src/mess/machine/teleprinter.c
| r0 | r6505 | |
| 1 | #include "driver.h" |
| 2 | #include "machine/teleprinter.h" |
| 3 | |
| 4 | /*************************************************************************** |
| 5 | TYPE DEFINITIONS |
| 6 | ***************************************************************************/ |
| 7 | #define TELEPRINTER_WIDTH 80 |
| 8 | #define TELEPRINTER_HEIGHT 25 |
| 9 | typedef struct _teleprinter_state teleprinter_state; |
| 10 | struct _teleprinter_state |
| 11 | { |
| 12 | UINT8 buffer[TELEPRINTER_WIDTH*TELEPRINTER_HEIGHT]; |
| 13 | UINT8 x_pos; |
| 14 | UINT8 shift_state; |
| 15 | UINT8 ctrl_state; |
| 16 | devcb_resolved_write8 teleprinter_keyboard_func; |
| 17 | }; |
| 18 | |
| 19 | /***************************************************************************** |
| 20 | INLINE FUNCTIONS |
| 21 | *****************************************************************************/ |
| 22 | INLINE teleprinter_state *get_safe_token(const device_config *device) |
| 23 | { |
| 24 | assert(device != NULL); |
| 25 | assert(device->token != NULL); |
| 26 | assert(device->type == GENERIC_TELEPRINTER); |
| 27 | |
| 28 | return (teleprinter_state *)device->token; |
| 29 | } |
| 30 | |
| 31 | INLINE const teleprinter_interface *get_interface(const device_config *device) |
| 32 | { |
| 33 | assert(device != NULL); |
| 34 | assert(device->type == GENERIC_TELEPRINTER); |
| 35 | return (const teleprinter_interface *) device->static_config; |
| 36 | } |
| 37 | |
| 38 | /*************************************************************************** |
| 39 | IMPLEMENTATION |
| 40 | ***************************************************************************/ |
| 41 | |
| 42 | static const UINT8 teleprinter_font[128*8] = |
| 43 | { |
| 44 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 45 | 0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00, |
| 46 | 0x38,0x38,0x38,0x38,0x00,0x00,0x00,0x00, |
| 47 | 0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x00, |
| 48 | 0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07, |
| 49 | 0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07, |
| 50 | 0x38,0x38,0x38,0x38,0x07,0x07,0x07,0x07, |
| 51 | 0x3f,0x3f,0x3f,0x3f,0x07,0x07,0x07,0x07, |
| 52 | 0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x38, |
| 53 | 0x07,0x07,0x07,0x07,0x38,0x38,0x38,0x38, |
| 54 | 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, |
| 55 | 0x3f,0x3f,0x3f,0x3f,0x38,0x38,0x38,0x38, |
| 56 | 0x00,0x00,0x00,0x00,0x3f,0x3f,0x3f,0x3f, |
| 57 | 0x07,0x07,0x07,0x07,0x3f,0x3f,0x3f,0x3f, |
| 58 | 0x38,0x38,0x38,0x38,0x3f,0x3f,0x3f,0x3f, |
| 59 | 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, |
| 60 | 0x00,0x00,0x00,0x00,0x2a,0x15,0x2a,0x15, |
| 61 | 0x2a,0x15,0x2a,0x15,0x00,0x00,0x00,0x00, |
| 62 | 0x3f,0x3f,0x3f,0x3f,0x2a,0x15,0x2a,0x15, |
| 63 | 0x2a,0x15,0x2a,0x15,0x3f,0x3f,0x3f,0x3f, |
| 64 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 65 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 66 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 67 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 68 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 69 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 70 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 71 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 72 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 73 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 74 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 75 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 76 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 77 | 0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x00, |
| 78 | 0x14,0x14,0x14,0x00,0x00,0x00,0x00,0x00, |
| 79 | 0x14,0x14,0x3e,0x14,0x3e,0x14,0x14,0x00, |
| 80 | 0x08,0x3c,0x0a,0x1c,0x28,0x1e,0x08,0x00, |
| 81 | 0x06,0x26,0x10,0x08,0x04,0x32,0x30,0x00, |
| 82 | 0x08,0x14,0x14,0x0c,0x2a,0x12,0x2c,0x00, |
| 83 | 0x08,0x08,0x04,0x00,0x00,0x00,0x00,0x00, |
| 84 | 0x10,0x08,0x04,0x04,0x04,0x08,0x10,0x00, |
| 85 | 0x04,0x08,0x10,0x10,0x10,0x08,0x04,0x00, |
| 86 | 0x00,0x08,0x2a,0x1c,0x2a,0x08,0x00,0x00, |
| 87 | 0x00,0x08,0x08,0x3e,0x08,0x08,0x00,0x00, |
| 88 | 0x00,0x00,0x00,0x00,0x08,0x08,0x04,0x00, |
| 89 | 0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00, |
| 90 | 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, |
| 91 | 0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00, |
| 92 | 0x1c,0x22,0x32,0x2a,0x26,0x22,0x1c,0x00, |
| 93 | 0x08,0x0c,0x08,0x08,0x08,0x08,0x1c,0x00, |
| 94 | 0x1c,0x22,0x20,0x18,0x04,0x02,0x3e,0x00, |
| 95 | 0x3e,0x20,0x10,0x18,0x20,0x22,0x1c,0x00, |
| 96 | 0x10,0x18,0x14,0x12,0x3e,0x10,0x10,0x00, |
| 97 | 0x3e,0x02,0x1e,0x20,0x20,0x22,0x1c,0x00, |
| 98 | 0x10,0x08,0x04,0x1c,0x22,0x22,0x1c,0x00, |
| 99 | 0x3e,0x20,0x10,0x08,0x04,0x04,0x04,0x00, |
| 100 | 0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c,0x00, |
| 101 | 0x1c,0x22,0x22,0x1c,0x10,0x08,0x04,0x00, |
| 102 | 0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x00, |
| 103 | 0x00,0x00,0x08,0x00,0x08,0x08,0x04,0x00, |
| 104 | 0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x00, |
| 105 | 0x00,0x00,0x3e,0x00,0x3e,0x00,0x00,0x00, |
| 106 | 0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00, |
| 107 | 0x1c,0x22,0x20,0x10,0x08,0x00,0x08,0x00, |
| 108 | 0x1c,0x22,0x32,0x2a,0x3a,0x02,0x3c,0x00, |
| 109 | 0x08,0x14,0x22,0x22,0x3e,0x22,0x22,0x00, |
| 110 | 0x1e,0x22,0x22,0x1e,0x22,0x22,0x1e,0x00, |
| 111 | 0x1c,0x22,0x02,0x02,0x02,0x22,0x1c,0x00, |
| 112 | 0x1e,0x24,0x24,0x24,0x24,0x24,0x1e,0x00, |
| 113 | 0x3e,0x02,0x02,0x1e,0x02,0x02,0x3e,0x00, |
| 114 | 0x3e,0x02,0x02,0x1e,0x02,0x02,0x02,0x00, |
| 115 | 0x1c,0x22,0x02,0x02,0x32,0x22,0x3c,0x00, |
| 116 | 0x22,0x22,0x22,0x3e,0x22,0x22,0x22,0x00, |
| 117 | 0x1c,0x08,0x08,0x08,0x08,0x08,0x1c,0x00, |
| 118 | 0x38,0x10,0x10,0x10,0x10,0x12,0x0c,0x00, |
| 119 | 0x22,0x12,0x0a,0x06,0x0a,0x12,0x22,0x00, |
| 120 | 0x02,0x02,0x02,0x02,0x02,0x02,0x3e,0x00, |
| 121 | 0x22,0x36,0x2a,0x2a,0x22,0x22,0x22,0x00, |
| 122 | 0x22,0x22,0x26,0x2a,0x32,0x22,0x22,0x00, |
| 123 | 0x1c,0x22,0x22,0x22,0x22,0x22,0x1c,0x00, |
| 124 | 0x1e,0x22,0x22,0x1e,0x02,0x02,0x02,0x00, |
| 125 | 0x1c,0x22,0x22,0x22,0x2a,0x12,0x2c,0x00, |
| 126 | 0x1e,0x22,0x22,0x1e,0x0a,0x12,0x22,0x00, |
| 127 | 0x1c,0x22,0x02,0x1c,0x20,0x22,0x1c,0x00, |
| 128 | 0x3e,0x08,0x08,0x08,0x08,0x08,0x08,0x00, |
| 129 | 0x22,0x22,0x22,0x22,0x22,0x22,0x1c,0x00, |
| 130 | 0x22,0x22,0x22,0x14,0x14,0x08,0x08,0x00, |
| 131 | 0x22,0x22,0x22,0x2a,0x2a,0x2a,0x14,0x00, |
| 132 | 0x22,0x22,0x14,0x08,0x14,0x22,0x22,0x00, |
| 133 | 0x22,0x22,0x22,0x14,0x08,0x08,0x08,0x00, |
| 134 | 0x3e,0x20,0x10,0x08,0x04,0x02,0x3e,0x00, |
| 135 | 0x0e,0x02,0x02,0x02,0x02,0x02,0x0e,0x00, |
| 136 | 0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00, |
| 137 | 0x38,0x20,0x20,0x20,0x20,0x20,0x38,0x00, |
| 138 | 0x08,0x1c,0x2a,0x08,0x08,0x08,0x08,0x00, |
| 139 | 0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00, |
| 140 | 0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00, |
| 141 | 0x00,0x00,0x1c,0x20,0x3c,0x22,0x3c,0x00, |
| 142 | 0x02,0x02,0x1e,0x22,0x22,0x22,0x1e,0x00, |
| 143 | 0x00,0x00,0x3c,0x02,0x02,0x02,0x3c,0x00, |
| 144 | 0x20,0x20,0x3c,0x22,0x22,0x22,0x3c,0x00, |
| 145 | 0x00,0x00,0x1c,0x22,0x3e,0x02,0x1c,0x00, |
| 146 | 0x18,0x04,0x0e,0x04,0x04,0x04,0x04,0x00, |
| 147 | 0x00,0x00,0x3c,0x22,0x22,0x3c,0x20,0x18, |
| 148 | 0x02,0x02,0x1e,0x22,0x22,0x22,0x22,0x00, |
| 149 | 0x08,0x00,0x0c,0x08,0x08,0x08,0x1c,0x00, |
| 150 | 0x10,0x00,0x18,0x10,0x10,0x10,0x12,0x0c, |
| 151 | 0x02,0x02,0x22,0x12,0x0e,0x16,0x22,0x00, |
| 152 | 0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x00, |
| 153 | 0x00,0x00,0x16,0x2a,0x2a,0x2a,0x2a,0x00, |
| 154 | 0x00,0x00,0x1a,0x26,0x22,0x22,0x22,0x00, |
| 155 | 0x00,0x00,0x1c,0x22,0x22,0x22,0x1c,0x00, |
| 156 | 0x00,0x00,0x1e,0x22,0x22,0x1e,0x02,0x02, |
| 157 | 0x00,0x00,0x3c,0x22,0x22,0x3c,0x20,0x20, |
| 158 | 0x00,0x00,0x34,0x0c,0x04,0x04,0x04,0x00, |
| 159 | 0x00,0x00,0x3c,0x02,0x1c,0x20,0x1e,0x00, |
| 160 | 0x08,0x08,0x1c,0x08,0x08,0x08,0x10,0x00, |
| 161 | 0x00,0x00,0x22,0x22,0x22,0x32,0x2c,0x00, |
| 162 | 0x00,0x00,0x22,0x22,0x22,0x14,0x08,0x00, |
| 163 | 0x00,0x00,0x22,0x22,0x2a,0x2a,0x14,0x00, |
| 164 | 0x00,0x00,0x22,0x14,0x08,0x14,0x22,0x00, |
| 165 | 0x00,0x00,0x22,0x22,0x14,0x08,0x04,0x02, |
| 166 | 0x00,0x00,0x3e,0x10,0x08,0x04,0x3e,0x00, |
| 167 | 0x10,0x08,0x08,0x04,0x08,0x08,0x10,0x00, |
| 168 | 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00, |
| 169 | 0x04,0x08,0x08,0x10,0x08,0x08,0x04,0x00, |
| 170 | 0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 171 | 0x2a,0x15,0x2a,0x15,0x2a,0x15,0x2a,0x15 }; |
| 172 | |
| 173 | static void teleprinter_scroll_line(const device_config *device) |
| 174 | { |
| 175 | teleprinter_state *term = get_safe_token(device); |
| 176 | |
| 177 | memcpy(term->buffer,term->buffer+TELEPRINTER_WIDTH,(TELEPRINTER_HEIGHT-1)*TELEPRINTER_WIDTH); |
| 178 | memset(term->buffer + TELEPRINTER_WIDTH*(TELEPRINTER_HEIGHT-1),0,TELEPRINTER_WIDTH); |
| 179 | } |
| 180 | |
| 181 | static void teleprinter_write_char(const device_config *device,UINT8 data) { |
| 182 | teleprinter_state *term = get_safe_token(device); |
| 183 | |
| 184 | term->buffer[24*TELEPRINTER_WIDTH+term->x_pos] = data; |
| 185 | term->x_pos++; |
| 186 | if (term->x_pos > TELEPRINTER_WIDTH) { |
| 187 | term->x_pos = 0; |
| 188 | teleprinter_scroll_line(device); |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | static void teleprinter_clear(const device_config *device) { |
| 193 | teleprinter_state *term = get_safe_token(device); |
| 194 | |
| 195 | memset(term->buffer,0,TELEPRINTER_WIDTH*TELEPRINTER_HEIGHT); |
| 196 | term->x_pos = 0; |
| 197 | } |
| 198 | |
| 199 | WRITE8_DEVICE_HANDLER ( teleprinter_write ) |
| 200 | { |
| 201 | teleprinter_state *term = get_safe_token(device); |
| 202 | switch(data) { |
| 203 | case 10: term->x_pos = 0; |
| 204 | teleprinter_scroll_line(device); |
| 205 | break; |
| 206 | case 13: term->x_pos = 0; break; |
| 207 | case 9: do { |
| 208 | term->x_pos ++; |
| 209 | } while ((term->x_pos % 8)!=0); |
| 210 | break; |
| 211 | case 16: break; |
| 212 | default: teleprinter_write_char(device,data); break; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | /*************************************************************************** |
| 217 | VIDEO HARDWARE |
| 218 | ***************************************************************************/ |
| 219 | void generic_teleprinter_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect) |
| 220 | { |
| 221 | UINT8 code; |
| 222 | int y, c, x, b; |
| 223 | teleprinter_state *term = get_safe_token(device); |
| 224 | |
| 225 | for (y = 0; y < TELEPRINTER_HEIGHT; y++) |
| 226 | { |
| 227 | for (c = 0; c < 8; c++) |
| 228 | { |
| 229 | int horpos = 0; |
| 230 | for (x = 0; x < TELEPRINTER_WIDTH; x++) |
| 231 | { |
| 232 | code = teleprinter_font[(term->buffer[y*TELEPRINTER_WIDTH + x] & 0x7f) *8 + c]; |
| 233 | for (b = 0; b < 8; b++) |
| 234 | { |
| 235 | *BITMAP_ADDR16(bitmap, y*8 + c, horpos++) = (code >> b) & 0x01 ? 0 : 1; |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | static INPUT_CHANGED( teleprinter_shift ) |
| 243 | { |
| 244 | const device_config *devconf = devtag_get_device(field->port->machine, TELEPRINTER_TAG); |
| 245 | teleprinter_state *term = get_safe_token(devconf); |
| 246 | term->shift_state = BIT(input_port_read(field->port->machine, "KEYSSPEC"),1); |
| 247 | } |
| 248 | |
| 249 | static INPUT_CHANGED( teleprinter_ctrl ) |
| 250 | { |
| 251 | const device_config *devconf = devtag_get_device(field->port->machine, TELEPRINTER_TAG); |
| 252 | teleprinter_state *term = get_safe_token(devconf); |
| 253 | term->ctrl_state = BIT(input_port_read(field->port->machine, "KEYSSPEC"),0); |
| 254 | } |
| 255 | // Ugh, god, this is a horrible, HORRIBLE hack! |
| 256 | static INPUT_CHANGED( teleprinter_kbd_put ) |
| 257 | { |
| 258 | const device_config *devconf = devtag_get_device(field->port->machine, TELEPRINTER_TAG); |
| 259 | teleprinter_state *term = get_safe_token(devconf); |
| 260 | UINT8 data = (UINT8)(FPTR)param; |
| 261 | if(input_port_read(field->port->machine, "KEYS0") || |
| 262 | input_port_read(field->port->machine, "KEYS1") || |
| 263 | input_port_read(field->port->machine, "KEYS2") || |
| 264 | input_port_read(field->port->machine, "KEYS3") || |
| 265 | input_port_read(field->port->machine, "KEYS4")) |
| 266 | { |
| 267 | if (term->ctrl_state==1) { |
| 268 | data -= 0x60; |
| 269 | } |
| 270 | if (term->shift_state==1) { |
| 271 | data -= 0x20; |
| 272 | } |
| 273 | |
| 274 | devcb_call_write8(&term->teleprinter_keyboard_func, 0, data); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | /*************************************************************************** |
| 279 | VIDEO HARDWARE |
| 280 | ***************************************************************************/ |
| 281 | static VIDEO_START( teleprinter ) |
| 282 | { |
| 283 | |
| 284 | } |
| 285 | |
| 286 | static VIDEO_UPDATE(teleprinter ) |
| 287 | { |
| 288 | const device_config *devconf = devtag_get_device(screen->machine, TELEPRINTER_TAG); |
| 289 | generic_teleprinter_update( devconf, bitmap, cliprect); |
| 290 | return 0; |
| 291 | } |
| 292 | |
| 293 | MACHINE_DRIVER_START( generic_teleprinter ) |
| 294 | MDRV_SCREEN_ADD(TELEPRINTER_SCREEN_TAG, RASTER) |
| 295 | MDRV_SCREEN_REFRESH_RATE(50) |
| 296 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 297 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 298 | MDRV_SCREEN_SIZE(TELEPRINTER_WIDTH*8, TELEPRINTER_HEIGHT*8) |
| 299 | MDRV_SCREEN_VISIBLE_AREA(0, TELEPRINTER_WIDTH*8-1, 0, TELEPRINTER_HEIGHT*8-1) |
| 300 | MDRV_PALETTE_LENGTH(2) |
| 301 | MDRV_PALETTE_INIT(black_and_white) |
| 302 | |
| 303 | MDRV_VIDEO_START(teleprinter) |
| 304 | MDRV_VIDEO_UPDATE(teleprinter) |
| 305 | MACHINE_DRIVER_END |
| 306 | |
| 307 | |
| 308 | /*------------------------------------------------- |
| 309 | DEVICE_START( teleprinter ) |
| 310 | -------------------------------------------------*/ |
| 311 | |
| 312 | static DEVICE_START( teleprinter ) |
| 313 | { |
| 314 | teleprinter_state *term = get_safe_token(device); |
| 315 | const teleprinter_interface *intf = get_interface(device); |
| 316 | |
| 317 | devcb_resolve_write8(&term->teleprinter_keyboard_func, &intf->teleprinter_keyboard_func, device); |
| 318 | } |
| 319 | |
| 320 | /*------------------------------------------------- |
| 321 | DEVICE_RESET( teleprinter ) |
| 322 | -------------------------------------------------*/ |
| 323 | |
| 324 | static DEVICE_RESET( teleprinter ) |
| 325 | { |
| 326 | teleprinter_state *term = get_safe_token(device); |
| 327 | |
| 328 | teleprinter_clear(device); |
| 329 | term->shift_state = 0; |
| 330 | term->ctrl_state = 0; |
| 331 | } |
| 332 | |
| 333 | /*------------------------------------------------- |
| 334 | DEVICE_GET_INFO( teleprinter ) |
| 335 | -------------------------------------------------*/ |
| 336 | |
| 337 | DEVICE_GET_INFO( teleprinter ) |
| 338 | { |
| 339 | switch (state) |
| 340 | { |
| 341 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 342 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 343 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(teleprinter_state); break; |
| 344 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 345 | |
| 346 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 347 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(teleprinter); break; |
| 348 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 349 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(teleprinter); break; |
| 350 | |
| 351 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 352 | case DEVINFO_STR_NAME: strcpy(info->s, "Generic Teleprinter"); break; |
| 353 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Teleprinter"); break; |
| 354 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 355 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 356 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | INPUT_PORTS_START( generic_teleprinter ) |
| 361 | PORT_START("KEYS0") |
| 362 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED(teleprinter_kbd_put, (void*)'a') |
| 363 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED(teleprinter_kbd_put, (void*)'b') |
| 364 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHANGED(teleprinter_kbd_put, (void*)'c') |
| 365 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED(teleprinter_kbd_put, (void*)'d') |
| 366 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED(teleprinter_kbd_put, (void*)'e') |
| 367 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED(teleprinter_kbd_put, (void*)'f') |
| 368 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED(teleprinter_kbd_put, (void*)'g') |
| 369 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED(teleprinter_kbd_put, (void*)'h') |
| 370 | |
| 371 | PORT_START("KEYS1") |
| 372 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED(teleprinter_kbd_put, (void*)'i') |
| 373 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED(teleprinter_kbd_put, (void*)'j') |
| 374 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED(teleprinter_kbd_put, (void*)'k') |
| 375 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHANGED(teleprinter_kbd_put, (void*)'l') |
| 376 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED(teleprinter_kbd_put, (void*)'m') |
| 377 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED(teleprinter_kbd_put, (void*)'n') |
| 378 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED(teleprinter_kbd_put, (void*)'o') |
| 379 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED(teleprinter_kbd_put, (void*)'p') |
| 380 | |
| 381 | PORT_START("KEYS2") |
| 382 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED(teleprinter_kbd_put, (void*)'q') |
| 383 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED(teleprinter_kbd_put, (void*)'r') |
| 384 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED(teleprinter_kbd_put, (void*)'s') |
| 385 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED(teleprinter_kbd_put, (void*)'t') |
| 386 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED(teleprinter_kbd_put, (void*)'u') |
| 387 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED(teleprinter_kbd_put, (void*)'v') |
| 388 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED(teleprinter_kbd_put, (void*)'w') |
| 389 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED(teleprinter_kbd_put, (void*)'x') |
| 390 | |
| 391 | PORT_START("KEYS3") |
| 392 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED(teleprinter_kbd_put, (void*)'y') |
| 393 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED(teleprinter_kbd_put, (void*)'z') |
| 394 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED(teleprinter_kbd_put, (void*)'0') |
| 395 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHANGED(teleprinter_kbd_put, (void*)'1') |
| 396 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHANGED(teleprinter_kbd_put, (void*)'2') |
| 397 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHANGED(teleprinter_kbd_put, (void*)'3') |
| 398 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHANGED(teleprinter_kbd_put, (void*)'4') |
| 399 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHANGED(teleprinter_kbd_put, (void*)'5') |
| 400 | |
| 401 | PORT_START("KEYS4") |
| 402 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHANGED(teleprinter_kbd_put, (void*)'6') |
| 403 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHANGED(teleprinter_kbd_put, (void*)'7') |
| 404 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHANGED(teleprinter_kbd_put, (void*)'8') |
| 405 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHANGED(teleprinter_kbd_put, (void*)'9') |
| 406 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_CHANGED(teleprinter_kbd_put, (void*)',') |
| 407 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHANGED(teleprinter_kbd_put, (void*)'.') |
| 408 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHANGED(teleprinter_kbd_put, (void*)' ') |
| 409 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) PORT_CHANGED(teleprinter_kbd_put, (void*)0x0d) |
| 410 | PORT_START("KEYSSPEC") |
| 411 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) PORT_CHANGED(teleprinter_ctrl, NULL) |
| 412 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_CHANGED(teleprinter_shift, NULL) |
| 413 | PORT_BIT(0xFC, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 414 | |
| 415 | INPUT_PORTS_END |
src/mess/drivers/mod8.c
| r6504 | r6505 | |
| 2 | 2 | |
| 3 | 3 | Microsystems International Limited MOD-8 |
| 4 | 4 | |
| 5 | 02/12/2009 Working driver [Miodrag Milanovic] |
| 5 | 6 | 18/11/2009 Skeleton driver. |
| 6 | 7 | |
| 7 | 8 | ****************************************************************************/ |
| 8 | 9 | |
| 9 | 10 | #include "driver.h" |
| 10 | 11 | #include "cpu/i8008/i8008.h" |
| 12 | #include "machine/teleprinter.h" |
| 11 | 13 | |
| 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 | | |
| 145 | 14 | static UINT16 tty_data; |
| 146 | 15 | static UINT8 tty_key_data; |
| 147 | 16 | static int tty_cnt = 0; |
| 148 | 17 | |
| 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 | | } |
| 178 | 18 | static WRITE8_HANDLER(out_w) |
| 179 | 19 | { |
| 20 | const device_config *devconf = devtag_get_device(space->machine, TELEPRINTER_TAG); |
| 21 | |
| 180 | 22 | tty_data >>= 1; |
| 181 | 23 | tty_data |= (data & 0x01) ? 0x8000 : 0; |
| 182 | 24 | tty_cnt++; |
| 183 | 25 | if (tty_cnt==10) { |
| 184 | | tty_write((tty_data >> 7) & 0x7f); |
| 26 | teleprinter_write(devconf,0,(tty_data >> 7) & 0x7f); |
| 185 | 27 | tty_cnt = 0; |
| 186 | 28 | } |
| 187 | 29 | } |
| r6504 | r6505 | |
| 199 | 41 | return d; |
| 200 | 42 | } |
| 201 | 43 | |
| 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 | | |
| 217 | 44 | static ADDRESS_MAP_START(mod8_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 218 | 45 | ADDRESS_MAP_UNMAP_HIGH |
| 219 | 46 | AM_RANGE(0x000,0x6ff) AM_ROM |
| r6504 | r6505 | |
| 228 | 55 | ADDRESS_MAP_END |
| 229 | 56 | |
| 230 | 57 | /* Input ports */ |
| 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) |
| 58 | INPUT_PORTS_START( mod8 ) |
| 59 | PORT_INCLUDE(generic_teleprinter) |
| 281 | 60 | INPUT_PORTS_END |
| 282 | 61 | |
| 283 | 62 | static IRQ_CALLBACK ( mod8_irq_callback ) |
| r6504 | r6505 | |
| 288 | 67 | static MACHINE_RESET(mod8) |
| 289 | 68 | { |
| 290 | 69 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), mod8_irq_callback); |
| 291 | | tty_clear(); |
| 292 | 70 | } |
| 293 | 71 | |
| 294 | | static VIDEO_START( mod8 ) |
| 72 | static WRITE8_DEVICE_HANDLER( mod8_kbd_put ) |
| 295 | 73 | { |
| 296 | | |
| 74 | tty_key_data = data ^ 0xff; |
| 75 | cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE); |
| 297 | 76 | } |
| 298 | 77 | |
| 299 | | static VIDEO_UPDATE( mod8 ) |
| 78 | static GENERIC_TELEPRINTER_INTERFACE( mod8_teleprinter_intf ) |
| 300 | 79 | { |
| 301 | | UINT8 code; |
| 302 | | int y, c, x, b; |
| 80 | DEVCB_HANDLER(mod8_kbd_put) |
| 81 | }; |
| 303 | 82 | |
| 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; |
| 320 | | } |
| 321 | | |
| 322 | 83 | static MACHINE_DRIVER_START( mod8 ) |
| 323 | 84 | /* basic machine hardware */ |
| 324 | 85 | MDRV_CPU_ADD("maincpu",I8008, 800000) |
| r6504 | r6505 | |
| 326 | 87 | MDRV_CPU_IO_MAP(mod8_io) |
| 327 | 88 | |
| 328 | 89 | MDRV_MACHINE_RESET(mod8) |
| 329 | | |
| 90 | |
| 330 | 91 | /* video hardware */ |
| 331 | | MDRV_SCREEN_ADD("screen", RASTER) |
| 332 | | MDRV_SCREEN_REFRESH_RATE(50) |
| 333 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 334 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 335 | | MDRV_SCREEN_SIZE(8*80, 25*8) |
| 336 | | MDRV_SCREEN_VISIBLE_AREA(0, 8*80-1, 0, 25*8-1) |
| 337 | | MDRV_PALETTE_LENGTH(2) |
| 338 | | MDRV_PALETTE_INIT(black_and_white) |
| 339 | | |
| 340 | | MDRV_VIDEO_START(mod8) |
| 341 | | MDRV_VIDEO_UPDATE(mod8) |
| 92 | MDRV_IMPORT_FROM( generic_teleprinter ) |
| 93 | MDRV_GENERIC_TELEPRINTER_ADD(TELEPRINTER_TAG,mod8_teleprinter_intf) |
| 94 | |
| 342 | 95 | MACHINE_DRIVER_END |
| 343 | 96 | |
| 344 | 97 | |
| r6504 | r6505 | |
| 357 | 110 | /* Driver */ |
| 358 | 111 | |
| 359 | 112 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 360 | | COMP( 1974, mod8, 0, 0, mod8, mod8, 0, 0, "Microsystems International Ltd.", "MOD-8", GAME_NOT_WORKING) |
| 113 | COMP( 1974, mod8, 0, 0, mod8, mod8, 0, 0, "Microsystems International Ltd.", "MOD-8", 0) |
| 361 | 114 | |