void __fastcall sms_port_w(UINT16 port, UINT8 data) { switch(port & 0xC1) { case 0x00: memctrl_w(data); return; case 0x01: ioctrl_w(data); return; case 0x40: case 0x41: psg_write(data); return; case 0x80: case 0x81: vdp_write(port, data); return; case 0xC0: case 0xC1: return; } }
void sms_port_w(uint16 port, uint8 data) { switch(port & 0xC1) { case 0x00: memctrl_w(data); return; case 0x01: ioctrl_w(data); return; case 0x40: case 0x41: psg_write(data); return; case 0x80: case 0x81: vdp_write(port, data); return; case 0xC0: case 0xC1: return; } }
void __fastcall smsj_port_w(UINT16 port, UINT8 data) { port &= 0xFF; if(port >= 0xF0) { switch(port) { case 0xF0: fmunit_write(0, data); return; case 0xF1: fmunit_write(1, data); return; case 0xF2: fmunit_detect_w(data); return; } } switch(port & 0xC1) { case 0x00: memctrl_w(data); return; case 0x01: ioctrl_w(data); return; case 0x40: case 0x41: psg_write(data); return; case 0x80: case 0x81: vdp_write(port, data); return; case 0xC0: case 0xC1: return; } }
void main() { int i; char *ptr; vdp_set_address(0x8004); // mode 4, disable hbl irq vdp_set_address(0x8160); // screen on, enable vbl irq vdp_set_address(0x820e); // name table @ $3800 vdp_set_address(0x85ff); // sprite table @ $3f00 vdp_set_address(0x8700); // backdrop is color 0 vdp_set_address(0x8800); // scrollx is 0 vdp_set_address(0x8900); // scrolly is 0 vdp_set_address(0xc000); ptr = pal; for (i=0; i<32; i++) { vdp_write(*ptr++); } // turn off sprites vdp_set_address(0x3f00); vdp_write(0xd0); //Sound off - if resetted from a prior game set_sound_volume(0,0); set_sound_volume(1,0); set_sound_volume(2,0); set_sound_volume(3,0); while (1) { console_init(); console_clear(); console_gotoxy(3,0); console_puts("MASTER SYSTEM ROM LOADER\n"); console_gotoxy(3,1); console_puts("------------------------\n"); //console_gotoxy(3,3); i = 0; if (!sd_init()) { console_puts("Error initializing SD/MMC card\n"); } else { #ifdef DEBUG2 console_puts("SD card initialized\n"); #endif if (!fat_init()) { //console_puts("could not initialize FAT system\n"); //qq } else { #ifdef DEBUG2 console_puts("FAT system initialized\n"); #endif i = 1; } } choose_mode(i); } }