summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/olyboss.cpp
blob: 843bb2d08cc325e47c17c6ba82c8f5f0bcd40c94 (plain) (blame)
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
// license:BSD-3-Clause
// copyright-holders: Gabriele D'Antona
/* 
	Olympia BOSS
	Made in Germany around 1981
	
	The BOSS series was not a great success, as its members differed too much to be compatible:
	First they were 8085 based, later machines used a Z80A.
	
	Other distinguishing features were the capacity of the disk drives:
	
	BOSS A: Two 128K floppy drives
	BOSS B: Two 256K disk drives
	BOSS C: Two 600K disk drives
	BOSS D: One 600K disk drive, one 5 MB harddisk
	BOSS M: M for multipost, up to four BOSS machines linked together for up to 20MB shared harddisk space
	
	Olympia favoured the French Prologue operating system over CPM (cf. Olympia People PC) and supplied BAL
	as a programming language with it.
		
	Video is 80x28
	
	There are no service manuals available (or no documentation in general), so everything is guesswork.

	- Ports 0x80 and 0x81 seem to be related to the graphics chip and cursor position
	The rom outs value 0x81 to port 0x81 and then the sequence <column> <row> (?) to port 0x80

	- The machine boots up and shows "BOSS .." on the screen. Every keystroke is repeated on screen.
	If you press <return>, the machine seems to go into a boot sequence (from the HD, probably)
	
	The harddisk controller is based on a MSC-9056.
	
	Links: http://www.old-computers.com/museum/computer.asp?c=95
*/

#include "emu.h"
#include "cpu/z80/z80.h"
#include "machine/keyboard.h"
#include "video/upd3301.h"
#include "machine/i8257.h"
#include "machine/am9519.h"
#include "screen.h"

#define Z80_TAG         "z80"
#define UPD3301_TAG     "upd3301"
#define I8257_TAG       "i8257"
#define SCREEN_TAG		"screen"

//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

class olyboss_state : public driver_device
{
public:
	olyboss_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag),
			m_maincpu(*this, Z80_TAG),
			m_dma(*this, I8257_TAG),
			m_crtc(*this,UPD3301_TAG),
			m_char_rom(*this, UPD3301_TAG)
		{ }

	DECLARE_DRIVER_INIT(olyboss);
	DECLARE_READ8_MEMBER( videoram_read );
	DECLARE_WRITE8_MEMBER( videoram_write );
	DECLARE_READ8_MEMBER(keyboard_read);
	DECLARE_READ8_MEMBER(port_read);
	DECLARE_WRITE8_MEMBER(port_write);

	UPD3301_DRAW_CHARACTER_MEMBER( olyboss_display_pixels );

	DECLARE_WRITE_LINE_MEMBER( hrq_w );
	DECLARE_READ8_MEMBER( dma_mem_r );
	
	void olybossd(machine_config &config);
	
protected:
	required_device<cpu_device> m_maincpu;
	required_device<i8257_device> m_dma;
	required_device<upd3301_device> m_crtc;
	required_memory_region m_char_rom;
	//uint32_t screen_update_olyboss(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);	
private:

	bool m_keybhit;
	u8 m_keystroke;
	uint8_t m_mainVideoram[0x2000];
	void keyboard_put(u8 data);	


};

//**************************************************************************
//  ADDRESS MAPS
//**************************************************************************

static ADDRESS_MAP_START(olyboss_mem, AS_PROGRAM, 8, olyboss_state)
	AM_RANGE(0x0000, 0x7ff ) AM_ROM AM_REGION("mainrom", 0)
	AM_RANGE(0x800,  0xbffd) AM_RAM
	AM_RANGE(0xbffe, 0xbfff) AM_READ(keyboard_read)
	//AM_RANGE(0xc000,  0xf2c5) AM_RAM
	AM_RANGE(0xc000,  0xffff) AM_RAM
	//AM_RANGE(0xf2c6, 0xffbf ) AM_READWRITE(videoram_read,videoram_write)
	//AM_RANGE(0xffc0, 0xffff) AM_RAM
ADDRESS_MAP_END

static ADDRESS_MAP_START(olyboss_io, AS_IO, 8, olyboss_state)
	ADDRESS_MAP_GLOBAL_MASK(0xff)
	ADDRESS_MAP_UNMAP_HIGH
	AM_RANGE(0x0, 0x8) AM_DEVREADWRITE(I8257_TAG, i8257_device, read, write)
	AM_RANGE(0x9, 0x2f) AM_READWRITE(port_read,port_write)
	AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("uic", am9519_device, data_r, data_w)
	AM_RANGE(0x31, 0x31) AM_DEVREADWRITE("uic", am9519_device, stat_r, cmd_w)
	AM_RANGE(0x32, 0x7f) AM_READWRITE(port_read,port_write)
	AM_RANGE(0x80, 0x81) AM_DEVREADWRITE(UPD3301_TAG, upd3301_device, read, write)
	AM_RANGE(0x82, 0xff) AM_READWRITE(port_read,port_write)
ADDRESS_MAP_END

static INPUT_PORTS_START( olyboss )
	PORT_START("DSW")
INPUT_PORTS_END



//**************************************************************************
//  VIDEO
//**************************************************************************

UPD3301_DRAW_CHARACTER_MEMBER( olyboss_state::olyboss_display_pixels )
{
	uint8_t data = m_char_rom->base()[(cc << 4) | lc];
	int i;

	//if (lc >= 8) return;
	if (csr) 
	{
		logerror("csr\n");
		data = 0xff;
	}

	for (i = 0; i < 8; i++)
	{
		int color = BIT(data, 7) ^ rvv;
		bitmap.pix32(y, (sx * 8) + i) = color?0xffffff:0;
		data <<= 1;
	}
}

/* not used */
/*
uint32_t olyboss_state::screen_update_olyboss(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	uint8_t *chargen = memregion(UPD3301_TAG)->base();
	//uint8_t *chargen = memregion("chargen")->base();
	uint8_t y,ra,chr,gfx;
	uint16_t sy=0,ma=0,x;

	bitmap.fill(0);
	
	int numColumns=80;
	for (y = 28; y > 0; y--)
	{
		for (ra = 0; ra < 11; ra++)
		{
			uint16_t *p = &bitmap.pix16(sy++);

			for (x = ma; x < ma + numColumns; x++)
			{
				chr = m_mainVideoram[x];
				gfx = chargen[(chr<<4) | ra ];
				
				*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+=numColumns+40;
	}


	return 0;
}
*/

WRITE8_MEMBER( olyboss_state::videoram_write )
{
	// logerror("vramw [%2.2x][%2.2x] port0 [%2.2x] fbfd [%2.2x] fbfe [%2.2x] PC [%4.4x]\n",offset,data,m_port0,m_fbfd,m_fbfe,m_maincpu->safe_pc());
	m_mainVideoram[offset]=data;
}

READ8_MEMBER( olyboss_state::videoram_read )
{
	return m_mainVideoram[offset];
}

//**************************************************************************
//  KEYBOARD
//**************************************************************************

READ8_MEMBER( olyboss_state::keyboard_read )
{
	// logerror ("keyboard_read offs [%d]\n",offset);
	if (offset==0)
	{
		if (m_keybhit)
		{
			return 0x01;
		}
		
		return 0x00;
	}
	else if (offset==1)
	{
		if (m_keybhit)
		{
			m_keybhit=false;
			return m_keystroke;
		}
		
		return 0x00;
	}
	
	return 0x00;
}

DRIVER_INIT_MEMBER( olyboss_state, olyboss )
{
	m_keybhit=false;

	/* initialize DMA */
	m_dma->ready_w(1);
}

void olyboss_state::keyboard_put(u8 data)
{
	if (data)
	{
		//logerror("Keyboard stroke [%2x]\n",data);
		m_keystroke=data;
		m_keybhit=true;
	}
}

/* 8257 Interface */

WRITE_LINE_MEMBER( olyboss_state::hrq_w )
{
	//logerror("hrq_w\n");
	m_maincpu->set_input_line(INPUT_LINE_HALT,state);
	m_dma->hlda_w(state);
}

READ8_MEMBER( olyboss_state::dma_mem_r )
{
	address_space &program = m_maincpu->space(AS_PROGRAM);

	if (offset==0xf2c6)
	{
		logerror("DMA read at offset [%x] val is [%2.2x]\n",offset,program.read_byte(offset));
	}
	
	return program.read_byte(offset);
}

/* ports */

WRITE8_MEMBER( olyboss_state::port_write )
{
	logerror("Wrote to port [%2.2x] value [%2.2x]\n",offset,data);
}

READ8_MEMBER( olyboss_state::port_read)
{
	logerror("Reading from port [%2.2x]\n",offset);
	return 0xff;
}

//**************************************************************************
//  MACHINE CONFIGURATION
//**************************************************************************

MACHINE_CONFIG_START( olyboss_state::olybossd )
	MCFG_CPU_ADD(Z80_TAG, Z80, 4_MHz_XTAL)
	MCFG_CPU_PROGRAM_MAP(olyboss_mem)
	MCFG_CPU_IO_MAP(olyboss_io)
	MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("uic", am9519_device, iack_cb)

	/* video hardware */

	MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
	MCFG_SCREEN_REFRESH_RATE(60)
	MCFG_SCREEN_UPDATE_DEVICE(UPD3301_TAG, upd3301_device, screen_update)
	MCFG_SCREEN_SIZE(80*8, 28*11)
	MCFG_SCREEN_VISIBLE_AREA(0, (80*8)-1, 0, (28*11)-1)

	/* devices */

	MCFG_DEVICE_ADD("uic", AM9519, 0)
	MCFG_AM9519_OUT_INT_CB(INPUTLINE(Z80_TAG, 0))

	MCFG_DEVICE_ADD(I8257_TAG, I8257, XTAL(4'000'000))
	MCFG_I8257_OUT_HRQ_CB(WRITELINE(olyboss_state, hrq_w))
	MCFG_I8257_IN_MEMR_CB(READ8(olyboss_state, dma_mem_r))
	MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8(UPD3301_TAG, upd3301_device, dack_w))

	MCFG_DEVICE_ADD(UPD3301_TAG, UPD3301, XTAL(14'318'181))
	MCFG_UPD3301_CHARACTER_WIDTH(8)
	MCFG_UPD3301_DRAW_CHARACTER_CALLBACK_OWNER(olyboss_state, olyboss_display_pixels)
	MCFG_UPD3301_DRQ_CALLBACK(DEVWRITELINE(I8257_TAG, i8257_device, dreq2_w))
	MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)

	/* keyboard */
	MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0)
	MCFG_GENERIC_KEYBOARD_CB(PUT(olyboss_state, keyboard_put))
	
MACHINE_CONFIG_END

//**************************************************************************
//  ROM DEFINITIONS
//**************************************************************************

ROM_START( olybossd )
	ROM_REGION(0x800, "mainrom", ROMREGION_ERASEFF)
	ROM_LOAD( "olympia_boss_system_251-462.bin", 0x0000, 0x800, CRC(01b99609) SHA1(07b764c36337c12f7b40aa309b0805ceed8b22e2) )

	ROM_REGION( 0x800, UPD3301_TAG, 0)
	ROM_LOAD( "olympia_boss_graphics_251-461.bin", 0x0000, 0x800, CRC(56149540) SHA1(b2b893bd219308fc98a38528beb7ddae391c7609) )
ROM_END


//**************************************************************************
//  SYSTEM DRIVERS
//**************************************************************************

//   YEAR  NAME			PARENT	COMPAT	MACHINE		INPUT		CLASS			INIT		COMPANY						FULLNAME			FLAGS
COMP(1981, olybossd,	0,		0,		olybossd,	olyboss,	olyboss_state,	olyboss,	"Olympia International",	"Olympia BOSS D",	MACHINE_NOT_WORKING | MACHINE_NO_SOUND )