Refactor to two jump vectors

* Believe needed to allow minimal change for x86_64 codepath
This commit is contained in:
Aaron Culliney 2014-06-07 16:05:38 -07:00
parent 320819c829
commit 126d049ffc
7 changed files with 163 additions and 167 deletions

View File

@ -1930,8 +1930,8 @@ static void RegisterIoHandler(UINT uSlot, iofunction IOReadC0, iofunction IOWrit
assert(IOWriteC0); assert(IOWriteC0);
for (unsigned int i = 0; i < 16; i++) for (unsigned int i = 0; i < 16; i++)
{ {
cpu65_vmem[base_addr+i].r = IOReadC0; cpu65_vmem_r[base_addr+i] = IOReadC0;
cpu65_vmem[base_addr+i].w = IOWriteC0; cpu65_vmem_w[base_addr+i] = IOWriteC0;
} }
} }
@ -1939,8 +1939,8 @@ static void RegisterIoHandler(UINT uSlot, iofunction IOReadC0, iofunction IOWrit
base_addr = 0xC000 + (uSlot<<8); // uSlot == 4 => 0xC400 , uSlot == 5 => 0xC500 base_addr = 0xC000 + (uSlot<<8); // uSlot == 4 => 0xC400 , uSlot == 5 => 0xC500
for (unsigned int i = 0; i < 0x100; i++) for (unsigned int i = 0; i < 0x100; i++)
{ {
//cpu65_vmem[base_addr+i].r = IOReadCx; -- CANNOT DO THIS HERE -- DEPENDS ON cxrom softswitch //cpu65_vmem_r[base_addr+i] = IOReadCx; -- CANNOT DO THIS HERE -- DEPENDS ON cxrom softswitch
cpu65_vmem[base_addr+i].w = IOWriteCx; cpu65_vmem_w[base_addr+i] = IOWriteCx;
} }
} }
#endif #endif

View File

@ -28,7 +28,8 @@ static pthread_mutex_t irq_mutex = PTHREAD_MUTEX_INITIALIZER;
uint8_t cpu65_flags_encode[256] = { 0 }; uint8_t cpu65_flags_encode[256] = { 0 };
uint8_t cpu65_flags_decode[256] = { 0 }; uint8_t cpu65_flags_decode[256] = { 0 };
memory_vector_t cpu65_vmem[0x10000] = { 0 }; void *cpu65_vmem_r[0x10000] = { 0 };
void *cpu65_vmem_w[0x10000] = { 0 };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// 65c02 Opcode Jump Table // 65c02 Opcode Jump Table

View File

@ -23,12 +23,6 @@
/* types */ /* types */
typedef struct memory_vector_t {
void *r;
void *w;
} memory_vector_t;
struct cpu65_state struct cpu65_state
{ {
uint16_t pc; /* Program counter */ uint16_t pc; /* Program counter */
@ -59,7 +53,8 @@ extern void cpu65_run(void);
extern void cpu65_direct_write(int ea,int data); extern void cpu65_direct_write(int ea,int data);
extern memory_vector_t cpu65_vmem[65536]; extern void *cpu65_vmem_r[65536];
extern void *cpu65_vmem_w[65536];
extern struct cpu65_state cpu65_current; extern struct cpu65_state cpu65_current;
extern struct cpu65_extra cpu65_debug; extern struct cpu65_extra cpu65_debug;

View File

@ -788,37 +788,37 @@ void disk_io_initialize(unsigned int slot)
// disk softswitches // disk softswitches
// 0xC0Xi : X = slot 0x6 + 0x8 == 0xE // 0xC0Xi : X = slot 0x6 + 0x8 == 0xE
cpu65_vmem[0xC0E0].r = cpu65_vmem[0xC0E2].r = cpu65_vmem_r[0xC0E0] = cpu65_vmem_r[0xC0E2] =
cpu65_vmem[0xC0E4].r = cpu65_vmem[0xC0E6].r = cpu65_vmem_r[0xC0E4] = cpu65_vmem_r[0xC0E6] =
ram_nop; ram_nop;
cpu65_vmem[0xC0E1].r = cpu65_vmem[0xC0E3].r = cpu65_vmem_r[0xC0E1] = cpu65_vmem_r[0xC0E3] =
cpu65_vmem[0xC0E5].r = cpu65_vmem[0xC0E7].r = cpu65_vmem_r[0xC0E5] = cpu65_vmem_r[0xC0E7] =
disk_read_phase; disk_read_phase;
cpu65_vmem[0xC0E8].r = cpu65_vmem_r[0xC0E8] =
disk_read_motor_off; disk_read_motor_off;
cpu65_vmem[0xC0E9].r = cpu65_vmem_r[0xC0E9] =
disk_read_motor_on; disk_read_motor_on;
cpu65_vmem[0xC0EA].r = cpu65_vmem_r[0xC0EA] =
disk_read_select_a; disk_read_select_a;
cpu65_vmem[0xC0EB].r = cpu65_vmem_r[0xC0EB] =
disk_read_select_b; disk_read_select_b;
cpu65_vmem[0xC0EC].r = cpu65_vmem_r[0xC0EC] =
disk_read_byte; disk_read_byte;
cpu65_vmem[0xC0ED].r = cpu65_vmem_r[0xC0ED] =
disk_read_latch; /* read latch */ disk_read_latch; /* read latch */
cpu65_vmem[0xC0EE].r = cpu65_vmem_r[0xC0EE] =
disk_read_prepare_in; disk_read_prepare_in;
cpu65_vmem[0xC0EF].r = cpu65_vmem_r[0xC0EF] =
disk_read_prepare_out; disk_read_prepare_out;
for (i = 0xC0E0; i < 0xC0F0; i++) for (i = 0xC0E0; i < 0xC0F0; i++)
{ {
cpu65_vmem[i].w = cpu65_vmem_w[i] =
cpu65_vmem[i].r; cpu65_vmem_r[i];
} }
cpu65_vmem[0xC0ED].w = cpu65_vmem_w[0xC0ED] =
disk_write_latch; /* write latch */ disk_write_latch; /* write latch */
} }

View File

@ -334,11 +334,11 @@ static void c_initialize_tables_video(void) {
unsigned int idx = video__line_offset[y] + x + 0x400; unsigned int idx = video__line_offset[y] + x + 0x400;
// text/lores pages // text/lores pages
if (y < 20) { if (y < 20) {
cpu65_vmem[idx ].w = video__write_2e_text0; cpu65_vmem_w[idx ] = video__write_2e_text0;
cpu65_vmem[idx+0x400].w = video__write_2e_text1; cpu65_vmem_w[idx+0x400] = video__write_2e_text1;
} else { } else {
cpu65_vmem[idx ].w = video__write_2e_text0_mixed; cpu65_vmem_w[idx ] = video__write_2e_text0_mixed;
cpu65_vmem[idx+0x400].w = video__write_2e_text1_mixed; cpu65_vmem_w[idx+0x400] = video__write_2e_text1_mixed;
} }
// hires/dhires pages // hires/dhires pages
@ -346,19 +346,19 @@ static void c_initialize_tables_video(void) {
idx = 0x2000 + video__line_offset[ y ] + (0x400*i) + x; idx = 0x2000 + video__line_offset[ y ] + (0x400*i) + x;
if (y < 20) { if (y < 20) {
if (x & 1) { if (x & 1) {
cpu65_vmem[idx ].w = video__write_2e_odd0; cpu65_vmem_w[idx ] = video__write_2e_odd0;
cpu65_vmem[idx+0x2000].w = video__write_2e_odd1; cpu65_vmem_w[idx+0x2000] = video__write_2e_odd1;
} else { } else {
cpu65_vmem[idx ].w = video__write_2e_even0; cpu65_vmem_w[idx ] = video__write_2e_even0;
cpu65_vmem[idx+0x2000].w = video__write_2e_even1; cpu65_vmem_w[idx+0x2000] = video__write_2e_even1;
} }
} else { } else {
if (x & 1) { if (x & 1) {
cpu65_vmem[idx ].w = video__write_2e_odd0_mixed; cpu65_vmem_w[idx ] = video__write_2e_odd0_mixed;
cpu65_vmem[idx+0x2000].w = video__write_2e_odd1_mixed; cpu65_vmem_w[idx+0x2000] = video__write_2e_odd1_mixed;
} else { } else {
cpu65_vmem[idx ].w = video__write_2e_even0_mixed; cpu65_vmem_w[idx ] = video__write_2e_even0_mixed;
cpu65_vmem[idx+0x2000].w = video__write_2e_even1_mixed; cpu65_vmem_w[idx+0x2000] = video__write_2e_even1_mixed;
} }
} }
} }

View File

@ -127,17 +127,17 @@ void c_initialize_tables() {
/* reset everything */ /* reset everything */
for (i = 0; i < 0x10000; i++) for (i = 0; i < 0x10000; i++)
{ {
cpu65_vmem[i].r = iie_read_ram_default; cpu65_vmem_r[i] = iie_read_ram_default;
cpu65_vmem[i].w = iie_write_ram_default; cpu65_vmem_w[i] = iie_write_ram_default;
} }
/* language card read/write area */ /* language card read/write area */
for (i = 0xD000; i < 0xE000; i++) for (i = 0xD000; i < 0xE000; i++)
{ {
{ {
cpu65_vmem[i].w = cpu65_vmem_w[i] =
write_ram_bank; write_ram_bank;
cpu65_vmem[i].r = cpu65_vmem_r[i] =
read_ram_bank; read_ram_bank;
} }
} }
@ -145,9 +145,9 @@ void c_initialize_tables() {
for (i = 0xE000; i < 0x10000; i++) for (i = 0xE000; i < 0x10000; i++)
{ {
{ {
cpu65_vmem[i].w = cpu65_vmem_w[i] =
write_ram_lc; write_ram_lc;
cpu65_vmem[i].r = cpu65_vmem_r[i] =
read_ram_lc; read_ram_lc;
} }
} }
@ -157,9 +157,9 @@ void c_initialize_tables() {
/* initialize zero-page, //e specific */ /* initialize zero-page, //e specific */
for (i = 0; i < 0x200; i++) for (i = 0; i < 0x200; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
iie_read_ram_zpage_and_stack; iie_read_ram_zpage_and_stack;
cpu65_vmem[i].w = cpu65_vmem_w[i] =
iie_write_ram_zpage_and_stack; iie_write_ram_zpage_and_stack;
} }
@ -171,261 +171,261 @@ void c_initialize_tables() {
*/ */
for (i = 0x400; i < 0x800; i++) for (i = 0x400; i < 0x800; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
iie_read_ram_text_page0; iie_read_ram_text_page0;
cpu65_vmem[i].w = cpu65_vmem_w[i] =
iie_write_screen_hole_text_page0; iie_write_screen_hole_text_page0;
} }
for (i = 0x2000; i < 0x4000; i++) for (i = 0x2000; i < 0x4000; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
iie_read_ram_hires_page0; iie_read_ram_hires_page0;
cpu65_vmem[i].w = cpu65_vmem_w[i] =
iie_write_screen_hole_hires_page0; iie_write_screen_hole_hires_page0;
} }
/* softswich rom */ /* softswich rom */
for (i = 0xC000; i < 0xC100; i++) for (i = 0xC000; i < 0xC100; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
read_unmapped_softswitch; read_unmapped_softswitch;
cpu65_vmem[i].w = cpu65_vmem_w[i] =
write_unmapped_softswitch; write_unmapped_softswitch;
} }
/* slot rom defaults */ /* slot rom defaults */
for (i = 0xC100; i < 0xD000; i++) for (i = 0xC100; i < 0xD000; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
iie_read_ram_default; iie_read_ram_default;
cpu65_vmem[i].w = cpu65_vmem_w[i] =
ram_nop; ram_nop;
} }
/* keyboard data and strobe (READ) */ /* keyboard data and strobe (READ) */
for (i = 0xC000; i < 0xC010; i++) for (i = 0xC000; i < 0xC010; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
read_keyboard; read_keyboard;
} }
for (i = 0xC010; i < 0xC020; i++) for (i = 0xC010; i < 0xC020; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
cpu65_vmem[i].w = cpu65_vmem_w[i] =
read_keyboard_strobe; read_keyboard_strobe;
} }
/* RDBNK2 switch */ /* RDBNK2 switch */
cpu65_vmem[0xC011].r = cpu65_vmem_r[0xC011] =
iie_check_bank; iie_check_bank;
/* RDLCRAM switch */ /* RDLCRAM switch */
cpu65_vmem[0xC012].r = cpu65_vmem_r[0xC012] =
iie_check_lcram; iie_check_lcram;
/* 80STORE switch */ /* 80STORE switch */
cpu65_vmem[0xC000].w = iie_80store_off; cpu65_vmem_w[0xC000] = iie_80store_off;
cpu65_vmem[0xC001].w = iie_80store_on; cpu65_vmem_w[0xC001] = iie_80store_on;
cpu65_vmem[0xC018].r = iie_check_80store; cpu65_vmem_r[0xC018] = iie_check_80store;
/* RAMRD switch */ /* RAMRD switch */
cpu65_vmem[0xC002].w = iie_ramrd_main; cpu65_vmem_w[0xC002] = iie_ramrd_main;
cpu65_vmem[0xC003].w = iie_ramrd_aux; cpu65_vmem_w[0xC003] = iie_ramrd_aux;
cpu65_vmem[0xC013].r = iie_check_ramrd; cpu65_vmem_r[0xC013] = iie_check_ramrd;
/* RAMWRT switch */ /* RAMWRT switch */
cpu65_vmem[0xC004].w = iie_ramwrt_main; cpu65_vmem_w[0xC004] = iie_ramwrt_main;
cpu65_vmem[0xC005].w = iie_ramwrt_aux; cpu65_vmem_w[0xC005] = iie_ramwrt_aux;
cpu65_vmem[0xC014].r = iie_check_ramwrt; cpu65_vmem_r[0xC014] = iie_check_ramwrt;
/* ALTZP switch */ /* ALTZP switch */
cpu65_vmem[0xC008].w = iie_altzp_main; cpu65_vmem_w[0xC008] = iie_altzp_main;
cpu65_vmem[0xC009].w = iie_altzp_aux; cpu65_vmem_w[0xC009] = iie_altzp_aux;
cpu65_vmem[0xC016].r = iie_check_altzp; cpu65_vmem_r[0xC016] = iie_check_altzp;
/* 80COL switch */ /* 80COL switch */
cpu65_vmem[0xC00C].w = iie_80col_off; cpu65_vmem_w[0xC00C] = iie_80col_off;
cpu65_vmem[0xC00D].w = iie_80col_on; cpu65_vmem_w[0xC00D] = iie_80col_on;
cpu65_vmem[0xC01F].r = iie_check_80col; cpu65_vmem_r[0xC01F] = iie_check_80col;
/* ALTCHAR switch */ /* ALTCHAR switch */
cpu65_vmem[0xC00E].w = iie_altchar_off; cpu65_vmem_w[0xC00E] = iie_altchar_off;
cpu65_vmem[0xC00F].w = iie_altchar_on; cpu65_vmem_w[0xC00F] = iie_altchar_on;
cpu65_vmem[0xC01E].r = iie_check_altchar; cpu65_vmem_r[0xC01E] = iie_check_altchar;
/* SLOTC3ROM switch */ /* SLOTC3ROM switch */
cpu65_vmem[0xC00A].w = iie_c3rom_internal; cpu65_vmem_w[0xC00A] = iie_c3rom_internal; // HACK FIXME TODO VERIFY : the pattern here is reversed from cxrom?
cpu65_vmem[0xC00B].w = iie_c3rom_peripheral; cpu65_vmem_w[0xC00B] = iie_c3rom_peripheral;
cpu65_vmem[0xC017].r = iie_check_c3rom; cpu65_vmem_r[0xC017] = iie_check_c3rom;
/* SLOTCXROM switch */ /* SLOTCXROM switch */
cpu65_vmem[0xC006].w = iie_cxrom_peripheral; cpu65_vmem_w[0xC006] = iie_cxrom_peripheral; // HACK FIXME TODO VERIFY : the pattern here is reversed from c3rom?
cpu65_vmem[0xC007].w = iie_cxrom_internal; cpu65_vmem_w[0xC007] = iie_cxrom_internal;
cpu65_vmem[0xC015].r = iie_check_cxrom; cpu65_vmem_r[0xC015] = iie_check_cxrom;
/* RDVBLBAR switch */ /* RDVBLBAR switch */
cpu65_vmem[0xC019].r = cpu65_vmem_r[0xC019] =
iie_check_vbl; iie_check_vbl;
/* random number generator */ /* random number generator */
for (i = 0xC020; i < 0xC030; i++) for (i = 0xC020; i < 0xC030; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
cpu65_vmem[i].w = cpu65_vmem_w[i] =
read_random; read_random;
} }
/* TEXT switch */ /* TEXT switch */
cpu65_vmem[0xC050].r = cpu65_vmem_r[0xC050] =
cpu65_vmem[0xC050].w = cpu65_vmem_w[0xC050] =
read_switch_graphics; read_switch_graphics;
cpu65_vmem[0xC051].r = cpu65_vmem_r[0xC051] =
cpu65_vmem[0xC051].w = cpu65_vmem_w[0xC051] =
read_switch_text; read_switch_text;
cpu65_vmem[0xC01A].r = cpu65_vmem_r[0xC01A] =
iie_check_text; iie_check_text;
/* MIXED switch */ /* MIXED switch */
cpu65_vmem[0xC052].r = cpu65_vmem_r[0xC052] =
cpu65_vmem[0xC052].w = cpu65_vmem_w[0xC052] =
read_switch_no_mixed; read_switch_no_mixed;
cpu65_vmem[0xC053].r = cpu65_vmem_r[0xC053] =
cpu65_vmem[0xC053].w = cpu65_vmem_w[0xC053] =
read_switch_mixed; read_switch_mixed;
cpu65_vmem[0xC01B].r = cpu65_vmem_r[0xC01B] =
iie_check_mixed; iie_check_mixed;
/* PAGE2 switch */ /* PAGE2 switch */
cpu65_vmem[0xC054].r = cpu65_vmem_r[0xC054] =
cpu65_vmem[0xC054].w = cpu65_vmem_w[0xC054] =
iie_page2_off; iie_page2_off;
cpu65_vmem[0xC01C].r = cpu65_vmem_r[0xC01C] =
iie_check_page2; iie_check_page2;
/* PAGE2 switch */ /* PAGE2 switch */
cpu65_vmem[0xC055].r = cpu65_vmem_r[0xC055] =
cpu65_vmem[0xC055].w = cpu65_vmem_w[0xC055] =
iie_page2_on; iie_page2_on;
/* HIRES switch */ /* HIRES switch */
cpu65_vmem[0xC01D].r = cpu65_vmem_r[0xC01D] =
iie_check_hires; iie_check_hires;
cpu65_vmem[0xC056].r = cpu65_vmem_r[0xC056] =
cpu65_vmem[0xC056].w = cpu65_vmem_w[0xC056] =
iie_hires_off; iie_hires_off;
cpu65_vmem[0xC057].r = cpu65_vmem_r[0xC057] =
cpu65_vmem[0xC057].w = cpu65_vmem_w[0xC057] =
iie_hires_on; iie_hires_on;
/* game I/O switches */ /* game I/O switches */
cpu65_vmem[0xC061].r = cpu65_vmem_r[0xC061] =
cpu65_vmem[0xC069].r = cpu65_vmem_r[0xC069] =
read_button0; read_button0;
cpu65_vmem[0xC062].r = cpu65_vmem_r[0xC062] =
cpu65_vmem[0xC06A].r = cpu65_vmem_r[0xC06A] =
read_button1; read_button1;
cpu65_vmem[0xC063].r = cpu65_vmem_r[0xC063] =
cpu65_vmem[0xC06B].r = cpu65_vmem_r[0xC06B] =
read_button2; read_button2;
cpu65_vmem[0xC064].r = cpu65_vmem_r[0xC064] =
cpu65_vmem[0xC06C].r = cpu65_vmem_r[0xC06C] =
read_gc0; read_gc0;
cpu65_vmem[0xC065].r = cpu65_vmem_r[0xC065] =
cpu65_vmem[0xC06D].r = cpu65_vmem_r[0xC06D] =
read_gc1; read_gc1;
cpu65_vmem[0xC066].r = cpu65_vmem_r[0xC066] =
iie_read_gc2; iie_read_gc2;
cpu65_vmem[0xC067].r = cpu65_vmem_r[0xC067] =
iie_read_gc3; iie_read_gc3;
for (i = 0xC070; i < 0xC080; i++) for (i = 0xC070; i < 0xC080; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
cpu65_vmem[i].w = cpu65_vmem_w[i] =
read_gc_strobe; read_gc_strobe;
} }
/* IOUDIS switch & read_gc_strobe */ /* IOUDIS switch & read_gc_strobe */
cpu65_vmem[0xC07E].w = cpu65_vmem_w[0xC07E] =
iie_ioudis_on; iie_ioudis_on;
cpu65_vmem[0xC07F].w = cpu65_vmem_w[0xC07F] =
iie_ioudis_off; iie_ioudis_off; // HACK FIXME TODO : double-check this stuff against AWin...
cpu65_vmem[0xC07E].r = cpu65_vmem_r[0xC07E] =
iie_check_ioudis; iie_check_ioudis;
cpu65_vmem[0xC07F].r = cpu65_vmem_r[0xC07F] =
iie_check_dhires; iie_check_dhires;
/* DHIRES/Annunciator switches */ /* DHIRES/Annunciator switches */
cpu65_vmem[0xC05E].w = cpu65_vmem_w[0xC05E] =
cpu65_vmem[0xC05E].r = cpu65_vmem_r[0xC05E] =
iie_dhires_on; iie_dhires_on;
cpu65_vmem[0xC05F].w = cpu65_vmem_w[0xC05F] =
cpu65_vmem[0xC05F].r = cpu65_vmem_r[0xC05F] =
iie_dhires_off; iie_dhires_off;
/* language card softswitches */ /* language card softswitches */
cpu65_vmem[0xC080].r = cpu65_vmem[0xC080].w = cpu65_vmem_r[0xC080] = cpu65_vmem_w[0xC080] =
cpu65_vmem[0xC084].r = cpu65_vmem[0xC084].w = iie_c080; cpu65_vmem_r[0xC084] = cpu65_vmem_w[0xC084] = iie_c080;
cpu65_vmem[0xC081].r = cpu65_vmem[0xC081].w = cpu65_vmem_r[0xC081] = cpu65_vmem_w[0xC081] =
cpu65_vmem[0xC085].r = cpu65_vmem[0xC085].w = iie_c081; cpu65_vmem_r[0xC085] = cpu65_vmem_w[0xC085] = iie_c081;
cpu65_vmem[0xC082].r = cpu65_vmem[0xC082].w = cpu65_vmem_r[0xC082] = cpu65_vmem_w[0xC082] =
cpu65_vmem[0xC086].r = cpu65_vmem[0xC086].w = lc_c082; cpu65_vmem_r[0xC086] = cpu65_vmem_w[0xC086] = lc_c082;
cpu65_vmem[0xC083].r = cpu65_vmem[0xC083].w = cpu65_vmem_r[0xC083] = cpu65_vmem_w[0xC083] =
cpu65_vmem[0xC087].r = cpu65_vmem[0xC087].w = iie_c083; cpu65_vmem_r[0xC087] = cpu65_vmem_w[0xC087] = iie_c083;
cpu65_vmem[0xC088].r = cpu65_vmem[0xC088].w = cpu65_vmem_r[0xC088] = cpu65_vmem_w[0xC088] =
cpu65_vmem[0xC08C].r = cpu65_vmem[0xC08C].w = iie_c088; cpu65_vmem_r[0xC08C] = cpu65_vmem_w[0xC08C] = iie_c088;
cpu65_vmem[0xC089].r = cpu65_vmem[0xC089].w = cpu65_vmem_r[0xC089] = cpu65_vmem_w[0xC089] =
cpu65_vmem[0xC08D].r = cpu65_vmem[0xC08D].w = iie_c089; cpu65_vmem_r[0xC08D] = cpu65_vmem_w[0xC08D] = iie_c089;
cpu65_vmem[0xC08A].r = cpu65_vmem[0xC08A].w = cpu65_vmem_r[0xC08A] = cpu65_vmem_w[0xC08A] =
cpu65_vmem[0xC08E].r = cpu65_vmem[0xC08E].w = lc_c08a; cpu65_vmem_r[0xC08E] = cpu65_vmem_w[0xC08E] = lc_c08a;
cpu65_vmem[0xC08B].r = cpu65_vmem[0xC08B].w = cpu65_vmem_r[0xC08B] = cpu65_vmem_w[0xC08B] =
cpu65_vmem[0xC08F].r = cpu65_vmem[0xC08F].w = iie_c08b; cpu65_vmem_r[0xC08F] = cpu65_vmem_w[0xC08F] = iie_c08b;
/* slot i/o area */ /* slot i/o area */
for (i = 0xC100; i < 0xC300; i++) for (i = 0xC100; i < 0xC300; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
iie_read_slotx; /* slots 1 & 2 (x) */ iie_read_slotx; /* slots 1 & 2 (x) */
} }
for (i = 0xC300; i < 0xC400; i++) for (i = 0xC300; i < 0xC400; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
iie_read_slot3; /* slot 3 (80col) */ iie_read_slot3; /* slot 3 (80col) */
} }
for (i = 0xC400; i < 0xC500; i++) for (i = 0xC400; i < 0xC500; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
iie_read_slot4; /* slot 4 - MB or Phasor */ iie_read_slot4; /* slot 4 - MB or Phasor */
} }
for (i = 0xC500; i < 0xC600; i++) for (i = 0xC500; i < 0xC600; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
iie_read_slot5; /* slot 5 - MB #2 */ iie_read_slot5; /* slot 5 - MB #2 */
} }
for (i = 0xC600; i < 0xC800; i++) for (i = 0xC600; i < 0xC800; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
iie_read_slotx; /* slots 6 - 7 (x) */ iie_read_slotx; /* slots 6 - 7 (x) */
} }
for (i = 0xC800; i < 0xD000; i++) for (i = 0xC800; i < 0xD000; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem_r[i] =
iie_read_slot_expansion; /* expansion rom */ iie_read_slot_expansion; /* expansion rom */
} }
cpu65_vmem[0xCFFF].r = cpu65_vmem_r[0xCFFF] =
cpu65_vmem[0xCFFF].w = cpu65_vmem_w[0xCFFF] =
iie_disable_slot_expansion; iie_disable_slot_expansion;
video_set(0); video_set(0);
@ -519,7 +519,7 @@ void c_initialize_sound_hooks()
#endif #endif
for (int i = 0xC030; i < 0xC040; i++) for (int i = 0xC030; i < 0xC040; i++)
{ {
cpu65_vmem[i].r = cpu65_vmem[i].w = cpu65_vmem_r[i] = cpu65_vmem_w[i] =
#ifdef AUDIO_ENABLED #ifdef AUDIO_ENABLED
(sound_volume > 0) ? speaker_toggle : (sound_volume > 0) ? speaker_toggle :
#endif #endif
@ -531,7 +531,7 @@ void c_disable_sound_hooks()
{ {
for (int i = 0xC030; i < 0xC040; i++) for (int i = 0xC030; i < 0xC040; i++)
{ {
cpu65_vmem[i].r = ram_nop; cpu65_vmem_r[i] = ram_nop;
} }
} }

View File

@ -31,16 +31,16 @@
#define GetFromPC_B \ #define GetFromPC_B \
movLQ PC_Reg_X, EffectiveAddr_X; \ movLQ PC_Reg_X, EffectiveAddr_X; \
incw PC_Reg; \ incw PC_Reg; \
call *SN(cpu65_vmem)(,EffectiveAddr_X,SZ_PTR*2); call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define GetFromPC_W \ #define GetFromPC_W \
movLQ PC_Reg_X, EffectiveAddr_X; \ movLQ PC_Reg_X, EffectiveAddr_X; \
incw EffectiveAddr; \ incw EffectiveAddr; \
addw $2, PC_Reg; \ addw $2, PC_Reg; \
call *SN(cpu65_vmem)(,EffectiveAddr_X,SZ_PTR*2); \ call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR); \
decw EffectiveAddr; \ decw EffectiveAddr; \
movb %al, %ah; \ movb %al, %ah; \
call *SN(cpu65_vmem)(,EffectiveAddr_X,SZ_PTR*2); call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define JumpNextInstruction \ #define JumpNextInstruction \
GetFromPC_B \ GetFromPC_B \
@ -51,31 +51,31 @@
#define GetFromEA_B \ #define GetFromEA_B \
orb $1, DebugCurrRW; \ orb $1, DebugCurrRW; \
call *SN(cpu65_vmem)(,EffectiveAddr_X,SZ_PTR*2); call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define GetFromEA_W \ #define GetFromEA_W \
incw EffectiveAddr; \ incw EffectiveAddr; \
call *SN(cpu65_vmem)(,EffectiveAddr_X,SZ_PTR*2); \ call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR); \
decw EffectiveAddr; \ decw EffectiveAddr; \
movb %al, %ah; \ movb %al, %ah; \
call *SN(cpu65_vmem)(,EffectiveAddr_X,SZ_PTR*2); call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define PutToEA_B \ #define PutToEA_B \
orb $2, DebugCurrRW; \ orb $2, DebugCurrRW; \
movb %al, DebugCurrByte; \ movb %al, DebugCurrByte; \
call *SN(cpu65_vmem)+4(,EffectiveAddr_X,SZ_PTR*2); call *SN(cpu65_vmem_w)(,EffectiveAddr_X,SZ_PTR);
#define GetFromMem_B(x) \ #define GetFromMem_B(x) \
movLQ x, EffectiveAddr_X; \ movLQ x, EffectiveAddr_X; \
call *SN(cpu65_vmem)(,EffectiveAddr_X,SZ_PTR*2); call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define GetFromMem_W(x) \ #define GetFromMem_W(x) \
movLQ x, EffectiveAddr_X; \ movLQ x, EffectiveAddr_X; \
incw EffectiveAddr; \ incw EffectiveAddr; \
call *SN(cpu65_vmem)(,EffectiveAddr_X,SZ_PTR*2); \ call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR); \
decw EffectiveAddr; \ decw EffectiveAddr; \
movb %al, %ah; \ movb %al, %ah; \
call *SN(cpu65_vmem)(,EffectiveAddr_X,SZ_PTR*2); call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define Continue \ #define Continue \
jmp continue; jmp continue;
@ -2075,7 +2075,7 @@ E(cpu65_direct_write)
pushLQ EffectiveAddr_X pushLQ EffectiveAddr_X
movLQ 8(_XSP),EffectiveAddr_X movLQ 8(_XSP),EffectiveAddr_X
movLQ 12(_XSP),_XAX movLQ 12(_XSP),_XAX
call *SN(cpu65_vmem)+4(,EffectiveAddr_X,SZ_PTR*2) call *SN(cpu65_vmem_w)(,EffectiveAddr_X,SZ_PTR)
popLQ EffectiveAddr_X popLQ EffectiveAddr_X
ret ret