src/mess/drivers/fm7.c
| r4875 | r4876 | |
| 49 | 49 | emu_timer* fm7_timer; // main timer, triggered every 2.0345ms? |
| 50 | 50 | static UINT8 sub_busy; |
| 51 | 51 | static UINT8 basic_rom_en; |
| 52 | | static UINT8 fm7_attn_irq; |
| 52 | static UINT8 attn_irq; |
| 53 | static UINT8 vram_access; // VRAM access flag |
| 54 | static UINT8 crt_enable; |
| 53 | 55 | |
| 54 | 56 | /* |
| 55 | 57 | * I/O port 0xfd02 |
| r4875 | r4876 | |
| 136 | 138 | { |
| 137 | 139 | UINT8 ret = 0xff; |
| 138 | 140 | |
| 139 | | if(fm7_attn_irq != 0) |
| 141 | if(attn_irq != 0) |
| 140 | 142 | { |
| 141 | 143 | ret &= ~0x01; |
| 142 | | fm7_attn_irq = 0; |
| 144 | attn_irq = 0; |
| 143 | 145 | } |
| 144 | 146 | return ret; |
| 145 | 147 | } |
| r4875 | r4876 | |
| 211 | 213 | */ |
| 212 | 214 | READ8_HANDLER( fm7_attn_irq_r ) |
| 213 | 215 | { |
| 214 | | fm7_attn_irq = 1; |
| 216 | attn_irq = 1; |
| 215 | 217 | cputag_set_input_line(space->machine,"maincpu",M6809_FIRQ_LINE,ASSERT_LINE); |
| 216 | 218 | return 0xff; |
| 217 | 219 | } |
| 218 | 220 | |
| 221 | READ8_HANDLER( fm7_vram_access_r ) |
| 222 | { |
| 223 | vram_access = 1; |
| 224 | return 0xff; |
| 225 | } |
| 226 | |
| 227 | WRITE8_HANDLER( fm7_vram_access_w ) |
| 228 | { |
| 229 | vram_access = 0; |
| 230 | } |
| 231 | |
| 232 | READ8_HANDLER( fm7_vram_r ) |
| 233 | { |
| 234 | return fm7_video_ram[offset]; |
| 235 | } |
| 236 | |
| 237 | WRITE8_HANDLER( fm7_vram_w ) |
| 238 | { |
| 239 | if(vram_access != 0) |
| 240 | fm7_video_ram[offset] = data; |
| 241 | } |
| 242 | |
| 243 | READ8_HANDLER( fm7_crt_r ) |
| 244 | { |
| 245 | crt_enable = 1; |
| 246 | return 0xff; |
| 247 | } |
| 248 | |
| 249 | WRITE8_HANDLER( fm7_crt_w ) |
| 250 | { |
| 251 | crt_enable = 0; |
| 252 | } |
| 253 | |
| 219 | 254 | static TIMER_CALLBACK( fm7_timer_irq ) |
| 220 | 255 | { |
| 221 | 256 | if(~irq_mask & IRQ_FLAG_TIMER) |
| r4875 | r4876 | |
| 275 | 310 | */ |
| 276 | 311 | |
| 277 | 312 | static ADDRESS_MAP_START( fm7_sub_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 278 | | AM_RANGE(0x0000,0xbfff) AM_RAM AM_BASE(&fm7_video_ram) // VRAM |
| 313 | AM_RANGE(0x0000,0xbfff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM |
| 279 | 314 | AM_RANGE(0xc000,0xcfff) AM_RAM // Console RAM |
| 280 | 315 | AM_RANGE(0xd000,0xd37f) AM_RAM // Work RAM |
| 281 | 316 | AM_RANGE(0xd380,0xd3ff) AM_READWRITE(shared_r,shared_w) // shared RAM |
| 282 | 317 | // I/O space (D400-D7FF) |
| 283 | 318 | AM_RANGE(0xd402,0xd402) AM_READ(fm7_cancel_ack) |
| 284 | 319 | AM_RANGE(0xd404,0xd404) AM_READ(fm7_attn_irq_r) |
| 320 | AM_RANGE(0xd408,0xd408) AM_READWRITE(fm7_crt_r,fm7_crt_w) |
| 321 | AM_RANGE(0xd409,0xd409) AM_READWRITE(fm7_vram_access_r,fm7_vram_access_w) |
| 285 | 322 | AM_RANGE(0xd40a,0xd40a) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) |
| 286 | 323 | AM_RANGE(0xd800,0xffff) AM_ROM |
| 287 | 324 | ADDRESS_MAP_END |
| r4875 | r4876 | |
| 302 | 339 | static DRIVER_INIT(fm7) |
| 303 | 340 | { |
| 304 | 341 | shared_ram = auto_alloc_array(machine,UINT8,0x80); |
| 342 | fm7_video_ram = auto_alloc_array(machine,UINT8,0xc000); |
| 305 | 343 | fm7_timer = timer_alloc(machine,fm7_timer_irq,NULL); |
| 306 | 344 | cpu_set_irq_callback(cputag_get_cpu(machine,"maincpu"),fm7_irq_ack); |
| 307 | 345 | cpu_set_irq_callback(cputag_get_cpu(machine,"sub"),fm7_sub_irq_ack); |
| r4875 | r4876 | |
| 326 | 364 | timer_adjust_periodic(fm7_timer,attotime_zero,0,ATTOTIME_IN_USEC(2034)); |
| 327 | 365 | irq_mask = 0xff; |
| 328 | 366 | irq_flags = 0x00; |
| 329 | | fm7_attn_irq = 0; |
| 367 | attn_irq = 0; |
| 330 | 368 | sub_busy = 0x80; // busy at reset |
| 331 | 369 | basic_rom_en = 1; // enabled at reset |
| 370 | vram_access = 0; |
| 371 | crt_enable = 0; |
| 332 | 372 | memory_set_bankptr(machine,1,RAM+0x38000); |
| 333 | 373 | } |
| 334 | 374 | |
| r4875 | r4876 | |
| 342 | 382 | UINT8 col; |
| 343 | 383 | int y, x, b; |
| 344 | 384 | |
| 385 | if(crt_enable == 0) |
| 386 | return 0; |
| 387 | |
| 345 | 388 | for (y = 0; y < 200; y++) |
| 346 | 389 | { |
| 347 | 390 | for (x = 0; x < 80; x++) |