updated bcd_add() function for new compiler flags
This commit is contained in:
parent
5d60110327
commit
6404bfb43c
|
@ -85,6 +85,7 @@ TODO:
|
||||||
- live coding URL
|
- live coding URL
|
||||||
- memory viewer: ROM/RAM/VRAM/etc
|
- memory viewer: ROM/RAM/VRAM/etc
|
||||||
- resize memory browser when split resize
|
- resize memory browser when split resize
|
||||||
|
- preroll the emulator so optimizer does its thing before loading rom
|
||||||
|
|
||||||
|
|
||||||
WEB WORKER FORMAT
|
WEB WORKER FORMAT
|
||||||
|
|
|
@ -165,24 +165,24 @@ void draw_bcd_word(word bcd, byte x, byte y, byte op) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add two 16-bit BCD values
|
// add two 16-bit BCD values
|
||||||
word bcd_add(word a, word b) {
|
word bcd_add(word a, word b) __naked {
|
||||||
a; b; // to avoid warning
|
a; b; // to avoid warning
|
||||||
__asm
|
__asm
|
||||||
ld hl,#4
|
push ix
|
||||||
add hl,sp
|
ld ix,#0
|
||||||
ld iy,#2
|
add ix,sp
|
||||||
add iy,sp
|
ld a,4 (ix)
|
||||||
ld a,0 (iy)
|
add a, 6 (ix)
|
||||||
add a, (hl)
|
daa
|
||||||
daa
|
ld c,a
|
||||||
ld c,a
|
ld a,5 (ix)
|
||||||
ld a,1 (iy)
|
adc a, 7 (ix)
|
||||||
inc hl
|
daa
|
||||||
adc a, (hl)
|
ld b,a
|
||||||
daa
|
ld l, c
|
||||||
ld b,a
|
ld h, b
|
||||||
ld l, c
|
pop ix
|
||||||
ld h, b
|
ret
|
||||||
__endasm;
|
__endasm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,24 +87,24 @@ void draw_bcd_word(byte x, byte y, word bcd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add two 16-bit BCD values
|
// add two 16-bit BCD values
|
||||||
word bcd_add(word a, word b) {
|
word bcd_add(word a, word b) __naked {
|
||||||
a; b; // to avoid warning
|
a; b; // to avoid warning
|
||||||
__asm
|
__asm
|
||||||
ld hl,#4
|
push ix
|
||||||
add hl,sp
|
ld ix,#0
|
||||||
ld iy,#2
|
add ix,sp
|
||||||
add iy,sp
|
ld a,4 (ix)
|
||||||
ld a,0 (iy)
|
add a, 6 (ix)
|
||||||
add a, (hl)
|
daa
|
||||||
daa
|
ld c,a
|
||||||
ld c,a
|
ld a,5 (ix)
|
||||||
ld a,1 (iy)
|
adc a, 7 (ix)
|
||||||
inc hl
|
daa
|
||||||
adc a, (hl)
|
ld b,a
|
||||||
daa
|
ld l, c
|
||||||
ld b,a
|
ld h, b
|
||||||
ld l, c
|
pop ix
|
||||||
ld h, b
|
ret
|
||||||
__endasm;
|
__endasm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,24 +185,24 @@ void draw_bcd_word(byte x, byte y, word bcd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add two 16-bit BCD values
|
// add two 16-bit BCD values
|
||||||
word bcd_add(word a, word b) {
|
word bcd_add(word a, word b) __naked {
|
||||||
a; b; // to avoid warning
|
a; b; // to avoid warning
|
||||||
__asm
|
__asm
|
||||||
ld hl,#4
|
push ix
|
||||||
add hl,sp
|
ld ix,#0
|
||||||
ld iy,#2
|
add ix,sp
|
||||||
add iy,sp
|
ld a,4 (ix)
|
||||||
ld a,0 (iy)
|
add a, 6 (ix)
|
||||||
add a, (hl)
|
daa
|
||||||
daa
|
ld c,a
|
||||||
ld c,a
|
ld a,5 (ix)
|
||||||
ld a,1 (iy)
|
adc a, 7 (ix)
|
||||||
inc hl
|
daa
|
||||||
adc a, (hl)
|
ld b,a
|
||||||
daa
|
ld l, c
|
||||||
ld b,a
|
ld h, b
|
||||||
ld l, c
|
pop ix
|
||||||
ld h, b
|
ret
|
||||||
__endasm;
|
__endasm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,24 +181,24 @@ void draw_bcd_word(word bcd, byte x, byte y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add two 16-bit BCD values
|
// add two 16-bit BCD values
|
||||||
word bcd_add(word a, word b) {
|
word bcd_add(word a, word b) __naked {
|
||||||
a; b; // to avoid warning
|
a; b; // to avoid warning
|
||||||
__asm
|
__asm
|
||||||
ld hl,#4
|
push ix
|
||||||
add hl,sp
|
ld ix,#0
|
||||||
ld iy,#2
|
add ix,sp
|
||||||
add iy,sp
|
ld a,4 (ix)
|
||||||
ld a,0 (iy)
|
add a, 6 (ix)
|
||||||
add a, (hl)
|
daa
|
||||||
daa
|
ld c,a
|
||||||
ld c,a
|
ld a,5 (ix)
|
||||||
ld a,1 (iy)
|
adc a, 7 (ix)
|
||||||
inc hl
|
daa
|
||||||
adc a, (hl)
|
ld b,a
|
||||||
daa
|
ld l, c
|
||||||
ld b,a
|
ld h, b
|
||||||
ld l, c
|
pop ix
|
||||||
ld h, b
|
ret
|
||||||
__endasm;
|
__endasm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue