From fc3e486d99102831178a295236e972bb107f6968 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sun, 9 May 2021 04:04:59 +1000 Subject: [PATCH] sys80 and clones: added Video Cut and Page. --- src/mame/drivers/h01x.cpp | 2 - src/mame/drivers/trs80.cpp | 21 +++++---- src/mame/includes/trs80.h | 5 ++- src/mame/video/trs80.cpp | 90 +++++++++++++++++++++++++++++++++++--- 4 files changed, 100 insertions(+), 18 deletions(-) diff --git a/src/mame/drivers/h01x.cpp b/src/mame/drivers/h01x.cpp index 53355edd3e3..11bca4cf202 100644 --- a/src/mame/drivers/h01x.cpp +++ b/src/mame/drivers/h01x.cpp @@ -106,8 +106,6 @@ void h01x_state::h01x(machine_config &config) screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_raw(10.6445_MHz_XTAL, 336, 0, 336, 192, 0, 192); screen.set_screen_update("crtc", FUNC(mc6845_device::screen_update)); - //screen.set_palette("palette"); - PALETTE(config, m_palette, palette_device::MONOCHROME); MC6845(config, m_crtc, 10.6445_MHz_XTAL / 8); // freq guess diff --git a/src/mame/drivers/trs80.cpp b/src/mame/drivers/trs80.cpp index f2fbde72593..a6ebd38d305 100644 --- a/src/mame/drivers/trs80.cpp +++ b/src/mame/drivers/trs80.cpp @@ -145,7 +145,6 @@ trs80l2: works sys80: works investigate expansion-box - add 32 / 64 cpl switch ht1080z works verify clock for AY-3-8910 @@ -279,13 +278,12 @@ static INPUT_PORTS_START( trs80 ) PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') // These keys produce output on all systems, the shift key having no effect. They display arrow symbols and underscore. // On original TRS80, shift cancels all keys except F3 which becomes backspace. - // On the radionic, Shift works, and the symbols display correctly. - // PORT_CHAR('_') is correct for all systems, however the others are only for radionic. - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_F1) PORT_CHAR('[') PORT_CHAR('{') // radionic: F1 - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_F2) PORT_CHAR('\\') PORT_CHAR('}') // radionic: F2 ; sys80 mkII: F2 ; lnw80: F1 - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_F3) PORT_CHAR(']') PORT_CHAR('|') // radionic: F3 ; sys80 mkII: F3 - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_F4) PORT_CHAR('^') // radionic: F4 ; sys80 mkII: F4 ; lnw80: F2 - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_F5) PORT_CHAR('_') // radionic: LF ; sys80 mkII: F1 ; lnw80: _ + // PORT_CHAR('_') is correct for all systems. + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_F1) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_F2) // sys80 mkII: F2 + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_F3) // sys80 mkII: F3 + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_F4) // sys80 mkII: F4 + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_F5) PORT_CHAR('_') // sys80 mkII: F1 PORT_START("LINE4") // Number pad: System 80 Mk II only PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') @@ -349,6 +347,12 @@ INPUT_PORTS_END static INPUT_PORTS_START(sys80) PORT_INCLUDE (trs80l2) + PORT_MODIFY("CONFIG") + PORT_CONFNAME( 0x08, 0x00, "Video Cut") // Toggle switch on the back + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x08, DEF_STR( On ) ) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Page") PORT_CODE(KEYCODE_F6) PORT_TOGGLE // extra keys above the main keyboard + //PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F7) PORT_TOGGLE // this turns on the tape motor PORT_START("BAUD") PORT_DIPNAME( 0xff, 0x06, "Baud Rate") PORT_DIPSETTING( 0x00, "110") @@ -501,6 +505,7 @@ void trs80_state::sys80(machine_config &config) { model1(config); m_maincpu->set_addrmap(AS_IO, &trs80_state::sys80_io); + subdevice("screen")->set_screen_update(FUNC(trs80_state::screen_update_sys80)); config.device_remove("brg"); CLOCK(config, m_uart_clock, 19200 * 16); diff --git a/src/mame/includes/trs80.h b/src/mame/includes/trs80.h index 6e24cc14778..546763ece6f 100644 --- a/src/mame/includes/trs80.h +++ b/src/mame/includes/trs80.h @@ -122,8 +122,9 @@ private: void trs80_mem(address_map &map); void ht1080z_io(address_map &map); - uint32_t screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_sys80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); static void floppy_formats(format_registration &fr); }; diff --git a/src/mame/video/trs80.cpp b/src/mame/video/trs80.cpp index 420d5d81f1e..6199c7e0bbb 100644 --- a/src/mame/video/trs80.cpp +++ b/src/mame/video/trs80.cpp @@ -4,9 +4,8 @@ #include "emu.h" #include "includes/trs80.h" -#include "screen.h" -/* 7 or 8-bit video, 32/64 characters per line = trs80, trs80l2, sys80 */ +// 7 or 8-bit video. Software control of 32/64 CPL = trs80, trs80l2. u32 trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { u16 sy=0,ma=0; @@ -29,6 +28,83 @@ u32 trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap { u8 chr = m_p_videoram[x]; + if (chr & 0x80) + { + u8 gfxbit = (ra & 0x0c)>>1; + // Display one line of a lores character (6 pixels) + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + gfxbit++; + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + } + else + { + if (m_7bit && (chr < 32)) chr+=64; + + // if g,j,p,q,y; lower the descender + u8 gfx; + if ((chr==0x2c)||(chr==0x3b)||(chr==0x67)||(chr==0x6a)||(chr==0x70)||(chr==0x71)||(chr==0x79)) + { + if ((ra < 10) && (ra > 1)) + gfx = m_p_chargen[(chr<<3) | (ra-2) ]; + else + gfx = 0; + } + else + { + if (ra < 8) + gfx = m_p_chargen[(chr<<3) | ra ]; + else + gfx = 0; + } + + // Display a scanline of a character (6 pixels) + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + } + ma+=64; + } + return 0; +} + + +// 7 or 8-bit video. No software control of 32/64 CPL = sys80 and clones. Using Video Cut/Page. +// The Video Cut switch changes the screen to 32 characters. The Page button selects which half of the +// screen to display. The TRS-80 wide character mode is not supported. The software code still exists, +// but if operated the characters stay narrow with a space inserted after each one. +u32 trs80_state::screen_update_sys80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + u8 cpl = m_io_config->read() & 12; + u16 sy=0,ma=0; + u8 const cols = BIT(cpl, 3) ? 32 : 64; + if (cpl == 12) + ma = 32; + + if (cols != m_cols) + { + m_cols = cols; + screen.set_visible_area(0, cols*6-1, 0, 16*12-1); + } + + for (u8 y = 0; y < 16; y++) + { + for (u8 ra = 0; ra < 12; ra++) + { + u16 *p = &bitmap.pix(sy++); + + for (u16 x = ma; x < (ma + cols); x++) + { + u8 chr = m_p_videoram[x]; + if (chr & 0x80) { u8 gfxbit = (ra & 0x0c)>>1; @@ -78,12 +154,14 @@ u32 trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap } -/* 7 or 8-bit video, 64/32 characters per line = ht1080z, ht1080z2, ht108064 */ +// 7 or 8-bit video. No software control of 64/32 CPL = ht1080z, ht1080z2, ht108064. See above about the Video Cut. u32 trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { + u8 cpl = m_io_config->read() & 12; u16 sy=0,ma=0; - u8 const cols = m_cpl ? 32 : 64; - u8 const skip = m_cpl ? 2 : 1; + u8 const cols = BIT(cpl, 3) ? 32 : 64; + if (cpl == 12) + ma = 32; if (cols != m_cols) { @@ -97,7 +175,7 @@ u32 trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitm { u16 *p = &bitmap.pix(sy++); - for (u16 x = ma; x < ma + 64; x+=skip) + for (u16 x = ma; x < (ma + cols); x++) { u8 chr = m_p_videoram[x];