summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2020-06-18 14:49:39 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2020-06-18 14:49:39 +1000
commit1fce454a0b1556474b4d6f2ad09ef198a8798e0d (patch)
treeacfa37604626a828c47bbfced95d0438fa28b8b9
parent3ad3a40eb4d88128f69af999d776efd1e77ed8f5 (diff)
(nw) mbee: checkpoint 2
-rw-r--r--src/mame/drivers/mbee.cpp65
-rw-r--r--src/mame/includes/mbee.h38
-rw-r--r--src/mame/machine/mbee.cpp286
-rw-r--r--src/mame/video/mbee.cpp47
4 files changed, 189 insertions, 247 deletions
diff --git a/src/mame/drivers/mbee.cpp b/src/mame/drivers/mbee.cpp
index b18c6194460..73ea7aa20cf 100644
--- a/src/mame/drivers/mbee.cpp
+++ b/src/mame/drivers/mbee.cpp
@@ -138,7 +138,9 @@ void mbee_state::mbee_mem(address_map &map)
{
map.unmap_value_high();
map(0x0000, 0x7fff).ram();
- map(0x8000, 0xefff).rom().region("maincpu",0);
+ map(0x8000, 0xbfff).rom().region("maincpu",0);
+ map(0xc000, 0xdfff).rom().region("pakrom",0);
+ map(0xe000, 0xefff).rom().region("telcomrom",0);
map(0xf000, 0xf7ff).rw(FUNC(mbee_state::video_low_r), FUNC(mbee_state::video_low_w));
map(0xf800, 0xffff).rw(FUNC(mbee_state::video_high_r), FUNC(mbee_state::video_high_w));
}
@@ -148,7 +150,7 @@ void mbee_state::mbeeic_mem(address_map &map)
map(0x0000, 0x7fff).ram();
map(0x8000, 0xbfff).rom().region("maincpu",0);
map(0xc000, 0xdfff).bankr("pak");
- map(0xe000, 0xefff).rom().region("maincpu",0x4000);
+ map(0xe000, 0xefff).rom().region("telcomrom",0);
map(0xf000, 0xf7ff).rw(FUNC(mbee_state::video_low_r), FUNC(mbee_state::video_low_w));
map(0xf800, 0xffff).rw(FUNC(mbee_state::video_high_r), FUNC(mbee_state::video_high_w));
}
@@ -651,8 +653,6 @@ void mbee_state::mbee(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &mbee_state::mbee_io);
m_maincpu->set_daisy_config(mbee_daisy_chain);
- MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee)
-
Z80PIO(config, m_pio, 12_MHz_XTAL / 6);
m_pio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
m_pio->out_pa_callback().set("cent_data_out", FUNC(output_latch_device::write));
@@ -671,8 +671,6 @@ void mbee_state::mbee(machine_config &config)
PALETTE(config, m_palette, FUNC(mbee_state::standard_palette), 100);
- MCFG_VIDEO_START_OVERRIDE(mbee_state, mono)
-
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50);
@@ -710,8 +708,6 @@ void mbee_state::mbeeic(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &mbee_state::mbeeic_io);
m_maincpu->set_daisy_config(mbee_daisy_chain);
- MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee)
-
Z80PIO(config, m_pio, 13.5_MHz_XTAL / 4);
m_pio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
m_pio->out_pa_callback().set("cent_data_out", FUNC(output_latch_device::write));
@@ -730,8 +726,6 @@ void mbee_state::mbeeic(machine_config &config)
PALETTE(config, m_palette, FUNC(mbee_state::standard_palette), 100);
- MCFG_VIDEO_START_OVERRIDE(mbee_state, standard)
-
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50);
@@ -773,7 +767,6 @@ void mbee_state::mbeeppc(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &mbee_state::mbeeppc_mem);
m_maincpu->set_addrmap(AS_IO, &mbee_state::mbeeppc_io);
- MCFG_VIDEO_START_OVERRIDE(mbee_state, premium)
subdevice<gfxdecode_device>("gfxdecode")->set_info(gfx_premium);
m_palette->set_init(FUNC(mbee_state::premium_palette));
@@ -786,7 +779,6 @@ void mbee_state::mbee56(machine_config &config)
mbeeic(config);
m_maincpu->set_addrmap(AS_PROGRAM, &mbee_state::mbee56_mem);
m_maincpu->set_addrmap(AS_IO, &mbee_state::mbee56_io);
- MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee56)
WD2793(config, m_fdc, 4_MHz_XTAL / 2);
m_fdc->intrq_wr_callback().set(FUNC(mbee_state::fdc_intrq_w));
@@ -801,7 +793,6 @@ void mbee_state::mbee128(machine_config &config)
mbee56(config);
m_maincpu->set_addrmap(AS_PROGRAM, &mbee_state::mbee256_mem);
m_maincpu->set_addrmap(AS_IO, &mbee_state::mbee128_io);
- MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee128)
MC146818(config, m_rtc, 32.768_kHz_XTAL);
m_rtc->irq().set(FUNC(mbee_state::rtc_irq_w));
@@ -812,7 +803,6 @@ void mbee_state::mbee128p(machine_config &config)
mbeeppc(config);
m_maincpu->set_addrmap(AS_PROGRAM, &mbee_state::mbee256_mem);
m_maincpu->set_addrmap(AS_IO, &mbee_state::mbee128_io);
- MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee128)
WD2793(config, m_fdc, 4_MHz_XTAL / 2);
m_fdc->intrq_wr_callback().set(FUNC(mbee_state::fdc_intrq_w));
@@ -827,7 +817,6 @@ void mbee_state::mbee256(machine_config &config)
mbee128p(config);
m_maincpu->set_addrmap(AS_PROGRAM, &mbee_state::mbee256_mem);
m_maincpu->set_addrmap(AS_IO, &mbee_state::mbee256_io);
- MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee256)
config.device_remove("fdc:0");
config.device_remove("fdc:1");
@@ -840,7 +829,6 @@ void mbee_state::mbeett(machine_config &config)
mbeeppc(config);
m_maincpu->set_addrmap(AS_PROGRAM, &mbee_state::mbeett_mem);
m_maincpu->set_addrmap(AS_IO, &mbee_state::mbeett_io);
- MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbeett)
config.device_remove("quickload");
config.device_remove("quickload2");
SCC8530(config, "scc", 4000000); // clock unknown
@@ -860,14 +848,19 @@ void mbee_state::mbeett(machine_config &config)
ROM_START( mbee )
- ROM_REGION( 0x7000, "maincpu", 0 )
+ ROM_REGION( 0x6000, "maincpu", 0 )
ROM_LOAD("bas510a.ic25", 0x0000, 0x1000, CRC(2ca47c36) SHA1(f36fd0afb3f1df26edc67919e78000b762b6cbcb) )
ROM_LOAD("bas510b.ic27", 0x1000, 0x1000, CRC(a07a0c51) SHA1(dcbdd9df78b4b6b2972de2e4050dabb8ae9c3f5a) )
ROM_LOAD("bas510c.ic28", 0x2000, 0x1000, CRC(906ac00f) SHA1(9b46458e5755e2c16cdb191a6a70df6de9fe0271) )
ROM_LOAD("bas510d.ic30", 0x3000, 0x1000, CRC(61727323) SHA1(c0fea9fd0e25beb9faa7424db8efd07cf8d26c1b) )
- ROM_LOAD_OPTIONAL("edasma.ic31", 0x4000, 0x1000, CRC(120c3dea) SHA1(32c9bb6e54dd50d5218bb43cc921885a0307161d) )
- ROM_LOAD_OPTIONAL("edasmb.ic33", 0x5000, 0x1000, CRC(a23bf3c8) SHA1(73a57c2800a1c744b527d0440b170b8b03351753) )
- ROM_LOAD_OPTIONAL("telcom10.rom", 0x6000, 0x1000, CRC(cc9ac94d) SHA1(6804b5ff54d16f8e06180751d8681c44f351e0bb) )
+
+ ROM_REGION( 0x1000, "telcomrom", 0 )
+ ROM_LOAD_OPTIONAL("telcom10.rom", 0x0000, 0x1000, CRC(cc9ac94d) SHA1(6804b5ff54d16f8e06180751d8681c44f351e0bb) )
+
+ // there's no actual PAK board or command in this machine
+ ROM_REGION( 0x20000, "pakrom", ROMREGION_ERASEFF )
+ ROM_LOAD_OPTIONAL("edasma.ic31", 0x0000, 0x1000, CRC(120c3dea) SHA1(32c9bb6e54dd50d5218bb43cc921885a0307161d) )
+ ROM_LOAD_OPTIONAL("edasmb.ic33", 0x1000, 0x1000, CRC(a23bf3c8) SHA1(73a57c2800a1c744b527d0440b170b8b03351753) )
// first 0x800 for normal chars, 2nd 0x800 for small chars. Some roms don't have small chars so normal ones loaded twice.
ROM_REGION( 0x1000, "chargen", 0 )
@@ -879,10 +872,12 @@ ROM_START( mbee )
ROM_END
ROM_START( mbeeic )
- ROM_REGION( 0x5000, "maincpu", 0 )
+ ROM_REGION( 0x4000, "maincpu", 0 )
ROM_LOAD("bas522a.rom", 0x0000, 0x2000, CRC(7896a696) SHA1(a158f7803296766160e1f258dfc46134735a9477) )
ROM_LOAD("bas522b.rom", 0x2000, 0x2000, CRC(b21d9679) SHA1(332844433763331e9483409cd7da3f90ac58259d) )
- ROM_LOAD_OPTIONAL("telcom12.rom", 0x4000, 0x1000, CRC(0231bda3) SHA1(be7b32499034f985cc8f7865f2bc2b78c485585c) )
+
+ ROM_REGION( 0x1000, "telcomrom", 0 )
+ ROM_LOAD_OPTIONAL("telcom12.rom", 0x0000, 0x1000, CRC(0231bda3) SHA1(be7b32499034f985cc8f7865f2bc2b78c485585c) )
/* PAK option roms */
ROM_REGION( 0x20000, "pakrom", ROMREGION_ERASEFF )
@@ -1125,16 +1120,16 @@ ROM_END
***************************************************************************/
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME
-COMP( 1982, mbee, 0, 0, mbee, mbee, mbee_state, init_mbee, "Applied Technology", "Microbee 16 Standard", 0 )
-COMP( 1982, mbeeic, mbee, 0, mbeeic, mbee, mbee_state, init_mbeeic, "Applied Technology", "Microbee 32 IC", 0 )
-COMP( 1982, mbeepc, mbee, 0, mbeepc, mbee, mbee_state, init_mbeepc, "Applied Technology", "Microbee Personal Communicator", 0 )
-COMP( 1985, mbeepc85, mbee, 0, mbeepc, mbee, mbee_state, init_mbeepc85, "Applied Technology", "Microbee PC85", 0 )
-COMP( 1985, mbeepc85b, mbee, 0, mbeepc, mbee, mbee_state, init_mbeepc85, "Applied Technology", "Microbee PC85 (New version)", 0 )
-COMP( 1985, mbeepc85s, mbee, 0, mbeepc, mbee, mbee_state, init_mbeepc85, "Applied Technology", "Microbee PC85 (Swedish)", 0 )
-COMP( 1986, mbeeppc, mbee, 0, mbeeppc, mbee, mbee_state, init_mbeeppc, "Applied Technology", "Microbee Premium PC85", 0 )
-COMP( 1986, mbeett, mbee, 0, mbeett, mbee256, mbee_state, init_mbeett, "Applied Technology", "Microbee Teleterm", MACHINE_NOT_WORKING )
-COMP( 1986, mbee56, mbee, 0, mbee56, mbee, mbee_state, init_mbee56, "Applied Technology", "Microbee 56k", MACHINE_NOT_WORKING )
-COMP( 1986, mbee128, mbee, 0, mbee128, mbee128, mbee_state, init_mbee128, "Applied Technology", "Microbee 128k Standard", MACHINE_NOT_WORKING )
-COMP( 1986, mbee128p, mbee, 0, mbee128p, mbee128, mbee_state, init_mbee128, "Applied Technology", "Microbee 128k Premium", MACHINE_NOT_WORKING )
-COMP( 1987, mbee256, mbee, 0, mbee256, mbee256, mbee_state, init_mbee256, "Applied Technology", "Microbee 256TC", MACHINE_NOT_WORKING )
-COMP( 2012, mbeepp, mbee, 0, mbee256, mbee128, mbee_state, init_mbee128, "Microbee Systems", "Microbee Premium Plus", MACHINE_NOT_WORKING )
+COMP( 1982, mbee, 0, 0, mbee, mbee, mbee_state, init_mbee, "Applied Technology", "Microbee 16 Standard", MACHINE_SUPPORTS_SAVE )
+COMP( 1982, mbeeic, mbee, 0, mbeeic, mbee, mbee_state, init_mbeeic, "Applied Technology", "Microbee 32 IC", MACHINE_SUPPORTS_SAVE )
+COMP( 1982, mbeepc, mbee, 0, mbeepc, mbee, mbee_state, init_mbeeic, "Applied Technology", "Microbee Personal Communicator", MACHINE_SUPPORTS_SAVE )
+COMP( 1985, mbeepc85, mbee, 0, mbeepc, mbee, mbee_state, init_mbeeic, "Applied Technology", "Microbee PC85", MACHINE_SUPPORTS_SAVE )
+COMP( 1985, mbeepc85b, mbee, 0, mbeepc, mbee, mbee_state, init_mbeeic, "Applied Technology", "Microbee PC85 (New version)", MACHINE_SUPPORTS_SAVE )
+COMP( 1985, mbeepc85s, mbee, 0, mbeepc, mbee, mbee_state, init_mbeeic, "Applied Technology", "Microbee PC85 (Swedish)", MACHINE_SUPPORTS_SAVE )
+COMP( 1986, mbeeppc, mbee, 0, mbeeppc, mbee, mbee_state, init_mbeeppc, "Applied Technology", "Microbee Premium PC85", MACHINE_SUPPORTS_SAVE )
+COMP( 1986, mbeett, mbee, 0, mbeett, mbee256, mbee_state, init_mbeett, "Applied Technology", "Microbee Teleterm", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
+COMP( 1986, mbee56, mbee, 0, mbee56, mbee, mbee_state, init_mbee56, "Applied Technology", "Microbee 56k", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
+COMP( 1986, mbee128, mbee, 0, mbee128, mbee128, mbee_state, init_mbee128, "Applied Technology", "Microbee 128k Standard", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
+COMP( 1986, mbee128p, mbee, 0, mbee128p, mbee128, mbee_state, init_mbee128p, "Applied Technology", "Microbee 128k Premium", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
+COMP( 1987, mbee256, mbee, 0, mbee256, mbee256, mbee_state, init_mbee256, "Applied Technology", "Microbee 256TC", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
+COMP( 2012, mbeepp, mbee, 0, mbee256, mbee128, mbee_state, init_mbeepp, "Microbee Systems", "Microbee Premium Plus", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/includes/mbee.h b/src/mame/includes/mbee.h
index 45679518f76..a1cc801322f 100644
--- a/src/mame/includes/mbee.h
+++ b/src/mame/includes/mbee.h
@@ -72,15 +72,15 @@ public:
void mbeepc(machine_config &config);
void mbee128p(machine_config &config);
- void init_mbeepc85();
- void init_mbee256();
- void init_mbee56();
- void init_mbeett();
- void init_mbeeppc();
- void init_mbee();
- void init_mbeepc();
- void init_mbeeic();
- void init_mbee128();
+ void init_mbee() { m_features = 0x00; };
+ void init_mbeett() { m_features = 0x0d; };
+ void init_mbeeppc() { m_features = 0x09; };
+ void init_mbeepp() { m_features = 0x29; }; // TODO: give 1MB ram when we find out how it is switched (feature byte = 0x39)
+ void init_mbeeic() { m_features = 0x01; };
+ void init_mbee56() { m_features = 0x03; };
+ void init_mbee128() { m_features = 0x11; };
+ void init_mbee128p() { m_features = 0x19; };
+ void init_mbee256() { m_features = 0x2d; };
private:
enum
@@ -116,16 +116,8 @@ private:
DECLARE_WRITE_LINE_MEMBER(crtc_vs);
uint8_t fdc_status_r();
void fdc_motor_w(uint8_t data);
- DECLARE_MACHINE_RESET(mbee);
- DECLARE_VIDEO_START(mono);
- DECLARE_VIDEO_START(standard);
- DECLARE_VIDEO_START(premium);
void standard_palette(palette_device &palette) const;
void premium_palette(palette_device &palette) const;
- DECLARE_MACHINE_RESET(mbee56);
- DECLARE_MACHINE_RESET(mbee128);
- DECLARE_MACHINE_RESET(mbee256);
- DECLARE_MACHINE_RESET(mbeett);
uint32_t screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(timer_newkb);
DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_bee);
@@ -135,6 +127,8 @@ private:
WRITE_LINE_MEMBER(fdc_drq_w);
MC6845_UPDATE_ROW(crtc_update_row);
MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr);
+ void machine_start() override;
+ void machine_reset() override;
required_device<palette_device> m_palette;
void mbee128_io(address_map &map);
@@ -153,8 +147,7 @@ private:
void mbeett_io(address_map &map);
void mbeett_mem(address_map &map);
- bool m_is_premium;
- bool m_has_oldkb;
+ u8 m_features;
size_t m_size;
bool m_b7_rtc;
bool m_b7_vs;
@@ -164,9 +157,9 @@ private:
uint8_t m_0a;
uint8_t m_0b;
uint8_t m_1c;
- uint8_t m_mbee256_was_pressed[15];
- uint8_t m_mbee256_q[20];
- uint8_t m_mbee256_q_pos;
+ uint8_t m_newkb_was_pressed[15];
+ uint8_t m_newkb_q[20];
+ uint8_t m_newkb_q_pos;
uint8_t m_sy6545_reg[32];
uint8_t m_sy6545_ind;
uint8_t m_fdc_rq;
@@ -180,7 +173,6 @@ private:
void setup_banks(uint8_t data, bool first_time, uint8_t b_mask);
void oldkb_scan(uint16_t param);
void oldkb_matrix_r(uint16_t offs);
- void machine_reset_common();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
required_device<z80_device> m_maincpu;
required_device<z80pio_device> m_pio;
diff --git a/src/mame/machine/mbee.cpp b/src/mame/machine/mbee.cpp
index 32da7fbfb7a..3540076b3b4 100644
--- a/src/mame/machine/mbee.cpp
+++ b/src/mame/machine/mbee.cpp
@@ -163,25 +163,25 @@ TIMER_CALLBACK_MEMBER( mbee_state::timer_newkb )
for (i = 0; i < 15; i++)
{
pressed = m_io_newkb[i]->read();
- if (pressed != m_mbee256_was_pressed[i])
+ if (pressed != m_newkb_was_pressed[i])
{
// get scankey value
for (j = 0; j < 8; j++)
{
- if (BIT(pressed^m_mbee256_was_pressed[i], j))
+ if (BIT(pressed^m_newkb_was_pressed[i], j))
{
// put it in the queue
uint8_t code = (i << 3) | j | (BIT(pressed, j) ? 0x80 : 0);
- m_mbee256_q[m_mbee256_q_pos] = code;
- if (m_mbee256_q_pos < 19) m_mbee256_q_pos++;
+ m_newkb_q[m_newkb_q_pos] = code;
+ if (m_newkb_q_pos < 19) m_newkb_q_pos++;
}
}
- m_mbee256_was_pressed[i] = pressed;
+ m_newkb_was_pressed[i] = pressed;
}
}
// if anything queued, cause an interrupt
- if (m_mbee256_q_pos)
+ if (m_newkb_q_pos)
m_b2 = 1; // set irq
if (m_b2)
@@ -192,12 +192,12 @@ TIMER_CALLBACK_MEMBER( mbee_state::timer_newkb )
uint8_t mbee_state::port18_r()
{
- uint8_t i, data = m_mbee256_q[0]; // get oldest key
+ uint8_t i, data = m_newkb_q[0]; // get oldest key
- if (m_mbee256_q_pos)
+ if (m_newkb_q_pos)
{
- m_mbee256_q_pos--;
- for (i = 0; i < m_mbee256_q_pos; i++) m_mbee256_q[i] = m_mbee256_q[i+1]; // ripple queue
+ m_newkb_q_pos--;
+ for (i = 0; i < m_newkb_q_pos; i++) m_newkb_q[i] = m_newkb_q[i+1]; // ripple queue
}
m_b2 = 0; // clear irq
@@ -434,182 +434,164 @@ uint8_t mbee_state::telcom_high_r()
It gets set back to normal on the first attempt to write to memory. (/WR line goes active).
*/
-
-void mbee_state::machine_reset_common()
+void mbee_state::machine_start()
{
+ // must init these vars here, or weird random crashes can occur when scroll lock pressed
m_fdc_rq = 0;
m_08 = 0;
m_0a = 0;
m_0b = 0;
m_1c = 0;
+ save_item(NAME(m_features));
+ save_item(NAME(m_size));
+ save_item(NAME(m_b7_rtc));
+ save_item(NAME(m_b7_vs));
+ save_item(NAME(m_b2));
+ save_item(NAME(m_framecnt)); // not important
+ save_item(NAME(m_08));
+ save_item(NAME(m_0a));
+ save_item(NAME(m_0b));
+ save_item(NAME(m_1c));
+ save_item(NAME(m_newkb_was_pressed));
+ save_item(NAME(m_newkb_q));
+ save_item(NAME(m_newkb_q_pos));
+ save_item(NAME(m_sy6545_reg));
+ save_item(NAME(m_sy6545_ind));
+ save_item(NAME(m_fdc_rq));
+ save_item(NAME(m_bank_array));
+
+ // banking of the BASIC roms
if (m_basic)
- m_basic->set_entry(0);
+ {
+ u8 *b = memregion("basicrom")->base();
+ m_basic->configure_entries(0, 2, b, 0x2000);
+ }
+ // banking of the TELCOM rom
if (m_telcom)
- m_telcom->set_entry(0);
-}
-
-MACHINE_RESET_MEMBER( mbee_state, mbee )
-{
- machine_reset_common();
- m_maincpu->set_pc(0x8000);
-}
-
-MACHINE_RESET_MEMBER( mbee_state, mbee56 )
-{
- machine_reset_common();
- m_maincpu->set_pc(0xE000);
-}
-
-MACHINE_RESET_MEMBER( mbee_state, mbee128 )
-{
- machine_reset_common();
- setup_banks(0, 1, 3); // set banks to default
- m_maincpu->set_pc(0x8000);
-}
-
-MACHINE_RESET_MEMBER( mbee_state, mbee256 )
-{
- m_mbee256_q_pos = 0;
- machine_reset_common();
- setup_banks(0, 1, 7); // set banks to default
- m_maincpu->set_pc(0x8000);
-}
-
-MACHINE_RESET_MEMBER( mbee_state, mbeett )
-{
- m_mbee256_q_pos = 0;
- machine_reset_common();
- m_maincpu->set_pc(0x8000);
-}
-
-void mbee_state::init_mbee()
-{
- m_size = 0x8000;
- m_has_oldkb = 1;
-}
-
-void mbee_state::init_mbeeic()
-{
- uint8_t *RAM = memregion("pakrom")->base();
- m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000);
- m_pak->set_entry(0);
-
- m_size = 0x8000;
- m_has_oldkb = 1;
-}
-
-void mbee_state::init_mbeepc()
-{
- uint8_t *RAM = memregion("telcomrom")->base();
- m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000);
-
- RAM = memregion("pakrom")->base();
- m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000);
- m_pak->set_entry(0);
-
- m_size = 0x8000;
- m_has_oldkb = 1;
-}
+ {
+ u8 *t = memregion("telcomrom")->base();
+ m_telcom->configure_entries(0, 2, t, 0x1000);
+ }
-void mbee_state::init_mbeepc85()
-{
- uint8_t *RAM = memregion("telcomrom")->base();
- m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000);
+ // PAKs fitted
+ if (m_pak)
+ {
+ u8 *p = memregion("pakrom")->base();
+ m_pak->configure_entries(0, 16, p, 0x2000);
+ }
- RAM = memregion("pakrom")->base();
- m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000);
- m_pak->set_entry(5);
+ // videoram
+ m_vram = make_unique_clear<u8[]>(0x0800);
+ save_pointer(NAME(m_vram), 0x0800);
- m_size = 0x8000;
- m_has_oldkb = 1;
-}
-
-void mbee_state::init_mbeeppc()
-{
- uint8_t *RAM = memregion("basicrom")->base();
- m_basic->configure_entries(0, 2, &RAM[0x0000], 0x2000);
+ // colour
+ if (BIT(m_features, 0))
+ {
+ m_cram = make_unique_clear<u8[]>(0x0800);
+ save_pointer(NAME(m_cram), 0x0800);
+ }
- RAM = memregion("telcomrom")->base();
- m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000);
+ // minimal main ram
+ if (BIT(m_features, 1))
+ m_size = 0xE000;
+ else
+ m_size = 0x8000;
- RAM = memregion("pakrom")->base();
- m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000);
- m_pak->set_entry(5);
+ // new keyboard
+ if (BIT(m_features, 2))
+ timer_set(attotime::from_hz(1), TIMER_MBEE_NEWKB); /* kick-start timer for kbd */
- m_size = 0x8000;
- m_has_oldkb = 1;
-}
+ // premium
+ if (BIT(m_features, 3))
+ {
+ m_aram = make_unique_clear<u8[]>(0x0800);
+ save_pointer(NAME(m_aram), 0x0800);
+ m_pram = make_unique_clear<u8[]>(0x8800);
+ save_pointer(NAME(m_pram), 0x8800);
+ }
+ else
+ {
+ m_pram = make_unique_clear<u8[]>(0x0800);
+ save_pointer(NAME(m_pram), 0x0800);
+ }
-void mbee_state::init_mbee56()
-{
- m_size = 0xe000;
- m_has_oldkb = 1;
-}
+ // Banked systems
+ u8 b = BIT(m_features, 4, 2);
+ if (b)
+ {
+ u32 ramsize = 0x40000; // 128k
+ if (b == 2)
+ ramsize = 0x40000; // 256k
+ else
+ if (b == 3)
+ ramsize = 0x100000; // 1MB for PP
-// 128k uses 32 RAM banks.
-// PP has 1024k which is 256 banks, but having 64 banks stops it crashing during the self-test. Need a schematic before we can fix it.
-void mbee_state::init_mbee128()
-{
- m_ram = make_unique_clear<u8[]>(0x40000);
- m_dummy = std::make_unique<u8[]>(0x1000);
- u8 *r = m_ram.get();
- u8 *d = m_dummy.get();
- u8 *m = memregion("maincpu")->base();
+ m_ram = make_unique_clear<u8[]>(ramsize);
+ save_pointer(NAME(m_ram), ramsize);
+ m_dummy = std::make_unique<u8[]>(0x1000); // don't save this
- for (u8 b_bank = 0; b_bank < 16; b_bank++)
- {
- m_bankr[b_bank]->configure_entries(0, 64, r, 0x1000); // RAM banks
- m_bankr[b_bank]->configure_entries(64, 4, m, 0x1000); // rom
+ u8 *r = m_ram.get();
+ u8 *d = m_dummy.get();
+ u8 *m = memregion("maincpu")->base();
- m_bankw[b_bank]->configure_entries(0, 64, r, 0x1000); // RAM banks
- m_bankw[b_bank]->configure_entry(64, d); // dummy rom
+ for (u8 b_bank = 0; b_bank < 16; b_bank++)
+ {
+ m_bankr[b_bank]->configure_entries(0, 64, r, 0x1000); // RAM banks
+ m_bankr[b_bank]->configure_entries(64, 4, m, 0x1000); // rom
+ m_bankw[b_bank]->configure_entries(0, 64, r, 0x1000); // RAM banks
+ m_bankw[b_bank]->configure_entry(64, d); // dummy rom
+ }
}
-
- m_size = 0x8000;
- m_has_oldkb = 1;
}
-void mbee_state::init_mbee256()
+void mbee_state::machine_reset()
{
- m_ram = make_unique_clear<u8[]>(0x40000);
- m_dummy = std::make_unique<u8[]>(0x1000);
- u8 *r = m_ram.get();
- u8 *d = m_dummy.get();
- u8 *m = memregion("maincpu")->base();
-
- for (u8 b_bank = 0; b_bank < 16; b_bank++)
- {
- m_bankr[b_bank]->configure_entries(0, 64, r, 0x1000); // RAM banks
- m_bankr[b_bank]->configure_entries(64, 4, m, 0x1000); // rom
+ m_fdc_rq = 0;
+ m_08 = 0;
+ m_0a = 0;
+ m_0b = 0;
+ m_1c = 0;
- m_bankw[b_bank]->configure_entries(0, 64, r, 0x1000); // RAM banks
- m_bankw[b_bank]->configure_entry(64, d); // dummy rom
- }
+ // set default chars
+ memcpy(m_pram.get(), memregion("chargen")->base(), 0x800);
- timer_set(attotime::from_hz(1), TIMER_MBEE_NEWKB); /* kick-start timer for kbd */
+ if (m_basic)
+ m_basic->set_entry(0);
- m_size = 0x8000;
- m_has_oldkb = 0;
-}
+ if (m_telcom)
+ m_telcom->set_entry(0);
-void mbee_state::init_mbeett()
-{
- uint8_t *RAM = memregion("telcomrom")->base();
- m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000);
+ if (m_pak)
+ m_pak->set_entry(5);
- RAM = memregion("pakrom")->base();
- m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000);
- m_pak->set_entry(5);
+ m_maincpu->set_pc(m_size);
- timer_set(attotime::from_hz(1), TIMER_MBEE_NEWKB); /* kick-start timer for kbd */
+ // init new kbd
+ if (BIT(m_features, 2))
+ m_newkb_q_pos = 0;
- m_size = 0x8000;
- m_has_oldkb = 0;
+ // set banks to default
+ if (BIT(m_features, 4, 2) == 1)
+ setup_banks(0, 1, 3);
+ else
+ if (BIT(m_features, 4, 2) == 2)
+ setup_banks(0, 1, 7);
+ else
+ if (BIT(m_features, 4, 2) == 3)
+ setup_banks(0, 1, 31);
}
+/* m_features:
+bit 0 : (colour fitted) 1 = yes
+bit 1 : (initial pc value / size of main ram) 1=0xE000, 0=0x8000
+bit 2 : (keyboard type) 1 = new keyboard
+bit 3 : (core type) 1 = premium
+bit 4,5 : (banking main ram) 0x10 = 128k; 0x20 = 256k
+*/
+
/***********************************************************
Quickload
diff --git a/src/mame/video/mbee.cpp b/src/mame/video/mbee.cpp
index 903ec947e94..30e1c607ce1 100644
--- a/src/mame/video/mbee.cpp
+++ b/src/mame/video/mbee.cpp
@@ -63,7 +63,7 @@ WRITE_LINE_MEMBER( mbee_state::crtc_vs )
uint8_t mbee_state::video_low_r(offs_t offset)
{
- if (m_is_premium && ((m_1c & 0x9f) == 0x90))
+ if (BIT(m_features, 3) && ((m_1c & 0x9f) == 0x90))
return m_aram[offset];
else
if (m_0b)
@@ -77,7 +77,7 @@ void mbee_state::video_low_w(offs_t offset, uint8_t data)
if (BIT(m_1c, 4))
{
// non-premium attribute writes are discarded
- if (m_is_premium && BIT(m_1c, 7))
+ if (BIT(m_features, 3) && BIT(m_1c, 7))
m_aram[offset] = data;
}
else
@@ -127,7 +127,7 @@ void mbee_state::port1c_w(uint8_t data)
d4 select attribute ram
d3..d0 select videoram bank */
- if (m_is_premium && BIT(data, 7))
+ if (BIT(m_features, 3) && BIT(data, 7))
m_1c = data;
else
m_1c = data & 0x30;
@@ -146,7 +146,7 @@ void mbee_state::port1c_w(uint8_t data)
void mbee_state::oldkb_matrix_r(uint16_t offs)
{
- if (m_has_oldkb)
+ if (!BIT(m_features, 2))
{
uint8_t port = (offs >> 7) & 7;
uint8_t bit = (offs >> 4) & 7;
@@ -157,7 +157,7 @@ void mbee_state::oldkb_matrix_r(uint16_t offs)
// This adds premium-style cursor keys to the old keyboard.
// They are used by the pc85 menu. Premium keyboards already
// have these keys fitted.
- if (!keydown && !m_is_premium)
+ if (!keydown && !BIT(m_features, 3))
{
if ((port == 0) || (port == 2) || (port == 3))
extra = m_io_x7->read();
@@ -241,33 +241,6 @@ void mbee_state::m6545_data_w(uint8_t data)
************************************************************/
-VIDEO_START_MEMBER( mbee_state, mono )
-{
- m_vram = make_unique_clear<u8[]>(0x0800);
- m_pram = make_unique_clear<u8[]>(0x1000);
- memcpy(m_pram.get(), memregion("chargen")->base(), 0x800);
- m_is_premium = 0;
-}
-
-VIDEO_START_MEMBER( mbee_state, standard )
-{
- m_vram = make_unique_clear<u8[]>(0x0800);
- m_pram = make_unique_clear<u8[]>(0x1000);
- m_cram = make_unique_clear<u8[]>(0x0800);
- memcpy(m_pram.get(), memregion("chargen")->base(), 0x800);
- m_is_premium = 0;
-}
-
-VIDEO_START_MEMBER( mbee_state, premium )
-{
- m_vram = make_unique_clear<u8[]>(0x0800);
- m_pram = make_unique_clear<u8[]>(0x8800);
- m_cram = make_unique_clear<u8[]>(0x0800);
- m_aram = make_unique_clear<u8[]>(0x0800);
- memcpy(m_pram.get(), memregion("chargen")->base(), 0x800);
- m_is_premium = 1;
-}
-
uint32_t mbee_state::screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_framecnt++;
@@ -290,10 +263,10 @@ MC6845_UPDATE_ROW( mbee_state::crtc_update_row )
const rgb_t *palette = m_palette->palette()->entry_list_raw();
// colours
- uint8_t colourm = (m_08 & 0x0e) >> 1;
- uint8_t monopal = (m_io_config->read() & 0x30) >> 4;
+ uint8_t colourm = BIT(m_08, 2, 3);
+ uint8_t monopal = BIT(m_io_config->read(), 4, 2);
// if colour chosen on mono bee, default to amber
- if (!monopal && !m_cram)
+ if ((monopal==0) && !BIT(m_features, 0))
monopal = 2;
uint32_t *p = &bitmap.pix32(y);
@@ -326,11 +299,11 @@ MC6845_UPDATE_ROW( mbee_state::crtc_update_row )
gfx = m_pram[(chr<<4) | ra] ^ inv;
// get colours
- if (!monopal)
+ if (monopal==0)
{
col = m_cram[mem]; // read a byte of colour
- if (m_is_premium)
+ if (BIT(m_features, 3)) // premium
{
fg = col & 15;
bg = col >> 4;