Previous 15994 Revisions Next

r6562 Monday 7th December, 2009 at 01:41:35 UTC by Jonathan Gevaryahu
Add zexall z80 test suite driver with simple output stub by kevtris (eventually will probably make compiled in only for DEBUG builds?), this is useful for people debugging other z80 core implementations, and mess passes all the tests.
[src/mess]mess.mak messdriv.c
[src/mess/drivers]zexall.c*

src/mess/messdriv.c
r6561r6562
15421542   DRIVER( pro80 )
15431543   DRIVER( pimps )
15441544   DRIVER( sage2 )
1545   DRIVER( zexall ) /* zexall z80 test suite with kevtris' preloader/serial interface at 0000-00ff */
15451546   
15461547#endif /* DRIVER_RECURSIVE */
src/mess/mess.mak
r6561r6562
15391539   $(MESS_DRIVERS)/pro80.o      \
15401540   $(MESS_DRIVERS)/pimps.o      \
15411541   $(MESS_DRIVERS)/sage2.o      \
1542   $(MESS_DRIVERS)/zexall.o   \
15421543
15431544
15441545
src/mess/drivers/zexall.c
r0r6562
1/******************************************************************************
2*
3*  Bare bones 'self contained' zexall test driver
4*  By Jonathan Gevaryahu AKA Lord Nightmare
5*  Binary supplied by Blargg
6*  with help from Kevin 'kevtris' Horton (wrote preloader at 0000-00ff which implements the fffd-ffff serial stuff)
7*
8*
9* mem map:
10Ram 0000-FFFF (preloaded with binary)
11Special calls take place for three ram values:
12FFFD - shared ram with output device; z80 reads from here and considers the byte at FFFF read if this value incremented
13FFFE - shared ram with output device; z80 writes an incrementing value to FFFD if there is a byte waiting at FFFF until FFFD is incremented
14FFFF - shared ram with output device; z80 writes data to be sent to output device here
15One i/o port is used:
160001 - bit 0 controls whether interrupt timer is enabled (1) or not (0), this is a holdover from a project of kevtris' and can be ignored.
17
18******************************************************************************/
19
20/* Core includes */
21#include "driver.h"
22#include "cpu/z80/z80.h"
23//#include "dectalk.lh" //  hack to avoid screenless system crash
24#include "machine/terminal.h"
25
26/* Defines */
27
28/* Components */
29static UINT8 *main_ram;
30
31static struct
32{
33UINT8 data[8]; // what is this for? to suppress the scalar initializer warning?
34UINT8 out_data;
35UINT8 out_req;
36UINT8 out_req_last;
37UINT8 out_ack;
38} zexall={ {0}};
39
40/* Devices */
41
42static DRIVER_INIT( zexall )
43{
44   zexall.out_ack = 0;
45   zexall.out_req = 0;
46   zexall.out_req_last = 0;
47   zexall.out_data = 0;
48}
49
50static MACHINE_RESET( zexall )
51{
52   UINT8 *rom = memory_region(machine, "romcode");
53   UINT8 *ram = main_ram;
54   int i;
55    /* fill main ram with zexall code */
56    for (i = 0; i < 0x228a; i++)
57   { ram[i] = rom[i];}
58   //fprintf(stderr,"MACHINE_RESET: copied romcode to maincpu\n");
59}
60
61static READ8_HANDLER( zexall_output_ack_r )
62{
63   const device_config   *devconf = devtag_get_device(space->machine, "terminal");
64// spit out the byte in out_byte if out_req is not equal to out_req_last
65   if (zexall.out_req != zexall.out_req_last)
66   {
67   terminal_write(devconf,0,zexall.out_data);
68   fprintf(stderr,"%c",zexall.out_data);
69   zexall.out_req_last = zexall.out_req;
70   zexall.out_ack++;
71   }
72   return zexall.out_ack;
73}
74
75static WRITE8_HANDLER( zexall_output_ack_w )
76{
77   zexall.out_ack = data;
78}
79
80static READ8_HANDLER( zexall_output_req_r )
81{
82   return zexall.out_req;
83}
84
85static WRITE8_HANDLER( zexall_output_req_w )
86{
87   zexall.out_req_last = zexall.out_req;
88   zexall.out_req = data;
89}
90
91static READ8_HANDLER( zexall_output_data_r )
92{
93   return zexall.out_data;
94}
95
96static WRITE8_HANDLER( zexall_output_data_w )
97{
98   zexall.out_data = data;
99}
100
101/******************************************************************************
102 Address Maps
103******************************************************************************/
104
105static ADDRESS_MAP_START(z80_mem, ADDRESS_SPACE_PROGRAM, 8)
106    ADDRESS_MAP_UNMAP_HIGH
107    AM_RANGE(0x0000, 0xfffc) AM_RAM AM_BASE(&main_ram)
108   AM_RANGE(0xfffd, 0xfffd) AM_READWRITE(zexall_output_ack_r,zexall_output_ack_w)
109   AM_RANGE(0xfffe, 0xfffe) AM_READWRITE(zexall_output_req_r,zexall_output_req_w)
110   AM_RANGE(0xffff, 0xffff) AM_READWRITE(zexall_output_data_r,zexall_output_data_w)
111ADDRESS_MAP_END
112
113static ADDRESS_MAP_START(z80_io, ADDRESS_SPACE_IO, 8)
114   ADDRESS_MAP_UNMAP_HIGH
115ADDRESS_MAP_END
116
117
118/******************************************************************************
119 Input Ports
120******************************************************************************/
121INPUT_PORTS_START( zexall )
122   PORT_INCLUDE(generic_terminal)   
123INPUT_PORTS_END
124
125/******************************************************************************
126 Machine Drivers
127******************************************************************************/
128static GENERIC_TERMINAL_INTERFACE( dectalk_terminal_intf )
129{
130   NULL
131};
132
133static MACHINE_DRIVER_START(zexall)
134    /* basic machine hardware */
135    MDRV_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz*60)  /* Toshiba TMPZ84C00AP @ 3.579545 MHz, verified, xtal is divided by 6 */
136    MDRV_CPU_PROGRAM_MAP(z80_mem)
137    MDRV_CPU_IO_MAP(z80_io)
138    MDRV_QUANTUM_TIME(HZ(60))
139    MDRV_MACHINE_RESET(zexall)
140
141    /* video hardware */
142    //MDRV_DEFAULT_LAYOUT(layout_dectalk) // hack to avoid screenless system crash
143
144    /* sound hardware */
145   MDRV_IMPORT_FROM( generic_terminal )   
146   MDRV_GENERIC_TERMINAL_ADD(TERMINAL_TAG,dectalk_terminal_intf)   
147
148MACHINE_DRIVER_END
149
150
151
152/******************************************************************************
153 ROM Definitions
154******************************************************************************/
155
156ROM_START(zexall)
157
158    ROM_REGION(0x10000, "romcode", 0)
159    ROM_LOAD("zex.bin", 0x00000, 0x2289, CRC(77E0A1DF) SHA1(CC8F84724E3837783816D92A6DFB8E5975232C66))
160ROM_END
161
162
163
164/******************************************************************************
165 Drivers
166******************************************************************************/
167
168/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT   INIT CONFIG      COMPANY                     FULLNAME                            FLAGS */
169COMP( 199?, zexall,   0,          0,      zexall,   zexall, zexall,   0,   "Frank Cringle",        "Zexall z80 test suite", 0 )
170

Previous 15994 Revisions Next


© 1998-2018 The MESS Team