Previous 15994 Revisions Next

r6486 Monday 30th November, 2009 at 14:56:43 UTC by Curt Coder
[HUEBLER] Added accurate video timing, and keyboard skeleton.
[src/mess/drivers]huebler.c
[src/mess/includes]huebler.h

src/mess/includes/huebler.h
r6485r6486
1212typedef struct _huebler_state huebler_state;
1313struct _huebler_state
1414{
15   /* keyboard state */
16   int keylatch;
17   UINT8 keydata;
18   int keystatus;
19   const UINT8 *keyboard_rom;
20
1521   /* video state */
1622   UINT8 *video_ram;
1723   const UINT8 *char_rom;
src/mess/drivers/huebler.c
r6485r6486
66
77****************************************************************************/
88
9/*
10
11   TODO:
12
13   - keyboard
14   - cassette
15   - tone generator
16   - eprom programmer
17
18*/
19
920#include "driver.h"
1021#include "includes/huebler.h"
1122#include "cpu/z80/z80.h"
r6485r6486
1627#include "machine/z80ctc.h"
1728#include "devices/messram.h"
1829
30/* Keyboard */
31
32static void keyboard_scan(running_machine *machine)
33{
34   huebler_state *state = machine->driver_data;
35//   static const char *const keynames[] = { "Y0", "Y1", "Y2", "Y3", "Y4", "Y5", "Y6", "Y7", "Y8", "Y9", "Y10", "Y11", "Y12", "Y13", "Y14", "Y15" };
36//   UINT8 data = input_port_read(machine, keynames[state->keylatch]);
37
38   state->keylatch++;
39
40   if (state->keylatch == 16)
41   {
42      state->keylatch = 0;
43   }
44}
45
46static TIMER_DEVICE_CALLBACK( keyboard_tick )
47{
48   keyboard_scan(timer->machine);
49}
50
1951/* Read/Write Handlers */
2052
2153static READ8_DEVICE_HANDLER( huebler_z80sio_r )
r6485r6486
4274   }
4375}
4476
77static READ8_HANDLER( keyboard_data_r )
78{
79   huebler_state *state = space->machine->driver_data;
80
81   return state->keydata;
82}
83
84static READ8_HANDLER( keyboard_status_r )
85{
86   huebler_state *state = space->machine->driver_data;
87
88   return state->keystatus;
89}
90
4591/* Memory Maps */
4692
4793static ADDRESS_MAP_START( huebler_mem, ADDRESS_SPACE_PROGRAM, 8 )
r6485r6486
55101static ADDRESS_MAP_START( huebler_io, ADDRESS_SPACE_IO, 8 )
56102   ADDRESS_MAP_UNMAP_HIGH
57103   ADDRESS_MAP_GLOBAL_MASK(0xff)
104//   AM_RANGE(0x00, 0x00) AM_WRITE(power_off_w)
105//   AM_RANGE(0x04, 0x04) AM_WRITE(tone_off_w)
106//   AM_RANGE(0x05, 0x05) AM_WRITE(tone_on_w)
107   AM_RANGE(0x08, 0x08) AM_READ(keyboard_data_r)
108   AM_RANGE(0x09, 0x09) AM_READ(keyboard_status_r)
58109   AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_alt_r, z80pio_alt_w)
59110   AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_alt_r, z80pio_alt_w)
60111   AM_RANGE(0x14, 0x17) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_r, z80ctc_w)
r6485r6486
64115/* Input Ports */
65116
66117static INPUT_PORTS_START( huebler )
118   PORT_START("Y0")
119   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
120   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
121   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
122   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
123
124   PORT_START("Y1")
125   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
126   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
127   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
128   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
129
130   PORT_START("Y2")
131   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
132   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
133   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
134   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
135
136   PORT_START("Y3")
137   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
138   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
139   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
140   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
141
142   PORT_START("Y4")
143   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
144   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
145   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
146   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
147
148   PORT_START("Y5")
149   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
150   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
151   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
152   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
153
154   PORT_START("Y6")
155   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
156   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
157   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
158   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
159
160   PORT_START("Y7")
161   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
162   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
163   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
164   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
165
166   PORT_START("Y8")
167   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
168   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
169   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
170   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
171
172   PORT_START("Y9")
173   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
174   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
175   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
176   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
177
178   PORT_START("Y10")
179   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
180   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
181   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
182   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
183
184   PORT_START("Y11")
185   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
186   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
187   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
188   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
189
190   PORT_START("Y12")
191   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
192   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
193   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
194   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
195
196   PORT_START("Y13")
197   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
198   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
199   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
200   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
201
202   PORT_START("Y14")
203   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
204   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
205   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
206   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
207
208   PORT_START("Y15")
209   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
210   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
211   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
212   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
67213INPUT_PORTS_END
68214
69215/* Video */
r6485r6486
91237         UINT16 videoram_addr = ((y / 10) * 64) + sx;
92238         UINT8 videoram_data = state->video_ram[videoram_addr & 0x7ff];
93239
94         UINT16 charrom_addr = (videoram_data << 3) | line;
240         UINT16 charrom_addr = ((videoram_data & 0x7f) << 3) | line;
95241         UINT8 data = state->char_rom[charrom_addr & 0x3ff];
96242
97243         for (x = 0; x < 6; x++)
98244         {
99            int color = (line > 7) ? 0 : BIT(data, 7);
245            int color = ((line > 7) ? 0 : BIT(data, 7)) ^ BIT(videoram_data, 7);
100246
101247            *BITMAP_ADDR16(bitmap, y, (sx * 6) + x) = color;
102248
r6485r6486
191337
192338   /* find devices */
193339   state->cassette = devtag_get_device(machine, CASSETTE_TAG);
340
341   /* find memory regions */
342   state->keyboard_rom = memory_region(machine, "keyboard");
194343}
195344
196345/* Machine Driver */
r6485r6486
206355   MDRV_DRIVER_DATA(huebler_state)
207356
208357   /* basic machine hardware */
209    MDRV_CPU_ADD(Z80_TAG, Z80, 2500000) /* U880D */
358    MDRV_CPU_ADD(Z80_TAG, Z80, XTAL_10MHz/4) /* U880D */
210359    MDRV_CPU_PROGRAM_MAP(huebler_mem)
211360    MDRV_CPU_IO_MAP(huebler_io)
212361   MDRV_CPU_CONFIG(huebler_daisy_chain)
213362
214363    MDRV_MACHINE_START(huebler)
215364
365   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, HZ(1500))
366
216367    /* video hardware */
217    MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
218    MDRV_SCREEN_REFRESH_RATE(50)
219    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
220    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
221    MDRV_SCREEN_SIZE(384, 240)
222    MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 240-1)
368   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
369   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
370   MDRV_SCREEN_RAW_PARAMS(9000000, 576, 0*6, 64*6, 320, 0*10, 24*10)
371
223372    MDRV_PALETTE_LENGTH(2)
224373    MDRV_PALETTE_INIT(black_and_white)
225374
r6485r6486
227376    MDRV_VIDEO_UPDATE(huebler)
228377
229378   /* devices */
230   MDRV_Z80CTC_ADD(Z80CTC_TAG, 2500000, ctc_intf)
379   MDRV_Z80CTC_ADD(Z80CTC_TAG, XTAL_10MHz/4, ctc_intf)
231380   MDRV_Z80PIO_ADD(Z80PIO1_TAG, pio1_intf)
232381   MDRV_Z80PIO_ADD(Z80PIO2_TAG, pio2_intf)
233   MDRV_Z80SIO_ADD(Z80SIO_TAG, 2500000, sio_intf)
382   MDRV_Z80SIO_ADD(Z80SIO_TAG, XTAL_10MHz/4, sio_intf)
234383
235384   MDRV_CASSETTE_ADD(CASSETTE_TAG, huebler_cassette_config)
236385   
r6485r6486
243392
244393ROM_START( huebler )
245394   ROM_REGION( 0x10000, Z80_TAG, 0 )
246   ROM_LOAD( "mon21.bin",    0xf000, 0x0bdf, BAD_DUMP CRC(ba905563) SHA1(1fa0aeab5428731756bdfa74efa3c664898bf083) )
247   ROM_LOAD( "mon30.bin",    0xf000, 0x1000, CRC(033f8112) SHA1(0c6ae7b9d310dec093652db6e8ae84f8ebfdcd29) )
395   ROM_DEFAULT_BIOS( "v21" )
396   ROM_SYSTEM_BIOS( 0, "v21", "H.MON v2.1" )
397   ROMX_LOAD( "mon21.bin", 0xf000, 0x0bdf, BAD_DUMP CRC(ba905563) SHA1(1fa0aeab5428731756bdfa74efa3c664898bf083), ROM_BIOS(1) )
398   ROM_SYSTEM_BIOS( 1, "v30", "H.MON v3.0" )
399   ROMX_LOAD( "mon30.bin", 0xf000, 0x1000, CRC(033f8112) SHA1(0c6ae7b9d310dec093652db6e8ae84f8ebfdcd29), ROM_BIOS(2) )
400
401   ROM_REGION( 0x4800, "hbasic", 0 )
248402   ROM_LOAD( "mon30p_hbasic33p.bin", 0x0000, 0x4800, CRC(c927e7be) SHA1(2d1f3ff4d882c40438a1281872c6037b2f07fdf2) )
249403
250   ROM_REGION( 0x0400, "chargen", 0 )
404   ROM_REGION( 0x400, "chargen", 0 )
251405   ROM_LOAD( "hemcfont.bin", 0x0000, 0x0400, CRC(1074d103) SHA1(e558279cff5744acef4eccf30759a9508b7f8750) )
406
407   ROM_REGION( 0x400, "keyboard", 0 )
408   ROM_LOAD( "keyboard.bin", 0x0000, 0x0400, BAD_DUMP CRC(daa06361) SHA1(b0299bd8d1686e05dbeeaed54f6c41ae543be20c) ) // typed in from manual
252409ROM_END
253410
254411/* System Drivers */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team