src/mess/drivers/x1.c
| r5660 | r5661 | |
| 141 | 141 | #include "machine/z80ctc.h" |
| 142 | 142 | #include "machine/z80sio.h" |
| 143 | 143 | #include "machine/8255ppi.h" |
| 144 | #include "machine/z80dma.h" |
| 144 | 145 | #include "sound/ay8910.h" |
| 145 | 146 | #include "video/mc6845.h" |
| 146 | 147 | #include "sound/2151intf.h" |
| r5660 | r5661 | |
| 957 | 958 | scrn_reg.pcg_mode = (data & 0x20)>>5; |
| 958 | 959 | scrn_reg.gfx_bank = (data & 0x10)>>4; |
| 959 | 960 | scrn_reg.v400_mode = ((data & 0x03) == 3) ? 1 : 0; |
| 960 | | printf("SCRN = %02x\n",data); |
| 961 | if(data & 0xcc) |
| 962 | printf("SCRN = %02x\n",data & 0xcc); |
| 961 | 963 | } |
| 962 | 964 | |
| 963 | 965 | static WRITE8_HANDLER( x1_ply_w ) |
| 964 | 966 | { |
| 965 | 967 | scrn_reg.ply = data; |
| 966 | | printf("PLY = %02x\n",data); |
| 968 | // printf("PLY = %02x\n",data); |
| 967 | 969 | } |
| 968 | 970 | |
| 969 | 971 | static WRITE8_HANDLER( x1_6845_w ) |
| r5660 | r5661 | |
| 987 | 989 | } |
| 988 | 990 | } |
| 989 | 991 | |
| 990 | | static WRITE8_HANDLER( x1_dma_w ) |
| 991 | | { |
| 992 | | //printf("%02x %02x\n",offset,data); |
| 993 | | //if(data) |
| 994 | | // fatalerror("Data written to the DMA space"); |
| 995 | | } |
| 996 | | |
| 997 | 992 | static READ8_HANDLER( x1_blackclip_r ) |
| 998 | 993 | { |
| 999 | 994 | return scrn_reg.blackclip; |
| r5660 | r5661 | |
| 1041 | 1036 | else if(offset >= 0x1900 && offset <= 0x19ff) { return sub_io_r(space, 0); } |
| 1042 | 1037 | else if(offset >= 0x1a00 && offset <= 0x1aff) { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); } |
| 1043 | 1038 | else if(offset >= 0x1b00 && offset <= 0x1bff) { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); } |
| 1039 | else if(offset >= 0x1f80 && offset <= 0x1f8f) { return z80dma_r(devtag_get_device(space->machine, "dma"), 0); } |
| 1044 | 1040 | else if(offset >= 0x1f90 && offset <= 0x1f91) { return z80sio_c_r(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1); } |
| 1045 | 1041 | else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1); } |
| 1046 | 1042 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); } |
| r5660 | r5661 | |
| 1077 | 1073 | else if(offset >= 0x1c00 && offset <= 0x1cff) { ay8910_address_w(devtag_get_device(space->machine, "ay"), 0,data); } |
| 1078 | 1074 | else if(offset >= 0x1d00 && offset <= 0x1dff) { rom_bank_1_w(space,0,data); } |
| 1079 | 1075 | else if(offset >= 0x1e00 && offset <= 0x1eff) { rom_bank_0_w(space,0,data); } |
| 1080 | | else if(offset >= 0x1f80 && offset <= 0x1f8f) { x1_dma_w(space,offset-0x1f80,data); } |
| 1076 | else if(offset >= 0x1f80 && offset <= 0x1f8f) { z80dma_w(devtag_get_device(space->machine, "dma"), 0,data); } |
| 1081 | 1077 | else if(offset >= 0x1f90 && offset <= 0x1f91) { z80sio_c_w(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1,data); } |
| 1082 | 1078 | else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1,data); } |
| 1083 | 1079 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa0,data); } |
| r5660 | r5661 | |
| 1109 | 1105 | else if(offset >= 0x1900 && offset <= 0x19ff) { return sub_io_r(space, 0); } |
| 1110 | 1106 | else if(offset >= 0x1a00 && offset <= 0x1aff) { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); } |
| 1111 | 1107 | else if(offset >= 0x1b00 && offset <= 0x1bff) { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); } |
| 1108 | else if(offset >= 0x1f80 && offset <= 0x1f8f) { return z80dma_r(devtag_get_device(space->machine, "dma"), 0); } |
| 1112 | 1109 | else if(offset >= 0x1f90 && offset <= 0x1f91) { return z80sio_c_r(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1); } |
| 1113 | 1110 | else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1); } |
| 1114 | 1111 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); } |
| r5660 | r5661 | |
| 1146 | 1143 | else if(offset >= 0x1c00 && offset <= 0x1cff) { ay8910_address_w(devtag_get_device(space->machine, "ay"), 0,data); } |
| 1147 | 1144 | else if(offset >= 0x1d00 && offset <= 0x1dff) { rom_bank_1_w(space,0,data); } |
| 1148 | 1145 | else if(offset >= 0x1e00 && offset <= 0x1eff) { rom_bank_0_w(space,0,data); } |
| 1149 | | else if(offset >= 0x1f80 && offset <= 0x1f8f) { x1_dma_w(space,offset-0x1f80,data); } |
| 1146 | else if(offset >= 0x1f80 && offset <= 0x1f8f) { z80dma_w(devtag_get_device(space->machine, "dma"), 0,data); } |
| 1150 | 1147 | else if(offset >= 0x1f90 && offset <= 0x1f91) { z80sio_c_w(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1,data); } |
| 1151 | 1148 | else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1,data); } |
| 1152 | 1149 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa0,data); } |
| r5660 | r5661 | |
| 1289 | 1286 | NULL /* update address callback */ |
| 1290 | 1287 | }; |
| 1291 | 1288 | |
| 1289 | static READ8_DEVICE_HANDLER(x1_dma_read_byte) |
| 1290 | { |
| 1291 | const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1292 | return memory_read_byte(space, offset); |
| 1293 | } |
| 1294 | |
| 1295 | static WRITE8_DEVICE_HANDLER(x1_dma_write_byte) |
| 1296 | { |
| 1297 | const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1298 | memory_write_byte(space, offset, data); |
| 1299 | } |
| 1300 | |
| 1301 | static const z80dma_interface x1_dma = |
| 1302 | { |
| 1303 | "maincpu", |
| 1304 | |
| 1305 | x1_dma_read_byte, |
| 1306 | x1_dma_write_byte, |
| 1307 | 0, 0, 0, 0, |
| 1308 | NULL |
| 1309 | }; |
| 1310 | |
| 1292 | 1311 | /************************************* |
| 1293 | 1312 | * |
| 1294 | 1313 | * Inputs |
| r5660 | r5661 | |
| 1833 | 1852 | |
| 1834 | 1853 | MDRV_Z80CTC_ADD( "ctc", XTAL_4MHz , ctc_intf ) |
| 1835 | 1854 | MDRV_Z80SIO_ADD( "sio", XTAL_4MHz , sio_intf ) |
| 1855 | MDRV_Z80DMA_ADD( "dma", XTAL_4MHz , x1_dma ) |
| 1836 | 1856 | |
| 1837 | 1857 | MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf ) |
| 1838 | 1858 | |