src/mess/machine/trs80.c
| r4432 | r4433 | |
| 10 | 10 | /* Core includes */ |
| 11 | 11 | #include "driver.h" |
| 12 | 12 | #include "machine/ctronics.h" |
| 13 | #include "machine/ay31015.h" |
| 13 | 14 | #include "includes/trs80.h" |
| 14 | 15 | |
| 15 | 16 | /* Components */ |
| r4432 | r4433 | |
| 49 | 50 | static UINT8 sector[4] = {0, }; /* current sector per drive */ |
| 50 | 51 | #endif |
| 51 | 52 | static UINT8 irq_mask = 0; |
| 53 | static UINT8 trs80_reg_load=1; |
| 52 | 54 | |
| 53 | 55 | #define FW TRS80_FONT_W |
| 54 | 56 | #define FH TRS80_FONT_H |
| r4432 | r4433 | |
| 57 | 59 | static UINT8 cassette_data; |
| 58 | 60 | static emu_timer *cassette_data_timer; |
| 59 | 61 | static const device_config *trs80_printer; |
| 62 | static const device_config *trs80_ay31015; |
| 63 | static const device_config *trs80_cass; |
| 60 | 64 | |
| 61 | 65 | static TIMER_CALLBACK( cassette_data_callback ) |
| 62 | 66 | { |
| 63 | | double new_val = cassette_input(devtag_get_device(machine, "cassette")); |
| 67 | double new_val = cassette_input(trs80_cass); |
| 64 | 68 | |
| 65 | 69 | /* Check for HI-LO transition */ |
| 66 | 70 | if ( old_cassette_val > -0.2 && new_val < -0.2 ) |
| r4432 | r4433 | |
| 201 | 205 | /* set deleted data address mark for sector specified */ |
| 202 | 206 | basicdsk_set_ddam(image, track, side, sector_id, 1); |
| 203 | 207 | } |
| 204 | | return INIT_PASS; |
| 208 | return INIT_PASS; |
| 205 | 209 | } |
| 206 | 210 | |
| 207 | 211 | MACHINE_RESET( trs80 ) |
| 208 | 212 | { |
| 209 | | cassette_data = 0x00; |
| 213 | cassette_data = 0; |
| 210 | 214 | cassette_data_timer = timer_alloc(machine, cassette_data_callback, NULL ); |
| 211 | 215 | timer_adjust_periodic( cassette_data_timer, attotime_zero, 0, ATTOTIME_IN_HZ(11025) ); |
| 212 | 216 | trs80_printer = devtag_get_device(machine, "centronics"); |
| 217 | trs80_ay31015 = devtag_get_device(machine, "tr1602"); |
| 218 | trs80_cass = devtag_get_device(machine, "cassette"); |
| 213 | 219 | } |
| 214 | 220 | |
| 215 | 221 | |
| r4432 | r4433 | |
| 324 | 330 | * |
| 325 | 331 | *************************************/ |
| 326 | 332 | |
| 333 | READ8_HANDLER( trs80m3_e8_r ) |
| 334 | { |
| 335 | /* These bits directly read pins on the RS-232 socket, and are not emulated |
| 336 | d7 Clear-to-Send (CTS), Pin 5 |
| 337 | d6 Data-Set-Ready (DSR), pin 6 |
| 338 | d5 Carrier Detect (CD), pin 8 |
| 339 | d4 Ring Indicator (RI), pin 22 |
| 340 | d3..d1 Not used |
| 341 | d0 ?? UART Receiver Input, pin 20 (pin 20 is also DTR) */ |
| 327 | 342 | |
| 328 | | READ8_HANDLER( trs80_port_xx_r ) |
| 329 | | { |
| 330 | | return 0; |
| 343 | return 0; // this is a guess |
| 331 | 344 | } |
| 332 | 345 | |
| 333 | | |
| 334 | | WRITE8_HANDLER( trs80_port_ff_w ) |
| 346 | READ8_HANDLER( trs80m3_ea_r ) |
| 335 | 347 | { |
| 336 | | static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 }; |
| 337 | | const device_config *cass = devtag_get_device(space->machine, "cassette"); |
| 348 | /* UART Status Register |
| 349 | d7 Data Received ('1'=condition true) |
| 350 | d6 Transmitter Holding Register empty ('1'=condition true) |
| 351 | d5 Overrun Error ('1'=condition true) |
| 352 | d4 Framing Error ('1'=condition true) |
| 353 | d3 Parity Error ('1'=condition true) |
| 354 | d2..d0 Not used */ |
| 338 | 355 | |
| 339 | | cassette_change_state( cass, ( data & 0x04 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR ); |
| 356 | UINT8 data=7; |
| 357 | ay31015_set_input_pin( trs80_ay31015, AY31015_SWE, 0 ); |
| 358 | data |= ay31015_get_output_pin( trs80_ay31015, AY31015_TBMT ) ? 0x40 : 0; |
| 359 | data |= ay31015_get_output_pin( trs80_ay31015, AY31015_DAV ) ? 0x80 : 0; |
| 360 | data |= ay31015_get_output_pin( trs80_ay31015, AY31015_OR ) ? 0x20 : 0; |
| 361 | data |= ay31015_get_output_pin( trs80_ay31015, AY31015_FE ) ? 0x10 : 0; |
| 362 | data |= ay31015_get_output_pin( trs80_ay31015, AY31015_PE ) ? 0x08 : 0; |
| 363 | ay31015_set_input_pin( trs80_ay31015, AY31015_SWE, 1 ); |
| 340 | 364 | |
| 341 | | cassette_output( cass, levels[data & 0x03]); |
| 365 | return data; |
| 366 | } |
| 342 | 367 | |
| 343 | | cassette_data &= ~0x80; |
| 344 | | trs80_port_ff = data; |
| 368 | READ8_HANDLER( trs80m3_eb_r ) |
| 369 | { |
| 370 | /* UART received data */ |
| 371 | UINT8 data = ay31015_get_received_data( trs80_ay31015 ); |
| 372 | ay31015_set_input_pin( trs80_ay31015, AY31015_RDAV, 0 ); |
| 373 | ay31015_set_input_pin( trs80_ay31015, AY31015_RDAV, 1 ); |
| 374 | return data; |
| 345 | 375 | } |
| 346 | 376 | |
| 377 | READ8_HANDLER( trs80_fe_r ) |
| 378 | { |
| 379 | /* not emulated yet */ |
| 380 | return 0xff; |
| 381 | } |
| 347 | 382 | |
| 348 | | READ8_HANDLER( trs80_port_ff_r ) |
| 383 | |
| 384 | READ8_HANDLER( trs80_ff_r ) |
| 349 | 385 | { |
| 350 | 386 | UINT8 data = (~trs80_port_ff & 8) << 3; // MODESEL bit (32 or 64 chars per line) |
| 351 | 387 | return data | cassette_data; |
| 352 | 388 | } |
| 353 | 389 | |
| 390 | |
| 391 | WRITE8_HANDLER( trs80m3_e8_w ) |
| 392 | { |
| 393 | /* d1 when '1' enables control register load (see below) */ |
| 394 | trs80_reg_load = data & 1; |
| 395 | } |
| 396 | |
| 397 | WRITE8_HANDLER( trs80m3_e9_w ) |
| 398 | { |
| 399 | /* UART set baud rate. Rx = bits 0..3, Tx = bits 4..7 |
| 400 | 00h 50 |
| 401 | 11h 75 |
| 402 | 22h 100 |
| 403 | 33h 134.5 |
| 404 | 44h 150 |
| 405 | 55h 300 |
| 406 | 66h 600 |
| 407 | 77h 1200 |
| 408 | 88h 1800 |
| 409 | 99h 2000 |
| 410 | AAh 2400 |
| 411 | BBh 3600 |
| 412 | CCh 4800 |
| 413 | DDh 7200 |
| 414 | EEh 9600 |
| 415 | FFh 19200 */ |
| 416 | |
| 417 | int baud_clock[]={ 800, 1200, 1600, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 }; |
| 418 | ay31015_set_receiver_clock( trs80_ay31015, baud_clock[data & 0x0f]); |
| 419 | ay31015_set_transmitter_clock( trs80_ay31015, baud_clock[data>>4]); |
| 420 | } |
| 421 | |
| 422 | WRITE8_HANDLER( trs80m3_ea_w ) |
| 423 | { |
| 424 | if (trs80_reg_load) |
| 425 | |
| 426 | /* bits d7..d3 are UART control; d2..d0 directly adjust levels at the RS-232 socket - we emulate UART control only |
| 427 | d7 Even Parity Enable ('1'=even, '0'=odd) |
| 428 | d6='1',d5='1' for 8 bits |
| 429 | d6='0',d5='1' for 7 bits |
| 430 | d6='1',d5='0' for 6 bits |
| 431 | d6='0',d5='0' for 5 bits |
| 432 | d4 Stop Bit Select ('1'=two stop bits, '0'=one stop bit) |
| 433 | d3 Parity Inhibit ('1'=disable; No parity, '0'=parity enabled) |
| 434 | d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) |
| 435 | d1 Data-Terminal-Ready (DTR), pin 20 |
| 436 | d0 Request-to-Send (RTS), pin 4 */ |
| 437 | |
| 438 | { |
| 439 | ay31015_set_input_pin( trs80_ay31015, AY31015_CS, 0 ); |
| 440 | ay31015_set_input_pin( trs80_ay31015, AY31015_NB1, ( data & 0x40 ) ? 1 : 0 ); |
| 441 | ay31015_set_input_pin( trs80_ay31015, AY31015_NB2, ( data & 0x20 ) ? 1 : 0 ); |
| 442 | ay31015_set_input_pin( trs80_ay31015, AY31015_TSB, ( data & 0x10 ) ? 1 : 0 ); |
| 443 | ay31015_set_input_pin( trs80_ay31015, AY31015_EPS, ( data & 0x80 ) ? 1 : 0 ); |
| 444 | ay31015_set_input_pin( trs80_ay31015, AY31015_NP, ( data & 0x08 ) ? 1 : 0 ); |
| 445 | ay31015_set_input_pin( trs80_ay31015, AY31015_CS, 1 ); |
| 446 | } |
| 447 | else |
| 448 | |
| 449 | /* These directly adjust levels at the RS-232 socket - not emulated |
| 450 | d7,d6 Not used |
| 451 | d5 Secondary Unassigned, pin 18 |
| 452 | d4 Secondary Transmit Data, pin 14 |
| 453 | d3 Secondary Request-to-Send, pin 19 |
| 454 | d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) |
| 455 | d1 Data-Terminal-Ready (DTR), pin 20 |
| 456 | d0 Request-to-Send (RTS), pin 4 */ |
| 457 | |
| 458 | { |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | WRITE8_HANDLER( trs80m3_eb_w ) |
| 463 | { |
| 464 | ay31015_set_transmit_data( trs80_ay31015, data ); |
| 465 | } |
| 466 | |
| 467 | WRITE8_HANDLER( trs80_ff_w ) |
| 468 | { |
| 469 | static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 }; |
| 470 | |
| 471 | cassette_change_state( trs80_cass, ( data & 0x04 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR ); |
| 472 | cassette_output( trs80_cass, levels[data & 0x03]); |
| 473 | |
| 474 | cassette_data &= ~0x80; |
| 475 | trs80_port_ff = data; |
| 476 | } |
| 477 | |
| 478 | |
| 354 | 479 | /************************************* |
| 355 | 480 | * |
| 356 | 481 | * Interrupt handlers. |
src/mess/drivers/trs80.c
| r4432 | r4433 | |
| 38 | 38 | I/O ports |
| 39 | 39 | FF: |
| 40 | 40 | - bits 0 and 1 are for writing a cassette |
| 41 | | - bit 2 must be high to turn the cassette player on, enables cassette data paths on a system-80 |
| 41 | - bit 2 must be high to turn the cassette motor on, enables cassette data paths on a system-80 |
| 42 | 42 | - bit 3 switches the display between 64 or 32 characters per line |
| 43 | 43 | - bit 6 remembers the 32/64 screen mode (inverted) |
| 44 | 44 | - bit 7 is for reading from a cassette |
| r4432 | r4433 | |
| 59 | 59 | F8: |
| 60 | 60 | - UART data (read) status (write) on a system-80 |
| 61 | 61 | For Model 4... |
| 62 | | F8h Write (output) send data to the printer data lines with strobe pulsed low. |
| 63 | | F8h Read (input) reads printer status as follows: |
| 64 | | d7 BUSY ('1'=true) |
| 65 | | d6 Out-of-Paper ('1'=true) |
| 66 | | d5 Device Select ('1'=true) |
| 67 | | d4 ERROR, printer fault ('1'=true) |
| 68 | | d3..d0 Reserved |
| 62 | F8h Write (output) send data to the printer data lines with strobe pulsed low. |
| 63 | F8h Read (input) reads printer status as follows: |
| 64 | d7 BUSY ('1'=true) |
| 65 | d6 Out-of-Paper ('1'=true) |
| 66 | d5 Device Select ('1'=true) |
| 67 | d4 ERROR, printer fault ('1'=true) |
| 68 | d3..d0 Reserved |
| 69 | 69 | |
| 70 | 70 | EB: |
| 71 | 71 | - UART data (read and write) on a Model III/4 |
| r4432 | r4433 | |
| 73 | 73 | EA: |
| 74 | 74 | - UART status (read and write) on a Model III/4 |
| 75 | 75 | EAh Output (Write), when E8h bit d1 is '1' (Control Register enabled): |
| 76 | | bits d7..d3 are UART control; d2..d0 are Modem line control |
| 77 | | d7 Even Parity Enable ('1'=even, '0'=odd) |
| 78 | | d6='1',d5='1' for 8 bits |
| 79 | | d6='0',d5='1' for 7 bits |
| 80 | | d6='1',d5='0' for 6 bits |
| 76 | bits d7..d3 are UART control; d2..d0 are Modem line control |
| 77 | d7 Even Parity Enable ('1'=even, '0'=odd) |
| 78 | d6='1',d5='1' for 8 bits |
| 79 | d6='0',d5='1' for 7 bits |
| 80 | d6='1',d5='0' for 6 bits |
| 81 | 81 | d6='0',d5='0' for 5 bits |
| 82 | | d4 Stop Bit Select ('1'=two stop bits, '0'=one stop bit) |
| 83 | | d3 Parity Inhibit ('1'=disable; No parity, '0'=parity enabled) |
| 84 | | d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) |
| 85 | | d1 Data-Terminal-Ready (DTR), pin 20 |
| 82 | d4 Stop Bit Select ('1'=two stop bits, '0'=one stop bit) |
| 83 | d3 Parity Inhibit ('1'=disable; No parity, '0'=parity enabled) |
| 84 | d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) |
| 85 | d1 Data-Terminal-Ready (DTR), pin 20 |
| 86 | 86 | d0 Request-to-Send (RTS), pin 4 |
| 87 | | EAh Output (Write), when E8h bit d1 is '0' (Control Register disabled): bits d5..d3 are secondary line control, and could even be used for steering or multiplexing logic; d2..d0 are Modem line control same as above |
| 88 | | d7,d6 Not used |
| 89 | | d5 Secondary Unassigned, pin 18 |
| 90 | | d4 Secondary Transmit Data, pin 14 |
| 91 | | d3 Secondary Request-to-Send, pin 19 |
| 92 | | d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) |
| 93 | | d1 Data-Terminal-Ready (DTR), pin 20 |
| 94 | | d0 Request-to-Send (RTS), pin 4 |
| 95 | | EAh Input (Read): UART Status Register |
| 96 | | d7 Data Received ('1'=condition true) |
| 97 | | d6 Transmitter Holding Register empty ('1'=condition true) |
| 98 | | d5 Overrun Error ('1'=condition true) |
| 99 | | d4 Framing Error ('1'=condition true) |
| 100 | | d3 Parity Error ('1'=condition true) |
| 101 | | d2..d0 Not used |
| 87 | EAh Output (Write), when E8h bit d1 is '0' (Control Register disabled): bits d5..d3 are secondary line control, and could even be used for steering or multiplexing logic; d2..d0 are Modem line control same as above |
| 88 | d7,d6 Not used |
| 89 | d5 Secondary Unassigned, pin 18 |
| 90 | d4 Secondary Transmit Data, pin 14 |
| 91 | d3 Secondary Request-to-Send, pin 19 |
| 92 | d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) |
| 93 | d1 Data-Terminal-Ready (DTR), pin 20 |
| 94 | d0 Request-to-Send (RTS), pin 4 |
| 95 | EAh Input (Read): UART Status Register |
| 96 | d7 Data Received ('1'=condition true) |
| 97 | d6 Transmitter Holding Register empty ('1'=condition true) |
| 98 | d5 Overrun Error ('1'=condition true) |
| 99 | d4 Framing Error ('1'=condition true) |
| 100 | d3 Parity Error ('1'=condition true) |
| 101 | d2..d0 Not used |
| 102 | 102 | |
| 103 | 103 | E9: |
| 104 | | - UART Configuration jumpers (read) on a Model III/4 |
| 104 | - UART Configuration jumpers (read) on a Model III/4 (?) |
| 105 | 105 | Rx = bits 0..3, Tx = bits 4..7 |
| 106 | | 00h 50 |
| 107 | | 11h 75 |
| 108 | | 22h 100 |
| 109 | | 33h 134.5 |
| 110 | | 44h 150 |
| 111 | | 55h 300 |
| 112 | | 66h 600 |
| 113 | | 77h 1200 |
| 114 | | 88h 1800 |
| 115 | | 99h 2000 |
| 116 | | AAh 2400 |
| 117 | | BBh 3600 |
| 118 | | CCh 4800 |
| 119 | | DDh 7200 |
| 120 | | EEh 9600 |
| 121 | | FFh 19200 |
| 106 | 00h 50 |
| 107 | 11h 75 |
| 108 | 22h 100 |
| 109 | 33h 134.5 |
| 110 | 44h 150 |
| 111 | 55h 300 |
| 112 | 66h 600 |
| 113 | 77h 1200 |
| 114 | 88h 1800 |
| 115 | 99h 2000 |
| 116 | AAh 2400 |
| 117 | BBh 3600 |
| 118 | CCh 4800 |
| 119 | DDh 7200 |
| 120 | EEh 9600 |
| 121 | FFh 19200 |
| 122 | 122 | |
| 123 | 123 | E8: |
| 124 | 124 | - UART Modem Status register (read) on a Model III/4 |
| 125 | 125 | - UART Master Reset (write) on a Model III/4 |
| 126 | | Port E8h |
| 126 | Port E8h |
| 127 | 127 | E8h Output: UART Master Reset, enables UART control register load |
| 128 | | d1 when '1' enables control register load (see Port EAh description below). |
| 129 | | Input: Modem Status Register |
| 130 | | d7 Clear-to-Send (CTS), Pin 5 |
| 131 | | d6 Data-Set-Ready (DSR), pin 6 |
| 132 | | d5 Carrier Detect (CD), pin 8 |
| 133 | | d4 Ring Indicator (RI), pin 22 |
| 134 | | d3..d2 Not used |
| 135 | | d0 ?? UART Receiver Input, pin 20 (pin 20 is also DTR) |
| 128 | d1 when '1' enables control register load (see Port EAh description above). |
| 129 | Input: Modem Status Register |
| 130 | d7 Clear-to-Send (CTS), Pin 5 |
| 131 | d6 Data-Set-Ready (DSR), pin 6 |
| 132 | d5 Carrier Detect (CD), pin 8 |
| 133 | d4 Ring Indicator (RI), pin 22 |
| 134 | d3..d1 Not used |
| 135 | d0 ?? UART Receiver Input, pin 20 (pin 20 is also DTR) |
| 136 | 136 | |
| 137 | 137 | *************************************************************************** |
| 138 | 138 | |
| r4432 | r4433 | |
| 157 | 157 | #include "cpu/z80/z80.h" |
| 158 | 158 | #include "sound/wave.h" |
| 159 | 159 | #include "machine/ctronics.h" |
| 160 | #include "machine/ay31015.h" |
| 160 | 161 | #include "includes/trs80.h" |
| 161 | 162 | |
| 162 | 163 | /* Components */ |
| r4432 | r4433 | |
| 184 | 185 | } |
| 185 | 186 | } |
| 186 | 187 | |
| 187 | | static ADDRESS_MAP_START( trs80_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 188 | static ADDRESS_MAP_START( trs80_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 188 | 189 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 189 | 190 | AM_RANGE(0x3800, 0x38ff) AM_READ(trs80_keyboard_r) |
| 190 | 191 | AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(SMH_RAM, trs80_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) |
| r4432 | r4433 | |
| 193 | 194 | |
| 194 | 195 | static ADDRESS_MAP_START( trs80_io, ADDRESS_SPACE_IO, 8 ) |
| 195 | 196 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 196 | | AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_port_ff_r, trs80_port_ff_w) |
| 197 | AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) |
| 197 | 198 | ADDRESS_MAP_END |
| 198 | 199 | |
| 199 | 200 | /* memory from 3700-37ff, 8000-ffff only exists when expansion box is used */ |
| 200 | | static ADDRESS_MAP_START( mem_model1, ADDRESS_SPACE_PROGRAM, 8 ) |
| 201 | static ADDRESS_MAP_START( model1_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 201 | 202 | AM_RANGE(0x0000, 0x35ff) AM_ROM |
| 202 | 203 | AM_RANGE(0x37e0, 0x37e3) AM_READWRITE(trs80_irq_status_r, trs80_motor_w) |
| 203 | 204 | // AM_RANGE(0x37e4, 0x37e7) AM_NOP |
| r4432 | r4433 | |
| 212 | 213 | AM_RANGE(0x4000, 0xffff) AM_RAM |
| 213 | 214 | ADDRESS_MAP_END |
| 214 | 215 | |
| 215 | | static ADDRESS_MAP_START( io_model1, ADDRESS_SPACE_IO, 8 ) |
| 216 | static ADDRESS_MAP_START( model1_io, ADDRESS_SPACE_IO, 8 ) |
| 216 | 217 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 217 | | AM_RANGE(0xfe, 0xfe) AM_READ(trs80_port_xx_r) |
| 218 | | AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_port_ff_r, trs80_port_ff_w) |
| 218 | AM_RANGE(0xfe, 0xfe) AM_READ(trs80_fe_r) |
| 219 | AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) |
| 219 | 220 | ADDRESS_MAP_END |
| 220 | 221 | |
| 221 | | static ADDRESS_MAP_START( mem_model3, ADDRESS_SPACE_PROGRAM, 8 ) |
| 222 | static ADDRESS_MAP_START( sys80_io, ADDRESS_SPACE_IO, 8 ) |
| 223 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 224 | AM_RANGE(0xfd, 0xfd) AM_READWRITE(trs80_printer_r, trs80_printer_w) |
| 225 | AM_RANGE(0xfe, 0xfe) AM_READ(trs80_fe_r) |
| 226 | AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) |
| 227 | ADDRESS_MAP_END |
| 228 | |
| 229 | static ADDRESS_MAP_START( model3_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 222 | 230 | AM_RANGE(0x0000, 0x37ff) AM_ROM |
| 223 | 231 | AM_RANGE(0x3800, 0x38ff) AM_READ(trs80_keyboard_r) |
| 224 | 232 | AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(SMH_RAM, trs80_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) |
| 225 | 233 | AM_RANGE(0x4000, 0xffff) AM_RAM |
| 226 | 234 | ADDRESS_MAP_END |
| 227 | 235 | |
| 228 | | static ADDRESS_MAP_START( io_model3, ADDRESS_SPACE_IO, 8 ) |
| 236 | static ADDRESS_MAP_START( model3_io, ADDRESS_SPACE_IO, 8 ) |
| 229 | 237 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 230 | 238 | /* the ports marked NOP are not emulated yet */ |
| 231 | 239 | // AM_RANGE(0xe0, 0xe3) AM_READWRITE(trs80_irq_status_r, trs80_irq_mask_w) // needs to be fixed because it breaks the keyboard |
| 232 | 240 | AM_RANGE(0xe4, 0xe4) AM_READWRITE(SMH_NOP,trs80_motor_w) |
| 233 | | AM_RANGE(0xe8, 0xe8) AM_NOP |
| 234 | | AM_RANGE(0xe9, 0xe9) AM_WRITENOP |
| 235 | | AM_RANGE(0xea, 0xea) AM_NOP |
| 236 | | AM_RANGE(0xeb, 0xeb) AM_NOP |
| 241 | AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m3_e8_r, trs80m3_e8_w) |
| 242 | AM_RANGE(0xe9, 0xe9) AM_WRITE(trs80m3_e9_w) |
| 243 | AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m3_ea_r, trs80m3_ea_w) |
| 244 | AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m3_eb_r, trs80m3_eb_w) |
| 237 | 245 | AM_RANGE(0xec, 0xec) AM_WRITENOP |
| 238 | 246 | AM_RANGE(0xf0, 0xf0) AM_DEVREADWRITE("wd179x", trs80_wd179x_r, wd17xx_command_w) |
| 239 | 247 | AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("wd179x", wd17xx_track_r, wd17xx_track_w) |
| 240 | 248 | AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("wd179x", wd17xx_sector_r, wd17xx_sector_w) |
| 241 | 249 | AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("wd179x", wd17xx_data_r, wd17xx_data_w) |
| 242 | 250 | AM_RANGE(0xf4, 0xf4) AM_WRITENOP |
| 243 | | AM_RANGE(0xf8, 0xf8) AM_WRITENOP |
| 244 | | AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_port_ff_r, trs80_port_ff_w) |
| 251 | AM_RANGE(0xf8, 0xf8) AM_READWRITE(trs80_printer_r, trs80_printer_w) |
| 252 | AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) |
| 245 | 253 | ADDRESS_MAP_END |
| 246 | 254 | |
| 247 | 255 | |
| r4432 | r4433 | |
| 453 | 461 | CASSETTE_PLAY |
| 454 | 462 | }; |
| 455 | 463 | |
| 464 | static const ay31015_config trs80_ay31015_config = |
| 465 | { |
| 466 | AY_3_1015, |
| 467 | 0.0, |
| 468 | 0.0, |
| 469 | NULL, |
| 470 | NULL, |
| 471 | NULL |
| 472 | }; |
| 473 | |
| 456 | 474 | static MACHINE_DRIVER_START( trs80 ) |
| 457 | 475 | /* basic machine hardware */ |
| 458 | 476 | MDRV_CPU_ADD("maincpu", Z80, 1796000) /* 1.796 MHz */ |
| 459 | | MDRV_CPU_PROGRAM_MAP(trs80_mem, 0) |
| 477 | MDRV_CPU_PROGRAM_MAP(trs80_map, 0) |
| 460 | 478 | MDRV_CPU_IO_MAP(trs80_io, 0) |
| 461 | 479 | MDRV_CPU_VBLANK_INT("screen", trs80_frame_interrupt) |
| 462 | 480 | MDRV_CPU_PERIODIC_INT(trs80_timer_interrupt, 40) |
| r4432 | r4433 | |
| 492 | 510 | static MACHINE_DRIVER_START( model1 ) |
| 493 | 511 | MDRV_IMPORT_FROM( trs80 ) |
| 494 | 512 | MDRV_CPU_MODIFY( "maincpu" ) |
| 495 | | MDRV_CPU_PROGRAM_MAP( mem_model1, 0 ) |
| 496 | | MDRV_CPU_IO_MAP( io_model1, 0 ) |
| 513 | MDRV_CPU_PROGRAM_MAP( model1_map, 0 ) |
| 514 | MDRV_CPU_IO_MAP( model1_io, 0 ) |
| 497 | 515 | |
| 498 | 516 | MDRV_CASSETTE_MODIFY( "cassette", trs80l2_cassette_config ) |
| 499 | 517 | MDRV_QUICKLOAD_ADD("quickload", trs80_cmd, "cmd", 0.5) |
| r4432 | r4433 | |
| 506 | 524 | static MACHINE_DRIVER_START( model3 ) |
| 507 | 525 | MDRV_IMPORT_FROM( model1 ) |
| 508 | 526 | MDRV_CPU_MODIFY( "maincpu" ) |
| 509 | | MDRV_CPU_PROGRAM_MAP( mem_model3, 0 ) |
| 510 | | MDRV_CPU_IO_MAP( io_model3, 0 ) |
| 527 | MDRV_CPU_PROGRAM_MAP( model3_map, 0 ) |
| 528 | MDRV_CPU_IO_MAP( model3_io, 0 ) |
| 511 | 529 | MDRV_CPU_VBLANK_INT_HACK(trs80_frame_interrupt, 2) |
| 530 | MDRV_AY31015_ADD( "tr1602", trs80_ay31015_config ) |
| 512 | 531 | MACHINE_DRIVER_END |
| 513 | 532 | |
| 514 | | static MACHINE_DRIVER_START( ht1080z ) |
| 533 | static MACHINE_DRIVER_START( sys80 ) |
| 515 | 534 | MDRV_IMPORT_FROM( model1 ) |
| 516 | | MDRV_GFXDECODE( ht1080z ) |
| 535 | MDRV_CPU_MODIFY( "maincpu" ) |
| 536 | MDRV_CPU_IO_MAP( sys80_io, 0 ) |
| 537 | //MDRV_AY31015_ADD( "tr1602", trs80_ay31015_config ) // need more info |
| 517 | 538 | MACHINE_DRIVER_END |
| 518 | 539 | |
| 519 | | static MACHINE_DRIVER_START( ht108064 ) |
| 520 | | MDRV_IMPORT_FROM( model3 ) |
| 540 | static MACHINE_DRIVER_START( ht1080z ) |
| 541 | MDRV_IMPORT_FROM( sys80 ) |
| 521 | 542 | MDRV_GFXDECODE( ht1080z ) |
| 522 | 543 | MACHINE_DRIVER_END |
| 523 | 544 | |
| 545 | |
| 524 | 546 | /*************************************************************************** |
| 525 | 547 | |
| 526 | 548 | Game driver(s) |
| r4432 | r4433 | |
| 655 | 677 | COMP( 1977, trs80, 0, 0, trs80, trs80, trs80, 0, "Tandy Radio Shack", "TRS-80 Model I (Level I Basic)" , 0) |
| 656 | 678 | COMP( 1978, trs80l2, trs80, 0, model1, trs80, trs80, trs8012, "Tandy Radio Shack", "TRS-80 Model I (Level II Basic)" , 0) |
| 657 | 679 | COMP( 1983, radionic, trs80, 0, model1, trs80, radionic, trs8012, "Komtek", "Radionic" , 0) |
| 658 | | COMP( 1980, sys80, trs80, 0, model1, trs80, trs80, trs8012, "EACA Computers Ltd.","System-80" , 0) |
| 680 | COMP( 1980, sys80, trs80, 0, sys80, trs80, trs80, trs8012, "EACA Computers Ltd.","System-80" , 0) |
| 659 | 681 | COMP( 1981, lnw80, trs80, 0, model1, trs80, lnw80, trs8012, "LNW Research","LNW-80", 0 ) |
| 660 | 682 | COMP( 1980, trs80m3, trs80, 0, model3, trs80, trs80, trs8012, "Tandy Radio Shack", "TRS-80 Model III", 0 ) |
| 661 | 683 | COMP( 1980, trs80m4, trs80, 0, model3, trs80, trs80, trs8012, "Tandy Radio Shack", "TRS-80 Model 4", 0 ) |
| 662 | 684 | COMP( 1983, ht1080z, trs80, 0, ht1080z, trs80, ht1080z, trs8012, "Hiradastechnika Szovetkezet", "HT-1080Z Series I" , 0) |
| 663 | 685 | COMP( 1984, ht1080z2, trs80, 0, ht1080z, trs80, ht1080z, trs8012, "Hiradastechnika Szovetkezet", "HT-1080Z Series II" , 0) |
| 664 | | COMP( 1985, ht108064, trs80, 0, ht108064, trs80, ht108064, trs8012, "Hiradastechnika Szovetkezet", "HT-1080Z/64" , 0) |
| 686 | COMP( 1985, ht108064, trs80, 0, ht1080z, trs80, ht108064, trs8012, "Hiradastechnika Szovetkezet", "HT-1080Z/64" , 0) |