src/mess/drivers/jr200.c
| r8761 | r8762 | |
| 7 | 7 | http://www.armchairarcade.com/neo/node/1598 |
| 8 | 8 | |
| 9 | 9 | TODO: |
| 10 | | - Timings are basically screwed, it's too fast in idle mode, too slow |
| 11 | | when the beeper fires for a syntax error; |
| 10 | - Timings are basically screwed, it takes too much to load the POST but |
| 11 | then the cursor blink is too fast |
| 12 | - keyboard MCU irq and data polling simulation should be inside a timer |
| 13 | callback |
| 12 | 14 | - MN1544 4-bit CPU core and ROM dump |
| 13 | 15 | |
| 14 | 16 | ****************************************************************************/ |
| r8761 | r8762 | |
| 20 | 22 | static UINT8 *jr200_vram,*jr200_cram; |
| 21 | 23 | static UINT8 jr200_border_col; |
| 22 | 24 | |
| 25 | /* TODO: double check this */ |
| 23 | 26 | static const UINT8 jr200_keycodes[4][9][8] = |
| 24 | 27 | { |
| 25 | 28 | /* unshifted */ |
| r8761 | r8762 | |
| 29 | 32 | { 0x37, 0x38, 0x39, 0x09, 0x71, 0x77, 0x65, 0x72 }, |
| 30 | 33 | { 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x40, 0x5b }, |
| 31 | 34 | { 0x1b, 0x2b, 0x34, 0x35, 0x36, 0x61, 0x73, 0x64 }, |
| 32 | | { 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x3a }, |
| 35 | { 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27 }, |
| 33 | 36 | { 0x0d, 0x0a, 0x1e, 0x31, 0x32, 0x33, 0x7a, 0x78 }, |
| 34 | 37 | { 0x63, 0x76, 0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2f }, |
| 35 | 38 | { 0x1d, 0x1f, 0x1c, 0x30, 0x2e, 0x20, 0x03, 0x00 } |
| r8761 | r8762 | |
| 42 | 45 | { 0x37, 0x38, 0x39, 0x09, 0x51, 0x57, 0x45, 0x52 }, |
| 43 | 46 | { 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x40, 0x7b }, |
| 44 | 47 | { 0x1b, 0x2b, 0x34, 0x35, 0x36, 0x41, 0x53, 0x44 }, |
| 45 | | { 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x2b, 0x2a }, |
| 48 | { 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22 }, |
| 46 | 49 | { 0x0d, 0x0a, 0x1e, 0x31, 0x32, 0x33, 0x5a, 0x58 }, |
| 47 | 50 | { 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x3c, 0x3e, 0x3f }, |
| 48 | 51 | { 0x1d, 0x1f, 0x1c, 0x30, 0x2e, 0x20, 0x00, 0x00 } |
| r8761 | r8762 | |
| 97 | 100 | { |
| 98 | 101 | for(xi=0;xi<8;xi++) |
| 99 | 102 | { |
| 100 | | UINT8 *gfx_data; //= memory_region(screen->machine, "gfx_ram"); |
| 103 | UINT8 *gfx_data; |
| 101 | 104 | |
| 102 | 105 | if(attr & 0x80) //bitmap mode |
| 103 | 106 | { |
| r8761 | r8762 | |
| 105 | 108 | this mode draws 4 x 4 dot blocks, by combining lower 6 bits of tile and attribute vram |
| 106 | 109 | |
| 107 | 110 | tile def |
| 108 | | --xx x--- up-right |
| 109 | | ---- -xxx up-left |
| 111 | 00xx x--- up-right |
| 112 | 00-- -xxx up-left |
| 110 | 113 | attr def |
| 111 | | --xx x--- down-right |
| 112 | | ---- -xxx down-left |
| 114 | 10xx x--- down-right |
| 115 | 10-- -xxx down-left |
| 113 | 116 | */ |
| 114 | 117 | int step; |
| 115 | 118 | |
| r8761 | r8762 | |
| 118 | 121 | |
| 119 | 122 | pen = ((((attr & 0x3f) << 6) | (tile & 0x3f)) >> (step)) & 0x07; |
| 120 | 123 | } |
| 121 | | else |
| 124 | else // tile mode |
| 122 | 125 | { |
| 123 | 126 | gfx_data = memory_region(screen->machine, attr & 0x40 ? "pcg" : "gfx_ram"); |
| 124 | 127 | |
| r8761 | r8762 | |
| 128 | 131 | *BITMAP_ADDR16(bitmap, y*8+yi+16, x*8+xi+16) = screen->machine->pens[pen]; |
| 129 | 132 | } |
| 130 | 133 | } |
| 131 | | //drawgfx_opaque(bitmap, cliprect, screen->machine->gfx[(col & 0x40) >> 6], code, col & 0x3f, 0, 0, 16 + j * 8, 16 + (i >> 5) * 8); |
| 132 | 134 | } |
| 133 | | //} |
| 134 | 135 | } |
| 135 | 136 | |
| 136 | 137 | return 0; |
| r8761 | r8762 | |
| 253 | 254 | return 1; // needs this to be high otherwise system refuses to boot |
| 254 | 255 | } |
| 255 | 256 | |
| 257 | static READ8_HANDLER( jr200_tape_r ) |
| 258 | { |
| 259 | return mame_rand(space->machine); |
| 260 | } |
| 261 | |
| 262 | static READ8_HANDLER( jr200_tape2_r ) |
| 263 | { |
| 264 | return mame_rand(space->machine); |
| 265 | } |
| 266 | |
| 267 | |
| 268 | static READ8_HANDLER( mcu_portd_r ) |
| 269 | { |
| 270 | /* |
| 271 | ---x ---- printer status ready (ACTIVE HIGH) |
| 272 | */ |
| 273 | |
| 274 | return 0x10; |
| 275 | } |
| 276 | |
| 277 | |
| 278 | static ADDRESS_MAP_START(jr200_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 256 | 279 | /* |
| 257 | 280 | 0000-3fff RAM |
| 258 | 281 | 4000-4fff RAM ( 4k expansion) |
| 259 | 282 | 4000-7fff RAM (16k expansion) |
| 260 | 283 | 4000-bfff RAM (32k expansion) |
| 261 | 284 | */ |
| 262 | | |
| 263 | | static ADDRESS_MAP_START(jr200_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 264 | 285 | AM_RANGE(0x0000, 0x7fff) AM_RAM |
| 265 | 286 | |
| 266 | 287 | AM_RANGE(0xa000, 0xbfff) AM_ROM |
| r8761 | r8762 | |
| 272 | 293 | |
| 273 | 294 | // 0xc800 - 0xcfff I / O area |
| 274 | 295 | AM_RANGE(0xc801, 0xc801) AM_READ(mcu_keyb_r) |
| 275 | | AM_RANGE(0xc803, 0xc803) AM_WRITENOP //used in IRQ routine (0x01 -> 0x43) |
| 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 |
| 276 | 298 | // AM_RANGE(0xc806, 0xc806) //writes 0x78 there |
| 277 | | // AM_RANGE(0xc807, 0xc807) //bit 6 enables tape play |
| 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) |
| 278 | 301 | AM_RANGE(0xc819, 0xc819) AM_WRITE(jr200_beep_w) |
| 279 | 302 | AM_RANGE(0xc81a, 0xc81b) AM_WRITE(jr200_beep_freq_w) |
| 280 | 303 | AM_RANGE(0xc81c, 0xc81c) AM_READ(jr200_system_latch_1_r) |
| r8761 | r8762 | |
| 445 | 468 | |
| 446 | 469 | static MACHINE_DRIVER_START( jr200 ) |
| 447 | 470 | /* basic machine hardware */ |
| 448 | | MDRV_CPU_ADD("maincpu", M6802, 890000) /* MN1800A */ |
| 471 | MDRV_CPU_ADD("maincpu", M6802, 4000000) /* MN1800A, ? Mhz */ |
| 449 | 472 | MDRV_CPU_PROGRAM_MAP(jr200_mem) |
| 450 | 473 | MDRV_CPU_VBLANK_INT("screen", jr200_irq) |
| 451 | 474 | MDRV_CPU_PERIODIC_INT(jr200_nmi,20) |
| r8761 | r8762 | |
| 465 | 488 | MDRV_SCREEN_VISIBLE_AREA(0, 16 + 256 + 16 - 1, 0, 16 + 192 + 16 - 1) |
| 466 | 489 | |
| 467 | 490 | MDRV_GFXDECODE(jr200) |
| 468 | | MDRV_PALETTE_LENGTH(128) |
| 491 | MDRV_PALETTE_LENGTH(8) |
| 469 | 492 | MDRV_PALETTE_INIT(jr200) |
| 470 | 493 | |
| 471 | 494 | MDRV_VIDEO_START(jr200) |