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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -112,12 +112,12 @@ void menu_print_page (const page_t *page)
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);
return;
}
if (keys&KEY_B)
if (keys&(KEY_B|KEY_START))
return;
swiWaitForVBlank();