src/mess/drivers/jr200.c
| r8762 | r8763 | |
| 20 | 20 | #include "sound/beep.h" |
| 21 | 21 | |
| 22 | 22 | static UINT8 *jr200_vram,*jr200_cram; |
| 23 | static UINT8 *mn1271_ram; |
| 23 | 24 | static UINT8 jr200_border_col; |
| 24 | 25 | |
| 25 | 26 | /* TODO: double check this */ |
| r8762 | r8763 | |
| 249 | 250 | jr200_border_col = data; |
| 250 | 251 | } |
| 251 | 252 | |
| 252 | | static READ8_HANDLER( jr200_system_latch_1_r ) |
| 253 | static READ8_HANDLER( mn1271_io_r ) |
| 253 | 254 | { |
| 254 | | return 1; // needs this to be high otherwise system refuses to boot |
| 255 | | } |
| 255 | if((offset+0xc800) > 0xca00) |
| 256 | return 0xff; |
| 256 | 257 | |
| 257 | | static READ8_HANDLER( jr200_tape_r ) |
| 258 | | { |
| 259 | | return mame_rand(space->machine); |
| 260 | | } |
| 258 | switch(offset+0xc800) |
| 259 | { |
| 260 | case 0xc801: return mcu_keyb_r(space,0); |
| 261 | case 0xc803: return (mn1271_ram[0x03] & 0xcf) | 0x30; //---x ---- printer status ready (ACTIVE HIGH) |
| 262 | case 0xc807: return (mn1271_ram[0x07] & 0x80) | 0x60; |
| 263 | case 0xc80a: return (mn1271_ram[0x0a] & 0xfe); |
| 264 | case 0xc80c: return (mn1271_ram[0x0c] & 0xdf) | 0x20; |
| 265 | case 0xc80e: return 0; |
| 266 | case 0xc810: return 0; |
| 267 | case 0xc816: return 0x4e; |
| 268 | case 0xc81c: return (mn1271_ram[0x1c] & 0xfe) | 1; //bit 0 needs to be high otherwise system refuses to boot |
| 269 | case 0xc81d: return (mn1271_ram[0x1d] & 0xed); |
| 270 | } |
| 261 | 271 | |
| 262 | | static READ8_HANDLER( jr200_tape2_r ) |
| 263 | | { |
| 264 | | return mame_rand(space->machine); |
| 272 | return mn1271_ram[offset]; |
| 265 | 273 | } |
| 266 | 274 | |
| 267 | | |
| 268 | | static READ8_HANDLER( mcu_portd_r ) |
| 275 | static WRITE8_HANDLER( mn1271_io_w ) |
| 269 | 276 | { |
| 270 | | /* |
| 271 | | ---x ---- printer status ready (ACTIVE HIGH) |
| 272 | | */ |
| 277 | mn1271_ram[offset] = data; |
| 273 | 278 | |
| 274 | | return 0x10; |
| 279 | switch(offset+0xc800) |
| 280 | { |
| 281 | case 0xc805: break; //LPT printer port W |
| 282 | case 0xc819: jr200_beep_w(space,0,data); break; |
| 283 | case 0xc81a: |
| 284 | case 0xc81b: jr200_beep_freq_w(space,offset-0x1a,data); break; |
| 285 | case 0xca00: jr200_border_col_w(space,0,data); break; |
| 286 | } |
| 275 | 287 | } |
| 276 | 288 | |
| 277 | | |
| 278 | 289 | static ADDRESS_MAP_START(jr200_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 279 | 290 | /* |
| 280 | 291 | 0000-3fff RAM |
| r8762 | r8763 | |
| 292 | 303 | AM_RANGE(0xc500, 0xc7ff) AM_RAM AM_BASE(&jr200_cram) |
| 293 | 304 | |
| 294 | 305 | // 0xc800 - 0xcfff I / O area |
| 295 | | AM_RANGE(0xc801, 0xc801) AM_READ(mcu_keyb_r) |
| 296 | | AM_RANGE(0xc803, 0xc803) AM_READ(mcu_portd_r) AM_WRITENOP //used in IRQ routine (0x01 -> 0x43) |
| 297 | | AM_RANGE(0xc805, 0xc805) AM_WRITENOP //printer LPT port |
| 298 | | // AM_RANGE(0xc806, 0xc806) //writes 0x78 there |
| 299 | | AM_RANGE(0xc807, 0xc807) AM_READ(jr200_tape_r) //W bit 6 enables tape play |
| 300 | | AM_RANGE(0xc80e, 0xc80e) AM_READ(jr200_tape2_r) |
| 301 | | AM_RANGE(0xc819, 0xc819) AM_WRITE(jr200_beep_w) |
| 302 | | AM_RANGE(0xc81a, 0xc81b) AM_WRITE(jr200_beep_freq_w) |
| 303 | | AM_RANGE(0xc81c, 0xc81c) AM_READ(jr200_system_latch_1_r) |
| 304 | | AM_RANGE(0xc81d, 0xc81d) AM_READNOP //jr200_system_latch_2_r |
| 305 | | AM_RANGE(0xca00, 0xca00) AM_WRITE(jr200_border_col_w) |
| 306 | AM_RANGE(0xc800, 0xcfff) AM_READWRITE(mn1271_io_r,mn1271_io_w) AM_BASE(&mn1271_ram) |
| 306 | 307 | |
| 307 | 308 | AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(jr200_bios_char_r,jr200_bios_char_w) //BIOS PCG RAM area |
| 308 | 309 | AM_RANGE(0xd800, 0xdfff) AM_ROM // cart space (header 0x7e) |