mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2025-02-07 04:30:31 +00:00
Implement llabs and imaxabs functions.
These give the absolute value of 64-bit numbers.
This commit is contained in:
parent
b072f5d042
commit
6635346ae8
41
stdlib.asm
41
stdlib.asm
@ -496,6 +496,47 @@ labs start
|
||||
lb1 creturn 4:i
|
||||
end
|
||||
|
||||
****************************************************************
|
||||
*
|
||||
* long long llabs(long long i)
|
||||
*
|
||||
* Return the absolute value of i.
|
||||
*
|
||||
* Inputs:
|
||||
* i - argument
|
||||
*
|
||||
* Outputs:
|
||||
* Returns abs(i).
|
||||
*
|
||||
****************************************************************
|
||||
*
|
||||
llabs start
|
||||
imaxabs entry
|
||||
retptr equ 1
|
||||
|
||||
csubroutine (8:i),4
|
||||
stx retptr
|
||||
stz retptr+2
|
||||
|
||||
ph8 i
|
||||
jsl ~ABS8
|
||||
pla
|
||||
sta [retptr]
|
||||
ldy #2
|
||||
pla
|
||||
sta [retptr],y
|
||||
iny
|
||||
iny
|
||||
pla
|
||||
sta [retptr],y
|
||||
iny
|
||||
iny
|
||||
pla
|
||||
sta [retptr],y
|
||||
|
||||
creturn
|
||||
end
|
||||
|
||||
****************************************************************
|
||||
*
|
||||
* ldiv_t ldiv(n,d)
|
||||
|
Loading…
x
Reference in New Issue
Block a user