Adapted div & mod for popptr1.
This commit is contained in:
26
libsrc/runtime/negabs.s
Normal file
26
libsrc/runtime/negabs.s
Normal file
@@ -0,0 +1,26 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 05.08.1998
|
||||
;
|
||||
; int abs (int x);
|
||||
; and
|
||||
; CC65 runtime: negation on ints
|
||||
;
|
||||
|
||||
.export negax
|
||||
.export _abs
|
||||
|
||||
_abs: cpx #$00 ; test hi byte
|
||||
bpl L1 ; don't touch if positive
|
||||
negax: clc
|
||||
eor #$FF
|
||||
adc #1
|
||||
pha
|
||||
txa
|
||||
eor #$FF
|
||||
adc #0
|
||||
tax
|
||||
pla
|
||||
L1: rts
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user