diff options
author | Robbbert <Robbbert@users.noreply.github.com> | 2020-06-07 22:08:42 +1000 |
---|---|---|
committer | Robbbert <Robbbert@users.noreply.github.com> | 2020-06-07 22:08:42 +1000 |
commit | 9512a41c976c4d26490f71745f28aa08ac59d6d3 (patch) | |
tree | 9a71444fbcc32209c2f914e85c87580c47884f59 | |
parent | 228ddfb7aa055b64b51af2c6179ee45d8a9796b3 (diff) |
(nw) excali64, br8641: cleaned
-rw-r--r-- | src/mame/drivers/br8641.cpp | 43 | ||||
-rw-r--r-- | src/mame/drivers/excali64.cpp | 165 |
2 files changed, 114 insertions, 94 deletions
diff --git a/src/mame/drivers/br8641.cpp b/src/mame/drivers/br8641.cpp index d8177351d5a..ba9b44a74f6 100644 --- a/src/mame/drivers/br8641.cpp +++ b/src/mame/drivers/br8641.cpp @@ -44,16 +44,17 @@ public: , m_beep(*this, "beeper") { } - uint8_t port08_r(); - void port08_w(uint8_t data); - void port09_w(uint8_t data); - void brandt8641(machine_config &config); - void brandt8641_io(address_map &map); - void brandt8641_mem(address_map &map); + private: - uint8_t m_port08; - uint8_t m_port09; + virtual void machine_start() override; + void io_map(address_map &map); + void mem_map(address_map &map); + u8 port08_r(); + void port08_w(u8 data); + void port09_w(u8 data); + u8 m_port08; + u8 m_port09; required_device<z80_device> m_maincpu; required_device<z80pio_device> m_pio1; required_device<z80pio_device> m_pio2; @@ -63,14 +64,14 @@ private: required_device<beep_device> m_beep; }; -void brandt8641_state::brandt8641_mem(address_map &map) +void brandt8641_state::mem_map(address_map &map) { map.unmap_value_high(); map(0x0000, 0x7fff).rom(); // 27256 at U12 map(0x8000, 0x9fff).ram(); // 8KB static ram 6264 at U12 } -void brandt8641_state::brandt8641_io(address_map &map) +void brandt8641_state::io_map(address_map &map) { map.unmap_value_high(); map.global_mask(0xff); @@ -125,9 +126,9 @@ static INPUT_PORTS_START( brandt8641 ) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) INPUT_PORTS_END -uint8_t brandt8641_state::port08_r() +u8 brandt8641_state::port08_r() { - uint8_t i, data = 7; + u8 i, data = 7; for (i = 0; i < 8; i++) if (BIT(m_port09, i)) @@ -136,17 +137,23 @@ uint8_t brandt8641_state::port08_r() return data | m_port08; } -void brandt8641_state::port08_w(uint8_t data) +void brandt8641_state::port08_w(u8 data) { m_port08 = data & 0xf8; m_beep->set_state(BIT(data, 4)); } -void brandt8641_state::port09_w(uint8_t data) +void brandt8641_state::port09_w(u8 data) { m_port09 = data ^ 0xff; } +void brandt8641_state::machine_start() +{ + save_item(NAME(m_port08)); + save_item(NAME(m_port09)); +} + static const z80_daisy_config daisy_chain_intf[] = { { "pio1" }, @@ -162,8 +169,8 @@ void brandt8641_state::brandt8641(machine_config &config) { /* basic machine hardware */ Z80(config, m_maincpu, XTAL(4'000'000)); // U4 ,4MHz crystal on board - m_maincpu->set_addrmap(AS_PROGRAM, &brandt8641_state::brandt8641_mem); - m_maincpu->set_addrmap(AS_IO, &brandt8641_state::brandt8641_io); + m_maincpu->set_addrmap(AS_PROGRAM, &brandt8641_state::mem_map); + m_maincpu->set_addrmap(AS_IO, &brandt8641_state::io_map); m_maincpu->set_daisy_config(daisy_chain_intf); /* sound hardware */ @@ -190,9 +197,9 @@ void brandt8641_state::brandt8641(machine_config &config) /* ROM definition */ ROM_START( br8641 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASEFF ) ROM_LOAD( "v0911he.u11", 0x0000, 0x8000, CRC(59a16951) SHA1(893dba60ec8bfa391fb2d2a30db5d42d601f5eb9)) ROM_END /* Driver */ -COMP( 1986, br8641, 0, 0, brandt8641, brandt8641, brandt8641_state, empty_init, "Brandt", "Brandt 8641", MACHINE_NOT_WORKING ) +COMP( 1986, br8641, 0, 0, brandt8641, brandt8641, brandt8641_state, empty_init, "Brandt", "Brandt 8641", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/excali64.cpp b/src/mame/drivers/excali64.cpp index 84e7b3b84b9..973c2ea72c4 100644 --- a/src/mame/drivers/excali64.cpp +++ b/src/mame/drivers/excali64.cpp @@ -13,6 +13,7 @@ There are 2 versions of the colour prom, which have different palettes. We have the later version. Notes: +- When booted it asks for a disk. Press enter to start ROM BASIC. - Control W then Enter will switch between 40 and 80 characters per line. - Control V turns cursor on - Graphics commands such as LINE, CIRCLE, HGRCLS, HGRSET etc only work with disk basic @@ -74,27 +75,26 @@ public: void excali64(machine_config &config); -protected: - virtual void machine_reset() override; - private: + virtual void machine_reset() override; + virtual void machine_start() override; void excali64_palette(palette_device &palette); - void ppib_w(uint8_t data); - uint8_t ppic_r(); - void ppic_w(uint8_t data); - uint8_t port00_r(); - uint8_t port50_r(); - void port70_w(uint8_t data); - void porte4_w(uint8_t data); - uint8_t porte8_r(); - void portec_w(uint8_t data); + void ppib_w(u8 data); + u8 ppic_r(); + void ppic_w(u8 data); + u8 port00_r(); + u8 port50_r(); + void port70_w(u8 data); + void porte4_w(u8 data); + u8 porte8_r(); + void portec_w(u8 data); DECLARE_FLOPPY_FORMATS(floppy_formats); DECLARE_WRITE_LINE_MEMBER(cent_busy_w); DECLARE_WRITE_LINE_MEMBER(busreq_w); - uint8_t memory_read_byte(offs_t offset); - void memory_write_byte(offs_t offset, uint8_t data); - uint8_t io_read_byte(offs_t offset); - void io_write_byte(offs_t offset, uint8_t data); + u8 memory_read_byte(offs_t offset); + void memory_write_byte(offs_t offset, u8 data); + u8 io_read_byte(offs_t offset); + void io_write_byte(offs_t offset, u8 data); MC6845_UPDATE_ROW(update_row); DECLARE_WRITE_LINE_MEMBER(crtc_hs); DECLARE_WRITE_LINE_MEMBER(crtc_vs); @@ -103,16 +103,17 @@ private: void io_map(address_map &map); void mem_map(address_map &map); - uint8_t *m_p_videoram; - uint8_t *m_p_hiresram; - uint8_t m_sys_status; - uint8_t m_kbdrow; + u8 m_sys_status; + u8 m_kbdrow; bool m_crtc_vs; bool m_crtc_hs; bool m_motor; bool m_centronics_busy; + std::unique_ptr<u8[]> m_vram; + std::unique_ptr<u8[]> m_hram; + std::unique_ptr<u8[]> m_ram; required_device<palette_device> m_palette; - required_device<cpu_device> m_maincpu; + required_device<z80_device> m_maincpu; required_region_ptr<u8> m_p_chargen; required_device<cassette_image_device> m_cass; required_device<mc6845_device> m_crtc; @@ -131,7 +132,7 @@ void excali64_state::mem_map(address_map &map) map(0x2000, 0x2FFF).bankr("bankr2").bankw("bankw2"); map(0x3000, 0x3FFF).bankr("bankr3").bankw("bankw3"); map(0x4000, 0xBFFF).bankr("bankr4").bankw("bankw4"); - map(0xC000, 0xFFFF).ram().region("rambank", 0xC000); + map(0xC000, 0xFFFF).ram(); } void excali64_state::io_map(address_map &map) @@ -257,12 +258,12 @@ WRITE_LINE_MEMBER( excali64_state::motor_w ) m_floppy0->get_device()->mon_w(!m_motor); } -uint8_t excali64_state::porte8_r() +u8 excali64_state::porte8_r() { - return 0xfc | (uint8_t)m_motor; + return 0xfc | (u8)m_motor; } -void excali64_state::porte4_w(uint8_t data) +void excali64_state::porte4_w(u8 data) { floppy_image_device *floppy = nullptr; if (BIT(data, 0)) @@ -283,7 +284,7 @@ d0 = precomp (selectable by jumper) d1 = size select d2 = density select (0 = double) */ -void excali64_state::portec_w(uint8_t data) +void excali64_state::portec_w(u8 data) { m_fdc->enmf_w(BIT(data, 1)); m_fdc->dden_w(BIT(data, 2)); @@ -296,52 +297,52 @@ WRITE_LINE_MEMBER( excali64_state::busreq_w ) m_dma->bai_w(state); // tell dma that bus has been granted } -uint8_t excali64_state::memory_read_byte(offs_t offset) +u8 excali64_state::memory_read_byte(offs_t offset) { address_space& prog_space = m_maincpu->space(AS_PROGRAM); return prog_space.read_byte(offset); } -void excali64_state::memory_write_byte(offs_t offset, uint8_t data) +void excali64_state::memory_write_byte(offs_t offset, u8 data) { address_space& prog_space = m_maincpu->space(AS_PROGRAM); prog_space.write_byte(offset, data); } -uint8_t excali64_state::io_read_byte(offs_t offset) +u8 excali64_state::io_read_byte(offs_t offset) { address_space& prog_space = m_maincpu->space(AS_IO); return prog_space.read_byte(offset); } -void excali64_state::io_write_byte(offs_t offset, uint8_t data) +void excali64_state::io_write_byte(offs_t offset, u8 data) { address_space& prog_space = m_maincpu->space(AS_IO); prog_space.write_byte(offset, data); } -void excali64_state::ppib_w(uint8_t data) +void excali64_state::ppib_w(u8 data) { m_kbdrow = data; } -uint8_t excali64_state::ppic_r() +u8 excali64_state::ppic_r() { - uint8_t data = 0xf4; // READY line must be low to print - data |= (uint8_t)m_centronics_busy; + u8 data = 0xf4; // READY line must be low to print + data |= (u8)m_centronics_busy; data |= (m_cass->input() > 0.1) << 3; return data; } -void excali64_state::ppic_w(uint8_t data) +void excali64_state::ppic_w(u8 data) { m_cass->output(BIT(data, 7) ? -1.0 : +1.0); m_centronics->write_strobe(BIT(data, 4)); } -uint8_t excali64_state::port00_r() +u8 excali64_state::port00_r() { - uint8_t data = 0xff; + u8 data = 0xff; for (int i = 0; i < 8; i++) { @@ -360,11 +361,11 @@ d3 : 2nd colour set (previously, dispen, which is a mistake in hardware and sche d4 : vsync d5 : rombank */ -uint8_t excali64_state::port50_r() +u8 excali64_state::port50_r() { - uint8_t data = m_sys_status & 0x2f; + u8 data = m_sys_status & 0x2f; bool csync = m_crtc_hs | m_crtc_vs; - data |= (uint8_t)csync << 4; + data |= (u8)csync << 4; return data; } @@ -372,7 +373,7 @@ uint8_t excali64_state::port50_r() d0,1,2,3,5 : same as port50 (schematic wrongly says d7 used for 2nd colour set) */ -void excali64_state::port70_w(uint8_t data) +void excali64_state::port70_w(u8 data) { m_sys_status = data; m_crtc->set_unscaled_clock(BIT(data, 2) ? 2e6 : 1e6); @@ -428,6 +429,18 @@ void excali64_state::machine_reset() m_maincpu->reset(); } +void excali64_state::machine_start() +{ + save_pointer(NAME(m_vram), 0x2000); + save_pointer(NAME(m_hram), 0x8000); + save_pointer(NAME(m_ram), 0xc000); + save_item(NAME(m_sys_status)); + save_item(NAME(m_kbdrow)); + save_item(NAME(m_crtc_vs)); + save_item(NAME(m_crtc_hs)); + save_item(NAME(m_motor)); + save_item(NAME(m_centronics_busy)); +} WRITE_LINE_MEMBER( excali64_state::crtc_hs ) { m_crtc_hs = state; @@ -462,20 +475,23 @@ GFXDECODE_END void excali64_state::excali64_palette(palette_device &palette) { // do this here because driver_init hasn't run yet - m_p_videoram = memregion("videoram")->base(); - m_p_hiresram = m_p_videoram + 0x2000; - uint8_t *main = memregion("roms")->base(); - uint8_t *ram = memregion("rambank")->base(); + m_vram = make_unique_clear<u8[]>(0x2000); + m_hram = make_unique_clear<u8[]>(0x8000); + m_ram = make_unique_clear<u8[]>(0xc000); + u8 *v = m_vram.get(); + u8 *h = m_hram.get(); + u8 *r = m_ram.get(); + u8 *main = memregion("roms")->base(); // main ram (cp/m mode) - membank("bankr1")->configure_entry(0, &ram[0x0000]); - membank("bankr2")->configure_entry(0, &ram[0x2000]); - membank("bankr3")->configure_entry(0, &ram[0x3000]); - membank("bankr4")->configure_entry(0, &ram[0x4000]);//boot - membank("bankw1")->configure_entry(0, &ram[0x0000]);//boot - membank("bankw2")->configure_entry(0, &ram[0x2000]); - membank("bankw3")->configure_entry(0, &ram[0x3000]); - membank("bankw4")->configure_entry(0, &ram[0x4000]);//boot + membank("bankr1")->configure_entry(0, r); + membank("bankr2")->configure_entry(0, r+0x2000); + membank("bankr3")->configure_entry(0, r+0x3000); + membank("bankr4")->configure_entry(0, r+0x4000);//boot + membank("bankw1")->configure_entry(0, r);//boot + membank("bankw2")->configure_entry(0, r+0x2000); + membank("bankw3")->configure_entry(0, r+0x3000); + membank("bankw4")->configure_entry(0, r+0x4000);//boot // rom_1 membank("bankr1")->configure_entry(1, &main[0x0000]);//boot membank("bankr1")->configure_entry(2, &main[0x2000]); @@ -483,21 +499,21 @@ void excali64_state::excali64_palette(palette_device &palette) membank("bankr2")->configure_entry(1, &main[0x4000]);//boot membank("bankr3")->configure_entry(1, &main[0x5000]);//boot // videoram - membank("bankr2")->configure_entry(2, &m_p_videoram[0x0000]); - membank("bankw2")->configure_entry(2, &m_p_videoram[0x0000]);//boot + membank("bankr2")->configure_entry(2, v); + membank("bankw2")->configure_entry(2, v);//boot // hiresram - membank("bankr3")->configure_entry(2, &m_p_videoram[0x1000]); - membank("bankw3")->configure_entry(2, &m_p_videoram[0x1000]);//boot - membank("bankr4")->configure_entry(2, &m_p_hiresram[0x0000]); - membank("bankw4")->configure_entry(2, &m_p_hiresram[0x0000]); + membank("bankr3")->configure_entry(2, v+0x1000); + membank("bankw3")->configure_entry(2, v+0x1000);//boot + membank("bankr4")->configure_entry(2, h); + membank("bankw4")->configure_entry(2, h); // Set up foreground colours - for (uint8_t i = 0; i < 32; i++) + for (u8 i = 0; i < 32; i++) { - uint8_t const code = m_p_chargen[0x1000+i]; - uint8_t const r = (BIT(code, 0) ? 38 : 0) + (BIT(code, 1) ? 73 : 0) + (BIT(code, 2) ? 144 : 0); - uint8_t const b = (BIT(code, 3) ? 38 : 0) + (BIT(code, 4) ? 73 : 0) + (BIT(code, 5) ? 144 : 0); - uint8_t const g = (BIT(code, 6) ? 85 : 0) + (BIT(code, 7) ? 170 : 0); + u8 const code = m_p_chargen[0x1000+i]; + u8 const r = (BIT(code, 0) ? 38 : 0) + (BIT(code, 1) ? 73 : 0) + (BIT(code, 2) ? 144 : 0); + u8 const b = (BIT(code, 3) ? 38 : 0) + (BIT(code, 4) ? 73 : 0) + (BIT(code, 5) ? 144 : 0); + u8 const g = (BIT(code, 6) ? 85 : 0) + (BIT(code, 7) ? 170 : 0); palette.set_pen_color(i, r, g, b); } @@ -515,26 +531,26 @@ void excali64_state::excali64_palette(palette_device &palette) MC6845_UPDATE_ROW( excali64_state::update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,col,bg,fg; - uint16_t mem,x; - uint8_t col_base = BIT(m_sys_status, 3) ? 16 : 0; - uint32_t *p = &bitmap.pix32(y); + u8 chr,gfx,col,bg,fg; + u16 mem,x; + u8 col_base = BIT(m_sys_status, 3) ? 16 : 0; + u32 *p = &bitmap.pix32(y); for (x = 0; x < x_count; x++) { mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - col = m_p_videoram[mem+0x800]; + chr = m_vram[mem]; + col = m_vram[mem+0x800]; fg = col_base + (col >> 4); bg = 32 + ((col >> 1) & 7); if (BIT(col, 0)) { - uint8_t h = m_p_videoram[mem+0x1000] - 4; + u8 h = m_vram[mem+0x1000] - 4; if (h > 5) h = 0; // keep us in bounds // hires definition - pixels are opposite order to characters - gfx = bitswap<8>(m_p_hiresram[(h << 12) | (chr<<4) | ra], 0, 1, 2, 3, 4, 5, 6, 7); + gfx = bitswap<8>(m_hram[(h << 12) | (chr<<4) | ra], 0, 1, 2, 3, 4, 5, 6, 7); } else gfx = m_p_chargen[(chr<<4) | ra]; // normal character @@ -645,9 +661,6 @@ ROM_START( excali64 ) // patch out the protection ROM_FILL(0x3ce7, 1, 0) - ROM_REGION(0x10000, "rambank", ROMREGION_ERASE00) - ROM_REGION(0xA000, "videoram", ROMREGION_ERASE00) - ROM_REGION(0x1020, "chargen", 0) ROM_LOAD( "genex_3.ic43", 0x0000, 0x1000, CRC(b91619a9) SHA1(2ced636cb7b94ba9d329868d7ecf79963cefe9d9) ) ROM_LOAD( "hm7603.ic55", 0x1000, 0x0020, CRC(c74f47dc) SHA1(331ff3c913846191ddd97cacb80bd19438c1ff71) ) @@ -656,4 +669,4 @@ ROM_END /* Driver */ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1984, excali64, 0, 0, excali64, excali64, excali64_state, empty_init, "BGR Computers", "Excalibur 64", 0 ) +COMP( 1984, excali64, 0, 0, excali64, excali64, excali64_state, empty_init, "BGR Computers", "Excalibur 64", MACHINE_SUPPORTS_SAVE ) |