Boost the cpu when doing disk IO

This commit is contained in:
LemonBoy 2014-05-02 23:13:13 +02:00
parent a664adb898
commit d014d615a1
7 changed files with 32 additions and 16 deletions

View File

@ -135,11 +135,18 @@ cycles .req r5
ldrsb r0, [reg_pc], #1 ldrsb r0, [reg_pc], #1
#ifdef CHECK_IDLE_JUMP #ifdef CHECK_IDLE_JUMP
cmp r0, #-2 cmp r0, #-2
bne 1f bne 2f
b _xx ldr r0, =idle_loop_msg
unbase_pc reg_pc
mov r1, reg_pc
bl iprintf
1: b 1b
#endif #endif
// XXX two cycle penality for page crossing 2: add r1, reg_pc, r0
1: add reg_pc, r0 eor r0, r1, reg_pc
tst r0, #0x100
addne cycles, #2
mov reg_pc, r1
.endm .endm
#define FLAG_CARRY 0x01<<24 #define FLAG_CARRY 0x01<<24
@ -164,18 +171,19 @@ cycles .req r5
// Decimal mode // Decimal mode
tst reg_f, #FLAG_DEC tst reg_f, #FLAG_DEC
beq 1f beq 1f
bic reg_f, #FLAG_CARRY
// Low nibble // Low nibble
and r2, reg_a, #0x0f bic reg_f, #FLAG_CARRY
cmp r2, #0x09 and r1, reg_a, #0x0f
cmp r1, #0x09
addhi reg_a, #0x06 addhi reg_a, #0x06
// High nibble // High nibble
and r1, reg_a, #0xf0<<24 and r1, reg_a, #0xf0
cmp r1, #0x90 cmp r1, #0x90
addhi reg_a, #0x60 addhi reg_a, #0x60
orrhi reg_f, #FLAG_CARRY orrhi reg_f, #FLAG_CARRY
and reg_a, #255
add cycles, #1 add cycles, #1
1: nop 1:
.endm .endm
.macro op_sbc r .macro op_sbc r
@ -192,6 +200,7 @@ cycles .req r5
tst reg_f, #FLAG_DEC tst reg_f, #FLAG_DEC
beq 1f beq 1f
sub reg_a, #0x66 sub reg_a, #0x66
and reg_a, #255
bic reg_f, #FLAG_CARRY bic reg_f, #FLAG_CARRY
// Low nibble // Low nibble
and r2, reg_a, #0x0f and r2, reg_a, #0x0f
@ -203,7 +212,7 @@ cycles .req r5
addhi reg_a, #0x60 addhi reg_a, #0x60
orrhi reg_f, #FLAG_CARRY orrhi reg_f, #FLAG_CARRY
add cycles, #1 add cycles, #1
1: nop 1:
.endm .endm
.macro op_and a1 .macro op_and a1
@ -1753,6 +1762,8 @@ unhandled_msg:
debug_msg: debug_msg:
.ascii "A%02x X%02x Y%02x OP%02x F%02x SP%02x P%04x\n" .ascii "A%02x X%02x Y%02x OP%02x F%02x SP%02x P%04x\n"
.byte 0 .byte 0
#ifdef CHECK_IDLE_JUMP
idle_loop_msg: idle_loop_msg:
.ascii "Idle %04x\n" .ascii "Idle %04x\n"
.byte 0 .byte 0
#endif

View File

@ -66,7 +66,7 @@ u8 disk_io_read (u16 addr)
phase = 0; phase = 0;
if (phase > 70) if (phase > 70)
phase = 70; phase = 70;
/*track_pos = 0;*/ track_pos = 0;
track_start = (phase >> 1) * 6656; track_start = (phase >> 1) * 6656;
} }
} }
@ -80,6 +80,7 @@ u8 disk_io_read (u16 addr)
case 0x8: case 0x8:
case 0x9: case 0x9:
motor_on = set; motor_on = set;
emu_boost = set;
return 0xff; return 0xff;
// SELECT // SELECT
case 0xa: case 0xa:

View File

@ -47,6 +47,7 @@ void emu_init ()
// Set some sane defaults // Set some sane defaults
emu_vsync = 1; emu_vsync = 1;
emu_hires = 2; emu_hires = 2;
emu_boost = 0;
// Setup the video hardware // Setup the video hardware
video_init(); video_init();
@ -66,6 +67,8 @@ void emu_init ()
// Load the disk rom in place // Load the disk rom in place
load_buf(disk_rom, 0xc600, 0x100); load_buf(disk_rom, 0xc600, 0x100);
/*mainram[0xFCA8] = 0x60;*/
#else #else
if (load_bin("6502_functional_test.bin", 0x0, -1, NULL) > 0) { if (load_bin("6502_functional_test.bin", 0x0, -1, NULL) > 0) {
const u16 reset_patch = 0x0400; const u16 reset_patch = 0x0400;
@ -104,7 +107,7 @@ void emu_run ()
sound_play(); sound_play();
if (emu_vsync) if (emu_vsync && !emu_boost)
swiWaitForVBlank(); swiWaitForVBlank();
bgUpdate(); bgUpdate();
} }

View File

@ -12,6 +12,7 @@
#define INPUT_KEYBOARD 1 #define INPUT_KEYBOARD 1
int emu_vsync; int emu_vsync;
int emu_boost;
int emu_input; int emu_input;
int emu_screen; int emu_screen;
int emu_scale; int emu_scale;

View File

@ -30,7 +30,7 @@ int main(int argc, char **argv)
/*load_disk("Airheart (1986)(Broderbund)[cr].dsk");*/ /*load_disk("Airheart (1986)(Broderbund)[cr].dsk");*/
// Slow loading // Slow loading
/*load_disk("PACMAN.DSK");*/ /*load_disk("PACMAN.DSK");*/
/*load_disk("Karateka (1984)(Broderbund).dsk");*/ load_disk("Karateka (1984)(Broderbund).dsk");
// Awesome! // Awesome!
/*load_disk("lode.dsk");*/ /*load_disk("lode.dsk");*/
// AppleII+ // AppleII+

View File

@ -207,7 +207,7 @@ mem_reset:
.ltorg .ltorg
.bss .bss
.align 4 .p2align 8
mainram: mainram:
.space 0x10000 .space 0x10000
lcram: lcram:

View File

@ -112,12 +112,12 @@ void menu_print_page (const page_t *page)
sel_entry->cb(*sel_entry->opt_ptr); sel_entry->cb(*sel_entry->opt_ptr);
} }
if (keys&KEY_A && sel_entry->confirm && sel_entry->cb) { if (keys&KEY_A && sel_entry->cb) {
sel_entry->cb(*sel_entry->opt_ptr); sel_entry->cb(*sel_entry->opt_ptr);
return; return;
} }
if (keys&KEY_B) if (keys&(KEY_B|KEY_START))
return; return;
swiWaitForVBlank(); swiWaitForVBlank();