1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
|
/***************************************************************************
BINBUG and DG640
2013-01-14 Driver created
All input must be in uppercase.
Commands:
A - See and alter memory
B - Set breakpoint (2 permitted)
C - Clear breakpoint
D - cassette save
G - Go to address, run
L - cassette load
S - See and alter registers
BINBUG is an alternate bios to PIPBUG, however it uses its own
video output. Method of output is through a DG640 board (sold by
Applied Technology) which uses a MCM6574 as a character generator.
The DG640 also supports blinking, reverse-video, and LORES graphics.
It is a S100 card, also known as ETI-640.
Keyboard input, like PIPBUG, is via a serial device.
The baud rate is 300, 8N1.
The SENSE and FLAG lines are used for 300 baud cassette, in
conjunction with unknown hardware.
There are 3 versions of BINBUG:
- 3.6 300 baud tape routines, 300 baud keyboard, memory-mapped VDU
- 4.4 300 baud keyboard, ACOS tape system, advanced video routines
- 5.2 ACOS tape system, 1200 baud terminal
Status:
- DG640 is completely emulated, even though BINBUG doesn't use most
of its features.
- BINBUG works except that the cassette interface isn't the same as
real hardware. But you can save, and load it back.
ToDo:
- Need dumps of 4.4 and 5.2.
- Fix cassette
****************************************************************************/
#include "emu.h"
#include "cpu/s2650/s2650.h"
#include "machine/keyboard.h"
#include "imagedev/cassette.h"
#include "sound/wave.h"
#include "imagedev/snapquik.h"
class binbug_state : public driver_device
{
public:
binbug_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_keyboard(*this, KEYBOARD_TAG),
m_cass(*this, CASSETTE_TAG),
m_p_videoram(*this, "videoram"),
m_p_attribram(*this, "attribram") { }
DECLARE_WRITE8_MEMBER(binbug_ctrl_w);
DECLARE_READ8_MEMBER(binbug_serial_r);
DECLARE_WRITE8_MEMBER(binbug_serial_w);
const UINT8 *m_p_chargen;
UINT8 m_framecnt;
virtual void video_start();
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
optional_device<serial_keyboard_device> m_keyboard;
optional_device<cassette_image_device> m_cass;
required_shared_ptr<const UINT8> m_p_videoram;
required_shared_ptr<const UINT8> m_p_attribram;
};
WRITE8_MEMBER( binbug_state::binbug_ctrl_w )
{
}
READ8_MEMBER( binbug_state::binbug_serial_r )
{
return m_keyboard->tx_r() & (m_cass->input() < 0.03);
}
WRITE8_MEMBER( binbug_state::binbug_serial_w )
{
m_cass->output(BIT(data, 0) ? -1.0 : +1.0);
}
static ADDRESS_MAP_START(binbug_mem, AS_PROGRAM, 8, binbug_state)
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE( 0x0000, 0x03ff) AM_ROM
AM_RANGE( 0x0400, 0x77ff) AM_RAM
AM_RANGE( 0x7800, 0x7bff) AM_RAM AM_SHARE("videoram")
AM_RANGE( 0x7c00, 0x7fff) AM_RAM AM_SHARE("attribram")
ADDRESS_MAP_END
static ADDRESS_MAP_START(binbug_io, AS_IO, 8, binbug_state)
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_WRITE(binbug_ctrl_w)
AM_RANGE(S2650_SENSE_PORT, S2650_FO_PORT) AM_READWRITE(binbug_serial_r,binbug_serial_w)
ADDRESS_MAP_END
/* Input ports */
static INPUT_PORTS_START( binbug )
INPUT_PORTS_END
static const serial_keyboard_interface keyboard_intf =
{
DEVCB_NULL
};
void binbug_state::video_start()
{
m_p_chargen = memregion("chargen")->base();
}
UINT32 binbug_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// attributes bit 0 = flash, bit 1 = lores. Also bit 7 of the character = reverse-video (text only).
UINT8 y,ra,chr,gfx,attr,inv,gfxbit;
UINT16 sy=0,ma=0,x;
bool flash;
m_framecnt++;
for (y = 0; y < 16; y++)
{
for (ra = 0; ra < 16; ra++)
{
UINT16 *p = &bitmap.pix16(sy++);
for (x = ma; x < ma + 64; x++)
{
attr = m_p_attribram[x];
chr = m_p_videoram[x];
flash = BIT(m_framecnt, 4) & BIT(attr, 0);
if (BIT(attr, 1)) // lores gfx - can flash
{
if (flash) chr = 0; // blank part of flashing
gfxbit = (ra & 0x0c)>>1;
/* Display one line of a lores character (8 pixels) */
*p++ = BIT(chr, gfxbit);
*p++ = BIT(chr, gfxbit);
*p++ = BIT(chr, gfxbit);
*p++ = BIT(chr, gfxbit);
gfxbit++;
*p++ = BIT(chr, gfxbit);
*p++ = BIT(chr, gfxbit);
*p++ = BIT(chr, gfxbit);
*p++ = BIT(chr, gfxbit);
}
else
{
gfx = 0;
if (!flash)
{
inv = BIT(chr, 7) ? 0xff : 0; // text with bit 7 high is reversed
chr &= 0x7f;
gfx = inv;
// if g,j,p,q,y; lower the descender
if ((chr==0x2c)||(chr==0x3b)||(chr==0x67)||(chr==0x6a)||(chr==0x70)||(chr==0x71)||(chr==0x79))
{
if (ra > 6)
gfx = m_p_chargen[(chr<<4) | (ra-7) ] ^ inv;
}
else
{
if ((ra > 3) & (ra < 13))
gfx = m_p_chargen[(chr<<4) | (ra-4) ] ^ inv;
}
}
/* Display a scanline of a character */
*p++ = BIT(gfx, 7);
*p++ = BIT(gfx, 6);
*p++ = BIT(gfx, 5);
*p++ = BIT(gfx, 4);
*p++ = BIT(gfx, 3);
*p++ = BIT(gfx, 2);
*p++ = BIT(gfx, 1);
*p++ = BIT(gfx, 0);
}
}
}
ma+=64;
}
return 0;
}
/* F4 Character Displayer */
static const gfx_layout dg640_charlayout =
{
7, 9, /* 7 x 9 characters */
128, /* 128 characters */
1, /* 1 bits per pixel */
{ 0 }, /* no bitplanes */
/* x offsets */
{ 0, 1, 2, 3, 4, 5, 6 },
/* y offsets */
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8 },
8*16 /* every char takes 16 bytes */
};
static GFXDECODE_START( dg640 )
GFXDECODE_ENTRY( "chargen", 0x0000, dg640_charlayout, 0, 1 )
GFXDECODE_END
QUICKLOAD_LOAD( binbug )
{
address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
int i;
int quick_addr = 0x0440;
int exec_addr;
int quick_length;
UINT8 *quick_data;
int read_;
quick_length = image.length();
quick_data = (UINT8*)malloc(quick_length);
if (!quick_data)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
image.message(" Cannot open file");
return IMAGE_INIT_FAIL;
}
read_ = image.fread( quick_data, quick_length);
if (read_ != quick_length)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file");
image.message(" Cannot read the file");
return IMAGE_INIT_FAIL;
}
if (quick_data[0] != 0xc4)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header");
image.message(" Invalid header");
return IMAGE_INIT_FAIL;
}
exec_addr = quick_data[1] * 256 + quick_data[2];
if (exec_addr >= quick_length)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file");
image.message(" Exec address beyond end of file");
return IMAGE_INIT_FAIL;
}
if (quick_length < 0x444)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short");
image.message(" File too short");
return IMAGE_INIT_FAIL;
}
if (quick_length > 0x8000)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long");
image.message(" File too long");
return IMAGE_INIT_FAIL;
}
for (i = quick_addr; i < quick_length; i++)
{
space.write_byte(i, quick_data[i]);
}
/* display a message about the loaded quickload */
image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
// Start the quickload
image.device().machine().device("maincpu")->state().set_pc(exec_addr);
return IMAGE_INIT_PASS;
}
static MACHINE_CONFIG_START( binbug, binbug_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz)
MCFG_CPU_PROGRAM_MAP(binbug_mem)
MCFG_CPU_IO_MAP(binbug_io)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_UPDATE_DRIVER(binbug_state, screen_update)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 255)
MCFG_GFXDECODE(dg640)
MCFG_PALETTE_LENGTH(2)
MCFG_PALETTE_INIT(monochrome_amber)
/* Keyboard */
MCFG_SERIAL_KEYBOARD_ADD(KEYBOARD_TAG, keyboard_intf, 300)
/* Cassette */
MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
/* quickload */
MCFG_QUICKLOAD_ADD("quickload", binbug, "pgm", 1)
MACHINE_CONFIG_END
/* ROM definition */
ROM_START( binbug )
ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASEFF )
ROM_LOAD( "binbug.rom", 0x0000, 0x0400, CRC(2cb1ac6e) SHA1(a969883fc767484d6b0fa103cfa4b4129b90441b) )
ROM_REGION( 0x0800, "chargen", 0 )
ROM_LOAD( "6574.bin", 0x0000, 0x0800, CRC(fd75df4f) SHA1(4d09aae2f933478532b7d3d1a2dee7123d9828ca) )
ROM_FILL(0, 16, 0)
ROM_END
/* Driver */
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
COMP( 1980, binbug, pipbug, 0, binbug, binbug, driver_device, 0, "MicroByte", "BINBUG 3.6", 0 )
/******************************************************************************************************************/
/*
DGOS-Z80 (ETI-680)
This is a S100 card.
ROM is a bad dump, scanned from a pdf. It is being worked on.
No schematic available, most of this is guesswork.
ToDo:
- dips
- leds
- need schematic to find out what else is missing
*/
#include "cpu/z80/z80.h"
#include "machine/z80ctc.h"
#include "machine/z80pio.h"
#include "cpu/z80/z80daisy.h"
class dgosz80_state : public binbug_state
{
public:
dgosz80_state(const machine_config &mconfig, device_type type, const char *tag)
: binbug_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_ctc(*this, "z80ctc"),
m_pio(*this, "z80pio")
{ }
DECLARE_READ8_MEMBER(porta_r);
DECLARE_WRITE8_MEMBER(kbd_put);
UINT8 m_term_data;
virtual void machine_reset();
required_device<cpu_device> m_maincpu;
required_device<z80ctc_device> m_ctc;
required_device<z80pio_device> m_pio;
};
static ADDRESS_MAP_START(dgosz80_mem, AS_PROGRAM, 8, dgosz80_state)
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE( 0x0000, 0xcfff) AM_RAM
AM_RANGE( 0xd000, 0xd7ff) AM_ROM
AM_RANGE( 0xd800, 0xefff) AM_RAM
AM_RANGE( 0xf000, 0xf3ff) AM_RAM AM_SHARE("videoram")
AM_RANGE( 0xf400, 0xf7ff) AM_RAM AM_SHARE("attribram")
ADDRESS_MAP_END
static ADDRESS_MAP_START(dgosz80_io, AS_IO, 8, dgosz80_state)
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00,0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
AM_RANGE(0x04,0x07) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write)
//AM_RANGE(0x08,0x08) SWP Control and Status
//AM_RANGE(0x09,0x09) parallel input port
// Optional AM9519 Programmable Interrupt Controller (port c = data, port d = control)
//AM_RANGE(0x0c,0x0d) AM_DEVREADWRITE("am9519", am9519_device, read, write)
ADDRESS_MAP_END
void dgosz80_state::machine_reset()
{
m_maincpu->set_pc(0xd000);
}
// this is a guess there is no information available
static const z80_daisy_config dgosz80_daisy_chain[] =
{
{ "z80ctc" },
{ "z80pio" },
{ NULL }
};
/* Input ports */
static INPUT_PORTS_START( dgosz80 )
INPUT_PORTS_END
WRITE8_MEMBER( dgosz80_state::kbd_put )
{
m_term_data = data;
/* strobe in keyboard data */
m_pio->strobe_a(0);
m_pio->strobe_a(1);
}
static ASCII_KEYBOARD_INTERFACE( dgosz80_keyboard_intf )
{
DEVCB_DRIVER_MEMBER(dgosz80_state, kbd_put)
};
READ8_MEMBER( dgosz80_state::porta_r )
{
UINT8 data = m_term_data;
m_term_data = 0;
return data;
}
static Z80PIO_INTERFACE( z80pio_intf )
{
DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), //IRQ
DEVCB_DRIVER_MEMBER(dgosz80_state, porta_r), // in port A
DEVCB_NULL, // out port A
DEVCB_NULL, // ready line port A - this activates to ask for kbd data but not known if actually used
DEVCB_NULL, // in port B
DEVCB_NULL, // out port B
DEVCB_NULL
};
static Z80CTC_INTERFACE( z80ctc_intf )
{
DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), // interrupt handler
DEVCB_DEVICE_LINE_MEMBER("z80ctc", z80ctc_device, trg1), // ZC/TO0 callback
DEVCB_DEVICE_LINE_MEMBER("z80ctc", z80ctc_device, trg2), // ZC/TO1 callback
DEVCB_DEVICE_LINE_MEMBER("z80ctc", z80ctc_device, trg3) // ZC/TO2 callback
};
static MACHINE_CONFIG_START( dgosz80, dgosz80_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz / 4)
MCFG_CPU_PROGRAM_MAP(dgosz80_mem)
MCFG_CPU_IO_MAP(dgosz80_io)
MCFG_CPU_CONFIG(dgosz80_daisy_chain)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_UPDATE_DRIVER(binbug_state, screen_update)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 255)
MCFG_GFXDECODE(dg640)
MCFG_PALETTE_LENGTH(2)
MCFG_PALETTE_INIT(monochrome_amber)
/* Keyboard */
MCFG_ASCII_KEYBOARD_ADD("keyb", dgosz80_keyboard_intf)
/* Devices */
MCFG_Z80CTC_ADD( "z80ctc", XTAL_8MHz / 4, z80ctc_intf )
MCFG_Z80PIO_ADD( "z80pio", XTAL_8MHz / 4, z80pio_intf )
MACHINE_CONFIG_END
/* ROM definition */
ROM_START( dgosz80 )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "dgosz80.rom", 0xd000, 0x0800, NO_DUMP)
ROM_REGION( 0x0800, "chargen", 0 )
ROM_LOAD( "6574.bin", 0x0000, 0x0800, CRC(fd75df4f) SHA1(4d09aae2f933478532b7d3d1a2dee7123d9828ca) )
ROM_REGION( 0x0020, "proms", 0 )
ROM_LOAD( "82s123.bin", 0x0000, 0x0020, NO_DUMP )
ROM_END
/* Driver */
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
COMP( 1980, dgosz80, 0, 0, dgosz80, dgosz80, driver_device, 0, "David Griffiths", "DGOS-Z80 1.4", GAME_NOT_WORKING | GAME_NO_SOUND_HW )
|