-rm/rm380z.cpp: Use SN74S262 as the VDU-40 COS 3.4 character generator. (#12128)

* Also cleaned up drawing code.

-video/sn74s262.cpp: Added hand-crafted character generator ROM based on datasheet.
This commit is contained in:
Robin Sergeant 2024-03-11 18:42:30 +00:00 committed by GitHub
parent 9626b93a41
commit 24c3868994
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 32 deletions

View File

@ -50,7 +50,7 @@ GFXDECODE_END
ROM_START( sn74s262 )
ROM_REGION( 0xa00, "chargen", 0 )
ROM_LOAD( "sn74s262", 0x000, 0xa00, NO_DUMP )
ROM_LOAD( "sn74s262", 0x000, 0x500, BAD_DUMP CRC(6896d319) SHA1(1234558418a5c7a9823d54a93d0c7f63bd8a490a) ) // created by hand
ROM_END

View File

@ -288,6 +288,9 @@ void rm380z_state_cos34::configure(machine_config &config)
m_screen->set_raw(8_MHz_XTAL, 512, 0, 320, 312, 0, 240);
PALETTE(config, "palette", palette_device::MONOCHROME_HIGHLIGHT);
SN74S262(config, m_rocg, 0);
m_rocg->set_palette("palette");
}
void rm380z_state_cos40::configure(machine_config &config)
@ -335,17 +338,11 @@ void rm480z_state::configure(machine_config &config)
ROM_START( rm380z34d ) // COS 3.4D/F
ROM_REGION( 0x10000, RM380Z_MAINCPU_TAG, ROMREGION_ERASEFF )
ROM_LOAD( "cos34d-f.bin", 0x0000, 0x1000, CRC(eb128b40) SHA1(c46f358fb76459987e41750d052995563f2f7d53))
// chargen ROM is undumped, afaik
ROM_REGION( 0x1680, "chargen", 0 )
ROM_LOAD( "ch3.raw", 0x0000, 0x1680, BAD_DUMP CRC(c223622b) SHA1(185ef24896419d7ff46f71a760ac217de3811684))
ROM_END
ROM_START( rm380z34e ) // COS 3.4E/M
ROM_REGION( 0x10000, RM380Z_MAINCPU_TAG, ROMREGION_ERASEFF )
ROM_LOAD( "cos34e-m.bin", 0x0000, 0x1000, CRC(20e2ddf4) SHA1(3177b28793d5a348c94fd0ae6393d74e2e9a8662))
// chargen ROM is undumped, afaik
ROM_REGION( 0x1680, "chargen", 0 )
ROM_LOAD( "ch3.raw", 0x0000, 0x1680, BAD_DUMP CRC(c223622b) SHA1(185ef24896419d7ff46f71a760ac217de3811684))
ROM_END
ROM_START( rm380z ) // COS 4.0B/M

View File

@ -18,6 +18,7 @@ Research Machines RM 380Z
#include "machine/keyboard.h"
#include "machine/ram.h"
#include "machine/wd_fdc.h"
#include "video/sn74s262.h"
#include "emupal.h"
@ -37,7 +38,6 @@ class rm380z_state : public driver_device
protected:
rm380z_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_chargen(*this, "chargen"),
m_maincpu(*this, RM380Z_MAINCPU_TAG),
m_screen(*this, "screen"),
m_messram(*this, RAM_TAG),
@ -88,7 +88,6 @@ protected:
uint8_t m_port1 = 0;
uint8_t m_fbfe = 0;
required_region_ptr<u8> m_chargen;
required_device<cpu_device> m_maincpu;
optional_device<screen_device> m_screen;
optional_device<ram_device> m_messram;
@ -103,6 +102,7 @@ class rm380z_state_cos34 : public rm380z_state
public:
rm380z_state_cos34(const machine_config &mconfig, device_type type, const char *tag) :
rm380z_state(mconfig, type, tag),
m_rocg(*this, "sn74s262"),
m_cassette(*this, "cassette")
{
}
@ -132,15 +132,11 @@ private:
uint8_t m_chars[ROWS][COLS];
};
static inline constexpr int RM380Z_CHDIMX = 5;
static inline constexpr int RM380Z_CHDIMY = 9;
static inline constexpr int RM380Z_NCX = 8;
static inline constexpr int RM380Z_NCY = 16;
void putChar_vdu40(int charnum, int x, int y, bitmap_ind16 &bitmap) const;
rm380z_vram<RM380Z_SCREENROWS, RM380Z_SCREENCOLS> m_vram;
required_device<sn74s262_device> m_rocg;
required_device<cassette_image_device> m_cassette;
};
@ -149,7 +145,8 @@ class rm380z_state_cos40 : public rm380z_state
{
public:
rm380z_state_cos40(const machine_config &mconfig, device_type type, const char *tag) :
rm380z_state(mconfig, type, tag)
rm380z_state(mconfig, type, tag),
m_chargen(*this, "chargen")
{
}
@ -191,6 +188,8 @@ protected:
int m_videomode = RM380Z_VIDEOMODE_80COL;
rm380z_vram<RM380Z_SCREENROWS, RM380Z_SCREENCOLS> m_vram;
required_region_ptr<u8> m_chargen;
private:
void config_videomode();
void putChar_vdu80(int charnum, int attribs, int x, int y, bitmap_ind16 &bitmap) const;

View File

@ -287,20 +287,20 @@ void rm380z_state_cos40::putChar_vdu80(int charnum, int attribs, int x, int y, b
void rm380z_state_cos34::putChar_vdu40(int charnum, int x, int y, bitmap_ind16 &bitmap) const
{
if ((charnum > 0) && (charnum <= 0x7f))
if (charnum <= 0x7f)
{
// normal chars (base set)
int basex=RM380Z_CHDIMX*(charnum/RM380Z_NCY);
int basey=RM380Z_CHDIMY*(charnum%RM380Z_NCY);
// 5x9 characters are drawn in 8x10 grid
// with 1 pixel gap to the left, 2 pixel gap to the right, and 1 pixel gap at the bottom
for (int r=0;r<RM380Z_CHDIMY;r++)
for (int r=0; r < 9; r++)
{
for (int c=0;c<RM380Z_CHDIMX;c++)
uint8_t data = m_rocg->read(charnum, r);
for (int c=1; c < 6; c++, data <<= 1)
{
uint8_t chval = (m_chargen[((basey + r) * RM380Z_CHDIMX * RM380Z_NCX) + basex + c] == 0xff) ? 0 : 2;
bitmap.pix(y * (RM380Z_CHDIMY+1) + r, x * (RM380Z_CHDIMX+3) + c + 1) = chval;
if (data & 0x40)
{
bitmap.pix(y * 10 + r, x * 8 + c) = 2;
}
}
}
}
@ -418,14 +418,6 @@ void rm380z_state_cos34::update_screen(bitmap_ind16 &bitmap) const
for (int col = 0; col < ncols; col++)
{
uint8_t curch = m_vram.get_char(row, col);
if (curch == 0)
{
// NUL character looked like 'O' when displayed and could be used instead of 'O'
// In fact the front panel writes 0x49, 0x00 to display "IO", and in COS 3.4
// displaying or typing 'O' actually writes 0x00 to vram.
// This hack is only necessary because we don't have the real 74LS262 charset ROM
curch = 'O';
}
putChar_vdu40(curch, col, row, bitmap);
}
}