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
|
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol,Vas Crabb
/*****************************************************************************
*
* includes/osborne1.h
*
****************************************************************************/
#ifndef MAME_INCLUDES_OSBORNE1_H
#define MAME_INCLUDES_OSBORNE1_H
#pragma once
#include "bus/ieee488/ieee488.h"
#include "cpu/z80/z80.h"
#include "imagedev/floppy.h"
#include "machine/6821pia.h"
#include "machine/6850acia.h"
#include "machine/ram.h"
#include "machine/wd_fdc.h"
#include "sound/spkrdev.h"
#include "video/mc6845.h"
#include "emupal.h"
#include "screen.h"
#include "tilemap.h"
class osborne1_state : public driver_device
{
public:
osborne1_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_ram(*this, RAM_TAG),
m_screen(*this, "screen"),
m_maincpu(*this, "maincpu"),
m_pia0(*this, "pia_0"),
m_pia1(*this, "pia_1"),
m_gfxdecode(*this, "gfxdecode"),
m_speaker(*this, "speaker"),
m_acia(*this, "acia"),
m_fdc(*this, "mb8877"),
m_ieee(*this, IEEE488_TAG),
m_floppy0(*this, "mb8877:0"),
m_floppy1(*this, "mb8877:1"),
m_keyb_row(*this, { "ROW0", "ROW1", "ROW3", "ROW4", "ROW5", "ROW2", "ROW6", "ROW7" }),
m_btn_reset(*this, "RESET"),
m_cnf(*this, "CNF"),
m_region_maincpu(*this, "maincpu"),
m_bank_0xxx(*this, "bank_0xxx"),
m_bank_1xxx(*this, "bank_1xxx"),
m_bank_fxxx(*this, "bank_fxxx"),
m_p_chargen(*this, "chargen"),
m_video_timer(nullptr),
m_tilemap(nullptr),
m_acia_rxc_txc_timer(nullptr)
{
}
void osborne1(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(reset_key);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
void osborne1_base(machine_config &config);
void osborne1_mem(address_map &map);
void osborne1_op(address_map &map);
void osborne1_io(address_map &map);
void bank_0xxx_w(offs_t offset, u8 data);
void bank_1xxx_w(offs_t offset, u8 data);
u8 bank_2xxx_3xxx_r(offs_t offset);
void bank_2xxx_3xxx_w(offs_t offset, u8 data);
void videoram_w(offs_t offset, u8 data);
u8 opcode_r(offs_t offset);
void bankswitch_w(offs_t offset, u8 data);
DECLARE_WRITE_LINE_MEMBER(irqack_w);
bool rom_mode() const { return 0 != m_rom_mode; }
u8 scroll_x() const { return m_scroll_x; }
template <int Width, unsigned Scale> void draw_rows(uint16_t col, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<ram_device> m_ram;
required_device<screen_device> m_screen;
required_device<z80_device> m_maincpu;
required_device<pia6821_device> m_pia0;
required_device<pia6821_device> m_pia1;
private:
u8 ieee_pia_pb_r();
void ieee_pia_pb_w(u8 data);
DECLARE_WRITE_LINE_MEMBER(ieee_pia_irq_a_func);
void video_pia_port_a_w(u8 data);
void video_pia_port_b_w(u8 data);
DECLARE_WRITE_LINE_MEMBER(video_pia_out_cb2_dummy);
DECLARE_WRITE_LINE_MEMBER(video_pia_irq_a_func);
DECLARE_WRITE_LINE_MEMBER(serial_acia_irq_func);
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<gfxdecode_device> m_gfxdecode;
required_device<speaker_sound_device> m_speaker;
required_device<acia6850_device> m_acia;
required_device<mb8877_device> m_fdc;
required_device<ieee488_device> m_ieee;
required_device<floppy_connector> m_floppy0;
required_device<floppy_connector> m_floppy1;
TIMER_CALLBACK_MEMBER(video_callback);
TIMER_CALLBACK_MEMBER(acia_rxc_txc_callback);
TILE_GET_INFO_MEMBER(get_tile_info);
bool set_rom_mode(u8 value);
bool set_bit_9(u8 value);
void update_irq();
void update_acia_rxc_txc();
// user inputs
required_ioport_array<8> m_keyb_row;
required_ioport m_btn_reset;
// fake inputs for hardware configuration and things that need rewiring
required_ioport m_cnf;
// pieces of memory
required_memory_region m_region_maincpu;
required_memory_bank m_bank_0xxx;
required_memory_bank m_bank_1xxx;
required_memory_bank m_bank_fxxx;
required_region_ptr<u8> m_p_chargen;
// configuration (reloaded on reset)
u8 m_acia_rxc_txc_div;
u8 m_acia_rxc_txc_p_low;
u8 m_acia_rxc_txc_p_high;
// bank switch control bits
u8 m_ub4a_q;
u8 m_ub6a_q;
u8 m_rom_mode;
u8 m_bit_9;
// onboard video state
u8 m_scroll_x;
u8 m_scroll_y;
u8 m_beep_state;
emu_timer *m_video_timer;
tilemap_t *m_tilemap;
// serial state
u8 m_acia_irq_state;
u8 m_acia_rxc_txc_state;
emu_timer *m_acia_rxc_txc_timer;
memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_mem_cache;
};
class osborne1sp_state : public osborne1_state
{
public:
osborne1sp_state(const machine_config &mconfig, device_type type, const char *tag) :
osborne1_state(mconfig, type, tag)
{
}
void osborne1sp(machine_config &config);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
void osborne1sp_mem(address_map &map);
u8 bank_2xxx_3xxx_r(offs_t offset);
void bank_2xxx_3xxx_w(offs_t offset, u8 data);
private:
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
// SCREEN-PAC registers
u8 m_resolution = 0;
u8 m_hc_left = 0;
};
class osborne1nv_state : public osborne1_state
{
public:
osborne1nv_state(const machine_config &mconfig, device_type type, const char *tag) :
osborne1_state(mconfig, type, tag),
m_palette(*this, "palette"),
m_p_nuevo(*this, "nuevo")
{
}
void osborne1nv(machine_config &config);
private:
void osborne1nv_io(address_map &map);
MC6845_UPDATE_ROW(crtc_update_row);
MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr_changed);
required_device<palette_device> m_palette;
required_region_ptr<u8> m_p_nuevo;
};
#endif // MAME_INCLUDES_OSBORNE1_H
|