gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/libc/asm/mos6502/abs.c
1
2 int abs(int j) __naked
3 {
4 (void)j;
5 __asm__("cpx #0x00");
6 __asm__("bpl skip");
7 __asm__("___negax::");
8 __asm__("sec");
9 __asm__("eor #0xff");
10 __asm__("adc #0x00");
11 __asm__("pha");
12 __asm__("txa");
13 __asm__("eor #0xff");
14 __asm__("adc #0x00");
15 __asm__("tax");
16 __asm__("pla");
17 __asm__("skip:");
18 __asm__("rts");
19 // return (j < 0) ? -j : j;
20 }
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.