This commit is contained in:
Scott Stone 2016-12-02 16:14:06 -05:00
commit eccd7accb4
12 changed files with 375 additions and 40 deletions

2
.gitignore vendored
View File

@ -17,6 +17,7 @@
!/docs/
!/hash/
!/hlsl/
!/ini/
!/keymaps/
!/language/
!/nl_examples/
@ -47,4 +48,3 @@ regtests/jedutil/output
/src/devices/cpu/m68000/m68kmake.*
/src/devices/cpu/m68000/m68kmake
!/src/devices/cpu/m68000/m68kmake.cpp
/samples

View File

@ -1,3 +1,2 @@
bin
build/*/obj
src/host/scripts.c

View File

@ -355,6 +355,18 @@ if (MACHINES["TTL74153"]~=null) then
}
end
---------------------------------------------------
--
--@src/devices/machine/74157.h,MACHINES["TTL74157"] = true
---------------------------------------------------
if (MACHINES["TTL74157"]~=null) then
files {
MAME_DIR .. "src/devices/machine/74157.cpp",
MAME_DIR .. "src/devices/machine/74157.h",
}
end
---------------------------------------------------
--
--@src/devices/machine/74161.h,MACHINES["TTL74161"] = true

View File

@ -360,6 +360,7 @@ MACHINES["TTL74123"] = true
MACHINES["TTL74145"] = true
MACHINES["TTL74148"] = true
MACHINES["TTL74153"] = true
MACHINES["TTL74157"] = true
--MACHINES["TTL74161"] = true
--MACHINES["TTL74175"] = true
MACHINES["TTL74181"] = true

View File

@ -536,6 +536,7 @@ MACHINES["TTL74123"] = true
MACHINES["TTL74145"] = true
MACHINES["TTL74148"] = true
MACHINES["TTL74153"] = true
--MACHINES["TTL74157"] = true
MACHINES["TTL74161"] = true
MACHINES["TTL74175"] = true
MACHINES["TTL74181"] = true

View File

@ -0,0 +1,202 @@
// license:BSD-3-Clause
// copyright-holders:AJR
/***************************************************************************
74LS157 Quad 2-Line to 1-Line Data Selectors/Multiplexers (TTL)
Often used to help feed 8-bit ROM data into a MSM5205, and for many
other purposes.
74LS158 has inverted outputs; 74LS157 is non-inverting.
***************************************************************************/
#include "emu.h"
#include "74157.h"
//**************************************************************************
// 74LS157 DEVICE
//**************************************************************************
const device_type LS157 = &device_creator<ls157_device>;
//-------------------------------------------------
// ls157_device - constructor
//-------------------------------------------------
ls157_device::ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, LS157, "74LS157 Data Selectors/Multiplexers", tag, owner, clock, "74ls157", __FILE__)
, m_out_cb(*this)
{
m_a = 0;
m_b = 0;
m_select = false;
m_strobe = false;
}
//-------------------------------------------------
// device_start - perform device-specific
// startup
//-------------------------------------------------
void ls157_device::device_start()
{
// resolve callbacks
m_out_cb.resolve_safe();
// register items for save state
save_item(NAME(m_a));
save_item(NAME(m_b));
save_item(NAME(m_select));
save_item(NAME(m_strobe));
}
//**************************************************************************
// DATA INPUTS
//**************************************************************************
//-------------------------------------------------
// a_w -- write nibble to A1-A4
//-------------------------------------------------
WRITE8_MEMBER(ls157_device::a_w)
{
a_w(data);
}
void ls157_device::a_w(u8 data)
{
m_a = data & 0xf;
update_output();
}
//-------------------------------------------------
// b_w -- write nibble to B1-B4
//-------------------------------------------------
WRITE8_MEMBER(ls157_device::b_w)
{
b_w(data);
}
void ls157_device::b_w(u8 data)
{
m_b = data & 0xf;
update_output();
}
//-------------------------------------------------
// ab_w -- write high nibble to A1-A4 and write
// low nibble to B1-B4
//-------------------------------------------------
WRITE8_MEMBER(ls157_device::ab_w)
{
ab_w(data);
}
void ls157_device::ab_w(u8 data)
{
m_a = data >> 4;
m_b = data & 0xf;
update_output();
}
//-------------------------------------------------
// ba_w -- write high nibble to B1-B4 and write
// low nibble to A1-A4
//-------------------------------------------------
WRITE8_MEMBER(ls157_device::ba_w)
{
ba_w(data);
}
void ls157_device::ba_w(u8 data)
{
m_b = data >> 4;
m_a = data & 0xf;
update_output();
}
//-------------------------------------------------
// interleave_w -- write even-numbered bits to
// A1-A4 and write odd-numbered bits to B1-B4
//-------------------------------------------------
WRITE8_MEMBER(ls157_device::interleave_w)
{
interleave_w(data);
}
void ls157_device::interleave_w(u8 data)
{
m_b = ((data >> 4) & 8)
| ((data >> 3) & 4)
| ((data >> 2) & 2)
| ((data >> 1) & 1);
m_a = ((data >> 3) & 8)
| ((data >> 2) & 4)
| ((data >> 1) & 2)
| ((data >> 0) & 1);
update_output();
}
//**************************************************************************
// CONTROL LINE INPUTS
//**************************************************************************
//-------------------------------------------------
// select_w -- set select input
//-------------------------------------------------
WRITE_LINE_MEMBER(ls157_device::select_w)
{
if (m_select != bool(state))
{
m_select = bool(state);
update_output();
}
}
//-------------------------------------------------
// strobe_w -- set strobe input (active low)
//-------------------------------------------------
WRITE_LINE_MEMBER(ls157_device::strobe_w)
{
if (m_strobe != bool(state))
{
m_strobe = bool(state);
// Clear output when strobe goes high
if (m_strobe)
m_out_cb(0);
else
m_out_cb(m_select ? m_b : m_a);
}
}
//-------------------------------------------------
// update_output -- update output lines Y1-Y4
// unless strobe is high
//-------------------------------------------------
void ls157_device::update_output()
{
// S high, strobe low: Y1-Y4 = B1-B4
// S low, strobe low: Y1-Y4 = A1-A4
if (!m_strobe)
m_out_cb(m_select ? m_b : m_a);
}

View File

@ -0,0 +1,95 @@
// license:BSD-3-Clause
// copyright-holders:AJR
/***************************************************************************
74LS157 Quad 2-Line to 1-Line Data Selectors/Multiplexers (TTL)
****************************************************************************
____ ____
SELECT 1 |* \_/ | 16 Vcc
A1 IN 2 | | 15 STROBE
B1 IN 3 | | 14 A4 IN
Y1 OUT 4 | | 13 B4 IN
A2 IN 5 | 74LS157 | 12 Y4 OUT
B2 IN 6 | | 11 A3 IN
Y2 OUT 7 | | 10 B3 IN
GND 8 |___________| 9 Y3 OUT
***************************************************************************/
#pragma once
#ifndef DEVICES_MACHINE_74157_H
#define DEVICES_MACHINE_74157_H
#include "emu.h"
//**************************************************************************
// DEVICE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_74LS157_OUT_CB(_devcb) \
devcb = &ls157_device::set_out_callback(*device, DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> ls157_device
class ls157_device : public device_t
{
public:
// construction/destruction
ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration
template<class _Object> static devcb_base &set_out_callback(device_t &device, _Object object) { return downcast<ls157_device &>(device).m_out_cb.set_callback(object); }
// data writes
DECLARE_WRITE8_MEMBER(a_w);
void a_w(u8 data);
DECLARE_WRITE8_MEMBER(b_w);
void b_w(u8 data);
DECLARE_WRITE8_MEMBER(ab_w);
void ab_w(u8 data);
DECLARE_WRITE8_MEMBER(ba_w);
void ba_w(u8 data);
DECLARE_WRITE8_MEMBER(interleave_w);
void interleave_w(u8 data);
// line writes
DECLARE_WRITE_LINE_MEMBER(select_w);
DECLARE_WRITE_LINE_MEMBER(strobe_w);
protected:
// device-level overrides
virtual void device_start() override;
private:
// internal helpers
void update_output();
// callbacks
devcb_write8 m_out_cb;
// internal state
u8 m_a;
u8 m_b;
bool m_select;
bool m_strobe;
};
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
// device type definition
extern const device_type LS157;
#endif

View File

@ -252,6 +252,11 @@ void msm5205_device::data_w(int data)
m_data = (data & 0x07) << 1; /* unknown */
}
WRITE8_MEMBER(msm5205_device::data_w)
{
data_w(data);
}
/*
* Handle a change of the selector
*/

View File

@ -52,12 +52,16 @@ public:
// reset signal should keep for 2cycle of VCLK
void reset_w(int reset);
// adpcmata is latched after vclk_interrupt callback
void data_w(int data);
DECLARE_WRITE8_MEMBER(data_w);
// VCLK slave mode option
// if VCLK and reset or data is changed at the same time,
// call vclk_w after data_w and reset_w.
void vclk_w(int vclk);
// option , selected pin selector
void playmode_w(int select);

View File

@ -8,7 +8,7 @@
// - Registers of graphics option not directly mapped (indirect access via mode register)
// - write mask is 16 bits wide (not only 8)
// - scroll register is 8 bits wide - not 16.
// - no "DMA SCROLL", "LINE ERASE MODE", no ZOOM hardware (factor must always be 1)
// - no "LINE ERASE MODE", 7220 DMA lines are unused. No ZOOM hardware (factor must always be 1)
// Two modes: highres and medres mode (different bank length..?)
// - MEDRES: palette of 16 colors out of 4096. 384 x 240
@ -34,14 +34,12 @@ SCREEN 1 vs. SCREEN 2 IN EMULATION
// The type of monochrome monitor (VR-210 A, B or C) is selectable via another DIP (coarsly simulates a phosphor color).
BUGS
- MEDRES LOOKS CORRECT
- HIRES-MODE SEMI BROKEN (colors OK, else untested).
- GDC diagnostic disk bails out on 10 of 13 low level tests. Separate SCROLL CHECK crashes CPU. Readback from GDC fails?
- VECTOR MODE SEEMS TO DISPLAY NOTHING AT ALL (16 bit access botched here in driver?)
- MEDRES and HIRES MODE APPEAR TO BE CORRECT
- GDC diagnostic disk bails out on 9 of 13 tests (tests 4 and 6 - 13). Scroll check doesn't...
Interaction of Upd7220 and Rainbow.cpp:
- FIG directions / params appear to be odd (lines go 45 degrees up or down instead of straight dir.),
- RDAT with MOD 2 is unimplemented. WDAT appears to set "m_bitmap_mod" wrongly ("2" means all pixels will be reset)...
Freeware to try: MMIND (MasterMind, after BMP logo), SOLIT (Solitaire), CANON (high resolution + vectors).
- RDAT with MOD 2 is unimplemented (other modes than 00). Effect of missing R-M-W...?
Software to try: MMIND (MasterMind, after BMP logo), SOLIT (Solitaire), CANON (high resolution + vectors), GDC Test Disk.
UNIMPLEMENTED:
// - Rainbow 100 A palette quirks (2 bit palette... applies to certain modes only)
@ -49,21 +47,19 @@ UNIMPLEMENTED:
UNKNOWN IMPLEMENTATION DETAILS:
// a. READBACK (hard copy programs like JOBSDUMP definitely use it. See also GDC diagnostics). VRAM_R ?
// b. SCROLL BUFFER initialization (details) unclear. What happens when a programs does not write all 256 bytes? Value of uninitialized areas?
Play, then retry (y) SCRAM to see the effect. Scram doesn't seem to write all (256) bytes, a GDC RESET is only executed at startup...
// b. SCROLL BUFFER details unclear. What happens when a programs does not write all 256 bytes? Value of uninitialized areas?
Play, then retry (y) SCRAM to see the effect. Scram doesn't seem to write all (256) bytes, a GDC RESET is only executed ONCE.
(PAGE 48 OF PDF HAS A SUPERFICIAL DESCRIPTION OF THE SCROLL BUFFER)
// c. UNVERIFIED XTAL / CLOCK:
// There is a 31.188 Mhz crystal in DUELL's hand written Option Graphics circuit (not to be found in XTAL).
// According to the datasheet, the NEC 7220 was certified for 4.0 , 5.0, and 5.5 Mhz and the 7220A for 6.0, 7.0, and 8.0 Mhz
// c. UNVERIFIED DIVIDER (31.188 Mhz / 32) is at least close to 1 Mhz (as seen on the VT240)
// d. UPD7220 oddities: * refresh rate much too fast at 32Mhz/4 (Upd7220 LOG says 492 Mhz?!).
// * pixels are stretched out too wide at 384 x 240. Compare the real SCRAM screenshot online!
// d. UPD7220 / CORE oddities:
* pixels are stretched out too wide at 384 x 240 (not fixable here). -KEEPASPECT?
// e. FIXME (MAME/MESS): what happens when the left screen is at 50 Hz and the right at 60 Hz?
// According to Haze: "if you have 2 screens running at different refresh rates one of them won't update properly
// (the partial update system gets very confused because it expects both the screens to end at the same time
// and if that isn't the case large parts of one screen end up not updating at all)
// * (MAME core): what happens when the left screen is at 50 Hz and the right at 60 Hz?
// According to Haze: "if you have 2 screens running at different refresh rates one of them won't update properly
// (the partial update system gets very confused because it expects both the screens to end at the same time
// and if that isn't the case large parts of one screen end up not updating at all)
*/
// license:GPL-2.0+
@ -72,7 +68,7 @@ UNKNOWN IMPLEMENTATION DETAILS:
DEC Rainbow 100
Driver-in-progress by R. Belmont and Miodrag Milanovic.
Keyboard fix by Cracyc (June 2016), Baud rate generator by Shattered (July 2016)
Keyboard & GDC fixes by Cracyc (June - Nov. 2016), Baud rate generator by Shattered (July 2016)
Portions (2013 - 2016) by Karl-Ludwig Deisenhofer (Floppy, ClikClok RTC, NVRAM, DIPs, hard disk, Color Graphics).
To unlock floppy drives A-D compile with WORKAROUND_RAINBOW_B (prevents a side effect of ERROR 13).
@ -92,8 +88,8 @@ PLEASE USE THE RIGHT SLOT - AND ALWAYS SAVE YOUR DATA BEFORE MOUNTING FOREIGN DI
You * should * also reassign SETUP (away from F3, where it sits on a LK201).
DATA LOSS POSSIBLE: when in partial emulation mode, F3 performs a hard reset!
STATE AS OF OCTOBER 2016
------------------------
STATE AS OF DECE;BER 2016
-------------------------
Driver is based entirely on the DEC-100 'B' variant (DEC-190 and DEC-100 A models are treated as clones).
While this is OK for the compatible -190, it doesn't do justice to ancient '100 A' hardware.
The public domain file RBCONVERT.ZIP documents how model 'A' differs from version B.
@ -733,8 +729,15 @@ UPD7220_DISPLAY_PIXELS_MEMBER( rainbow_state::hgdc_display_pixels )
uint16_t plane0, plane1, plane2, plane3;
uint8_t pen;
if(!(m_GDC_MODE_REGISTER & GDC_MODE_ENABLE_VIDEO))
if(m_ONBOARD_GRAPHICS_SELECTED && (m_inp13->read() != DUAL_MONITOR) )
{
for(xi=0;xi<16;xi++) // blank screen when VT102 output active (..)
{
if (bitmap.cliprect().contains(x + xi, y))
bitmap.pix32(y, x + xi) = 0;
}
return; // no output from graphics option
}
// ********************* GET BITMAP DATA FOR 4 PLANES ***************************************
// _READ_ BIT MAP from 2 or 4 planes (plane 0 is least, plane 3 most significant). See page 42 / 43
@ -2432,6 +2435,8 @@ WRITE_LINE_MEMBER(rainbow_state::GDC_vblank_irq)
}
case COLOR_MONITOR:
if(!(m_GDC_MODE_REGISTER & GDC_MODE_ENABLE_VIDEO))
red = blue = 0; // Page 21 of PDF AA-AE36A (PDF) explains why
red = uint8_t( red * 17 * ( (255-video_levels[ red ] ) / 255.0f) );
green = uint8_t( mono * 17 * ( (255-video_levels[ mono ]) / 255.0f) ); // BCC-17 cable (red, mono -> green, blue)
blue = uint8_t( blue * 17 * ( (255-video_levels[ blue ] ) / 255.0f) );
@ -3071,7 +3076,8 @@ MCFG_VT_VIDEO_RAM_CALLBACK(READ8(rainbow_state, read_video_ram_r))
MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(rainbow_state, clear_video_interrupt))
// *************************** COLOR GRAPHICS (OPTION) **************************************
MCFG_DEVICE_ADD("upd7220", UPD7220, 31188000 / 4) // Duell schematics shows a 31.188 Mhz clock (confirmed by RFKA; not in XTAL)
// While the OSC frequency is confirmed, the divider is not. Refresh rate is ~60 Hz with 32.
MCFG_DEVICE_ADD("upd7220", UPD7220, 31188000 / 32) // Duell schematics shows a 31.188 Mhz oscillator (confirmed by RFKA).
MCFG_UPD7220_VSYNC_CALLBACK(WRITELINE(rainbow_state, GDC_vblank_irq)) // "The vsync callback line needs to be below the 7220 DEVICE_ADD line."
MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)

View File

@ -171,16 +171,16 @@ WRITE8_MEMBER(rastan_state::rastan_bankswitch_w)
WRITE_LINE_MEMBER(rastan_state::rastan_msm5205_vck)
{
if (m_adpcm_data != -1)
if (!state)
return;
m_adpcm_ff = !m_adpcm_ff;
m_adpcm_sel->select_w(m_adpcm_ff);
if (m_adpcm_ff)
{
m_msm->data_w(m_adpcm_data & 0x0f);
m_adpcm_data = -1;
}
else
{
m_adpcm_data = memregion("adpcm")->base()[m_adpcm_pos];
m_adpcm_sel->ba_w(m_adpcm_data[m_adpcm_pos]);
m_adpcm_pos = (m_adpcm_pos + 1) & 0xffff;
m_msm->data_w(m_adpcm_data >> 4);
}
}
@ -192,6 +192,7 @@ WRITE8_MEMBER(rastan_state::rastan_msm5205_address_w)
WRITE8_MEMBER(rastan_state::rastan_msm5205_start_w)
{
m_msm->reset_w(0);
m_adpcm_ff = false;
}
WRITE8_MEMBER(rastan_state::rastan_msm5205_stop_w)
@ -344,7 +345,7 @@ void rastan_state::machine_start()
save_item(NAME(m_sprites_flipscreen));
save_item(NAME(m_adpcm_pos));
save_item(NAME(m_adpcm_data));
save_item(NAME(m_adpcm_ff));
}
void rastan_state::machine_reset()
@ -352,7 +353,7 @@ void rastan_state::machine_reset()
m_sprite_ctrl = 0;
m_sprites_flipscreen = 0;
m_adpcm_pos = 0;
m_adpcm_data = -1;
m_adpcm_ff = false;
}
@ -405,6 +406,9 @@ static MACHINE_CONFIG_START( rastan, rastan_state )
MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) /* 8 kHz */
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
MCFG_DEVICE_ADD("adpcm_sel", LS157, 0)
MCFG_74LS157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
MCFG_DEVICE_ADD("tc0140syt", TC0140SYT, 0)
MCFG_TC0140SYT_MASTER_CPU("maincpu")
MCFG_TC0140SYT_SLAVE_CPU("audiocpu")

View File

@ -5,6 +5,8 @@
Rastan
*************************************************************************/
#include "machine/74157.h"
#include "sound/msm5205.h"
#include "video/pc080sn.h"
#include "video/pc090oj.h"
@ -17,21 +19,25 @@ public:
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_msm(*this, "msm"),
m_adpcm_sel(*this, "adpcm_sel"),
m_adpcm_data(*this, "adpcm"),
m_pc080sn(*this, "pc080sn"),
m_pc090oj(*this, "pc090oj") { }
/* video-related */
uint16_t m_sprite_ctrl;
uint16_t m_sprites_flipscreen;
u16 m_sprite_ctrl;
u16 m_sprites_flipscreen;
/* misc */
int m_adpcm_pos;
int m_adpcm_data;
u16 m_adpcm_pos;
bool m_adpcm_ff;
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<msm5205_device> m_msm;
required_device<ls157_device> m_adpcm_sel;
required_region_ptr<u8> m_adpcm_data;
required_device<pc080sn_device> m_pc080sn;
required_device<pc090oj_device> m_pc090oj;
DECLARE_WRITE8_MEMBER(rastan_msm5205_address_w);