src/mess/drivers/pasopia.c
| r9013 | r9014 | |
| 19 | 19 | #include "video/mc6845.h" |
| 20 | 20 | |
| 21 | 21 | static UINT8 vram_sel,mio_sel; |
| 22 | | static UINT8 *p7_vram,*p7_pal; |
| 22 | static UINT8 *p7_pal; |
| 23 | 23 | static UINT8 bank_reg; |
| 24 | 24 | static UINT16 cursor_addr; |
| 25 | 25 | static UINT8 cursor_blink,cursor_raster; |
| r9013 | r9014 | |
| 27 | 27 | |
| 28 | 28 | static VIDEO_START( paso7 ) |
| 29 | 29 | { |
| 30 | | p7_vram = auto_alloc_array(machine, UINT8, 0x10000); |
| 31 | 30 | p7_pal = auto_alloc_array(machine, UINT8, 0x10); |
| 32 | 31 | } |
| 33 | 32 | |
| r9013 | r9014 | |
| 117 | 116 | |
| 118 | 117 | static VIDEO_UPDATE( paso7 ) |
| 119 | 118 | { |
| 119 | static UINT8 *vram = memory_region(screen->machine, "vram"); |
| 120 | 120 | int x,y,xi; |
| 121 | 121 | int count; |
| 122 | 122 | int width; |
| r9013 | r9014 | |
| 137 | 137 | { |
| 138 | 138 | int pen_b,pen_r,pen_g,color; |
| 139 | 139 | |
| 140 | | pen_b = (p7_vram[count+0x0000]>>(7-xi)) & 1; |
| 141 | | pen_r = (p7_vram[count+0x4000]>>(7-xi)) & 1; |
| 140 | pen_b = (vram[count+0x0000]>>(7-xi)) & 1; |
| 141 | pen_r = (vram[count+0x4000]>>(7-xi)) & 1; |
| 142 | 142 | pen_g = 0;//(p7_vram[count+0x8000]>>(7-xi)) & 1; |
| 143 | 143 | |
| 144 | 144 | color = pen_g<<2 | pen_r<<1 | pen_b<<0; |
| r9013 | r9014 | |
| 155 | 155 | { |
| 156 | 156 | for(x=0;x<width;x++) |
| 157 | 157 | { |
| 158 | | int tile = p7_vram[count+0x8000]; |
| 159 | | int color = p7_vram[count+0xc000]; |
| 158 | int tile = vram[count+0x8000]; |
| 159 | int color = vram[count+0xc000]; |
| 160 | 160 | |
| 161 | 161 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8,0); |
| 162 | 162 | |
| r9013 | r9014 | |
| 194 | 194 | |
| 195 | 195 | static READ8_HANDLER( vram_r ) |
| 196 | 196 | { |
| 197 | static UINT8 *vram = memory_region(space->machine, "vram"); |
| 197 | 198 | static UINT8 res; |
| 198 | 199 | |
| 199 | 200 | if(vram_sel == 0) |
| 200 | 201 | { |
| 201 | | UINT8 *cpu = memory_region(space->machine, "maincpu"); |
| 202 | UINT8 *work_ram = memory_region(space->machine, "maincpu"); |
| 202 | 203 | |
| 203 | | return cpu[offset+0x8000]; |
| 204 | return work_ram[offset+0x8000]; |
| 204 | 205 | } |
| 205 | 206 | |
| 206 | 207 | if(pal_sel && (plane_reg & 0x70) == 0x00) |
| r9013 | r9014 | |
| 209 | 210 | res = 0xff; |
| 210 | 211 | |
| 211 | 212 | if((plane_reg & 0x11) == 0x11) |
| 212 | | res &= p7_vram[offset | 0x0000]; |
| 213 | res &= vram[offset | 0x0000]; |
| 213 | 214 | if((plane_reg & 0x22) == 0x22) |
| 214 | | res &= p7_vram[offset | 0x4000]; |
| 215 | res &= vram[offset | 0x4000]; |
| 215 | 216 | if((plane_reg & 0x44) == 0x44) |
| 216 | 217 | { |
| 217 | | res &= p7_vram[offset | 0x8000]; |
| 218 | | attr_latch = p7_vram[offset | 0xc000]; |
| 218 | res &= vram[offset | 0x8000]; |
| 219 | attr_latch = vram[offset | 0xc000]; |
| 219 | 220 | i8255a_w(space->machine->device("ppi8255_0"), 1, (attr_latch << 4) | (attr_latch & 0x7)); |
| 220 | 221 | } |
| 221 | 222 | |
| r9013 | r9014 | |
| 224 | 225 | |
| 225 | 226 | static WRITE8_HANDLER( vram_w ) |
| 226 | 227 | { |
| 228 | static UINT8 *vram = memory_region(space->machine, "vram"); |
| 229 | |
| 227 | 230 | if(vram_sel) |
| 228 | 231 | { |
| 229 | 232 | if(pal_sel && (plane_reg & 0x70) == 0x00) |
| r9013 | r9014 | |
| 233 | 236 | } |
| 234 | 237 | |
| 235 | 238 | if(plane_reg & 0x10) |
| 236 | | p7_vram[offset | 0x0000] = (plane_reg & 1) ? data : 0xff; |
| 239 | vram[offset | 0x0000] = (plane_reg & 1) ? data : 0xff; |
| 237 | 240 | if(plane_reg & 0x20) |
| 238 | | p7_vram[offset | 0x4000] = (plane_reg & 2) ? data : 0xff; |
| 241 | vram[offset | 0x4000] = (plane_reg & 2) ? data : 0xff; |
| 239 | 242 | if(plane_reg & 0x40) |
| 240 | 243 | { |
| 241 | | p7_vram[offset | 0x8000] = (plane_reg & 4) ? data : 0xff; |
| 244 | vram[offset | 0x8000] = (plane_reg & 4) ? data : 0xff; |
| 242 | 245 | attr_latch = attr_wrap ? attr_latch : attr_data; |
| 243 | | p7_vram[offset | 0xc000] = attr_latch; |
| 246 | vram[offset | 0xc000] = attr_latch; |
| 244 | 247 | i8255a_w(space->machine->device("ppi8255_0"), 1, (attr_latch << 4) | (attr_latch & 0x7)); |
| 245 | 248 | } |
| 246 | 249 | } |
| 247 | 250 | else |
| 248 | 251 | { |
| 249 | | UINT8 *cpu = memory_region(space->machine, "maincpu"); |
| 252 | UINT8 *work_ram = memory_region(space->machine, "maincpu"); |
| 250 | 253 | |
| 251 | | cpu[offset+0x8000] = data; |
| 254 | work_ram[offset+0x8000] = data; |
| 252 | 255 | } |
| 253 | 256 | } |
| 254 | 257 | |
| 255 | 258 | static WRITE8_HANDLER( pasopia7_memory_ctrl_w ) |
| 256 | 259 | { |
| 257 | | UINT8 *cpu = memory_region(space->machine, "maincpu"); |
| 260 | UINT8 *work_ram = memory_region(space->machine, "maincpu"); |
| 258 | 261 | UINT8 *basic = memory_region(space->machine, "basic"); |
| 259 | 262 | |
| 260 | 263 | switch(data & 3) |
| 261 | 264 | { |
| 262 | 265 | case 0: |
| 263 | 266 | case 3: //select Basic ROM |
| 264 | | memory_set_bankptr(space->machine, "bank1", basic + 0x00000); |
| 265 | | memory_set_bankptr(space->machine, "bank2", basic + 0x04000); |
| 267 | memory_set_bankptr(space->machine, "bank1", basic + 0x00000); |
| 268 | memory_set_bankptr(space->machine, "bank2", basic + 0x04000); |
| 266 | 269 | break; |
| 267 | 270 | case 1: //select Basic ROM + BIOS ROM |
| 268 | | memory_set_bankptr(space->machine, "bank1", basic + 0x00000); |
| 269 | | memory_set_bankptr(space->machine, "bank2", cpu + 0x10000); |
| 271 | memory_set_bankptr(space->machine, "bank1", basic + 0x00000); |
| 272 | memory_set_bankptr(space->machine, "bank2", work_ram + 0x10000); |
| 270 | 273 | break; |
| 271 | 274 | case 2: //select Work RAM |
| 272 | | memory_set_bankptr(space->machine, "bank1", cpu + 0x00000); |
| 273 | | memory_set_bankptr(space->machine, "bank2", cpu + 0x04000); |
| 275 | memory_set_bankptr(space->machine, "bank1", work_ram + 0x00000); |
| 276 | memory_set_bankptr(space->machine, "bank2", work_ram + 0x04000); |
| 274 | 277 | break; |
| 275 | 278 | } |
| 276 | 279 | |
| r9013 | r9014 | |
| 354 | 357 | /* writes always occurs to the RAM banks, even if the ROMs are selected. */ |
| 355 | 358 | static WRITE8_HANDLER( ram_bank_w ) |
| 356 | 359 | { |
| 357 | | UINT8 *cpu = memory_region(space->machine, "maincpu"); |
| 360 | UINT8 *work_ram = memory_region(space->machine, "maincpu"); |
| 358 | 361 | |
| 359 | | cpu[offset] = data; |
| 362 | work_ram[offset] = data; |
| 360 | 363 | } |
| 361 | 364 | |
| 362 | 365 | static WRITE8_HANDLER( pasopia7_6845_w ) |
| r9013 | r9014 | |
| 753 | 756 | |
| 754 | 757 | ROM_REGION( 0x8000, "rampac2", ROMREGION_ERASEFF ) |
| 755 | 758 | // ROM_LOAD( "rampac2.bin", 0x0000, 0x8000, CRC(0e4f09bd) SHA1(4088906d57e4f6085a75b249a6139a0e2eb531a1) ) |
| 759 | |
| 760 | ROM_REGION( 0x10000, "vram", ROMREGION_ERASE00 ) |
| 756 | 761 | ROM_END |
| 757 | 762 | |
| 758 | 763 | static DRIVER_INIT( paso7 ) |