mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
alphatpx.cpp: Added P1 (rfka01), fixed P2 drive ready (helwie44) ... (#3139)
* alphatpx.cpp: Added P1 (rfka01), made P2 floppy system work correctly (helwie44) * alphatpx.cpp: remove traces from experiments * alphatpx.cpp: Add missing <> key * alphatpx.cpp: Indentation fix * alphatpx.cpp: Simplify floppy drive connections (thanks Duke & Vas Crabb) * alphatpx.cpp: srcclean * itt3030: Simplify floppy system analogous to alphatpx.cpp * alphatpx.cpp, itt3030.cpp: comments fixes * alphatpx.cpp, itt3030.cpp: keyboard code simplifications * alphatpx.cpp: Another spurious debugger.h, millennium hand and shrimp
This commit is contained in:
parent
9798aa0a06
commit
e0ac072a29
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,6 @@
|
||||
ToDo:
|
||||
- Check Beeper
|
||||
- finish hooking up keyboard
|
||||
- According to the manual, the keyboard is based on a 8278 ... it's nowhere to be found. The keyboard / video card has a 8741 instead of which a ROM dump exists
|
||||
- serial port
|
||||
- daisy chain
|
||||
- ...
|
||||
@ -198,15 +197,17 @@ Beeper Circuit, all ICs shown:
|
||||
#include "machine/wd_fdc.h"
|
||||
#include "sound/beep.h"
|
||||
#include "video/tms9927.h" //Display hardware
|
||||
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
|
||||
#include "formats/itt3030_dsk.h"
|
||||
|
||||
#include "debugger.h"
|
||||
|
||||
#define MAIN_CLOCK XTAL_4.194MHz
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class itt3030_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -218,8 +219,7 @@ public:
|
||||
, m_crtc(*this, "crt5027")
|
||||
, m_48kbank(*this, "lowerbank")
|
||||
, m_fdc (*this, "fdc")
|
||||
, m_floppy0(*this, "fdc:0")
|
||||
, m_floppy1(*this, "fdc:1")
|
||||
, m_floppy(*this, "fdc:%u", 0)
|
||||
, m_beep(*this, "beeper")
|
||||
, m_keyrows(*this, "ROW.%u", 0)
|
||||
, m_vram(*this, "vram")
|
||||
@ -263,8 +263,7 @@ protected:
|
||||
required_device<crt5027_device> m_crtc;
|
||||
required_device<address_map_bank_device> m_48kbank;
|
||||
required_device<fd1791_device> m_fdc;
|
||||
required_device<floppy_connector> m_floppy0;
|
||||
required_device<floppy_connector> m_floppy1;
|
||||
required_device_array<floppy_connector, 3> m_floppy;
|
||||
required_device<beep_device> m_beep;
|
||||
|
||||
required_ioport_array<16> m_keyrows;
|
||||
@ -278,165 +277,11 @@ private:
|
||||
required_device<palette_device> m_palette;
|
||||
floppy_image_device *m_curfloppy;
|
||||
bool m_fdc_irq, m_fdc_drq, m_fdc_hld;
|
||||
floppy_connector *m_con1, *m_con2, *m_con3;
|
||||
};
|
||||
|
||||
READ8_MEMBER(itt3030_state::vsync_r)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
|
||||
if (machine().first_screen()->vblank())
|
||||
{
|
||||
ret |= 0xc0; // set both bits 6 and 7 if vblank
|
||||
}
|
||||
|
||||
if (machine().first_screen()->hblank())
|
||||
{
|
||||
ret |= 0x80; // set only bit 7 if hblank
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( itt3030_state::beep_w )
|
||||
{
|
||||
m_beep->set_state(data&1);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(itt3030_state::bank_w)
|
||||
{
|
||||
int bank = 8;
|
||||
|
||||
if (BIT(data, 4))
|
||||
{
|
||||
bank = (BIT(data, 5) << 2) | (BIT(data, 6) << 1) | BIT(data, 7);
|
||||
}
|
||||
|
||||
// printf("bank_w: new value %02x, m_bank %x, bank %x\n", data, m_bank, bank);
|
||||
|
||||
m_48kbank->set_bank(bank);
|
||||
}
|
||||
|
||||
uint32_t itt3030_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int start = m_crtc->upscroll_offset();
|
||||
for(int y = 0; y < 24; y++ )
|
||||
{
|
||||
int vramy = (start + y) % 24;
|
||||
for(int x = 0; x < 80; x++ )
|
||||
{
|
||||
uint8_t code = m_vram[x + vramy*128];
|
||||
int invert = code & 0x80 ? 1 : 0;
|
||||
code &= 0x7f;
|
||||
m_gfxdecode->gfx(invert)->opaque(bitmap,cliprect, code , 0, 0,0, x*8,y*12);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(itt3030_state::fdcirq_w)
|
||||
{
|
||||
m_fdc_irq = state;
|
||||
}
|
||||
|
||||
#include "debugger.h"
|
||||
|
||||
WRITE_LINE_MEMBER(itt3030_state::fdcdrq_w)
|
||||
{
|
||||
m_fdc_drq = state;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(itt3030_state::fdchld_w)
|
||||
{
|
||||
m_fdc_hld = state;
|
||||
}
|
||||
|
||||
/*
|
||||
7 Data Request (DRQ - inverted 1791-Signal)
|
||||
6 Interrupt Request (INTRQ - 1791-Signal)
|
||||
5 Head Load (HLD - inverted 1791-Signal)
|
||||
4 Ready 3 (Drive 3 ready)
|
||||
3 Ready 2 (Drive 2 ready)
|
||||
2 Ready l (Drive 1 ready)
|
||||
1 Write protect (the disk in the selected drive is write protected)
|
||||
0 HLT (Halt signal during head load and track change)
|
||||
*/
|
||||
READ8_MEMBER(itt3030_state::fdc_stat_r)
|
||||
{
|
||||
uint8_t res = 0;
|
||||
floppy_image_device *floppy1 = m_con1 ? m_con1->get_device() : nullptr;
|
||||
floppy_image_device *floppy2 = m_con2 ? m_con2->get_device() : nullptr;
|
||||
floppy_image_device *floppy3 = m_con3 ? m_con3->get_device() : nullptr;
|
||||
|
||||
res = m_fdc_drq ? 0x80 : 0x00;
|
||||
res |= m_fdc_irq ? 0x40 : 0x00;
|
||||
res |= m_fdc_hld ? 0x00 : 0x20;
|
||||
if (floppy3) res |= !floppy3->ready_r() ? 0x10 : 0;
|
||||
if (floppy2) res |= !floppy2->ready_r() ? 0x08 : 0;
|
||||
if (floppy1) res |= !floppy1->ready_r() ? 0x04 : 0;
|
||||
if (m_curfloppy) res |= m_curfloppy->wpt_r() ? 0x02 : 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* As far as we can tell, the mess of ttl de-inverts the bus */
|
||||
READ8_MEMBER(itt3030_state::fdc_r)
|
||||
{
|
||||
return m_fdc->gen_r(offset) ^ 0xff;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(itt3030_state::fdc_w)
|
||||
{
|
||||
m_fdc->gen_w(offset, data ^ 0xff);
|
||||
}
|
||||
|
||||
/*
|
||||
7 SEL1 - Select drive 1
|
||||
6 SEL2 - Select drive 2
|
||||
5 SEL3 - Select drive 3
|
||||
4 MOTOR - Motor on
|
||||
3 DOOR - Drive door lock drives 1 + 2 (not possible with all drives)
|
||||
2 SIDESEL - Select disk side
|
||||
1 KOMP - write comp on/off
|
||||
0 RG J - Change separator stage to read
|
||||
*/
|
||||
WRITE8_MEMBER(itt3030_state::fdc_cmd_w)
|
||||
{
|
||||
floppy_image_device *floppy = nullptr;
|
||||
|
||||
logerror("%02x to fdc_cmd_w: motor %d side %d\n", data, (data & 0x10)>>4, (data & 4)>>2);
|
||||
|
||||
// select drive
|
||||
if (data & 0x80)
|
||||
{
|
||||
floppy = m_con1 ? m_con1->get_device() : nullptr;
|
||||
}
|
||||
else if (data & 0x40)
|
||||
{
|
||||
floppy = m_con2 ? m_con2->get_device() : nullptr;
|
||||
}
|
||||
else if (data & 0x20)
|
||||
{
|
||||
floppy = m_con3 ? m_con3->get_device() : nullptr;
|
||||
}
|
||||
|
||||
// selecting a new drive?
|
||||
if (floppy != m_curfloppy)
|
||||
{
|
||||
m_fdc->set_floppy(floppy);
|
||||
m_curfloppy = floppy;
|
||||
}
|
||||
|
||||
if (floppy != nullptr)
|
||||
{
|
||||
// side select
|
||||
floppy->ss_w((data & 4) ? 1 : 0);
|
||||
|
||||
// motor control (active low)
|
||||
floppy->mon_w((data & 0x10) ? 0 : 1);
|
||||
}
|
||||
}
|
||||
//**************************************************************************
|
||||
// ADDRESS MAPS
|
||||
//**************************************************************************
|
||||
|
||||
// The lower 48K is switchable among the first 48K of each of 8 48K banks numbered 0-7 or "bank 8" which is the internal ROM and VRAM
|
||||
// The upper 16K is always the top 16K of the first bank, F5 can set this to 32K
|
||||
@ -464,6 +309,11 @@ static ADDRESS_MAP_START( itt3030_io, AS_IO, 8, itt3030_state )
|
||||
AM_RANGE(0xf6, 0xf6) AM_WRITE(bank_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INPUTS
|
||||
//**************************************************************************
|
||||
|
||||
READ_LINE_MEMBER(itt3030_state::kbd_matrix_r)
|
||||
{
|
||||
return m_kbdread;
|
||||
@ -471,14 +321,11 @@ READ_LINE_MEMBER(itt3030_state::kbd_matrix_r)
|
||||
|
||||
WRITE8_MEMBER(itt3030_state::kbd_matrix_w)
|
||||
{
|
||||
int rd_masks[8] = { 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80 };
|
||||
int tmp_read;
|
||||
|
||||
// printf("matrix_w: %02x (col %d row %d clk %d)\n", data, m_kbdcol, m_kbdrow, (data & 0x80) ? 1 : 0);
|
||||
|
||||
if ((data & 0x80) && (!m_kbdclk))
|
||||
{
|
||||
tmp_read = m_keyrows[(data >> 3) & 0xf]->read() & rd_masks[data & 0x7];
|
||||
const ioport_value tmp_read = m_keyrows[(data >> 3) & 0xf]->read() & (1 << (data & 0x7));
|
||||
m_kbdread = (tmp_read != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -496,6 +343,11 @@ READ8_MEMBER(itt3030_state::kbd_port2_r)
|
||||
return m_kbdport2;
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// KEYBOARD
|
||||
//**************************************************************************
|
||||
|
||||
static INPUT_PORTS_START( itt3030 )
|
||||
PORT_START("ROW.0")
|
||||
PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
|
||||
@ -599,6 +451,60 @@ static INPUT_PORTS_START( itt3030 )
|
||||
PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT))
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// VIDEO
|
||||
//**************************************************************************
|
||||
|
||||
READ8_MEMBER(itt3030_state::vsync_r)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
|
||||
if (machine().first_screen()->vblank())
|
||||
{
|
||||
ret |= 0xc0; // set both bits 6 and 7 if vblank
|
||||
}
|
||||
|
||||
if (machine().first_screen()->hblank())
|
||||
{
|
||||
ret |= 0x80; // set only bit 7 if hblank
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(itt3030_state::bank_w)
|
||||
{
|
||||
int bank = 8;
|
||||
|
||||
if (BIT(data, 4))
|
||||
{
|
||||
bank = (BIT(data, 5) << 2) | (BIT(data, 6) << 1) | BIT(data, 7);
|
||||
}
|
||||
|
||||
// printf("bank_w: new value %02x, m_bank %x, bank %x\n", data, m_bank, bank);
|
||||
|
||||
m_48kbank->set_bank(bank);
|
||||
}
|
||||
|
||||
uint32_t itt3030_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int start = m_crtc->upscroll_offset();
|
||||
for(int y = 0; y < 24; y++ )
|
||||
{
|
||||
int vramy = (start + y) % 24;
|
||||
for(int x = 0; x < 80; x++ )
|
||||
{
|
||||
uint8_t code = m_vram[x + vramy*128];
|
||||
int invert = code & 0x80 ? 1 : 0;
|
||||
code &= 0x7f;
|
||||
m_gfxdecode->gfx(invert)->opaque(bitmap,cliprect, code , 0, 0,0, x*8,y*12);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const gfx_layout charlayout =
|
||||
{
|
||||
8, 16, /* 8x16 characters */
|
||||
@ -616,6 +522,148 @@ static GFXDECODE_START( itt3030 )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 )
|
||||
GFXDECODE_END
|
||||
|
||||
PALETTE_INIT_MEMBER(itt3030_state, itt3030)
|
||||
{
|
||||
palette.set_pen_color(0, rgb_t::black());
|
||||
palette.set_pen_color(1, rgb_t(215, 229, 82));
|
||||
palette.set_pen_color(2, rgb_t::black());
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// SOUND
|
||||
//**************************************************************************
|
||||
|
||||
WRITE8_MEMBER( itt3030_state::beep_w )
|
||||
{
|
||||
m_beep->set_state(data&1);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// FLOPPY
|
||||
//**************************************************************************
|
||||
|
||||
WRITE_LINE_MEMBER(itt3030_state::fdcirq_w)
|
||||
{
|
||||
m_fdc_irq = state;
|
||||
}
|
||||
|
||||
|
||||
WRITE_LINE_MEMBER(itt3030_state::fdcdrq_w)
|
||||
{
|
||||
m_fdc_drq = state;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(itt3030_state::fdchld_w)
|
||||
{
|
||||
m_fdc_hld = state;
|
||||
}
|
||||
|
||||
/*
|
||||
7 Data Request (DRQ - inverted 1791-Signal)
|
||||
6 Interrupt Request (INTRQ - 1791-Signal)
|
||||
5 Head Load (HLD - inverted 1791-Signal)
|
||||
4 Ready 3 (Drive 3 ready)
|
||||
3 Ready 2 (Drive 2 ready)
|
||||
2 Ready l (Drive 1 ready)
|
||||
1 Write protect (the disk in the selected drive is write protected)
|
||||
0 HLT (Halt signal during head load and track change)
|
||||
*/
|
||||
READ8_MEMBER(itt3030_state::fdc_stat_r)
|
||||
{
|
||||
uint8_t res = 0;
|
||||
floppy_image_device *floppy1 = m_floppy[0] ? m_floppy[0]->get_device() : nullptr;
|
||||
floppy_image_device *floppy2 = m_floppy[1] ? m_floppy[1]->get_device() : nullptr;
|
||||
floppy_image_device *floppy3 = m_floppy[2] ? m_floppy[2]->get_device() : nullptr;
|
||||
|
||||
res = m_fdc_drq ? 0x80 : 0x00;
|
||||
res |= m_fdc_irq ? 0x40 : 0x00;
|
||||
res |= m_fdc_hld ? 0x00 : 0x20;
|
||||
if (floppy3) res |= !floppy3->ready_r() ? 0x10 : 0;
|
||||
if (floppy2) res |= !floppy2->ready_r() ? 0x08 : 0;
|
||||
if (floppy1) res |= !floppy1->ready_r() ? 0x04 : 0;
|
||||
if (m_curfloppy) res |= m_curfloppy->wpt_r() ? 0x02 : 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* As far as we can tell, the mess of ttl de-inverts the bus */
|
||||
READ8_MEMBER(itt3030_state::fdc_r)
|
||||
{
|
||||
return m_fdc->gen_r(offset) ^ 0xff;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(itt3030_state::fdc_w)
|
||||
{
|
||||
m_fdc->gen_w(offset, data ^ 0xff);
|
||||
}
|
||||
|
||||
/*
|
||||
7 SEL1 - Select drive 1
|
||||
6 SEL2 - Select drive 2
|
||||
5 SEL3 - Select drive 3
|
||||
4 MOTOR - Motor on
|
||||
3 DOOR - Drive door lock drives 1 + 2 (not possible with all drives)
|
||||
2 SIDESEL - Select disk side
|
||||
1 KOMP - write comp on/off
|
||||
0 RG J - Change separator stage to read
|
||||
*/
|
||||
WRITE8_MEMBER(itt3030_state::fdc_cmd_w)
|
||||
{
|
||||
floppy_image_device *floppy = nullptr;
|
||||
|
||||
logerror("%02x to fdc_cmd_w: motor %d side %d\n", data, (data & 0x10)>>4, (data & 4)>>2);
|
||||
|
||||
// select drive
|
||||
if (data & 0x80)
|
||||
{
|
||||
floppy = m_floppy[0] ? m_floppy[0]->get_device() : nullptr;
|
||||
}
|
||||
else if (data & 0x40)
|
||||
{
|
||||
floppy = m_floppy[1] ? m_floppy[1]->get_device() : nullptr;
|
||||
}
|
||||
else if (data & 0x20)
|
||||
{
|
||||
floppy = m_floppy[2] ? m_floppy[2]->get_device() : nullptr;
|
||||
}
|
||||
|
||||
// selecting a new drive?
|
||||
if (floppy != m_curfloppy)
|
||||
{
|
||||
m_fdc->set_floppy(floppy);
|
||||
m_curfloppy = floppy;
|
||||
}
|
||||
|
||||
if (floppy != nullptr)
|
||||
{
|
||||
// side select
|
||||
floppy->ss_w((data & 4) ? 1 : 0);
|
||||
|
||||
// motor control (active low)
|
||||
floppy->mon_w((data & 0x10) ? 0 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// FLOPPY - Drive definitions
|
||||
//**************************************************************************
|
||||
|
||||
FLOPPY_FORMATS_MEMBER( itt3030_state::itt3030_floppy_formats )
|
||||
FLOPPY_ITT3030_FORMAT
|
||||
FLOPPY_FORMATS_END
|
||||
|
||||
|
||||
static SLOT_INTERFACE_START( itt3030_floppies )
|
||||
SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
|
||||
SLOT_INTERFACE( "525qd", FLOPPY_525_QD )
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// MACHINE
|
||||
//**************************************************************************
|
||||
|
||||
void itt3030_state::machine_start()
|
||||
{
|
||||
@ -634,28 +682,6 @@ void itt3030_state::machine_reset()
|
||||
m_kbdclk = 1;
|
||||
m_fdc_irq = m_fdc_drq = m_fdc_hld = 0;
|
||||
m_curfloppy = nullptr;
|
||||
|
||||
// look up floppies in advance
|
||||
m_con1 = machine().device<floppy_connector>("fdc:0");
|
||||
m_con2 = machine().device<floppy_connector>("fdc:1");
|
||||
m_con3 = machine().device<floppy_connector>("fdc:2");
|
||||
}
|
||||
|
||||
FLOPPY_FORMATS_MEMBER( itt3030_state::itt3030_floppy_formats )
|
||||
FLOPPY_ITT3030_FORMAT
|
||||
FLOPPY_FORMATS_END
|
||||
|
||||
|
||||
static SLOT_INTERFACE_START( itt3030_floppies )
|
||||
SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
|
||||
SLOT_INTERFACE( "525qd", FLOPPY_525_QD )
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
PALETTE_INIT_MEMBER(itt3030_state, itt3030)
|
||||
{
|
||||
palette.set_pen_color(0, rgb_t::black());
|
||||
palette.set_pen_color(1, rgb_t(215, 229, 82));
|
||||
palette.set_pen_color(2, rgb_t::black());
|
||||
}
|
||||
|
||||
MACHINE_CONFIG_START(itt3030_state::itt3030)
|
||||
@ -720,11 +746,9 @@ MACHINE_CONFIG_START(itt3030_state::itt3030)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Game driver(s)
|
||||
|
||||
***************************************************************************/
|
||||
//**************************************************************************
|
||||
// ROM DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
ROM_START( itt3030 )
|
||||
ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 )
|
||||
@ -735,4 +759,8 @@ ROM_START( itt3030 )
|
||||
ROM_LOAD( "8741ad.bin", 0x0000, 0x0400, CRC(cabf4394) SHA1(e5d1416b568efa32b578ca295a29b7b5d20c0def))
|
||||
ROM_END
|
||||
|
||||
//**************************************************************************
|
||||
// SYSTEM DRIVERS
|
||||
//**************************************************************************
|
||||
|
||||
COMP( 1982, itt3030, 0, 0, itt3030, itt3030, itt3030_state, 0, "ITT RFA", "ITT3030", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
|
||||
|
@ -1079,6 +1079,7 @@ asma2k //
|
||||
asmapro //
|
||||
|
||||
@source:alphatpx.cpp
|
||||
alphatp1
|
||||
alphatp2
|
||||
alphatp2u
|
||||
alphatp3 // 1982 Triumph-Adler
|
||||
|
Loading…
Reference in New Issue
Block a user