Previous 15994 Revisions Next

r4425 Thursday 19th March, 2009 at 11:16:13 UTC by Robbbert
[TRS80] WIP - added printer
[src/mess/drivers]trs80.c
[src/mess/machine]trs80.c

src/mess/machine/trs80.c
r4424r4425
99
1010/* Core includes */
1111#include "driver.h"
12#include "machine/ctronics.h"
1213#include "includes/trs80.h"
1314
1415/* Components */
r4424r4425
5556static double old_cassette_val;
5657static UINT8 cassette_data;
5758static emu_timer *cassette_data_timer;
59static const device_config *trs80_printer;
5860
5961static TIMER_CALLBACK( cassette_data_callback )
6062{
r4424r4425
207209   cassette_data = 0x00;
208210   cassette_data_timer = timer_alloc(machine,  cassette_data_callback, NULL );
209211   timer_adjust_periodic( cassette_data_timer, attotime_zero, 0, ATTOTIME_IN_HZ(11025) );
212   trs80_printer = devtag_get_device(machine, "centronics");
210213}
211214
212215
r4424r4425
344347
345348 READ8_HANDLER( trs80_port_ff_r )
346349{
347   return cassette_data;// | 0x7F;
350   UINT8 data = (~trs80_port_ff & 8) << 3;   // MODESEL bit (32 or 64 chars per line)
351   return data | cassette_data;
348352}
349353
350354/*************************************
r4424r4425
408412
409413 READ8_HANDLER ( trs80_printer_r )
410414{
411   /* nothing yet :( */
412   return 0;
415   /* Bit 7 - 1 = Busy; 0 = Not Busy
416      Bit 6 - 1 = Out of Paper; 0 = Paper
417      Bit 5 - 1 = Ready; 0 = Not Ready
418      Bit 4 - 1 = Printer selected; 0 = Printer not selected
419      Bits 3..0 - Not used */
420
421   return 0x30 | (centronics_busy_r(trs80_printer) << 7);
413422}
414423
415424WRITE8_HANDLER( trs80_printer_w )
416425{
417   /* nothing yet :( */
426   centronics_strobe_w(trs80_printer, 1);
427   centronics_data_w(trs80_printer, 0, data);
428   centronics_strobe_w(trs80_printer, 0);
418429}
419430
420431 READ8_HANDLER( trs80_irq_status_r )
src/mess/drivers/trs80.c
r4424r4425
3737- bits 0 and 1 are for writing a cassette
3838- bit 2 must be high to turn the cassette player on, enables cassette data paths on a system-80
3939- bit 3 switches the display between 64 or 32 characters per line
40- bit 6 remembers the 32/64 screen mode (inverted)
4041- bit 7 is for reading from a cassette
4142FE:
4243- bit 0 is for selecting inverse video of the whole screen on a lnw80
r4424r4425
8182#include "deprecat.h"
8283#include "cpu/z80/z80.h"
8384#include "sound/wave.h"
85#include "machine/ctronics.h"
8486#include "includes/trs80.h"
8587
8688/* Components */
r4424r4425
108110   }
109111}
110112
111static ADDRESS_MAP_START( mem_level1, ADDRESS_SPACE_PROGRAM, 8 )
113static ADDRESS_MAP_START( trs80_mem, ADDRESS_SPACE_PROGRAM, 8 )
112114   AM_RANGE(0x0000, 0x0fff) AM_ROM
113115   AM_RANGE(0x3800, 0x38ff) AM_READ(trs80_keyboard_r)
114116   AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(SMH_RAM, trs80_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
115117   AM_RANGE(0x4000, 0x7fff) AM_RAM
116118ADDRESS_MAP_END
117119
118static ADDRESS_MAP_START( io_level1, ADDRESS_SPACE_IO, 8 )
120static ADDRESS_MAP_START( trs80_io, ADDRESS_SPACE_IO, 8 )
119121   ADDRESS_MAP_GLOBAL_MASK(0xff)
120   AM_RANGE(0xfe, 0xfe) AM_READ(trs80_port_xx_r)
121122   AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_port_ff_r, trs80_port_ff_w)
122123ADDRESS_MAP_END
123124
125/* memory from 3700-37ff, 8000-ffff only exists when expansion box is used */
124126static ADDRESS_MAP_START( mem_model1, ADDRESS_SPACE_PROGRAM, 8 )
125   AM_RANGE(0x0000, 0x37df) AM_ROM
127   AM_RANGE(0x0000, 0x35ff) AM_ROM
126128   AM_RANGE(0x37e0, 0x37e3) AM_READWRITE(trs80_irq_status_r, trs80_motor_w)
127   AM_RANGE(0x37e4, 0x37e7) AM_NOP
129//   AM_RANGE(0x37e4, 0x37e7) AM_NOP
128130   AM_RANGE(0x37e8, 0x37eb) AM_READWRITE(trs80_printer_r, trs80_printer_w)
129131   AM_RANGE(0x37ec, 0x37ec) AM_DEVREADWRITE("wd179x", trs80_wd179x_r, wd17xx_command_w)
130132   AM_RANGE(0x37ed, 0x37ed) AM_DEVREADWRITE("wd179x", wd17xx_track_r, wd17xx_track_w)
131133   AM_RANGE(0x37ee, 0x37ee) AM_DEVREADWRITE("wd179x", wd17xx_sector_r, wd17xx_sector_w)
132134   AM_RANGE(0x37ef, 0x37ef) AM_DEVREADWRITE("wd179x", wd17xx_data_r, wd17xx_data_w)
133   AM_RANGE(0x37f0, 0x37ff) AM_NOP
134   AM_RANGE(0x3800, 0x38ff) AM_READ(trs80_keyboard_r)
135   AM_RANGE(0x3900, 0x3bff) AM_NOP
135//   AM_RANGE(0x37f0, 0x37ff) AM_NOP
136   AM_RANGE(0x3800, 0x38ff) AM_MIRROR(0x300) AM_READ(trs80_keyboard_r)
136137   AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(SMH_RAM, trs80_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
137138   AM_RANGE(0x4000, 0xffff) AM_RAM
138139ADDRESS_MAP_END
r4424r4425
378379   CASSETTE_PLAY
379380};
380381
381static MACHINE_DRIVER_START( level1 )
382static MACHINE_DRIVER_START( trs80 )
382383   /* basic machine hardware */
383384   MDRV_CPU_ADD("maincpu", Z80, 1796000)        /* 1.796 MHz */
384   MDRV_CPU_PROGRAM_MAP(mem_level1, 0)
385   MDRV_CPU_IO_MAP(io_level1, 0)
385   MDRV_CPU_PROGRAM_MAP(trs80_mem, 0)
386   MDRV_CPU_IO_MAP(trs80_io, 0)
386387   MDRV_CPU_VBLANK_INT("screen", trs80_frame_interrupt)
387388   MDRV_CPU_PERIODIC_INT(trs80_timer_interrupt, 40)
388   MDRV_QUANTUM_TIME(HZ(60))
389389
390390   MDRV_MACHINE_RESET( trs80 )
391391
r4424r4425
410410   MDRV_SOUND_WAVE_ADD("wave", "cassette")
411411   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
412412   /* devices */
413   MDRV_QUICKLOAD_ADD("quickload", trs80_cmd, "cmd", 0.5)
414413
415414   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
416415   
417   MDRV_WD179X_ADD("wd179x", trs80_wd17xx_interface )
418416MACHINE_DRIVER_END
419417
420418static MACHINE_DRIVER_START( model1 )
421   MDRV_IMPORT_FROM( level1 )
419   MDRV_IMPORT_FROM( trs80 )
422420   MDRV_CPU_MODIFY( "maincpu" )
423421   MDRV_CPU_PROGRAM_MAP( mem_model1, 0 )
424422   MDRV_CPU_IO_MAP( io_model1, 0 )
425423
426424   MDRV_CASSETTE_MODIFY( "cassette", trs80l2_cassette_config )
425   MDRV_QUICKLOAD_ADD("quickload", trs80_cmd, "cmd", 0.5)
426   MDRV_WD179X_ADD("wd179x", trs80_wd17xx_interface )
427   /* printer */
428   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
427429MACHINE_DRIVER_END
428430
429431
430432static MACHINE_DRIVER_START( model3 )
431   MDRV_IMPORT_FROM( level1 )
433   MDRV_IMPORT_FROM( model1 )
432434   MDRV_CPU_MODIFY( "maincpu" )
433435   MDRV_CPU_PROGRAM_MAP( mem_model3, 0 )
434436   MDRV_CPU_IO_MAP( io_model3, 0 )
435437   MDRV_CPU_VBLANK_INT_HACK(trs80_frame_interrupt, 2)
436
437   MDRV_CASSETTE_MODIFY( "cassette", trs80l2_cassette_config )
438438MACHINE_DRIVER_END
439439
440440static MACHINE_DRIVER_START( ht1080z )
r4424r4425
578578
579579
580580/*    YEAR  NAME      PARENT  COMPAT  MACHINE     INPUT  INIT      CONFIG       COMPANY  FULLNAME */
581COMP( 1977, trs80,    0,   0,   level1,   trs80, trs80,    0,      "Tandy Radio Shack",  "TRS-80 Model I (Level I Basic)" , 0)
581COMP( 1977, trs80,    0,   0,   trs80,    trs80, trs80,    0,      "Tandy Radio Shack",  "TRS-80 Model I (Level I Basic)" , 0)
582582COMP( 1978, trs80l2,  trs80,   0,   model1,   trs80, trs80,    trs8012,   "Tandy Radio Shack",  "TRS-80 Model I (Level II Basic)" , 0)
583583COMP( 1983, radionic, trs80,   0,   model1,   trs80, radionic, trs8012,   "Komtek",  "Radionic" , 0)
584584COMP( 1980, sys80,    trs80,   0,   model1,   trs80, trs80,    trs8012,   "EACA Computers Ltd.","System-80" , 0)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team