src/mess/drivers/jr200.c
| r5830 | r5831 | |
| 20 | 20 | #include "cpu/m6800/m6800.h" |
| 21 | 21 | |
| 22 | 22 | static UINT8 *textram; |
| 23 | static UINT8 io_reg[0x20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 24 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 23 | 25 | |
| 24 | 26 | static const UINT8 jr200_keycodes[4][9][8] = |
| 25 | 27 | { |
| r5830 | r5831 | |
| 76 | 78 | } |
| 77 | 79 | }; |
| 78 | 80 | |
| 81 | /* |
| 79 | 82 | static READ8_HANDLER( test_r ) |
| 80 | 83 | { |
| 81 | 84 | return 0x00; |
| 82 | 85 | } |
| 86 | */ |
| 83 | 87 | |
| 84 | | static WRITE8_HANDLER( test_w ) |
| 88 | static WRITE8_HANDLER( io_reg_w ) |
| 85 | 89 | { |
| 86 | | ; |
| 90 | io_reg[offset] = data; |
| 87 | 91 | } |
| 88 | 92 | |
| 89 | | static READ8_HANDLER( test01_r ) |
| 93 | static READ8_HANDLER( io_reg_r ) |
| 90 | 94 | { |
| 91 | | // hack |
| 92 | | int row, col, keydata = 0, table = 0; |
| 93 | | static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" }; |
| 95 | UINT8 value = 0x00; |
| 94 | 96 | |
| 95 | | /* scan keyboard */ |
| 96 | | for (row = 0; row < 9; row++) |
| 97 | switch (offset) |
| 97 | 98 | { |
| 98 | | UINT8 data = input_port_read(space->machine, keynames[row]); |
| 99 | | |
| 100 | | for (col = 0; col < 8; col++) |
| 99 | case 0x01: |
| 101 | 100 | { |
| 102 | | if (!BIT(data, col)) |
| 101 | // hack |
| 102 | int row, col, keydata = 0, table = 0; |
| 103 | static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" }; |
| 104 | |
| 105 | /* scan keyboard */ |
| 106 | for (row = 0; row < 9; row++) |
| 103 | 107 | { |
| 104 | | /* latch key data */ |
| 105 | | keydata = jr200_keycodes[table][row][col]; |
| 108 | UINT8 data = input_port_read(space->machine, keynames[row]); |
| 109 | |
| 110 | for (col = 0; col < 8; col++) |
| 111 | { |
| 112 | if (!BIT(data, col)) |
| 113 | { |
| 114 | /* latch key data */ |
| 115 | keydata = jr200_keycodes[table][row][col]; |
| 116 | } |
| 117 | } |
| 106 | 118 | } |
| 119 | |
| 120 | value = keydata; |
| 107 | 121 | } |
| 122 | break; |
| 123 | case 0x07: |
| 124 | value = 0x80; |
| 125 | break; |
| 126 | case 0x1c: |
| 127 | value = 0x01; |
| 128 | break; |
| 129 | default: |
| 130 | value = io_reg[offset]; |
| 131 | break; |
| 108 | 132 | } |
| 109 | 133 | |
| 110 | | return keydata; |
| 134 | return value; |
| 111 | 135 | } |
| 112 | 136 | |
| 113 | | static READ8_HANDLER( test07_r ) |
| 114 | | { |
| 115 | | return 0x80; |
| 116 | | } |
| 117 | | |
| 118 | | static READ8_HANDLER( test1c_r ) |
| 119 | | { |
| 120 | | return 0x01; |
| 121 | | } |
| 122 | | |
| 123 | | static READ8_HANDLER( test1d_r ) |
| 124 | | { |
| 125 | | return 0x00; |
| 126 | | } |
| 127 | | |
| 128 | 137 | /* |
| 129 | 138 | 0000-3fff RAM |
| 130 | 139 | 4000-4fff RAM ( 4k expansion) |
| r5830 | r5831 | |
| 141 | 150 | AM_RANGE(0x000e, 0x3fff) AM_RAM |
| 142 | 151 | AM_RANGE(0xa000, 0xbfff) AM_ROM |
| 143 | 152 | AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_BASE(&textram) |
| 144 | | AM_RANGE(0xc800, 0xc800) AM_RAM AM_READWRITE(test_r, test_w) |
| 145 | | AM_RANGE(0xc801, 0xc801) AM_RAM AM_READWRITE(test01_r, test_w) |
| 146 | | AM_RANGE(0xc802, 0xc802) AM_RAM AM_READWRITE(test_r, test_w) |
| 147 | | AM_RANGE(0xc803, 0xc803) AM_RAM AM_READWRITE(test_r, test_w) |
| 148 | | AM_RANGE(0xc804, 0xc804) AM_RAM AM_READWRITE(test_r, test_w) |
| 149 | | AM_RANGE(0xc805, 0xc805) AM_RAM AM_READWRITE(test_r, test_w) |
| 150 | | AM_RANGE(0xc806, 0xc806) AM_RAM AM_READWRITE(test_r, test_w) |
| 151 | | AM_RANGE(0xc807, 0xc807) AM_RAM AM_READWRITE(test07_r, test_w) |
| 152 | | AM_RANGE(0xc808, 0xc808) AM_RAM AM_READWRITE(test_r, test_w) |
| 153 | | AM_RANGE(0xc809, 0xc809) AM_RAM AM_READWRITE(test_r, test_w) |
| 154 | | AM_RANGE(0xc80a, 0xc80a) AM_RAM AM_READWRITE(test_r, test_w) |
| 155 | | AM_RANGE(0xc80b, 0xc80b) AM_RAM AM_READWRITE(test_r, test_w) |
| 156 | | AM_RANGE(0xc80c, 0xc80c) AM_RAM AM_READWRITE(test_r, test_w) |
| 157 | | AM_RANGE(0xc80d, 0xc80d) AM_RAM AM_READWRITE(test_r, test_w) |
| 158 | | AM_RANGE(0xc80e, 0xc80e) AM_RAM AM_READWRITE(test_r, test_w) |
| 159 | | AM_RANGE(0xc80f, 0xc80f) AM_RAM AM_READWRITE(test_r, test_w) |
| 160 | | AM_RANGE(0xc810, 0xc810) AM_RAM AM_READWRITE(test_r, test_w) |
| 161 | | AM_RANGE(0xc811, 0xc811) AM_RAM AM_READWRITE(test_r, test_w) |
| 162 | | AM_RANGE(0xc812, 0xc812) AM_RAM AM_READWRITE(test_r, test_w) |
| 163 | | AM_RANGE(0xc813, 0xc813) AM_RAM AM_READWRITE(test_r, test_w) |
| 164 | | AM_RANGE(0xc814, 0xc814) AM_RAM AM_READWRITE(test_r, test_w) |
| 165 | | AM_RANGE(0xc815, 0xc815) AM_RAM AM_READWRITE(test_r, test_w) |
| 166 | | AM_RANGE(0xc816, 0xc816) AM_RAM AM_READWRITE(test_r, test_w) |
| 167 | | AM_RANGE(0xc817, 0xc817) AM_RAM AM_READWRITE(test_r, test_w) |
| 168 | | AM_RANGE(0xc818, 0xc818) AM_RAM AM_READWRITE(test_r, test_w) |
| 169 | | AM_RANGE(0xc819, 0xc819) AM_RAM AM_READWRITE(test_r, test_w) |
| 170 | | AM_RANGE(0xc81a, 0xc81a) AM_RAM AM_READWRITE(test_r, test_w) |
| 171 | | AM_RANGE(0xc81b, 0xc81b) AM_RAM AM_READWRITE(test_r, test_w) |
| 172 | | AM_RANGE(0xc81c, 0xc81c) AM_RAM AM_READWRITE(test1c_r, test_w) |
| 173 | | AM_RANGE(0xc81d, 0xc81d) AM_RAM AM_READWRITE(test1d_r, test_w) |
| 174 | | AM_RANGE(0xc81e, 0xc81e) AM_RAM AM_READWRITE(test_r, test_w) |
| 175 | | AM_RANGE(0xc81f, 0xc81f) AM_RAM AM_READWRITE(test_r, test_w) |
| 153 | AM_RANGE(0xc800, 0xc81f) AM_READWRITE(io_reg_r, io_reg_w) |
| 176 | 154 | AM_RANGE(0xe000, 0xffff) AM_ROM |
| 177 | 155 | ADDRESS_MAP_END |
| 178 | 156 | |
| r5830 | r5831 | |
| 344 | 322 | GFXDECODE_ENTRY( "char", 0, tiles8x8_layout, 0, 0x100 ) |
| 345 | 323 | GFXDECODE_END |
| 346 | 324 | |
| 347 | | /* |
| 325 | |
| 348 | 326 | static INTERRUPT_GEN( jr200_nmi ) |
| 349 | 327 | { |
| 350 | 328 | cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); |
| 351 | 329 | } |
| 352 | | */ |
| 353 | 330 | |
| 354 | 331 | static INTERRUPT_GEN( jr200_irq ) |
| 355 | 332 | { |
| r5830 | r5831 | |
| 362 | 339 | MDRV_CPU_PROGRAM_MAP(jr200_mem) |
| 363 | 340 | MDRV_CPU_IO_MAP(jr200_io) |
| 364 | 341 | // MDRV_CPU_VBLANK_INT("screen", jr200_irq) |
| 365 | | // MDRV_CPU_PERIODIC_INT(jr200_nmi,60) |
| 342 | MDRV_CPU_PERIODIC_INT(jr200_nmi,60) |
| 366 | 343 | MDRV_CPU_PERIODIC_INT(jr200_irq,10) |
| 367 | 344 | /* |
| 368 | 345 | MDRV_CPU_ADD("mn1544", MN1544, ?) |