Previous 199869 Revisions Next

r19096 Thursday 22nd November, 2012 at 01:43:20 UTC by R. Belmont
z800x: Fixed some incorrect opcodes and address register math in segment mode.  Olivetti M20 now can boot PCOS to the prompt. [Christian Grössler]
[src/emu/cpu/z8000]z8000.c z8000cpu.h z8000ops.c
[src/mess/drivers]m20.c

trunk/src/emu/cpu/z8000/z8000cpu.h
r19095r19096
188188#define GET_DSP8      INT8 dsp8 = (INT8)get_operand(cpustate, 0)
189189#define GET_DSP16      UINT32 dsp16 = addr_add(cpustate, cpustate->pc, (INT16)get_operand(cpustate, 1))
190190#define GET_ADDR(o)    UINT32 addr = (UINT32)get_addr_operand(cpustate, o)
191#define GET_ADDR_RAW(o)    UINT32 addr = (UINT32)get_raw_addr_operand(cpustate, o)
191192
192193struct z8000_state;
193194
trunk/src/emu/cpu/z8000/z8000.c
r19095r19096
184184    return cpustate->op[opnum];
185185}
186186
187INLINE UINT32 get_raw_addr_operand (z8000_state *cpustate, int opnum)
188{
189    int i;
190    assert (cpustate->device->type() == Z8001 || cpustate->device->type() == Z8002);
187191
192    for (i = 0; i < opnum; i++)
193        assert (cpustate->op_valid & (1 << i));
194
195    if (! (cpustate->op_valid & (1 << opnum)))
196    {
197        UINT32 seg = cpustate->direct->read_decrypted_word(cpustate->pc);
198        cpustate->pc += 2;
199        if (segmented_mode(cpustate))
200        {
201            if (seg & 0x8000)
202            {
203                cpustate->op[opnum] = (seg << 16) | cpustate->direct->read_decrypted_word(cpustate->pc);
204                cpustate->pc += 2;
205            }
206            else
207                cpustate->op[opnum] = (seg << 16) | (seg & 0xff);
208        }
209        else
210            cpustate->op[opnum] = seg;
211        cpustate->op_valid |= (1 << opnum);
212    }
213    return cpustate->op[opnum];
214}
215
188216INLINE UINT8 RDMEM_B(z8000_state *cpustate, UINT32 addr)
189217{
190218   return cpustate->program->read_byte(addr);
trunk/src/emu/cpu/z8000/z8000ops.c
r19095r19096
66 *
77 *   Copyright Juergen Buchmueller, all rights reserved.
88 *   Bug fixes and MSB_FIRST compliance Ernesto Corvi.
9 *   Bug fixes and segmented mode support Christian Groessler.
910 *
1011 *   - This source code is released as freeware for non-commercial purposes.
1112 *   - You are free to use and redistribute this code in modified or
r19095r19096
7374
7475INLINE UINT32 make_segmented_addr(UINT32 addr)
7576{
76    return ((addr & 0xffff0000) << 8) | (addr & 0xffff);
77    return ((addr & 0x007f0000) << 8) | 0x80000000 | (addr & 0xffff);
7778}
7879
7980INLINE UINT32 segmented_addr(UINT32 addr)
r19095r19096
9192
9293INLINE void addr_to_reg(z8000_state *cpustate, int regno, UINT32 addr)
9394{
94    if (segmented_mode(cpustate))
95        cpustate->RL(regno) = /*(cpustate->RL(regno) & 0x00ff0000) |*/ make_segmented_addr(addr);
95   if (segmented_mode(cpustate)) {
96      UINT32 segaddr = make_segmented_addr(addr);
97      cpustate->RW(regno) = (cpustate->RW(regno) & 0x80ff) | ((segaddr >> 16) & 0x7f00);
98      cpustate->RW(regno | 1) = segaddr & 0xffff;
99   }
96100    else
97101        cpustate->RW(regno) = addr;
98102}
99103
104INLINE void add_to_addr_reg(z8000_state *cpustate, int regno, UINT16 addend)
105{
106   if (segmented_mode(cpustate))
107      regno |= 1;
108   cpustate->RW(regno) += addend;
109}
110
111INLINE void sub_from_addr_reg(z8000_state *cpustate, int regno, UINT16 subtrahend)
112{
113   if (segmented_mode(cpustate))
114      regno |= 1;
115   cpustate->RW(regno) -= subtrahend;
116}
117
100118INLINE void PUSHW(z8000_state *cpustate, UINT8 dst, UINT16 value)
101119{
102120    if (segmented_mode(cpustate))
r19095r19096
14371455static void Z0C_ddN0_0000(z8000_state *cpustate)
14381456{
14391457   GET_DST(OP0,NIB3);
1440   WRMEM_B(cpustate,  cpustate->RW(dst), COMB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst))));
1458   UINT32 addr = addr_from_reg(cpustate, dst);
1459   WRMEM_B(cpustate, addr, COMB(cpustate, RDMEM_B(cpustate, addr)));
14411460}
14421461
14431462/******************************************
r19095r19096
14801499{
14811500   GET_DST(OP0,NIB2);
14821501   GET_IMM8(OP1);
1483   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), imm8);
1502   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), imm8);
14841503}
14851504
14861505/******************************************
r19095r19096
15351554{
15361555   GET_DST(OP0,NIB2);
15371556    UINT32 addr = addr_from_reg(cpustate, dst);
1538   WRMEM_W(cpustate, addr, NEGW(cpustate, RDMEM_W(cpustate, addr)));
1557   WRMEM_W(cpustate, addr, NEGW(cpustate, RDMEM_W(cpustate, addr)));
15391558}
15401559
15411560/******************************************
r19095r19096
15781597static void Z0D_ddN0_1000(z8000_state *cpustate)
15791598{
15801599   GET_DST(OP0,NIB2);
1581   WRMEM_W(cpustate, addr_from_reg(cpustate, dst), 0);
1600   WRMEM_W(cpustate, addr_from_reg(cpustate, dst), 0);
15821601}
15831602
15841603/******************************************
r19095r19096
17111730}
17121731
17131732/******************************************
1714 popl    @rd,@rs
1733 popl    rd,@rs
17151734 flags:  ------
17161735 ******************************************/
17171736static void Z15_ssN0_ddN0(z8000_state *cpustate)
r19095r19096
17511770{
17521771   GET_DST(OP0,NIB3);
17531772   GET_SRC(OP0,NIB2);
1754   cpustate->RW(dst) = POPW(cpustate, src);
1773   WRMEM_W(cpustate, addr_from_reg(cpustate, dst), POPW(cpustate, src));
17551774}
17561775
17571776/******************************************
r19095r19096
18611880    GET_DST(OP0,NIB2);
18621881    GET_CNT(OP1,NIB3);
18631882    GET_SRC(OP1,NIB1);
1864   UINT16 idx = cpustate->RW(dst);
1883   UINT32 addr = addr_from_reg(cpustate, dst);
18651884    while (cnt-- >= 0) {
1866        WRMEM_W(cpustate,  idx, cpustate->RW(src));
1867      idx = (idx + 2) & 0xffff;
1885        WRMEM_W(cpustate, addr, cpustate->RW(src));
1886      addr = addr_add(cpustate, addr, 2);
18681887      src = (src+1) & 15;
18691888    }
18701889}
r19095r19096
18781897   GET_SRC(OP0,NIB2);
18791898   GET_CNT(OP1,NIB3);
18801899   GET_DST(OP1,NIB1);
1881   UINT16 idx = cpustate->RW(src);
1900   UINT32 addr = addr_from_reg(cpustate, src);
18821901   while (cnt-- >= 0) {
1883      cpustate->RW(dst) = RDMEM_W(cpustate,  idx);
1884      idx = (idx + 2) & 0xffff;
1902      cpustate->RW(dst) = RDMEM_W(cpustate, addr);
1903      addr = addr_add(cpustate, addr, 2);
18851904      dst = (dst+1) & 15;
18861905    }
18871906}
r19095r19096
23222341   GET_DST(OP0,NIB3);
23232342   GET_SRC(OP0,NIB2);
23242343   GET_IDX16(OP1);
2325   idx16 = addr_add(cpustate, addr_from_reg(cpustate, src), idx16);
2326   addr_to_reg(cpustate, dst, idx16);
2344   if (segmented_mode(cpustate)) {
2345      cpustate->RL(dst) = cpustate->RL(src);
2346   }
2347   else {
2348      cpustate->RW(dst) = cpustate->RW(src);
2349   }
2350   add_to_addr_reg(cpustate, dst, idx16);
23272351}
23282352
23292353/******************************************
r19095r19096
24452469    GET_DST(OP1,NIB2);
24462470    GET_CCC(OP1,NIB3);
24472471    WRMEM_B(cpustate, addr_from_reg(cpustate, dst), RDPORT_B(cpustate,  0, cpustate->RW(src)));
2448   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
2472   add_to_addr_reg(cpustate, dst, 1);
24492473   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
24502474}
24512475
r19095r19096
24802504    GET_DST(OP1,NIB2);
24812505    GET_CCC(OP1,NIB3);
24822506    WRPORT_B(cpustate,  0, cpustate->RW(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
2483   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
2507   add_to_addr_reg(cpustate, src, 1);
24842508   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
24852509}
24862510
r19095r19096
44244448   GET_DST(OP0,NIB3);
44254449   GET_SRC(OP0,NIB2);
44264450   GET_IDX(OP1,NIB1);
4427   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
4451   if (segmented_mode(cpustate)) {
4452      cpustate->RL(dst) = cpustate->RL(src);
4453   }
4454   else {
4455      cpustate->RW(dst) = cpustate->RW(src);
4456   }
4457   add_to_addr_reg(cpustate, dst, cpustate->RW(idx));
44284458}
44294459
44304460/******************************************
r19095r19096
44464476static void Z76_0000_dddd_addr(z8000_state *cpustate)
44474477{
44484478   GET_DST(OP0,NIB3);
4449   GET_ADDR(OP1);
4450    addr_to_reg(cpustate, dst, addr);
4479   GET_ADDR_RAW(OP1);
4480   if (segmented_mode(cpustate)) {
4481      cpustate->RL(dst) = addr;
4482   }
4483   else {
4484      cpustate->RW(dst) = addr;
4485   }
44514486}
44524487
44534488/******************************************
r19095r19096
44554490 flags:  ------
44564491 ******************************************/
44574492static void Z76_ssN0_dddd_addr(z8000_state *cpustate)
4458{
4493{//@@@
44594494   GET_DST(OP0,NIB3);
44604495   GET_SRC(OP0,NIB2);
4461   GET_ADDR(OP1);
4462   addr = addr_add(cpustate, addr, cpustate->RW(src));
4463    addr_to_reg(cpustate, dst, addr);
4496   GET_ADDR_RAW(OP1);
4497   if (segmented_mode(cpustate)) {
4498      cpustate->RL(dst) = addr;
4499   }
4500   else {
4501      cpustate->RW(dst) = addr;
4502   }
4503   add_to_addr_reg(cpustate, dst, cpustate->RW(src));
44644504}
44654505
44664506/******************************************
r19095r19096
55435583static void ZB2_dddd_0001_imm8(z8000_state *cpustate)
55445584{
55455585   GET_DST(OP0,NIB2);
5546   GET_IMM16(OP1);
5547   if (imm16 & S16)
5548      cpustate->RB(dst) = SRLB(cpustate, cpustate->RB(dst), -(INT16)imm16);
5586   GET_IMM8(OP1);
5587   if (imm8 & S08)
5588      cpustate->RB(dst) = SRLB(cpustate, cpustate->RB(dst), -(INT8)imm8);
55495589   else
5550      cpustate->RB(dst) = SLLB(cpustate, cpustate->RB(dst), imm16);
5590      cpustate->RB(dst) = SLLB(cpustate, cpustate->RB(dst), imm8);
55515591}
55525592
55535593/******************************************
r19095r19096
55925632static void ZB2_dddd_1001_imm8(z8000_state *cpustate)
55935633{
55945634   GET_DST(OP0,NIB2);
5595   GET_IMM16(OP1);
5596   if (imm16 & S16)
5597      cpustate->RB(dst) = SRAB(cpustate, cpustate->RB(dst), -(INT16)imm16);
5635   GET_IMM8(OP1);
5636   if (imm8 & S08)
5637      cpustate->RB(dst) = SRAB(cpustate, cpustate->RB(dst), -(INT8)imm8);
55985638   else
5599      cpustate->RB(dst) = SLAB(cpustate, cpustate->RB(dst), imm16);
5639      cpustate->RB(dst) = SLAB(cpustate, cpustate->RB(dst), imm8);
56005640}
56015641
56025642/******************************************
r19095r19096
58405880   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
58415881   cpustate->RB(1) = xlt;   /* load RH1 */
58425882   if (xlt) CLR_Z; else SET_Z;
5843   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
5883   add_to_addr_reg(cpustate, dst, 1);
58445884   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
58455885}
58465886
r19095r19096
58565896   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
58575897   cpustate->RB(1) = xlt;   /* load RH1 */
58585898   if (xlt) CLR_Z; else SET_Z;
5859   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
5899   add_to_addr_reg(cpustate, dst, 1);
58605900   if (--cpustate->RW(cnt)) {
58615901     CLR_V;
58625902     if (!xlt)
r19095r19096
58775917   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
58785918   cpustate->RB(1) = xlt;   /* load RH1 */
58795919   if (xlt) CLR_Z; else SET_Z;
5880   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1));
5920   sub_from_addr_reg(cpustate, dst, 1);
58815921   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
58825922}
58835923
r19095r19096
58935933   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
58945934   cpustate->RB(1) = xlt;   /* load RH1 */
58955935   if (xlt) CLR_Z; else SET_Z;
5896   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1));
5936   sub_from_addr_reg(cpustate, dst, 1);
58975937   if (--cpustate->RW(cnt)) {
58985938     CLR_V;
58995939     if (!xlt)
r19095r19096
59145954   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
59155955   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt);
59165956   cpustate->RB(1) = xlt;   /* destroy RH1 */
5917   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
5957   add_to_addr_reg(cpustate, dst, 1);
59185958   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
59195959}
59205960
r19095r19096
59305970   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
59315971   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt);
59325972   cpustate->RB(1) = xlt;   /* destroy RH1 */
5933   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
5973   add_to_addr_reg(cpustate, dst, 1);
59345974   if (--cpustate->RW(cnt)) { CLR_V; cpustate->pc -= 4; } else SET_V;
59355975}
59365976
r19095r19096
59465986   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
59475987   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt);
59485988   cpustate->RB(1) = xlt;   /* destroy RH1 */
5949   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1));
5989   sub_from_addr_reg(cpustate, dst, 1);
59505990   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
59515991}
59525992
r19095r19096
59626002   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
59636003   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt);
59646004   cpustate->RB(1) = xlt;   /* destroy RH1 */
5965   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1));
6005   sub_from_addr_reg(cpustate, dst, 1);
59666006   if (--cpustate->RW(cnt)) { CLR_V; cpustate->pc -= 4; } else SET_V;
59676007}
59686008
r19095r19096
60106050      case 14: if (CCE) SET_Z; else CLR_Z; break;
60116051      case 15: if (CCF) SET_Z; else CLR_Z; break;
60126052    }
6013   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
6053   add_to_addr_reg(cpustate, src, 1);
60146054   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
60156055}
60166056
r19095r19096
60266066   GET_DST(OP1,NIB2);
60276067   GET_CCC(OP1,NIB3);   /* repeat? */
60286068    WRMEM_B(cpustate,  addr_from_reg(cpustate, dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6029   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
6030   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
6069   add_to_addr_reg(cpustate, src, 1);
6070   add_to_addr_reg(cpustate, dst, 1);
60316071   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
60326072}
60336073
r19095r19096
60606100      case 14: if (CCE) SET_Z; else CLR_Z; break;
60616101      case 15: if (CCF) SET_Z; else CLR_Z; break;
60626102    }
6063   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
6064   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
6103   add_to_addr_reg(cpustate, src, 1);
6104   add_to_addr_reg(cpustate, dst, 1);
60656105   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
60666106}
60676107
r19095r19096
60946134      case 14: if (CCE) SET_Z; else CLR_Z; break;
60956135      case 15: if (CCF) SET_Z; else CLR_Z; break;
60966136    }
6097   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
6137   add_to_addr_reg(cpustate, src, 1);
60986138   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
60996139}
61006140
r19095r19096
61276167      case 14: if (CCE) SET_Z; else CLR_Z; break;
61286168      case 15: if (CCF) SET_Z; else CLR_Z; break;
61296169    }
6130   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
6131   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
6170   add_to_addr_reg(cpustate, src, 1);
6171   add_to_addr_reg(cpustate, dst, 1);
61326172   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
61336173}
61346174
r19095r19096
61616201      case 14: if (CCE) SET_Z; else CLR_Z; break;
61626202      case 15: if (CCF) SET_Z; else CLR_Z; break;
61636203    }
6164   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 1));
6204   sub_from_addr_reg(cpustate, src, 1);
61656205   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
61666206}
61676207
r19095r19096
61776217   GET_DST(OP1,NIB2);
61786218   GET_CCC(OP1,NIB3);
61796219   WRMEM_B(cpustate,  addr_from_reg(cpustate, dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6180   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1));
6181   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 1));
6220   sub_from_addr_reg(cpustate, src, 1);
6221   sub_from_addr_reg(cpustate, dst, 1);
61826222   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
61836223}
61846224
r19095r19096
62116251      case 14: if (CCE) SET_Z; else CLR_Z; break;
62126252      case 15: if (CCF) SET_Z; else CLR_Z; break;
62136253    }
6214   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1));
6215   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 1));
6254   sub_from_addr_reg(cpustate, src, 1);
6255   sub_from_addr_reg(cpustate, dst, 1);
62166256   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
62176257}
62186258
r19095r19096
62456285      case 14: if (CCE) SET_Z; else CLR_Z; break;
62466286      case 15: if (CCF) SET_Z; else CLR_Z; break;
62476287    }
6248   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 1));
6288   sub_from_addr_reg(cpustate, src, 1);
62496289   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
62506290}
62516291
r19095r19096
62786318      case 14: if (CCE) SET_Z; else CLR_Z; break;
62796319      case 15: if (CCF) SET_Z; else CLR_Z; break;
62806320   }
6281   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1));
6282   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 1));
6321   sub_from_addr_reg(cpustate, src, 1);
6322   sub_from_addr_reg(cpustate, dst, 1);
62836323   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
62846324}
62856325
r19095r19096
63126352      case 14: if (CCE) SET_Z; else CLR_Z; break;
63136353      case 15: if (CCF) SET_Z; else CLR_Z; break;
63146354    }
6315   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 2));
6355   add_to_addr_reg(cpustate, src, 2);
63166356   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
63176357}
63186358
r19095r19096
63286368   GET_DST(OP1,NIB2);
63296369   GET_CCC(OP1,NIB3);
63306370   WRMEM_W(cpustate,  addr_from_reg(cpustate, dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6331   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 2));
6332   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 2));
6371   add_to_addr_reg(cpustate, src, 2);
6372   add_to_addr_reg(cpustate, dst, 2);
63336373   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
63346374}
63356375
r19095r19096
63626402      case 14: if (CCE) SET_Z; else CLR_Z; break;
63636403      case 15: if (CCF) SET_Z; else CLR_Z; break;
63646404    }
6365   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 2));
6366   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 2));
6405   add_to_addr_reg(cpustate, src, 2);
6406   add_to_addr_reg(cpustate, dst, 2);
63676407   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
63686408}
63696409
r19095r19096
63966436      case 14: if (CCE) SET_Z; else CLR_Z; break;
63976437      case 15: if (CCF) SET_Z; else CLR_Z; break;
63986438    }
6399   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 2));
6439   add_to_addr_reg(cpustate, src, 2);
64006440   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
64016441}
64026442
r19095r19096
64296469      case 14: if (CCE) SET_Z; else CLR_Z; break;
64306470      case 15: if (CCF) SET_Z; else CLR_Z; break;
64316471    }
6432   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 2));
6433   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 2));
6472   add_to_addr_reg(cpustate, src, 2);
6473   add_to_addr_reg(cpustate, dst, 2);
64346474   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
64356475}
64366476
r19095r19096
64636503      case 14: if (CCE) SET_Z; else CLR_Z; break;
64646504      case 15: if (CCF) SET_Z; else CLR_Z; break;
64656505    }
6466   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 2));
6506   sub_from_addr_reg(cpustate, src, 2);
64676507   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
64686508}
64696509
r19095r19096
64796519    GET_DST(OP1,NIB2);
64806520   GET_CCC(OP1,NIB3);
64816521    WRMEM_W(cpustate,  addr_from_reg(cpustate, dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6482   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 2));
6483   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 2));
6522   sub_from_addr_reg(cpustate, src, 2);
6523   sub_from_addr_reg(cpustate, dst, 2);
64846524   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
64856525}
64866526
r19095r19096
65136553      case 14: if (CCE) SET_Z; else CLR_Z; break;
65146554      case 15: if (CCF) SET_Z; else CLR_Z; break;
65156555    }
6516   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 2));
6517   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 2));
6556   sub_from_addr_reg(cpustate, src, 2);
6557   sub_from_addr_reg(cpustate, dst, 2);
65186558   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
65196559}
65206560
r19095r19096
65476587      case 14: if (CCE) SET_Z; else CLR_Z; break;
65486588      case 15: if (CCF) SET_Z; else CLR_Z; break;
65496589    }
6550   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 2));
6590   sub_from_addr_reg(cpustate, src, 2);
65516591   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
65526592}
65536593
r19095r19096
65806620      case 14: if (CCE) SET_Z; else CLR_Z; break;
65816621      case 15: if (CCF) SET_Z; else CLR_Z; break;
65826622    }
6583   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 2));
6584   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 2));
6623   sub_from_addr_reg(cpustate, src, 2);
6624   sub_from_addr_reg(cpustate, dst, 2);
65856625   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
65866626}
65876627
trunk/src/mess/drivers/m20.c
r19095r19096
185185!       1 selects single density    1 => Perform basic tests
186186!                                   Latched copy when B7 is written to Port21
187187!   B4  Uncommitted output          0 => 128K card(s) present
188!                                   1 => 32K(s) card present
188!                                   1 => 32K card(s) present
189189!                                   Cannot mix types!
190190!   B5  Uncommitted output          0 => 8-colour card present
191191!                                   1 => 4-colour card present
r19095r19096
202202
203203WRITE16_MEMBER(m20_state::port21_w)
204204{
205   printf("port21 write: offset 0x%x, data 0x%x\n", offset, data);
205   //printf("port21 write: offset 0x%x, data 0x%x\n", offset, data);
206206   m_port21 = (m_port21 & 0xf8) | (data & 0x7);
207207   m_port21_sd = (data & 8) ? 1 : 0;
208208   //printf("port21: sd = %d\n", m_port21_sd);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team