summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/basf7100.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/basf7100.cpp')
-rw-r--r--src/mame/drivers/basf7100.cpp166
1 files changed, 131 insertions, 35 deletions
diff --git a/src/mame/drivers/basf7100.cpp b/src/mame/drivers/basf7100.cpp
index 8bab2c025d5..498d8934213 100644
--- a/src/mame/drivers/basf7100.cpp
+++ b/src/mame/drivers/basf7100.cpp
@@ -35,11 +35,12 @@
- COM8116
- 5.0688 MHz XTAL
- Keyboard:
- - 30293E-054 20-04592-054 (?)
-
TODO:
- - The floppy is partially hooked up, everything else needs to be done
+ - Dump real character ROM
+ - Improve video emulation
+ - Hook up switches
+ - Hook up serial ports
+ - Hook up parallel port
Notes:
- Runs the BOS operating system, possibly also CP/M?
@@ -49,8 +50,10 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "machine/i8255.h"
+#include "machine/pic8259.h"
#include "machine/wd_fdc.h"
#include "imagedev/floppy.h"
+#include "machine/basf7100_kbd.h"
#include "emupal.h"
#include "screen.h"
@@ -68,16 +71,23 @@ public:
basf7100_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_ppi(*this, "ppi%u", 0U),
m_fdccpu(*this, "fdccpu"),
+ m_pic(*this, "pic"),
+ m_ppi(*this, "ppi%u", 0U),
m_fdc(*this, "fdc"),
m_floppy(*this, "fdc:%u", 0),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
+ m_shared_ram(*this, "shared_ram"),
m_chargen(*this, "chargen"),
m_bootview(*this, "bootview"),
+ m_cursor_col(0x00), m_cursor_row(0x00),
+ m_highlight(0x00),
+ m_roll_offset(0x00),
+ m_sod(0x0000),
m_fdc_intrq_vector(0),
- m_fdc_drq(false)
+ m_fdc_drq(false),
+ m_int_flags(0x00)
{ }
void basf7100(machine_config &config);
@@ -88,15 +98,23 @@ protected:
private:
required_device<z80_device> m_maincpu;
- required_device_array<i8255_device, 5> m_ppi;
required_device<z80_device> m_fdccpu;
+ required_device<pic8259_device> m_pic;
+ required_device_array<i8255_device, 5> m_ppi;
required_device<fd1791_device> m_fdc;
required_device_array<floppy_connector, 3> m_floppy;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
+ required_shared_ptr<uint8_t> m_shared_ram;
required_region_ptr<uint8_t> m_chargen;
memory_view m_bootview;
+ enum : uint8_t
+ {
+ INT_KEYBOARD = 0x08,
+ INT_VBLANK = 0x10
+ };
+
void mem_map(address_map &map);
void io_map(address_map &map);
@@ -106,8 +124,15 @@ private:
uint8_t mmio_r(offs_t offset);
void mmio_w(offs_t offset, uint8_t data);
+ void keyboard_w(uint8_t data);
+
+ void cursor_col_w(uint8_t data);
+ void cursor_row_w(uint8_t data);
+ void highlight_w(uint8_t data);
+ void roll_offset_w(uint8_t data);
void sod_high_w(uint8_t data);
void sod_low_w(uint8_t data);
+ void vblank_w(int state);
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void fdc_drq_w(int state);
@@ -116,12 +141,17 @@ private:
void fdc_intrq_vector_w(uint8_t data);
void unk_cc_w(uint8_t data);
+ IRQ_CALLBACK_MEMBER(maincpu_irq_callback);
IRQ_CALLBACK_MEMBER(fdccpu_irq_callback);
- uint8_t int_flags_r();
+ uint8_t m_cursor_col;
+ uint8_t m_cursor_row;
+ uint8_t m_highlight;
+ uint8_t m_roll_offset;
uint16_t m_sod;
uint8_t m_fdc_intrq_vector;
bool m_fdc_drq;
+ uint8_t m_int_flags;
};
@@ -131,8 +161,8 @@ private:
void basf7100_state::mem_map(address_map &map)
{
- map(0x0000, 0x7fff).ram().share("shared_ram");
- map(0x8000, 0xffff).ram();
+ map(0x0000, 0x9fff).ram().share("shared_ram");
+ map(0xa000, 0xffff).ram();
map(0xff00, 0xffff).rw(FUNC(basf7100_state::mmio_r), FUNC(basf7100_state::mmio_w));
map(0x0000, 0xffff).view(m_bootview);
m_bootview[0](0x0000, 0x001f).mirror(0xffe0).rom().region("maincpu", 0);
@@ -143,14 +173,14 @@ void basf7100_state::io_map(address_map &map)
map.global_mask(0xff);
map(0x00, 0x03).rw(m_ppi[0], FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0x04, 0x07).rw(m_ppi[1], FUNC(i8255_device::read), FUNC(i8255_device::write));
-// map(0x08, 0x09).mirror(0x02) 8259
+ map(0x08, 0x09).mirror(0x02).rw(m_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write));
map(0x0c, 0x0f).rw(m_ppi[2], FUNC(i8255_device::read), FUNC(i8255_device::write));
// map(0x10, 0x11) 8251 (primary)
// map(0x12, 0x12) baud rate
// map(0x14, 0x15) 8251 (secondary)
// map(0x16, 0x16) baud rate
// map(0x17, 0x17) rs232 flags/control
- map(0x18, 0x18).r(FUNC(basf7100_state::int_flags_r));
+ map(0x18, 0x18).lr8(NAME([this] () -> uint8_t { return m_int_flags; }));
// map(0x1c, 0x1f) switches
// map(0xb0, 0xb3) display hardware clear
map(0xb8, 0xbb).rw(m_ppi[3], FUNC(i8255_device::read), FUNC(i8255_device::write));
@@ -164,9 +194,8 @@ void basf7100_state::io_map(address_map &map)
void basf7100_state::fdc_mem_map(address_map &map)
{
- map(0x0000, 0x7fff).ram().share("shared_ram");
- map(0x8000, 0xefff).ram();
- map(0xf000, 0xfbff).ram();
+ map(0x0000, 0x9fff).ram().share("shared_ram");
+ map(0xa000, 0xfbff).ram();
map(0xfc00, 0xffff).rom().region("fdccpu", 0);
map(0xff00, 0xffff).rw(FUNC(basf7100_state::mmio_r), FUNC(basf7100_state::mmio_w));
}
@@ -185,6 +214,17 @@ void basf7100_state::fdc_io_map(address_map &map)
static INPUT_PORTS_START( basf7100 )
INPUT_PORTS_END
+void basf7100_state::keyboard_w(uint8_t data)
+{
+ // PPI OBF
+ m_int_flags &= ~INT_KEYBOARD;
+ m_int_flags |= BIT(data, 1) ? INT_KEYBOARD : 0x00;
+
+ m_pic->ir3_w(BIT(data, 1));
+
+ // TODO: keyboard bell
+}
+
//**************************************************************************
// VIDEO EMULATION
@@ -205,6 +245,32 @@ static GFXDECODE_START( gfx_crt8002 )
GFXDECODE_ENTRY( "chargen", 0, crt8002_charlayout, 0, 1 )
GFXDECODE_END
+void basf7100_state::cursor_col_w(uint8_t data)
+{
+ m_cursor_col = data;
+}
+
+void basf7100_state::cursor_row_w(uint8_t data)
+{
+ // 7------- graphics enable?
+ // -65----- unknown
+ // ---43210 cursor row
+
+ m_cursor_row = data & 0x1f;
+}
+
+void basf7100_state::highlight_w(uint8_t data)
+{
+ logerror("highlight = %02x\n", data);
+ m_highlight = data;
+}
+
+void basf7100_state::roll_offset_w(uint8_t data)
+{
+ logerror("roll offset = %02x\n", data);
+ m_roll_offset = data;
+}
+
void basf7100_state::sod_high_w(uint8_t data)
{
m_sod = (data << 8) | (m_sod & 0x00ff);
@@ -218,23 +284,39 @@ void basf7100_state::sod_low_w(uint8_t data)
m_sod = (m_sod & 0xff00) | ((data & 0xf0) << 0);
}
+void basf7100_state::vblank_w(int state)
+{
+ m_int_flags &= ~INT_VBLANK;
+ m_int_flags |= state ? INT_VBLANK : 0x00;
+
+ m_pic->ir4_w(state);
+}
+
uint32_t basf7100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
+ uint16_t addr = m_sod + (m_roll_offset * 16);
+
for (int y = 0; y < 24; y++)
{
for (int x = 0; x < 80; x++)
{
- uint16_t addr = m_sod + y * 80 + x;
- uint8_t code = m_maincpu->space(AS_PROGRAM).read_byte(addr);
+ if (addr >= (m_sod + 0x780))
+ addr = m_sod;
+
+ uint8_t code = m_shared_ram[addr];
// draw 12 lines
for (int i = 0; i < 12; i++)
{
uint8_t data = m_chargen[(((code & 0x7f) << 4) + i)];
+ // wrong
if (BIT(code, 7))
data ^= 0xff;
+ if (y == m_cursor_row && x == m_cursor_col)
+ data ^= 0xff;
+
// 8 pixels of the character
bitmap.pix(y * 12 + i, x * 8 + 0) = BIT(data, 7) ? rgb_t::white() : rgb_t::black();
bitmap.pix(y * 12 + i, x * 8 + 1) = BIT(data, 6) ? rgb_t::white() : rgb_t::black();
@@ -245,6 +327,9 @@ uint32_t basf7100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm
bitmap.pix(y * 12 + i, x * 8 + 6) = BIT(data, 1) ? rgb_t::white() : rgb_t::black();
bitmap.pix(y * 12 + i, x * 8 + 7) = BIT(data, 0) ? rgb_t::white() : rgb_t::black();
}
+
+ // next char
+ addr++;
}
}
@@ -334,24 +419,29 @@ void basf7100_state::mmio_w(offs_t offset, uint8_t data)
m_maincpu->space(AS_IO).write_byte(offset, data);
}
-IRQ_CALLBACK_MEMBER( basf7100_state::fdccpu_irq_callback )
+IRQ_CALLBACK_MEMBER( basf7100_state::maincpu_irq_callback )
{
- return m_fdc_intrq_vector;
+ uint32_t vector = 0;
+
+ vector |= m_pic->acknowledge() << 16;
+ vector |= m_pic->acknowledge();
+ vector |= m_pic->acknowledge() << 8;
+
+ return vector;
}
-uint8_t basf7100_state::int_flags_r()
+IRQ_CALLBACK_MEMBER( basf7100_state::fdccpu_irq_callback )
{
- // 765----- unknown
- // ---4---- unknown (used, needs to be set at least 2 times to continue booting)
- // ----3--- unknown (used)
- // -----210 unknown
-
- return m_screen->vblank() ? 0x10 : 0x00;
+ return m_fdc_intrq_vector;
}
void basf7100_state::machine_start()
{
// register for save states
+ save_item(NAME(m_cursor_col));
+ save_item(NAME(m_cursor_row));
+ save_item(NAME(m_highlight));
+ save_item(NAME(m_roll_offset));
save_item(NAME(m_sod));
save_item(NAME(m_fdc_intrq_vector));
save_item(NAME(m_fdc_drq));
@@ -373,16 +463,20 @@ void basf7100_state::basf7100(machine_config &config)
Z80(config, m_maincpu, 4000000);
m_maincpu->set_addrmap(AS_PROGRAM, &basf7100_state::mem_map);
m_maincpu->set_addrmap(AS_IO, &basf7100_state::io_map);
+ m_maincpu->set_irq_acknowledge_callback(FUNC(basf7100_state::maincpu_irq_callback));
Z80(config, m_fdccpu, 4000000);
m_fdccpu->set_addrmap(AS_PROGRAM, &basf7100_state::fdc_mem_map);
m_fdccpu->set_addrmap(AS_IO, &basf7100_state::fdc_io_map);
m_fdccpu->set_irq_acknowledge_callback(FUNC(basf7100_state::fdccpu_irq_callback));
+ PIC8259(config, m_pic, 0);
+ m_pic->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
+
I8255(config, m_ppi[0]);
// port a: input (switches?)
- // port b: input (keyboard data)
- // port c: input (keyboard strobe), output (bell)
+ m_ppi[0]->in_pb_callback().set("keyboard", FUNC(basf7100_kbd_device::read));
+ m_ppi[0]->out_pc_callback().set(FUNC(basf7100_state::keyboard_w));
I8255(config, m_ppi[1]);
// port a: output (printer data)
@@ -395,12 +489,12 @@ void basf7100_state::basf7100(machine_config &config)
// port c: input (auto dialer status), output (rs232 and auto dialer control)
I8255(config, m_ppi[3]);
- // port a: output (cursor column)
- // port b: output (cursor row, graphics enable)
- // port c: output (highlight mode)
+ m_ppi[3]->out_pa_callback().set(FUNC(basf7100_state::cursor_col_w));
+ m_ppi[3]->out_pb_callback().set(FUNC(basf7100_state::cursor_row_w));
+ m_ppi[3]->out_pc_callback().set(FUNC(basf7100_state::highlight_w));
I8255(config, m_ppi[4]);
- // port a: output (roll offset)
+ m_ppi[4]->out_pa_callback().set(FUNC(basf7100_state::roll_offset_w));
m_ppi[4]->out_pb_callback().set(FUNC(basf7100_state::sod_high_w));
m_ppi[4]->out_pc_callback().set(FUNC(basf7100_state::sod_low_w));
@@ -412,6 +506,7 @@ void basf7100_state::basf7100(machine_config &config)
m_screen->set_refresh_hz(60);
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
m_screen->set_screen_update(FUNC(basf7100_state::screen_update));
+ m_screen->screen_vblank().set(FUNC(basf7100_state::vblank_w));
GFXDECODE(config, "gfxdecode", "palette", gfx_crt8002);
@@ -424,6 +519,10 @@ void basf7100_state::basf7100(machine_config &config)
FLOPPY_CONNECTOR(config, "fdc:0", basf7100_floppies, "basf6106", floppy_image_device::default_mfm_floppy_formats);
FLOPPY_CONNECTOR(config, "fdc:1", basf7100_floppies, "basf6106", floppy_image_device::default_mfm_floppy_formats);
FLOPPY_CONNECTOR(config, "fdc:2", basf7100_floppies, "basf6106", floppy_image_device::default_mfm_floppy_formats);
+
+ // keyboard
+ basf7100_kbd_device &keyboard(BASF7100_KBD(config, "keyboard"));
+ keyboard.int_handler().set(m_ppi[0], FUNC(i8255_device::pc2_w));
}
@@ -437,9 +536,6 @@ ROM_START( basf7120 )
ROM_REGION(0x400, "fdccpu", 0)
ROM_LOAD("19-2130-2h.u45", 0x000, 0x400, CRC(cb077c69) SHA1(dfa16082b88275442c48082aeb5f62fe1238ae3e)) // 2708
-
- ROM_REGION(0x400, "keyboard", 0)
- ROM_LOAD("19-2114-01e.bin", 0x000, 0x400, CRC(d694b5dd) SHA1(6262379ba565c1de072b2b21dc3141db1ec5129c))
ROM_REGION(0x50, "floppy_pal", 0)
ROM_LOAD("19-2131-1.u23", 0x00, 0x28, CRC(f37ed4bc) SHA1(824b4405f396c262cf8116f85eb0b548eabb4c04)) // PAL10L8MJ