c128lib Common
Various common functionalities.
Loading...
Searching...
No Matches
math-global.asm File Reference

Math module. More...

Functions

macro c128lib_add16 (value, dest)
 
macro c128lib_sub16 (value, low)
 
macro c128lib_addMem16 (source, destination)
 
macro c128lib_subMem16 (source, destination)
 
macro c128lib_asl16 (address)
 
macro c128lib_inc16 (destination)
 
macro c128lib_dec16 (destination)
 
macro c128lib_mulAndAdd (left, right, targetAddr)
 
macro c128lib_div16By16 (dividend, divisor, remainder)
 
macro c128lib_div16By8 (dividend, divisor, remainder)
 

Variables

pseudocommand c128lib_add16 value
 
pseudocommand c128lib_sub16 source
 

Detailed Description

Math module.

Macros for math.

Date
2022

Function Documentation

◆ c128lib_add16()

macro c128lib_add16 ( value ,
dest  )

Adds 16 bit number value to given memory cell specified by dest address and set result to dest.

Parameters
valuefirst addend
destmemory location for second addend and result
Remarks
Register .A will be modified. Flags N, Z and C will be affected.
Since
0.6.0

◆ c128lib_addMem16()

macro c128lib_addMem16 ( source ,
destination  )

◆ c128lib_asl16()

macro c128lib_asl16 ( address )

Shifts left 2 byte number specified with address. Carry flag indicates last bit that has been "shifted out".

Parameters
addressaddress to shift Flag C will be affected.
Since
0.6.0

◆ c128lib_dec16()

macro c128lib_dec16 ( destination )

Decrements 16 bit number located in memory address starting from "destination".

Parameters
destinationmemory address to decrement
Remarks
Register .A will be modified. Flags N, Z and C will be affected.

◆ c128lib_div16By16()

macro c128lib_div16By16 ( dividend ,
divisor ,
remainder  )

Divides the two-byte number dividend by the two-byte number divisor, leaving the quotient in dividend and the remainder in remainder. Addressing mode of 16-bit numbers uses little endian.

Parameters
dividenddividend and also quotient
divisordivisor
remainderremainder (wide as divisor)
Remarks
Registers .A, .X and .Y will be modified. Flags N, Z and C will be affected.
Since
0.6.0

◆ c128lib_div16By8()

macro c128lib_div16By8 ( dividend ,
divisor ,
remainder  )

Divides the two-byte number dividend by the one-byte number divisor, leaving the quotient in dividend and the remainder in remainder. Addressing mode of 16-bit numbers uses little endian.

Parameters
dividenddividend and also quotient
divisordivisor
remainderremainder (wide as divisor)
Remarks
Registers .A, .X and .Y will be modified. Flags N, Z and C will be affected.
Since
0.6.0

◆ c128lib_inc16()

macro c128lib_inc16 ( destination )

Increments 16 bit number located in memory address starting from "destination".

Parameters
addressaddress to shift
Remarks
Register .A will be modified. Flags N and Z will be affected.
Since
0.6.0

◆ c128lib_mulAndAdd()

macro c128lib_mulAndAdd ( left ,
right ,
targetAddr  )

Multiplies left times right. Target value will be added to the value stored in targetAddr.

Parameters
leftfirst factor
destsecond factor
targetAddradding value and result
Remarks
Registers .A and .X will be modified. Flags N, Z and C will be affected.
Since
0.6.0

◆ c128lib_sub16()

macro c128lib_sub16 ( value ,
low  )

Subtracts 16 bit number value from given memory cell specified by low address and set result to low.

Parameters
valuesubtracting
destmemory location for minuend and result
Remarks
Register .A will be modified. Flags N, Z and C will be affected.
Since
0.6.0

◆ c128lib_subMem16()

macro c128lib_subMem16 ( source ,
destination  )

Subtracts value from "source" memory location from value in "destination" memory location.

Parameters
[in]sourcesubtracting
[in,out]destmemory location for minuend and result
Remarks
Register .A will be modified. Flags N, Z and C will be affected.
Since
0.7.0

Variable Documentation

◆ source

pseudocommand copy8 source

Subtracts value from "source" memory location from value in "destination" memory location.

MOD: A, C

◆ value

pseudocommand c128lib_add16 value

Adds 16 bit number value to given memory cell specified by dest address and set result to dest.

Parameters
valuefirst addend
destmemory location for second addend and result
Remarks
Register .A will be modified. Flags N, Z and C will be affected.
Since
0.6.0