gts1: various fixes. Still not working though.

This commit is contained in:
Robbbert 2021-08-27 02:10:56 +10:00
parent dd7ab74a3c
commit b106b6a17b
4 changed files with 519 additions and 521 deletions

View File

@ -125,7 +125,7 @@ u8 pps4_device::M()
{
u8 ret = m_data.read_byte(m_B & ~m_SAG);
m_SAG = 0;
return ret;
return ret & 15;
}
@ -211,9 +211,9 @@ inline u8 pps4_device::ARG()
*/
void pps4_device::iAD()
{
m_A = m_A + M();
m_C = (m_A >> 4) & 1;
m_A = m_A & 15;
m_A += M();
m_C = (m_A > 15) ? 1 : 0;
m_A &= 15;
}
/**
@ -232,8 +232,8 @@ void pps4_device::iAD()
void pps4_device::iADC()
{
m_A = m_A + M() + m_C;
m_C = m_A >> 4;
m_A = m_A & 15;
m_C = (m_A > 15) ? 1 : 0;
m_A &= 15;
}
/**
@ -252,10 +252,11 @@ void pps4_device::iADC()
*/
void pps4_device::iADSK()
{
m_A = m_A + M();
m_C = m_A >> 4;
m_A = m_A + M() + m_C; // This fixes the diagnostic test button, same as pinmame. It means ADSK and ADCSK are the same.
//m_A += M();
m_C = (m_A > 15) ? 1 : 0;
m_Skip = m_C;
m_A = m_A & 15;
m_A &= 15;
}
/**
@ -275,9 +276,9 @@ void pps4_device::iADSK()
void pps4_device::iADCSK()
{
m_A = m_A + M() + m_C;
m_C = m_A >> 4;
m_C = (m_A > 15) ? 1 : 0;
m_Skip = m_C;
m_A = m_A & 15;
m_A &= 15;
}
/**
@ -304,9 +305,9 @@ void pps4_device::iADCSK()
void pps4_device::iADI()
{
const u8 imm = ~m_I1 & 15;
m_A = m_A + imm;
m_Skip = (m_A >> 4) & 1;
m_A = m_A & 15;
m_A += imm;
m_Skip = (m_A > 15) ? 1 : 0;
m_A &= 15;
}
/**
@ -326,7 +327,7 @@ void pps4_device::iADI()
*/
void pps4_device::iDC()
{
m_A = m_A + 10;
m_A = (m_A + 10) & 15;
}
/**
@ -345,7 +346,7 @@ void pps4_device::iDC()
*/
void pps4_device::iAND()
{
m_A = m_A & M();
m_A &= M();
}
/**
@ -364,7 +365,7 @@ void pps4_device::iAND()
*/
void pps4_device::iOR()
{
m_A = m_A | M();
m_A |= M();
}
/**
@ -384,7 +385,7 @@ void pps4_device::iOR()
*/
void pps4_device::iEOR()
{
m_A = m_A ^ M();
m_A ^= M();
}
/**
@ -402,7 +403,7 @@ void pps4_device::iEOR()
*/
void pps4_device::iCOMP()
{
m_A = m_A ^ 15;
m_A ^= 15;
}
/**
@ -522,7 +523,7 @@ void pps4_device::iRF2()
* by B register are placed in the accumulator.
* The RAM address in the B register is then
* modified by the result of an exclusive-OR of
* the 3-b it immediate field I(3:1) and B(7:5)
* the 3-b immediate field I(3:1) and B(7:5)
*
* See %Note3
*/
@ -530,7 +531,7 @@ void pps4_device::iLD()
{
const u16 i3c = ~m_I1 & 7;
m_A = M();
m_B = m_B ^ (i3c << 4);
m_B ^= (i3c << 4);
}
/**
@ -555,7 +556,7 @@ void pps4_device::iEX()
const u8 mem = M();
W(m_A);
m_A = mem;
m_B = m_B ^ (i3c << 4);
m_B ^= (i3c << 4);
}
/**
@ -585,14 +586,10 @@ void pps4_device::iEXD()
u8 bl = m_B & 15;
W(m_A);
m_A = mem;
m_B = m_B ^ (i3c << 4);
m_B ^= (i3c << 4);
// if decrement BL wraps to 1111b
if (0 == bl) {
bl = 15;
m_Skip = 1;
} else {
bl = bl - 1;
}
bl = (bl - 1) & 15;
m_Skip = (bl == 15);
m_B = (m_B & ~15) | bl;
}
@ -640,7 +637,7 @@ void pps4_device::iLDI()
*/
void pps4_device::iLAX()
{
m_A = m_X;
m_A = m_X & 15;
}
/**
@ -654,11 +651,11 @@ void pps4_device::iLAX()
* X <- A
*
* The contents of the accumulator are
* tansferred to the X register.
* transferred to the X register.
*/
void pps4_device::iLXA()
{
m_X = m_A;
m_X = m_A & 15;
}
/**
@ -672,7 +669,7 @@ void pps4_device::iLXA()
* A <- BL
*
* The contents of BL register are
* tansferred to the accumulator.
* transferred to the accumulator.
*/
void pps4_device::iLABL()
{
@ -690,7 +687,7 @@ void pps4_device::iLABL()
* BM <- X
*
* The contents of X register are
* tansferred to BM register.
* transferred to the BM register.
*/
void pps4_device::iLBMX()
{
@ -708,7 +705,7 @@ void pps4_device::iLBMX()
* BU <- A
* A <- M
*
* The contents of accumulator are tansferred to
* The contents of accumulator are transferred to
* BU register. Also, the contents of the currently
* addressed RAM are transferred to accumulator.
*/
@ -776,9 +773,7 @@ void pps4_device::iXBMX()
void pps4_device::iXAX()
{
// swap A and X
m_A ^= m_X;
m_X ^= m_A;
m_A ^= m_X;
std::swap(m_A, m_X);
}
/**
@ -797,9 +792,7 @@ void pps4_device::iXAX()
void pps4_device::iXS()
{
// swap SA and SB
m_SA ^= m_SB;
m_SB ^= m_SA;
m_SA ^= m_SB;
std::swap(m_SA, m_SB);
}
/**
@ -875,9 +868,7 @@ void pps4_device::iLB()
m_B = ~ARG() & 255;
m_P = m_SA;
// swap SA and SB
m_SA ^= m_SB;
m_SB ^= m_SA;
m_SA ^= m_SB;
std::swap(m_SA, m_SB);
}
/**
@ -1103,7 +1094,7 @@ void pps4_device::iSKC()
*/
void pps4_device::iSKZ()
{
m_Skip = (0 == m_A) ? 1 : 0;
m_Skip = m_A ? 0 : 1;
}
/**
@ -1175,9 +1166,7 @@ void pps4_device::iRTN()
{
m_P = m_SA & 0xFFF;
// swap SA and SB
m_SA ^= m_SB;
m_SB ^= m_SA;
m_SA ^= m_SB;
std::swap(m_SA, m_SB);
}
/**
@ -1198,9 +1187,7 @@ void pps4_device::iRTNSK()
{
m_P = m_SA & 0xFFF;
// swap SA and SB
m_SA ^= m_SB;
m_SB ^= m_SA;
m_SA ^= m_SB;
std::swap(m_SA, m_SB);
m_Skip = 1; // next opcode is ignored
}
@ -1235,7 +1222,7 @@ void pps4_device::iRTNSK()
*/
void pps4_device::iIOL()
{
u8 ac = (~m_A & 15);
u8 ac = ~m_A & 15;
m_I2 = ARG();
m_io.write_byte(m_I2, ac);
LOG("%s: port:%02x <- %x\n", __FUNCTION__, m_I2, ac);
@ -1283,7 +1270,7 @@ void pps4_device::iDIB()
void pps4_2_device::iDIB()
{
// PPS-4/2 can write zeros onto bidirectional DIO pins to mask open-drain inputs
m_A = m_dib_cb() & m_DIO;
m_A = m_dib_cb() & m_DIO & 15;
}
/**
@ -1307,7 +1294,7 @@ void pps4_device::iDOA()
void pps4_2_device::iDOA()
{
// DOA also transfers contents of X to DIO on PPS-4/2
m_DIO = m_X;
m_DIO = m_X & 15;
m_do_cb(m_A | (m_X << 4));
}

View File

@ -13,7 +13,7 @@
KTR 1 1 x x x 1 1 0 0 Transfer Keyboard Return
KTS 1 1 x x x 1 0 1 0 Transfer Keyboard Strobe
KLA 1 1 x x x 1 1 1 0 Load Display Register A
KLB 1 1 x x x 1 1 0 1 Load Display Register A
KLB 1 1 x x x 1 1 0 1 Load Display Register B
KDN 1 1 x x x 0 0 1 1 Turn On Display
KAF 1 1 x x x 1 0 1 1 Turn Off A
KBF 1 1 x x x 0 1 1 1 Turn Off B
@ -34,6 +34,9 @@
7.) KER takes a maximum of 10-bit times to complete (= 80 clocks)
Therefore, there must be at least 10 bit times between KER
and the next KTS instruction.
8.) This device has only been tested on the gts1 driver. It does
not use the keyboard. The digit data is inverted (so it stores
6 when we want to display 9).
**********************************************************************/
#include "emu.h"
@ -137,7 +140,7 @@ void r10788_device::device_timer(emu_timer &timer, device_timer_id id, int param
void r10788_device::io_w(offs_t offset, uint8_t data)
{
assert(offset < 16);
offset &= 15;
switch (offset)
{
case KTR: // Transfer Keyboard Return
@ -149,6 +152,7 @@ void r10788_device::io_w(offs_t offset, uint8_t data)
m_kts = data;
break;
case KLA: // Load Display Register A
m_io_counter = (m_io_counter + 1) % 16;
LOG("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data);
m_kla = data;
m_reg[0][m_io_counter] = m_kla;
@ -156,21 +160,22 @@ void r10788_device::io_w(offs_t offset, uint8_t data)
case KLB: // Load Display Register B
LOG("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data);
m_klb = data;
m_reg[1][m_io_counter] = m_kla;
m_reg[1][m_io_counter] = m_klb;
break;
case KDN: // Turn On Display
LOG("%s: KDN data:%02x\n", __FUNCTION__, data);
m_mask_a = 15;
m_mask_b = 15;
m_io_counter = 15;
break;
case KAF: // Turn Off A
LOG("%s: KAF data:%02x\n", __FUNCTION__, data);
m_mask_a = 0;
m_mask_b &= ~3;
m_mask_b &= 12;
break;
case KBF: // Turn Off B
LOG("%s: KBF data:%02x\n", __FUNCTION__, data);
m_mask_b &= ~12;
m_mask_b &= 3;
break;
case KER: // Reset Keyboard Error
LOG("%s: KER data:%02x\n", __FUNCTION__, data);
@ -182,7 +187,7 @@ void r10788_device::io_w(offs_t offset, uint8_t data)
uint8_t r10788_device::io_r(offs_t offset)
{
assert(offset < 16);
offset &= 15;
uint8_t data = 0xf;
switch (offset)
{
@ -203,8 +208,6 @@ uint8_t r10788_device::io_r(offs_t offset)
m_klb = m_reg[1][m_io_counter];
data = m_klb;
LOG("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data);
// FIXME: does it automagically increment at KLB write?
m_io_counter = (m_io_counter + 1) % 16;
break;
case KDN: // Turn On Display
LOG("%s: KDN data:%02x\n", __FUNCTION__, data);

File diff suppressed because it is too large Load Diff

View File

@ -20,94 +20,94 @@ license:CC0
<bounds left="0" top="25" right="325" bottom="205" />
<!-- Top Row -->
<element name="digit8_5" ref="digit8_">
<element name="digit8_13" ref="digit8_">
<bounds left="10" top="45" right="30" bottom="84" />
</element>
<element name="digit8_4" ref="digit8_">
<element name="digit8_12" ref="digit8_">
<bounds left="34" top="45" right="54" bottom="84" />
</element>
<element name="digit8_3" ref="digit8_">
<element name="digit8_11" ref="digit8_">
<bounds left="58" top="45" right="78" bottom="84" />
</element>
<element name="digit8_2" ref="digit8_">
<element name="digit8_10" ref="digit8_">
<bounds left="87" top="45" right="107" bottom="84" />
</element>
<element name="digit8_1" ref="digit8_">
<element name="digit8_9" ref="digit8_">
<bounds left="111" top="45" right="131" bottom="84" />
</element>
<element name="digit8_0" ref="digit8_">
<element name="digit8_8" ref="digit8_">
<bounds left="135" top="45" right="155" bottom="84" />
</element>
<element name="digit8_13" ref="digit8_">
<element name="digit8_5" ref="digit8_">
<bounds left="170" top="45" right="190" bottom="84" />
</element>
<element name="digit8_12" ref="digit8_">
<element name="digit8_4" ref="digit8_">
<bounds left="194" top="45" right="214" bottom="84" />
</element>
<element name="digit8_11" ref="digit8_">
<element name="digit8_3" ref="digit8_">
<bounds left="218" top="45" right="238" bottom="84" />
</element>
<element name="digit8_10" ref="digit8_">
<element name="digit8_2" ref="digit8_">
<bounds left="247" top="45" right="267" bottom="84" />
</element>
<element name="digit8_9" ref="digit8_">
<element name="digit8_1" ref="digit8_">
<bounds left="271" top="45" right="291" bottom="84" />
</element>
<element name="digit8_8" ref="digit8_">
<element name="digit8_0" ref="digit8_">
<bounds left="295" top="45" right="315" bottom="84" />
</element>
<!-- Bottom Row -->
<element name="digit8_21" ref="digit8_">
<element name="digit8_29" ref="digit8_">
<bounds left="10" top="100" right="30" bottom="139" />
</element>
<element name="digit8_20" ref="digit8_">
<element name="digit8_28" ref="digit8_">
<bounds left="34" top="100" right="54" bottom="139" />
</element>
<element name="digit8_19" ref="digit8_">
<element name="digit8_27" ref="digit8_">
<bounds left="58" top="100" right="78" bottom="139" />
</element>
<element name="digit8_18" ref="digit8_">
<element name="digit8_26" ref="digit8_">
<bounds left="87" top="100" right="107" bottom="139" />
</element>
<element name="digit8_17" ref="digit8_">
<element name="digit8_25" ref="digit8_">
<bounds left="111" top="100" right="131" bottom="139" />
</element>
<element name="digit8_16" ref="digit8_">
<element name="digit8_24" ref="digit8_">
<bounds left="135" top="100" right="155" bottom="139" />
</element>
<!-- Digits 22 and 23 are not used -->
<element name="digit8_29" ref="digit8_">
<element name="digit8_21" ref="digit8_">
<bounds left="170" top="100" right="190" bottom="139" />
</element>
<element name="digit8_28" ref="digit8_">
<element name="digit8_20" ref="digit8_">
<bounds left="194" top="100" right="214" bottom="139" />
</element>
<element name="digit8_27" ref="digit8_">
<element name="digit8_19" ref="digit8_">
<bounds left="218" top="100" right="238" bottom="139" />
</element>
<element name="digit8_26" ref="digit8_">
<element name="digit8_18" ref="digit8_">
<bounds left="247" top="100" right="267" bottom="139" />
</element>
<element name="digit8_25" ref="digit8_">
<element name="digit8_17" ref="digit8_">
<bounds left="271" top="100" right="291" bottom="139" />
</element>
<element name="digit8_24" ref="digit8_">
<element name="digit8_16" ref="digit8_">
<bounds left="295" top="100" right="315" bottom="139" />
</element>
<!-- Digits 30 and 31 are not used -->
<!-- 4 digit display -->
<element name="digit7_15" ref="digit7_">
<element name="digit7_7" ref="digit7_">
<bounds left="121" top="155" right="136" bottom="189" />
</element>
<element name="digit7_14" ref="digit7_">
<element name="digit7_6" ref="digit7_">
<bounds left="140" top="155" right="155" bottom="189" />
</element>
<element name="digit7_7" ref="digit7_">
<element name="digit7_15" ref="digit7_">
<bounds left="170" top="155" right="185" bottom="189" />
</element>
<element name="digit7_6" ref="digit7_">
<element name="digit7_14" ref="digit7_">
<bounds left="189" top="155" right="204" bottom="189" />
</element>
</view>