diff --git a/doc/notes.txt b/doc/notes.txt index 0ea3b65f..212e59b8 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -85,6 +85,7 @@ TODO: - live coding URL - memory viewer: ROM/RAM/VRAM/etc - resize memory browser when split resize +- preroll the emulator so optimizer does its thing before loading rom WEB WORKER FORMAT diff --git a/presets/astrocade/cosmic.c b/presets/astrocade/cosmic.c index 55804765..3133a28c 100644 --- a/presets/astrocade/cosmic.c +++ b/presets/astrocade/cosmic.c @@ -165,24 +165,24 @@ void draw_bcd_word(word bcd, byte x, byte y, byte op) { } // 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 __asm - ld hl,#4 - add hl,sp - ld iy,#2 - add iy,sp - ld a,0 (iy) - add a, (hl) - daa - ld c,a - ld a,1 (iy) - inc hl - adc a, (hl) - daa - ld b,a - ld l, c - ld h, b + push ix + ld ix,#0 + add ix,sp + ld a,4 (ix) + add a, 6 (ix) + daa + ld c,a + ld a,5 (ix) + adc a, 7 (ix) + daa + ld b,a + ld l, c + ld h, b + pop ix + ret __endasm; } diff --git a/presets/coleco/common.c b/presets/coleco/common.c index 23068866..f4d787b1 100644 --- a/presets/coleco/common.c +++ b/presets/coleco/common.c @@ -87,24 +87,24 @@ void draw_bcd_word(byte x, byte y, word bcd) { } // 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 __asm - ld hl,#4 - add hl,sp - ld iy,#2 - add iy,sp - ld a,0 (iy) - add a, (hl) - daa - ld c,a - ld a,1 (iy) - inc hl - adc a, (hl) - daa - ld b,a - ld l, c - ld h, b + push ix + ld ix,#0 + add ix,sp + ld a,4 (ix) + add a, 6 (ix) + daa + ld c,a + ld a,5 (ix) + adc a, 7 (ix) + daa + ld b,a + ld l, c + ld h, b + pop ix + ret __endasm; } diff --git a/presets/galaxian-scramble/shoot2.c b/presets/galaxian-scramble/shoot2.c index 9ec2ed39..6502e4bc 100644 --- a/presets/galaxian-scramble/shoot2.c +++ b/presets/galaxian-scramble/shoot2.c @@ -185,24 +185,24 @@ void draw_bcd_word(byte x, byte y, word bcd) { } // 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 __asm - ld hl,#4 - add hl,sp - ld iy,#2 - add iy,sp - ld a,0 (iy) - add a, (hl) - daa - ld c,a - ld a,1 (iy) - inc hl - adc a, (hl) - daa - ld b,a - ld l, c - ld h, b + push ix + ld ix,#0 + add ix,sp + ld a,4 (ix) + add a, 6 (ix) + daa + ld c,a + ld a,5 (ix) + adc a, 7 (ix) + daa + ld b,a + ld l, c + ld h, b + pop ix + ret __endasm; } diff --git a/presets/mw8080bw/game2.c b/presets/mw8080bw/game2.c index def85add..d004d657 100644 --- a/presets/mw8080bw/game2.c +++ b/presets/mw8080bw/game2.c @@ -181,24 +181,24 @@ void draw_bcd_word(word bcd, byte x, byte y) { } // 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 __asm - ld hl,#4 - add hl,sp - ld iy,#2 - add iy,sp - ld a,0 (iy) - add a, (hl) - daa - ld c,a - ld a,1 (iy) - inc hl - adc a, (hl) - daa - ld b,a - ld l, c - ld h, b + push ix + ld ix,#0 + add ix,sp + ld a,4 (ix) + add a, 6 (ix) + daa + ld c,a + ld a,5 (ix) + adc a, 7 (ix) + daa + ld b,a + ld l, c + ld h, b + pop ix + ret __endasm; }