src/mess/drivers/mod8.c
| r6493 | r6494 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "cpu/i8008/i8008.h" |
| 11 | 11 | |
| 12 | static UINT8 tty_buffer[80*25]; |
| 13 | |
| 14 | static const UINT8 teleprinter_font[128*8] = { |
| 15 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 16 | 0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00, |
| 17 | 0x38,0x38,0x38,0x38,0x00,0x00,0x00,0x00, |
| 18 | 0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x00, |
| 19 | 0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07, |
| 20 | 0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07, |
| 21 | 0x38,0x38,0x38,0x38,0x07,0x07,0x07,0x07, |
| 22 | 0x3f,0x3f,0x3f,0x3f,0x07,0x07,0x07,0x07, |
| 23 | 0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x38, |
| 24 | 0x07,0x07,0x07,0x07,0x38,0x38,0x38,0x38, |
| 25 | 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, |
| 26 | 0x3f,0x3f,0x3f,0x3f,0x38,0x38,0x38,0x38, |
| 27 | 0x00,0x00,0x00,0x00,0x3f,0x3f,0x3f,0x3f, |
| 28 | 0x07,0x07,0x07,0x07,0x3f,0x3f,0x3f,0x3f, |
| 29 | 0x38,0x38,0x38,0x38,0x3f,0x3f,0x3f,0x3f, |
| 30 | 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, |
| 31 | 0x00,0x00,0x00,0x00,0x2a,0x15,0x2a,0x15, |
| 32 | 0x2a,0x15,0x2a,0x15,0x00,0x00,0x00,0x00, |
| 33 | 0x3f,0x3f,0x3f,0x3f,0x2a,0x15,0x2a,0x15, |
| 34 | 0x2a,0x15,0x2a,0x15,0x3f,0x3f,0x3f,0x3f, |
| 35 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 36 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 37 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 38 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 39 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 40 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 41 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 42 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 43 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 44 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 45 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 46 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 47 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 48 | 0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x00, |
| 49 | 0x14,0x14,0x14,0x00,0x00,0x00,0x00,0x00, |
| 50 | 0x14,0x14,0x3e,0x14,0x3e,0x14,0x14,0x00, |
| 51 | 0x08,0x3c,0x0a,0x1c,0x28,0x1e,0x08,0x00, |
| 52 | 0x06,0x26,0x10,0x08,0x04,0x32,0x30,0x00, |
| 53 | 0x08,0x14,0x14,0x0c,0x2a,0x12,0x2c,0x00, |
| 54 | 0x08,0x08,0x04,0x00,0x00,0x00,0x00,0x00, |
| 55 | 0x10,0x08,0x04,0x04,0x04,0x08,0x10,0x00, |
| 56 | 0x04,0x08,0x10,0x10,0x10,0x08,0x04,0x00, |
| 57 | 0x00,0x08,0x2a,0x1c,0x2a,0x08,0x00,0x00, |
| 58 | 0x00,0x08,0x08,0x3e,0x08,0x08,0x00,0x00, |
| 59 | 0x00,0x00,0x00,0x00,0x08,0x08,0x04,0x00, |
| 60 | 0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00, |
| 61 | 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, |
| 62 | 0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00, |
| 63 | 0x1c,0x22,0x32,0x2a,0x26,0x22,0x1c,0x00, |
| 64 | 0x08,0x0c,0x08,0x08,0x08,0x08,0x1c,0x00, |
| 65 | 0x1c,0x22,0x20,0x18,0x04,0x02,0x3e,0x00, |
| 66 | 0x3e,0x20,0x10,0x18,0x20,0x22,0x1c,0x00, |
| 67 | 0x10,0x18,0x14,0x12,0x3e,0x10,0x10,0x00, |
| 68 | 0x3e,0x02,0x1e,0x20,0x20,0x22,0x1c,0x00, |
| 69 | 0x10,0x08,0x04,0x1c,0x22,0x22,0x1c,0x00, |
| 70 | 0x3e,0x20,0x10,0x08,0x04,0x04,0x04,0x00, |
| 71 | 0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c,0x00, |
| 72 | 0x1c,0x22,0x22,0x1c,0x10,0x08,0x04,0x00, |
| 73 | 0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x00, |
| 74 | 0x00,0x00,0x08,0x00,0x08,0x08,0x04,0x00, |
| 75 | 0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x00, |
| 76 | 0x00,0x00,0x3e,0x00,0x3e,0x00,0x00,0x00, |
| 77 | 0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00, |
| 78 | 0x1c,0x22,0x20,0x10,0x08,0x00,0x08,0x00, |
| 79 | 0x1c,0x22,0x32,0x2a,0x3a,0x02,0x3c,0x00, |
| 80 | 0x08,0x14,0x22,0x22,0x3e,0x22,0x22,0x00, |
| 81 | 0x1e,0x22,0x22,0x1e,0x22,0x22,0x1e,0x00, |
| 82 | 0x1c,0x22,0x02,0x02,0x02,0x22,0x1c,0x00, |
| 83 | 0x1e,0x24,0x24,0x24,0x24,0x24,0x1e,0x00, |
| 84 | 0x3e,0x02,0x02,0x1e,0x02,0x02,0x3e,0x00, |
| 85 | 0x3e,0x02,0x02,0x1e,0x02,0x02,0x02,0x00, |
| 86 | 0x1c,0x22,0x02,0x02,0x32,0x22,0x3c,0x00, |
| 87 | 0x22,0x22,0x22,0x3e,0x22,0x22,0x22,0x00, |
| 88 | 0x1c,0x08,0x08,0x08,0x08,0x08,0x1c,0x00, |
| 89 | 0x38,0x10,0x10,0x10,0x10,0x12,0x0c,0x00, |
| 90 | 0x22,0x12,0x0a,0x06,0x0a,0x12,0x22,0x00, |
| 91 | 0x02,0x02,0x02,0x02,0x02,0x02,0x3e,0x00, |
| 92 | 0x22,0x36,0x2a,0x2a,0x22,0x22,0x22,0x00, |
| 93 | 0x22,0x22,0x26,0x2a,0x32,0x22,0x22,0x00, |
| 94 | 0x1c,0x22,0x22,0x22,0x22,0x22,0x1c,0x00, |
| 95 | 0x1e,0x22,0x22,0x1e,0x02,0x02,0x02,0x00, |
| 96 | 0x1c,0x22,0x22,0x22,0x2a,0x12,0x2c,0x00, |
| 97 | 0x1e,0x22,0x22,0x1e,0x0a,0x12,0x22,0x00, |
| 98 | 0x1c,0x22,0x02,0x1c,0x20,0x22,0x1c,0x00, |
| 99 | 0x3e,0x08,0x08,0x08,0x08,0x08,0x08,0x00, |
| 100 | 0x22,0x22,0x22,0x22,0x22,0x22,0x1c,0x00, |
| 101 | 0x22,0x22,0x22,0x14,0x14,0x08,0x08,0x00, |
| 102 | 0x22,0x22,0x22,0x2a,0x2a,0x2a,0x14,0x00, |
| 103 | 0x22,0x22,0x14,0x08,0x14,0x22,0x22,0x00, |
| 104 | 0x22,0x22,0x22,0x14,0x08,0x08,0x08,0x00, |
| 105 | 0x3e,0x20,0x10,0x08,0x04,0x02,0x3e,0x00, |
| 106 | 0x0e,0x02,0x02,0x02,0x02,0x02,0x0e,0x00, |
| 107 | 0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00, |
| 108 | 0x38,0x20,0x20,0x20,0x20,0x20,0x38,0x00, |
| 109 | 0x08,0x1c,0x2a,0x08,0x08,0x08,0x08,0x00, |
| 110 | 0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00, |
| 111 | 0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00, |
| 112 | 0x00,0x00,0x1c,0x20,0x3c,0x22,0x3c,0x00, |
| 113 | 0x02,0x02,0x1e,0x22,0x22,0x22,0x1e,0x00, |
| 114 | 0x00,0x00,0x3c,0x02,0x02,0x02,0x3c,0x00, |
| 115 | 0x20,0x20,0x3c,0x22,0x22,0x22,0x3c,0x00, |
| 116 | 0x00,0x00,0x1c,0x22,0x3e,0x02,0x1c,0x00, |
| 117 | 0x18,0x04,0x0e,0x04,0x04,0x04,0x04,0x00, |
| 118 | 0x00,0x00,0x3c,0x22,0x22,0x3c,0x20,0x18, |
| 119 | 0x02,0x02,0x1e,0x22,0x22,0x22,0x22,0x00, |
| 120 | 0x08,0x00,0x0c,0x08,0x08,0x08,0x1c,0x00, |
| 121 | 0x10,0x00,0x18,0x10,0x10,0x10,0x12,0x0c, |
| 122 | 0x02,0x02,0x22,0x12,0x0e,0x16,0x22,0x00, |
| 123 | 0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x00, |
| 124 | 0x00,0x00,0x16,0x2a,0x2a,0x2a,0x2a,0x00, |
| 125 | 0x00,0x00,0x1a,0x26,0x22,0x22,0x22,0x00, |
| 126 | 0x00,0x00,0x1c,0x22,0x22,0x22,0x1c,0x00, |
| 127 | 0x00,0x00,0x1e,0x22,0x22,0x1e,0x02,0x02, |
| 128 | 0x00,0x00,0x3c,0x22,0x22,0x3c,0x20,0x20, |
| 129 | 0x00,0x00,0x34,0x0c,0x04,0x04,0x04,0x00, |
| 130 | 0x00,0x00,0x3c,0x02,0x1c,0x20,0x1e,0x00, |
| 131 | 0x08,0x08,0x1c,0x08,0x08,0x08,0x10,0x00, |
| 132 | 0x00,0x00,0x22,0x22,0x22,0x32,0x2c,0x00, |
| 133 | 0x00,0x00,0x22,0x22,0x22,0x14,0x08,0x00, |
| 134 | 0x00,0x00,0x22,0x22,0x2a,0x2a,0x14,0x00, |
| 135 | 0x00,0x00,0x22,0x14,0x08,0x14,0x22,0x00, |
| 136 | 0x00,0x00,0x22,0x22,0x14,0x08,0x04,0x02, |
| 137 | 0x00,0x00,0x3e,0x10,0x08,0x04,0x3e,0x00, |
| 138 | 0x10,0x08,0x08,0x04,0x08,0x08,0x10,0x00, |
| 139 | 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00, |
| 140 | 0x04,0x08,0x08,0x10,0x08,0x08,0x04,0x00, |
| 141 | 0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 142 | 0x2a,0x15,0x2a,0x15,0x2a,0x15,0x2a,0x15 }; |
| 143 | |
| 144 | |
| 12 | 145 | static UINT16 tty_data; |
| 13 | 146 | static UINT8 tty_key_data; |
| 14 | 147 | static int tty_cnt = 0; |
| 148 | |
| 149 | static int tty_x_pos; |
| 150 | |
| 151 | static void tty_scroll_line(void) |
| 152 | { |
| 153 | memcpy(tty_buffer,tty_buffer+80,24*80); |
| 154 | memset(tty_buffer + 80*24,0,80); |
| 155 | } |
| 156 | |
| 157 | static void tty_write_char(UINT8 data) { |
| 158 | tty_buffer[24*80+tty_x_pos] = data; |
| 159 | tty_x_pos++; |
| 160 | if (tty_x_pos > 80) { |
| 161 | tty_x_pos = 0; |
| 162 | tty_scroll_line(); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | static void tty_clear(void) { |
| 167 | memset(tty_buffer,0,80*25); |
| 168 | tty_x_pos = 0; |
| 169 | } |
| 170 | |
| 171 | static void tty_write(UINT8 data) { |
| 172 | switch(data) { |
| 173 | case 10: tty_scroll_line(); break; |
| 174 | case 13: tty_x_pos = 0; break; |
| 175 | default: tty_write_char(data); break; |
| 176 | } |
| 177 | } |
| 15 | 178 | static WRITE8_HANDLER(out_w) |
| 16 | 179 | { |
| 17 | 180 | tty_data >>= 1; |
| 18 | 181 | tty_data |= (data & 0x01) ? 0x8000 : 0; |
| 19 | 182 | tty_cnt++; |
| 20 | 183 | if (tty_cnt==10) { |
| 21 | | logerror("%c",(tty_data >> 7) & 0x7f); |
| 184 | tty_write((tty_data >> 7) & 0x7f); |
| 22 | 185 | tty_cnt = 0; |
| 23 | 186 | } |
| 24 | 187 | } |
| r6493 | r6494 | |
| 26 | 189 | static WRITE8_HANDLER(tty_w) |
| 27 | 190 | { |
| 28 | 191 | tty_data = 0; |
| 29 | | tty_cnt = 0; |
| 192 | tty_cnt = 0; |
| 30 | 193 | } |
| 31 | 194 | |
| 32 | 195 | static READ8_HANDLER(tty_r) |
| r6493 | r6494 | |
| 35 | 198 | tty_key_data >>= 1; |
| 36 | 199 | return d; |
| 37 | 200 | } |
| 201 | |
| 202 | static INPUT_CHANGED( tty_kbd_put ) |
| 203 | { |
| 204 | if(input_port_read(field->port->machine, "KEYS0") || |
| 205 | input_port_read(field->port->machine, "KEYS1") || |
| 206 | input_port_read(field->port->machine, "KEYS2") || |
| 207 | input_port_read(field->port->machine, "KEYS3") || |
| 208 | input_port_read(field->port->machine, "KEYS4")) |
| 209 | { |
| 210 | tty_key_data = ((((UINT8)(FPTR)param))) ^ 0xff; |
| 211 | cputag_set_input_line(field->port->machine, "maincpu", 0, HOLD_LINE); |
| 212 | } else { |
| 213 | cputag_set_input_line(field->port->machine, "maincpu", 0, CLEAR_LINE); |
| 214 | } |
| 215 | } |
| 216 | |
| 38 | 217 | static ADDRESS_MAP_START(mod8_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 39 | 218 | ADDRESS_MAP_UNMAP_HIGH |
| 40 | 219 | AM_RANGE(0x000,0x6ff) AM_ROM |
| r6493 | r6494 | |
| 50 | 229 | |
| 51 | 230 | /* Input ports */ |
| 52 | 231 | static INPUT_PORTS_START( mod8 ) |
| 232 | PORT_START("KEYS0") |
| 233 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED(tty_kbd_put, (void*)'A') |
| 234 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED(tty_kbd_put, (void*)'B') |
| 235 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHANGED(tty_kbd_put, (void*)'C') |
| 236 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED(tty_kbd_put, (void*)'D') |
| 237 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED(tty_kbd_put, (void*)'E') |
| 238 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED(tty_kbd_put, (void*)'F') |
| 239 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED(tty_kbd_put, (void*)'G') |
| 240 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED(tty_kbd_put, (void*)'H') |
| 241 | |
| 242 | PORT_START("KEYS1") |
| 243 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED(tty_kbd_put, (void*)'I') |
| 244 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED(tty_kbd_put, (void*)'J') |
| 245 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED(tty_kbd_put, (void*)'K') |
| 246 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHANGED(tty_kbd_put, (void*)'L') |
| 247 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED(tty_kbd_put, (void*)'M') |
| 248 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED(tty_kbd_put, (void*)'N') |
| 249 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED(tty_kbd_put, (void*)'O') |
| 250 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED(tty_kbd_put, (void*)'P') |
| 251 | |
| 252 | PORT_START("KEYS2") |
| 253 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED(tty_kbd_put, (void*)'Q') |
| 254 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED(tty_kbd_put, (void*)'R') |
| 255 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED(tty_kbd_put, (void*)'S') |
| 256 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED(tty_kbd_put, (void*)'T') |
| 257 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED(tty_kbd_put, (void*)'U') |
| 258 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED(tty_kbd_put, (void*)'V') |
| 259 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED(tty_kbd_put, (void*)'W') |
| 260 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED(tty_kbd_put, (void*)'X') |
| 261 | |
| 262 | PORT_START("KEYS3") |
| 263 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED(tty_kbd_put, (void*)'Y') |
| 264 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED(tty_kbd_put, (void*)'Z') |
| 265 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED(tty_kbd_put, (void*)'0') |
| 266 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHANGED(tty_kbd_put, (void*)'1') |
| 267 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHANGED(tty_kbd_put, (void*)'2') |
| 268 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHANGED(tty_kbd_put, (void*)'3') |
| 269 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHANGED(tty_kbd_put, (void*)'4') |
| 270 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHANGED(tty_kbd_put, (void*)'5') |
| 271 | |
| 272 | PORT_START("KEYS4") |
| 273 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHANGED(tty_kbd_put, (void*)'6') |
| 274 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHANGED(tty_kbd_put, (void*)'7') |
| 275 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHANGED(tty_kbd_put, (void*)'8') |
| 276 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHANGED(tty_kbd_put, (void*)'9') |
| 277 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_CHANGED(tty_kbd_put, (void*)',') |
| 278 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHANGED(tty_kbd_put, (void*)'.') |
| 279 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHANGED(tty_kbd_put, (void*)' ') |
| 280 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0a) PORT_CHANGED(tty_kbd_put, (void*)0x0a) |
| 53 | 281 | INPUT_PORTS_END |
| 54 | 282 | |
| 55 | 283 | static IRQ_CALLBACK ( mod8_irq_callback ) |
| r6493 | r6494 | |
| 60 | 288 | static MACHINE_RESET(mod8) |
| 61 | 289 | { |
| 62 | 290 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), mod8_irq_callback); |
| 291 | tty_clear(); |
| 63 | 292 | } |
| 64 | 293 | |
| 65 | 294 | static VIDEO_START( mod8 ) |
| 66 | 295 | { |
| 296 | |
| 67 | 297 | } |
| 68 | 298 | |
| 69 | 299 | static VIDEO_UPDATE( mod8 ) |
| 70 | 300 | { |
| 71 | | return 0; |
| 301 | UINT8 code; |
| 302 | int y, c, x, b; |
| 303 | |
| 304 | for (y = 0; y < 25; y++) |
| 305 | { |
| 306 | for (c = 0; c < 8; c++) |
| 307 | { |
| 308 | int horpos = 0; |
| 309 | for (x = 0; x < 80; x++) |
| 310 | { |
| 311 | code = teleprinter_font[(tty_buffer[y*80 + x] & 0x7f)*8 + c]; |
| 312 | for (b = 0; b < 8; b++) |
| 313 | { |
| 314 | *BITMAP_ADDR16(bitmap, y*8 + c, horpos++) = (code >> b) & 0x01 ? 0 : 1; |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | return 0; |
| 72 | 320 | } |
| 73 | 321 | |
| 74 | 322 | static MACHINE_DRIVER_START( mod8 ) |
| r6493 | r6494 | |
| 84 | 332 | MDRV_SCREEN_REFRESH_RATE(50) |
| 85 | 333 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 86 | 334 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 87 | | MDRV_SCREEN_SIZE(640, 480) |
| 88 | | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 335 | MDRV_SCREEN_SIZE(8*80, 25*8) |
| 336 | MDRV_SCREEN_VISIBLE_AREA(0, 8*80-1, 0, 25*8-1) |
| 89 | 337 | MDRV_PALETTE_LENGTH(2) |
| 90 | 338 | MDRV_PALETTE_INIT(black_and_white) |
| 91 | 339 | |