src/mess/drivers/x1.c
| r5822 | r5823 | |
| 185 | 185 | { |
| 186 | 186 | UINT8 pal; |
| 187 | 187 | UINT8 gfx_pal; |
| 188 | | UINT8 txt_pal; |
| 188 | UINT8 txt_pal[8]; |
| 189 | 189 | UINT8 txt_disp; |
| 190 | 190 | }turbo_reg; |
| 191 | 191 | |
| r5822 | r5823 | |
| 1121 | 1121 | } |
| 1122 | 1122 | |
| 1123 | 1123 | static READ8_HANDLER( x1turbo_pal_r ) { return turbo_reg.pal; } |
| 1124 | | static READ8_HANDLER( x1turbo_txpal_r ) { return turbo_reg.txt_pal; } |
| 1124 | static READ8_HANDLER( x1turbo_txpal_r ) { return turbo_reg.txt_pal[offset]; } |
| 1125 | 1125 | static READ8_HANDLER( x1turbo_txdisp_r ) { return turbo_reg.txt_disp; } |
| 1126 | 1126 | static READ8_HANDLER( x1turbo_gfxpal_r ) { return turbo_reg.gfx_pal; } |
| 1127 | 1127 | |
| r5822 | r5823 | |
| 1133 | 1133 | |
| 1134 | 1134 | static WRITE8_HANDLER( x1turbo_txpal_w ) |
| 1135 | 1135 | { |
| 1136 | | printf("TURBO TEXT PAL %02x\n",data); |
| 1137 | | turbo_reg.txt_pal = data; |
| 1136 | int r,g,b; |
| 1137 | |
| 1138 | printf("TURBO TEXT PAL %02x %02x\n",data,offset); |
| 1139 | turbo_reg.txt_pal[offset] = data; |
| 1140 | |
| 1141 | if(turbo_reg.pal & 0x80) |
| 1142 | { |
| 1143 | r = (data & 0x0c) >> 2; |
| 1144 | g = (data & 0x30) >> 4; |
| 1145 | b = (data & 0x03) >> 0; |
| 1146 | |
| 1147 | palette_set_color_rgb(space->machine, offset, pal2bit(r), pal2bit(g), pal2bit(b)); |
| 1148 | } |
| 1138 | 1149 | } |
| 1139 | 1150 | |
| 1140 | 1151 | static WRITE8_HANDLER( x1turbo_txdisp_w ) |
| r5822 | r5823 | |
| 1253 | 1264 | else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1,data); } |
| 1254 | 1265 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa0,data); } |
| 1255 | 1266 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); } |
| 1256 | | else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } |
| 1257 | | else if(offset >= 0x1fb9 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb9,data); } |
| 1258 | | else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } |
| 1259 | | else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } |
| 1267 | // else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } |
| 1268 | // else if(offset >= 0x1fb9 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb9,data); } |
| 1269 | // else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } |
| 1270 | // else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } |
| 1260 | 1271 | else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } |
| 1261 | 1272 | else if(offset == 0x1fe0) { x1_blackclip_w(space,0,data); } |
| 1262 | 1273 | else if(offset >= 0x2000 && offset <= 0x2fff) { colorram[offset-0x2000] = data; } |
| r5822 | r5823 | |
| 1287 | 1298 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); } |
| 1288 | 1299 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa8); } |
| 1289 | 1300 | else if(offset == 0x1fb0) { return x1turbo_pal_r(space,0); } |
| 1290 | | else if(offset >= 0x1fb9 && offset <= 0x1fbf) { return x1turbo_txpal_r(space,offset-0x1fb9); } |
| 1301 | else if(offset >= 0x1fb8 && offset <= 0x1fbf) { return x1turbo_txpal_r(space,offset-0x1fb8); } |
| 1291 | 1302 | else if(offset == 0x1fc0) { return x1turbo_txdisp_r(space,0); } |
| 1292 | 1303 | else if(offset == 0x1fc5) { return x1turbo_gfxpal_r(space,0); } |
| 1293 | 1304 | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } |
| r5822 | r5823 | |
| 1331 | 1342 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa0,data); } |
| 1332 | 1343 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); } |
| 1333 | 1344 | else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } |
| 1334 | | else if(offset >= 0x1fb9 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb9,data); } |
| 1345 | else if(offset >= 0x1fb8 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb8,data); } |
| 1335 | 1346 | else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } |
| 1336 | 1347 | else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } |
| 1337 | 1348 | else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } |
| r5822 | r5823 | |
| 1989 | 2000 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); |
| 1990 | 2001 | |
| 1991 | 2002 | key_irq_flag = ctc_irq_flag = 0; |
| 2003 | |
| 2004 | /* Reinitialize palette here if there's a soft reset for the Turbo PAL stuff*/ |
| 2005 | for(i=0;i<8;i++) |
| 2006 | { |
| 2007 | palette_set_color_rgb(machine, i+0x000, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); |
| 2008 | palette_set_color_rgb(machine, i+0x100, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); |
| 2009 | } |
| 1992 | 2010 | } |
| 1993 | 2011 | |
| 1994 | 2012 | static PALETTE_INIT(x1) |
| r5822 | r5823 | |
| 2014 | 2032 | |
| 2015 | 2033 | palette_set_color_rgb(machine, i, r,g,b); |
| 2016 | 2034 | } |
| 2017 | | |
| 2018 | | /* TODO: fix this */ |
| 2019 | | for(i=0;i<8;i++) |
| 2020 | | { |
| 2021 | | palette_set_color_rgb(machine, i+0x000, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); |
| 2022 | | palette_set_color_rgb(machine, i+0x100, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); |
| 2023 | | } |
| 2024 | 2035 | } |
| 2025 | 2036 | |
| 2026 | 2037 | FLOPPY_OPTIONS_START( x1 ) |