1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-18 15:05:14 +00:00
cc65/libsrc/runtime/negabs.s

27 lines
421 B
ArmAsm
Raw Normal View History

;
; Ullrich von Bassewitz, 05.08.1998
;
2018-05-24 01:55:40 +00:00
; int abs (int x);
; and
; CC65 runtime: negation on ints
;
.export negax
2018-05-24 01:55:40 +00:00
.export _abs
2018-05-24 01:55:40 +00:00
_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
2018-05-24 01:55:40 +00:00
L1: rts