src/mess/machine/terminal.c
| r6510 | r6511 | |
| 5 | 5 | TYPE DEFINITIONS |
| 6 | 6 | ***************************************************************************/ |
| 7 | 7 | #define TERMINAL_WIDTH 80 |
| 8 | | #define TERMINAL_HEIGHT 25 |
| 8 | #define TERMINAL_HEIGHT 24 |
| 9 | 9 | typedef struct _terminal_state terminal_state; |
| 10 | 10 | struct _terminal_state |
| 11 | 11 | { |
| r6510 | r6511 | |
| 205 | 205 | WRITE8_DEVICE_HANDLER ( terminal_write ) |
| 206 | 206 | { |
| 207 | 207 | terminal_state *term = get_safe_token(device); |
| 208 | | switch(data) { |
| 209 | | case 10: term->y_pos++; |
| 210 | | term->x_pos = 0; |
| 211 | | if (term->y_pos==TERMINAL_HEIGHT) { |
| 212 | | terminal_scroll_line(device); |
| 213 | | term->y_pos = (TERMINAL_HEIGHT-1); |
| 214 | | }; break; |
| 215 | | case 13: term->x_pos = 0; break; |
| 216 | | case 9: do { |
| 217 | | term->x_pos ++; |
| 218 | | } while ((term->x_pos % 8)!=0); |
| 219 | | break; |
| 220 | | case 16: break; |
| 221 | | default: terminal_write_char(device,data); break; |
| 208 | if (data > 0x1f) { |
| 209 | // printable char |
| 210 | if (data!=0x7f) terminal_write_char(device,data); |
| 211 | } else { |
| 212 | switch(data) { |
| 213 | case 0x07 : // bell |
| 214 | break; |
| 215 | case 0x08: if (term->x_pos!=0) { |
| 216 | term->x_pos--; |
| 217 | } |
| 218 | break; |
| 219 | case 0x09: do { |
| 220 | term->x_pos ++; |
| 221 | } while ((term->x_pos % 8)!=0); |
| 222 | break; |
| 223 | case 0x0a: term->y_pos++; |
| 224 | term->x_pos = 0; |
| 225 | if (term->y_pos==TERMINAL_HEIGHT) { |
| 226 | terminal_scroll_line(device); |
| 227 | term->y_pos = (TERMINAL_HEIGHT-1); |
| 228 | }; |
| 229 | break; |
| 230 | case 0x0b: if (term->y_pos!=0) { |
| 231 | term->y_pos--; |
| 232 | } |
| 233 | break; |
| 234 | case 0x0d: term->x_pos = 0; |
| 235 | break; |
| 236 | case 0x1e: term->x_pos = 0; |
| 237 | term->y_pos = 0; |
| 238 | break; |
| 239 | } |
| 222 | 240 | } |
| 223 | 241 | } |
| 224 | 242 | |