Previous 199869 Revisions Next

r33674 Thursday 4th December, 2014 at 19:36:02 UTC by Jürgen Buchmüller
Fix cut+paste, typos and some implementation bugs (nw)
[src/emu/cpu/pps4]pps4.c

trunk/src/emu/cpu/pps4/pps4.c
r242185r242186
3333#include "pps4.h"
3434
3535
36#define VERBOSE 1       //!< set to 1 to log certain instruction conditions
36#define VERBOSE 0       //!< set to 1 to log certain instruction conditions
3737
3838#if VERBOSE
3939#define LOG(x) logerror x
r242185r242186
219219 * @brief pps4_device::iADI Add immediate
220220 * OPCODE     cycles  mnemonic
221221 * -----------------------------
222 * 0110 xxxx  1 cyc   ADI #x
222 * 0110 xxxx  1 cyc   ADI x
223223 *
224224 * Symbolic equation
225225 * -----------------------------
r242185r242186
248248 * @brief pps4_device::iDC Decimal correction
249249 * OPCODE     cycles  mnemonic
250250 * -----------------------------
251 * 0110 0110  1 cyc   DC
251 * 0110 0101  1 cyc   DC
252252 *
253253 * Symbolic equation
254254 * -----------------------------
r242185r242186
337337 */
338338void pps4_device::iCOMP()
339339{
340    m_A = ~m_A & 15;
340    m_A = m_A ^ 15;
341341}
342342
343343/**
r242185r242186
395395 * @brief pps4_device::iRF1 Reset flip-flop FF1
396396 * OPCODE     cycles  mnemonic
397397 * -----------------------------
398 * 0010 0100  1 cyc   RF1
398 * 0010 0110  1 cyc   RF1
399399 *
400400 * Symbolic equation
401401 * -----------------------------
r242185r242186
463463 */
464464void pps4_device::iLD()
465465{
466    const UINT16 imm = ~m_I & 7;
466    const UINT16 i3c = ~m_I & 7;
467467    m_A = M();
468    m_B = m_B ^ (imm << 4);
468    m_B = m_B ^ (i3c << 4);
469469}
470470
471471/**
r242185r242186
486486 */
487487void pps4_device::iEX()
488488{
489    const UINT16 imm = ~m_I & 7;
489    const UINT16 i3c = ~m_I & 7;
490490    const UINT8 mem = M();
491491    W(m_A);
492492    m_A = mem;
493    m_B = m_B ^ (imm << 4);
493    m_B = m_B ^ (i3c << 4);
494494}
495495
496496/**
r242185r242186
515515 */
516516void pps4_device::iEXD()
517517{
518    const UINT8 imm = ~m_I & 7;
518    const UINT8 i3c = ~m_I & 7;
519519    const UINT8 mem = M();
520520    UINT8 bl = m_B & 15;
521521    W(m_A);
522522    m_A = mem;
523    m_B = m_B ^ (imm << 4);
523    m_B = m_B ^ (i3c << 4);
524    // if decrement BL wraps to 1111b
524525    if (0 == bl) {
525        // decrement BL wraps to 1111b
526526        bl = 15;
527527        m_Skip = 1;
528528    } else {
529        // decrement BL
530529        bl = bl - 1;
531530    }
532531    m_B = (m_B & ~15) | bl;
r242185r242186
583582 * @brief pps4_device::iLXA
584583 * OPCODE     cycles  mnemonic
585584 * -----------------------------
586 * 0001 1011  1 cyc   LAX
585 * 0001 1011  1 cyc   LXA
587586 *
588587 * Symbolic equation
589588 * -----------------------------
r242185r242186
637636 * @brief pps4_device::iLBUA
638637 * OPCODE     cycles  mnemonic
639638 * -----------------------------
640 * 0001 0000  1 cyc   LBUA
639 * 0000 0100  1 cyc   LBUA
641640 *
642641 * Symbolic equation
643642 * -----------------------------
r242185r242186
760759 */
761760void pps4_device::iCYS()
762761{
763    const UINT16 sa = (m_SA >> 4) | (m_A << 12);
762    const UINT16 sa = (m_SA >> 4) | (m_A << 8);
764763    m_A = m_SA & 15;
765764    m_SA = sa;
766765}
r242185r242186
841840 */
842841void pps4_device::iLBL()
843842{
843    const UINT8 i8 = ~ARG() & 255;
844844    // previous LB or LBL instruction?
845845    if (0xc0 == m_Ip || 0x00 == m_Ip) {
846846        LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I));
847847        return;
848848    }
849    m_B = ~ARG() & 255;
849    m_B = i8;
850850}
851851
852852/**
r242185r242186
879879 * @brief pps4_device::iDECB
880880 * OPCODE     cycles  mnemonic
881881 * -----------------------------
882 * 0001 1111  1 cyc    DECq
882 * 0001 1111  1 cyc    DECB
883883 *
884884 * Symbolic equation
885885 * -----------------------------
r242185r242186
905905 * @brief pps4_device::iT Transfer
906906 * OPCODE     cycles  mnemonic
907907 * -----------------------------
908 * 10xx xxxx  1 cyc    T *
908 * 10xx xxxx  1 cyc    T *xx
909909 *
910910 * Symbolic equation
911911 * -----------------------------
r242185r242186
952952{
953953    m_SB = m_SA;
954954    m_SA = m_P;
955    m_P = 3 << 6;
956    m_P = m_P | (m_I & 63);
955    m_P = (3 << 6) | (m_I & 63);
957956    m_I2 = ARG();
958957    m_P = (1 << 8) | m_I2;
959958}
r242185r242186
978977void pps4_device::iTL()
979978{
980979    m_I2 = ARG();
981    m_P = (m_I & 15) << 8;
982    m_P = m_P | m_I2;
980    m_P = ((m_I & 15) << 8) | m_I2;
983981}
984982
985983/**
r242185r242186
10401038 */
10411039void pps4_device::iSKZ()
10421040{
1043    m_Skip = 0 == m_A ? 1 : 0;
1041    m_Skip = (0 == m_A) ? 1 : 0;
10441042}
10451043
10461044/**
r242185r242186
10591057 */
10601058void pps4_device::iSKBI()
10611059{
1062    const UINT8 imm = m_I & 15;
1060    const UINT8 i4 = m_I & 15;
10631061    const UINT8 bl = m_B & 15;
1064    m_Skip = bl == imm ? 1 : 0;
1062    m_Skip = bl == i4 ? 1 : 0;
10651063}
10661064
10671065/**
r242185r242186
10981096 * @brief pps4_device::iRTN Return
10991097 * OPCODE     cycles  mnemonic
11001098 * -----------------------------
1101 * 0000 0101  1 cyc    RET
1099 * 0000 0101  1 cyc    RTN
11021100 *
11031101 * Symbolic equation
11041102 * -----------------------------
r242185r242186
11211119 * @brief pps4_device::iRTN Return
11221120 * OPCODE     cycles  mnemonic
11231121 * -----------------------------
1124 * 0000 0111  1 cyc    RETSK
1122 * 0000 0111  1 cyc    RTNSK
11251123 *
11261124 * Symbolic equation
11271125 * -----------------------------
r242185r242186
11381136    m_SA ^= m_SB;
11391137    m_SB ^= m_SA;
11401138    m_SA ^= m_SB;
1141    ROP();      // next opcode is ignored
1142    m_I = 0;    // avoid LB/LBL or LDI skipping due to m_Ip
1139    m_Skip = 1; // next opcode is ignored
11431140}
11441141
11451142/**
r242185r242186
11661163 */
11671164void pps4_device::iIOL()
11681165{
1169    const UINT8 a = ~m_A & 15;
1166    const UINT8 ac = ~m_A & 15;
11701167    m_I2 = ARG();
1171    m_io->write_byte(m_I2, a);
1172    LOG(("%s: port:%02x <- %x\n", __FUNCTION__, m_I2, a));
1168    m_io->write_byte(m_I2, ac);
1169    LOG(("%s: port:%02x <- %x\n", __FUNCTION__, m_I2, ac));
11731170    m_A = ~m_io->read_byte(m_I2) & 15;
11741171    LOG(("%s: port:%02x -> %x\n", __FUNCTION__, m_I2, m_A));
11751172}
r242185r242186
11891186 */
11901187void pps4_device::iDIA()
11911188{
1192    m_A = m_io->read_byte(PPS4_PORT_A);
1189    m_A = m_io->read_byte(PPS4_PORT_A) & 15;
11931190}
11941191
11951192/**
r242185r242186
12071204 */
12081205void pps4_device::iDIB()
12091206{
1210    m_A = m_io->read_byte(PPS4_PORT_B);
1207    m_A = m_io->read_byte(PPS4_PORT_B) & 15;
12111208}
12121209
12131210/**
1214 * @brief pps4_device::iDIA Discrete input group A
1211 * @brief pps4_device::iDOA Discrete output
12151212 * OPCODE     cycles  mnemonic
12161213 * -----------------------------
1217 * 0010 1101  1 cyc    DOA
1214 * 0001 1101  1 cyc    DOA
12181215 *
12191216 * Symbolic equation
12201217 * -----------------------------


Previous 199869 Revisions Next


© 1997-2024 The MAME Team