summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/tandy2k.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/tandy2k.cpp')
-rw-r--r--src/mame/drivers/tandy2k.cpp113
1 files changed, 66 insertions, 47 deletions
diff --git a/src/mame/drivers/tandy2k.cpp b/src/mame/drivers/tandy2k.cpp
index ce2a717e810..77546de9ab5 100644
--- a/src/mame/drivers/tandy2k.cpp
+++ b/src/mame/drivers/tandy2k.cpp
@@ -219,30 +219,6 @@ READ8_MEMBER( tandy2k_state::kbint_clr_r )
return 0xff;
}
-READ16_MEMBER( tandy2k_state::vpac_r )
-{
- if (ACCESSING_BITS_0_7)
- {
- return m_vpac->read(space, offset);
- }
- else
- {
- return 0xff00;
- }
-}
-
-WRITE16_MEMBER( tandy2k_state::vpac_w )
-{
- if (ACCESSING_BITS_0_7)
- {
- m_vpac->write(space, offset, data & 0xff);
- }
- else
- {
- addr_ctrl_w(space, offset, data >> 8);
- }
-}
-
READ8_MEMBER( tandy2k_state::fldtc_r )
{
if (LOG) logerror("FLDTC\n");
@@ -306,11 +282,16 @@ WRITE8_MEMBER( tandy2k_state::addr_ctrl_w )
// Memory Maps
+void tandy2k_state::vrambank_mem(address_map &map)
+{
+ map(0x00000, 0x17fff).ram().share("hires_ram");
+ map(0x18000, 0x1ffff).noprw();
+}
+
void tandy2k_state::tandy2k_mem(address_map &map)
{
map.unmap_value_high();
-// AM_RANGE(0x00000, 0xdffff) AM_RAM
- map(0xe0000, 0xf7fff).ram().share("hires_ram");
+ map(0xe0000, 0xe7fff).rw(m_vrambank, FUNC(address_map_bank_device::read16), FUNC(address_map_bank_device::write16));
map(0xf8000, 0xfbfff).rw(FUNC(tandy2k_state::char_ram_r), FUNC(tandy2k_state::char_ram_w)).umask16(0x00ff);
map(0xfc000, 0xfdfff).mirror(0x2000).rom().region(I80186_TAG, 0);
}
@@ -329,12 +310,11 @@ void tandy2k_state::tandy2k_io(address_map &map)
map(0x00060, 0x00063).mirror(0xc).rw(m_pic0, FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0x00ff);
map(0x00070, 0x00073).mirror(0xc).rw(m_pic1, FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0x00ff);
map(0x00080, 0x00080).mirror(0xe).rw(m_fdc, FUNC(i8272a_device::mdma_r), FUNC(i8272a_device::mdma_w));
-// AM_RANGE(0x00100, 0x0017f) AM_DEVREADWRITE8(CRT9007_TAG, crt9007_t, read, write, 0x00ff) AM_WRITE8(addr_ctrl_w, 0xff00)
- map(0x00100, 0x0017f).rw(FUNC(tandy2k_state::vpac_r), FUNC(tandy2k_state::vpac_w));
-// AM_RANGE(0x00180, 0x00180) AM_READ8(hires_status_r, 0x00ff)
-// AM_RANGE(0x00180, 0x001bf) AM_WRITE(hires_palette_w)
-// AM_RANGE(0x001a0, 0x001a0) AM_READ8(hires_plane_w, 0x00ff)
-// AM_RANGE(0x0ff00, 0x0ffff) AM_READWRITE(i186_internal_port_r, i186_internal_port_w)
+ map(0x00100, 0x0017f).rw(m_vpac, FUNC(crt9007_device::read), FUNC(crt9007_device::write)).umask16(0x00ff);
+ map(0x00100, 0x0017f).w(FUNC(tandy2k_state::addr_ctrl_w)).umask16(0xff00);
+ map(0x00180, 0x00180).r(FUNC(tandy2k_state::hires_status_r)).umask16(0x00ff);
+ map(0x00190, 0x0019f).w(m_colpal, FUNC(palette_device::write8)).umask16(0x00ff).share("colpal");
+ map(0x001a0, 0x001a0).w(FUNC(tandy2k_state::hires_plane_w)).umask16(0x00ff);
}
void tandy2k_state::tandy2k_hd_io(address_map &map)
@@ -361,7 +341,7 @@ INPUT_PORTS_END
uint32_t tandy2k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- const pen_t *pen = m_palette->pens();
+ const pen_t *cpen = m_colpal->pens();
address_space &program = m_maincpu->space(AS_PROGRAM);
for (int y = 0; y < 400; y++)
@@ -370,18 +350,32 @@ uint32_t tandy2k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma
for (int sx = 0; sx < 80; sx++)
{
- offs_t addr = m_ram->size() - 0x1400 + (((y / 16) * 80) + sx) * 2;
- uint16_t vidla = program.read_word(addr);
- uint8_t attr = vidla >> 8;
- uint8_t data = m_char_ram[((vidla & 0xff) << 4) | cgra];
- if(attr & 0x80)
- data = ~data;
-
- for (int x = 0; x < 8; x++)
+ if (m_hires_en & 2)
+ {
+ uint8_t a = ((uint8_t *)m_hires_ram.target())[(y * 80) + sx];
+ uint8_t b = ((uint8_t *)m_hires_ram.target())[(y * 80) + sx + 0x8000];
+ uint8_t c = ((uint8_t *)m_hires_ram.target())[(y * 80) + sx + 0x8000 * 2];
+ for (int x = 0; x < 8; x++)
+ {
+ int color = BIT(a, x) | (BIT(b, x) << 1) | (BIT(c, x) << 2);
+ bitmap.pix32(y, (sx * 8) + (7 - x)) = cpen[color];
+ }
+ }
+ else
{
- int color = BIT(data, 7);
- bitmap.pix32(y, (sx * 8) + x) = pen[color];
- data <<= 1;
+ offs_t addr = m_ram->size() - 0x1400 + (((y / 16) * 80) + sx) * 2;
+ uint16_t vidla = program.read_word(addr);
+ uint8_t attr = vidla >> 8;
+ uint8_t data = m_char_ram[((vidla & 0xff) << 4) | cgra];
+ if(attr & 0x80)
+ data = ~data;
+
+ for (int x = 0; x < 8; x++)
+ {
+ int color = 4 | (BIT(attr, 6) << 1) | BIT(data, 7);
+ bitmap.pix32(y, (sx * 8) + x) = cpen[color];
+ data <<= 1;
+ }
}
}
}
@@ -429,6 +423,23 @@ WRITE_LINE_MEMBER( tandy2k_state::vpac_sld_w )
m_vac->sld_w(state);
}
+WRITE8_MEMBER( tandy2k_state::hires_plane_w )
+{
+ int bank = 3;
+ if (((data & 1) + ((data >> 1) & 1) + ((data >> 2) & 1)) == 1)
+ bank = (data & 1) ? 0 : (data & 2) ? 1 : (data & 4) ? 2 : 0;
+ m_vrambank->set_bank(bank);
+ m_hires_en = (data >> 4) & 3;
+}
+
+// bit 0 - 0 = hires board installed
+// bit 1 - 0 = 1 plane, 1 = 3 planes
+// bit 2-4 - board rev
+READ8_MEMBER( tandy2k_state::hires_status_r )
+{
+ return 2;
+}
+
WRITE8_MEMBER( tandy2k_state::vidla_w )
{
m_vidla = data;
@@ -463,7 +474,7 @@ WRITE8_MEMBER( tandy2k_state::drb_attr_w )
CRT9021_DRAW_CHARACTER_MEMBER( tandy2k_state::vac_draw_character )
{
- const pen_t *pen = m_palette->pens();
+ const pen_t *pen = m_colpal->pens();
for (int i = 0; i < 8; i++)
{
@@ -744,6 +755,7 @@ void tandy2k_state::machine_start()
program.install_ram(0x00000, ram_size - 1, ram);
m_char_ram.allocate(0x1000);
+ m_hires_en = 0;
// register for state saving
save_item(NAME(m_dma_mux));
@@ -766,6 +778,12 @@ void tandy2k_state::device_reset_after_children()
m_pc_keyboard->enable(0);
}
+rgb_t tandy2k_state::IRGB(uint32_t raw)
+{
+ uint8_t i = (raw >> 3) & 1;
+ return rgb_t(pal2bit(((raw & 4) >> 1) | i), pal2bit((raw & 2) | i), pal2bit(((raw & 1) << 1) | i));
+}
+
// Machine Driver
void tandy2k_state::tandy2k(machine_config &config)
@@ -778,7 +796,6 @@ void tandy2k_state::tandy2k(machine_config &config)
// video hardware
screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER));
- screen.set_color(rgb_t::green());
screen.set_refresh_hz(50);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
screen.set_size(640, 400);
@@ -786,7 +803,7 @@ void tandy2k_state::tandy2k(machine_config &config)
//screen.set_screen_update(CRT9021B_TAG, FUNC(crt9021_device::screen_update));
screen.set_screen_update(FUNC(tandy2k_state::screen_update));
- PALETTE(config, m_palette, palette_device::MONOCHROME);
+ PALETTE(config, m_colpal).set_format(1, &tandy2k_state::IRGB, 8);
crt9007_device &vpac(CRT9007(config, CRT9007_TAG, 16_MHz_XTAL * 28 / 20 / 8));
vpac.set_addrmap(0, &tandy2k_state::vpac_mem);
@@ -813,6 +830,8 @@ void tandy2k_state::tandy2k(machine_config &config)
CRT9021(config, m_vac, 16_MHz_XTAL * 28 / 20);
m_vac->set_screen(SCREEN_TAG);
+ ADDRESS_MAP_BANK(config, m_vrambank).set_map(&tandy2k_state::vrambank_mem).set_options(ENDIANNESS_LITTLE, 16, 17, 0x8000);
+
TIMER(config, "vidldsh").configure_generic(FUNC(tandy2k_state::vidldsh_tick));
// sound hardware