Previous 15994 Revisions Next

r15140 Friday 11th May, 2012 at 13:41:56 UTC by R. Belmont
More Z8001 work, M20 now passes memory test [Christian Gr?\195?\182ssler]
[src/emu/cpu/z8000]z8000.c z8000.h z8000cpu.h z8000ops.c z8000tbl.c
[src/mess/drivers]m20.c

src/emu/cpu/z8000/z8000cpu.h
r15139r15140
182182#define GET_IMM8(o)    UINT8 imm8 = (UINT8)get_operand(cpustate, o)
183183
184184#define GET_IMM16(o)   UINT16 imm16 = get_operand(cpustate, o)
185#define GET_IDX16(o)   UINT32 idx16 = get_operand(cpustate, o)
185186#define GET_IMM32      UINT32 imm32 = (get_operand(cpustate, 1) << 16) + get_operand(cpustate, 2)
186187#define GET_DSP7      UINT8 dsp7 = get_operand(cpustate, 0) & 127
187188#define GET_DSP8      INT8 dsp8 = (INT8)get_operand(cpustate, 0)
src/emu/cpu/z8000/z8000.c
r15139r15140
195195INLINE UINT16 RDMEM_W(z8000_state *cpustate, UINT32 addr)
196196{
197197   addr &= ~1;
198    /* hack for m20 driver: BIOS accesses 0x7f0000 and expects a segmentation violation */
199    if (addr >= 0x7f0000) {
200        cpustate->irq_req = Z8000_SEGTRAP;
201        return 0xffff;
202    }
198203   return cpustate->program->read_word(addr);
199204}
200205
r15139r15140
288293{
289294    switch ((type >> 8) & 255)
290295    {
296        case Z8000_EPU >> 8:
297            if (cpustate->irq_srv >= Z8000_EPU)
298                return;
299            cpustate->irq_req = type;
300            break;
291301        case Z8000_TRAP >> 8:
292302            if (cpustate->irq_srv >= Z8000_TRAP)
293303                return; /* double TRAP.. very bad :( */
r15139r15140
332342    PUSHW(cpustate, SP, cpustate->pc);        /* save current cpustate->pc */ \
333343} while (0)
334344
335#define SET_PC(VEC) (cpustate->device->type() == Z8001 ? segmented_addr(RDMEM_L(cpustate, VEC)) : (RDMEM_W(cpustate, VEC)))
345#define GET_PC(VEC) (cpustate->device->type() == Z8001 ? segmented_addr(RDMEM_L(cpustate, VEC + 4)) : RDMEM_W(cpustate, VEC + 2))
346#define GET_FCW(VEC) (cpustate->device->type() == Z8001 ? RDMEM_W(cpustate, VEC + 2) : RDMEM_W(cpustate, VEC))
336347
337348
338349INLINE void Interrupt(z8000_state *cpustate)
r15139r15140
352363    }
353364
354365    /* trap ? */
366    if (cpustate->irq_req & Z8000_EPU)
367    {
368        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
369        PUSH_PC();
370        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
371        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
372        cpustate->irq_srv = cpustate->irq_req;
373        cpustate->irq_req &= ~Z8000_EPU;
374        CHANGE_FCW(cpustate, GET_FCW(EPU));
375        cpustate->pc = GET_PC(EPU);
376        LOG(("Z8K '%s' ext instr trap $%04x\n", cpustate->device->tag(), cpustate->pc));
377    }
378    else
355379    if (cpustate->irq_req & Z8000_TRAP)
356380    {
357381        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
r15139r15140
360384        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
361385        cpustate->irq_srv = cpustate->irq_req;
362386        cpustate->irq_req &= ~Z8000_TRAP;
363        cpustate->pc = SET_PC(TRAP);
364        LOG(("Z8K '%s' trap $%04x\n", cpustate->device->tag(), cpustate->pc));
387        CHANGE_FCW(cpustate, GET_FCW(TRAP));
388        cpustate->pc = GET_PC(TRAP);
389        LOG(("Z8K '%s' priv instr trap $%04x\n", cpustate->device->tag(), cpustate->pc));
365390    }
366391    else
367392    if (cpustate->irq_req & Z8000_SYSCALL)
r15139r15140
372397        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
373398        cpustate->irq_srv = cpustate->irq_req;
374399        cpustate->irq_req &= ~Z8000_SYSCALL;
375        cpustate->pc = SET_PC(SYSCALL);
400        CHANGE_FCW(cpustate, GET_FCW(SYSCALL));
401        cpustate->pc = GET_PC(SYSCALL);
376402        LOG(("Z8K '%s' syscall $%04x\n", cpustate->device->tag(), cpustate->pc));
377403    }
378404    else
r15139r15140
384410        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
385411        cpustate->irq_srv = cpustate->irq_req;
386412        cpustate->irq_req &= ~Z8000_SEGTRAP;
387        cpustate->pc = SET_PC(SEGTRAP);
413        CHANGE_FCW(cpustate, GET_FCW(SEGTRAP));
414        cpustate->pc = GET_PC(SEGTRAP);
388415        LOG(("Z8K '%s' segtrap $%04x\n", cpustate->device->tag(), cpustate->pc));
389416    }
390417    else
r15139r15140
395422        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
396423        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
397424        cpustate->irq_srv = cpustate->irq_req;
398        fcw = RDMEM_W(cpustate,  NMI);
399       cpustate->pc = RDMEM_W(cpustate,  NMI + 2);
425        cpustate->pc = RDMEM_W(cpustate,  NMI);
400426        cpustate->irq_req &= ~Z8000_NMI;
401       CHANGE_FCW(cpustate, fcw);
402        cpustate->pc = SET_PC(NMI);
427        CHANGE_FCW(cpustate, GET_FCW(NMI));
428        cpustate->pc = GET_PC(NMI);
403429        LOG(("Z8K '%s' NMI $%04x\n", cpustate->device->tag(), cpustate->pc));
404430    }
405431    else
r15139r15140
410436        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
411437        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
412438        cpustate->irq_srv = cpustate->irq_req;
413        fcw = RDMEM_W(cpustate,  NVI);
414        cpustate->pc = SET_PC(NVI + 2); //RDMEM_W(cpustate,  NVI + 2);
439        cpustate->pc = GET_PC(NVI); //RDMEM_W(cpustate,  NVI + 2);
415440        cpustate->irq_req &= ~Z8000_NVI;
416       CHANGE_FCW(cpustate, fcw);
441        CHANGE_FCW(cpustate, GET_FCW(NVI));
417442        LOG(("Z8K '%s' NVI $%04x\n", cpustate->device->tag(), cpustate->pc));
418443    }
419444    else
r15139r15140
424449        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
425450        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
426451        cpustate->irq_srv = cpustate->irq_req;
427        fcw = RDMEM_W(cpustate,  cpustate->irq_vec);
428        cpustate->pc = SET_PC(VEC00 + (cpustate->device->type() == Z8001 ? 4 : 2) * (cpustate->irq_req & 0xff)); //RDMEM_W(cpustate,  VEC00 + 2 * (cpustate->irq_req & 0xff));
452        cpustate->pc = RDMEM_W(cpustate,  VEC00 + (cpustate->device->type() == Z8001 ? 4 : 2) * (cpustate->irq_req & 0xff));
429453        cpustate->irq_req &= ~Z8000_VI;
430       CHANGE_FCW(cpustate, fcw);
431        LOG(("Z8K '%s' VI [$%04x/$%04x] fcw $%04x, pc $%04x\n", cpustate->device->tag(), cpustate->irq_vec, VEC00 + 2 * (cpustate->irq_req & 0xff), cpustate->fcw, cpustate->pc));
454        CHANGE_FCW(cpustate, GET_FCW(VI));
455        LOG(("Z8K '%s' VI [$%04x/$%04x] fcw $%04x, pc $%04x\n", cpustate->device->tag(), cpustate->irq_vec, VEC00 + (cpustate->device->type() == Z8001 ? 4 : 2) * (cpustate->irq_req & 0xff), cpustate->fcw, cpustate->pc));
432456    }
433457}
434458
r15139r15140
781805      /* --- the following bits of info are returned as NULL-terminated strings --- */
782806      case DEVINFO_STR_NAME:                     strcpy(info->s, "Zilog Z8001");         break;
783807
808      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 2;                     break;
809      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 8;                     break;
810
784811      default:                              CPU_GET_INFO_CALL(z8002);            break;
785812   }
786813}
src/emu/cpu/z8000/z8000ops.c
r15139r15140
167167#define CHK_SUBW_V if (((~value & dest & ~result) | (value & ~dest & result)) & S16) SET_V
168168#define CHK_SUBL_V if (((~value & dest & ~result) | (value & ~dest & result)) & S32) SET_V
169169
170/* check for privileged instruction and trap if executed */
171#define CHECK_PRIVILEGED_INSTR() if (!(cpustate->fcw & F_S_N)) { cpustate->irq_req = Z8000_TRAP; return; }
170172
173/* if no EPU is present (it isn't), raise an extended intstuction trap */
174#define CHECK_EXT_INSTR()  if (!(cpustate->fcw & F_EPU)) { cpustate->irq_req = Z8000_EPU; return; }
175
176
171177/******************************************
172178 add byte
173179 flags:  CZSVDH
r15139r15140
15921598 ******************************************/
15931599static void Z0E_imm8(z8000_state *cpustate)
15941600{
1601    CHECK_EXT_INSTR();
15951602   GET_IMM8(0);
15961603   LOG(("Z8K '%s' %04x: ext0e  $%02x\n", cpustate->device->tag(), cpustate->pc, imm8));
15971604    if (cpustate->fcw & F_EPU) {
r15139r15140
16061613 ******************************************/
16071614static void Z0F_imm8(z8000_state *cpustate)
16081615{
1616    CHECK_EXT_INSTR();
16091617   GET_IMM8(0);
16101618   LOG(("Z8K '%s' %04x: ext0f  $%02x\n", cpustate->device->tag(), cpustate->pc, imm8));
16111619    if (cpustate->fcw & F_EPU) {
r15139r15140
22102218}
22112219
22122220/******************************************
2213 ldb     rbd,rs(imm16)
2221 ldb     rbd,rs(idx16)
22142222 flags:  ------
22152223 ******************************************/
22162224static void Z30_ssN0_dddd_imm16(z8000_state *cpustate)
22172225{
22182226   GET_DST(OP0,NIB3);
22192227   GET_SRC(OP0,NIB2);
2220   GET_IMM16(OP1);
2221   imm16 = addr_add(cpustate, addr_from_reg(cpustate, src), imm16);
2222   cpustate->RB(dst) = RDMEM_B(cpustate,  imm16);
2228   GET_IDX16(OP1);
2229   idx16 = addr_add(cpustate, addr_from_reg(cpustate, src), idx16);
2230   cpustate->RB(dst) = RDMEM_B(cpustate,  idx16);
22232231}
22242232
22252233/******************************************
r15139r15140
22342242}
22352243
22362244/******************************************
2237 ld      rd,rs(imm16)
2245 ld      rd,rs(idx16)
22382246 flags:  ------
22392247 ******************************************/
22402248static void Z31_ssN0_dddd_imm16(z8000_state *cpustate)
22412249{
22422250   GET_DST(OP0,NIB3);
22432251   GET_SRC(OP0,NIB2);
2244   GET_IMM16(OP1);
2245   imm16 = addr_add(cpustate, addr_from_reg(cpustate, src), imm16);
2246   cpustate->RW(dst) = RDMEM_W(cpustate,  imm16);
2252   GET_IDX16(OP1);
2253   idx16 = addr_add(cpustate, addr_from_reg(cpustate, src), idx16);
2254   cpustate->RW(dst) = RDMEM_W(cpustate,  idx16);
22472255}
22482256
22492257/******************************************
r15139r15140
22582266}
22592267
22602268/******************************************
2261 ldb     rd(imm16),rbs
2269 ldb     rd(idx16),rbs
22622270 flags:  ------
22632271 ******************************************/
22642272static void Z32_ddN0_ssss_imm16(z8000_state *cpustate)
22652273{
22662274   GET_SRC(OP0,NIB3);
22672275   GET_DST(OP0,NIB2);
2268   GET_IMM16(OP1);
2269   imm16 = addr_add(cpustate, addr_from_reg(cpustate, dst), imm16);
2270   WRMEM_B(cpustate,  imm16, cpustate->RB(src));
2276   GET_IDX16(OP1);
2277   idx16 = addr_add(cpustate, addr_from_reg(cpustate, dst), idx16);
2278   WRMEM_B(cpustate,  idx16, cpustate->RB(src));
22712279}
22722280
22732281/******************************************
r15139r15140
22822290}
22832291
22842292/******************************************
2285 ld      rd(imm16),rs
2293 ld      rd(idx16),rs
22862294 flags:  ------
22872295 ******************************************/
22882296static void Z33_ddN0_ssss_imm16(z8000_state *cpustate)
22892297{
22902298   GET_SRC(OP0,NIB3);
22912299   GET_DST(OP0,NIB2);
2292   GET_IMM16(OP1);
2293   imm16 = addr_add(cpustate, addr_from_reg(cpustate,dst), imm16);
2294   WRMEM_W(cpustate,  imm16, cpustate->RW(src));
2300   GET_IDX16(OP1);
2301   idx16 = addr_add(cpustate, addr_from_reg(cpustate,dst), idx16);
2302   WRMEM_W(cpustate,  idx16, cpustate->RW(src));
22952303}
22962304
22972305/******************************************
r15139r15140
23062314}
23072315
23082316/******************************************
2309 lda     prd,rs(imm16)
2317 lda     prd,rs(idx16)
23102318 flags:  ------
23112319 ******************************************/
23122320static void Z34_ssN0_dddd_imm16(z8000_state *cpustate)
23132321{
23142322   GET_DST(OP0,NIB3);
23152323   GET_SRC(OP0,NIB2);
2316   GET_IMM16(OP1);
2317   imm16 = addr_add(cpustate, addr_from_reg(cpustate, src), imm16);
2318   addr_to_reg(cpustate, dst, imm16);
2324   GET_IDX16(OP1);
2325   idx16 = addr_add(cpustate, addr_from_reg(cpustate, src), idx16);
2326   addr_to_reg(cpustate, dst, idx16);
23192327}
23202328
23212329/******************************************
r15139r15140
23302338}
23312339
23322340/******************************************
2333 ldl     rrd,rs(imm16)
2341 ldl     rrd,rs(idx16)
23342342 flags:  ------
23352343 ******************************************/
23362344static void Z35_ssN0_dddd_imm16(z8000_state *cpustate)
23372345{
23382346   GET_DST(OP0,NIB3);
23392347   GET_SRC(OP0,NIB2);
2340   GET_IMM16(OP1);
2341   imm16 = addr_add(cpustate, addr_from_reg(cpustate, src), imm16);
2342   cpustate->RL(dst) = RDMEM_L(cpustate,  imm16);
2348   GET_IDX16(OP1);
2349   idx16 = addr_add(cpustate, addr_from_reg(cpustate, src), idx16);
2350   cpustate->RL(dst) = RDMEM_L(cpustate,  idx16);
23432351}
23442352
23452353/******************************************
r15139r15140
23782386}
23792387
23802388/******************************************
2381 ldl     rd(imm16),rrs
2389 ldl     rd(idx16),rrs
23822390 flags:  ------
23832391 ******************************************/
23842392static void Z37_ddN0_ssss_imm16(z8000_state *cpustate)
23852393{
23862394   GET_SRC(OP0,NIB3);
23872395   GET_DST(OP0,NIB2);
2388   GET_IMM16(OP1);
2389   imm16 = addr_add(cpustate, addr_from_reg(cpustate, dst), imm16);
2390   WRMEM_L(cpustate,  imm16, cpustate->RL(src));
2396   GET_IDX16(OP1);
2397   idx16 = addr_add(cpustate, addr_from_reg(cpustate, dst), idx16);
2398   WRMEM_L(cpustate,  idx16, cpustate->RL(src));
23912399}
23922400
23932401/******************************************
r15139r15140
24102418 ******************************************/
24112419static void Z39_ssN0_0000(z8000_state *cpustate)
24122420{
2421    CHECK_PRIVILEGED_INSTR();
24132422   GET_SRC(OP0,NIB2);
24142423   UINT16 fcw;
24152424    if (segmented_mode(cpustate)) {
r15139r15140
24302439 ******************************************/
24312440static void Z3A_ssss_0000_0000_aaaa_dddd_x000(z8000_state *cpustate)
24322441{//@@@@
2442    CHECK_PRIVILEGED_INSTR();
24332443    GET_SRC(OP0,NIB2);
24342444    GET_CNT(OP1,NIB1);
24352445    GET_DST(OP1,NIB2);
r15139r15140
24472457 ******************************************/
24482458static void Z3A_ssss_0001_0000_aaaa_dddd_x000(z8000_state *cpustate)
24492459{//@@@@
2460    CHECK_PRIVILEGED_INSTR();
24502461    GET_SRC(OP0,NIB2);
24512462    GET_CNT(OP1,NIB1);
24522463    GET_DST(OP1,NIB2);
r15139r15140
24642475 ******************************************/
24652476static void Z3A_ssss_0010_0000_aaaa_dddd_x000(z8000_state *cpustate)
24662477{//@@@@
2478    CHECK_PRIVILEGED_INSTR();
24672479    GET_SRC(OP0,NIB2);
24682480    GET_CNT(OP1,NIB1);
24692481    GET_DST(OP1,NIB2);
r15139r15140
24812493 ******************************************/
24822494static void Z3A_ssss_0011_0000_aaaa_dddd_x000(z8000_state *cpustate)
24832495{//@@@@
2496    CHECK_PRIVILEGED_INSTR();
24842497    GET_SRC(OP0,NIB2);
24852498    GET_CNT(OP1,NIB1);
24862499    GET_DST(OP1,NIB2);
r15139r15140
24972510 ******************************************/
24982511static void Z3A_dddd_0100_imm16(z8000_state *cpustate)
24992512{
2513    CHECK_PRIVILEGED_INSTR();
25002514    GET_DST(OP0,NIB2);
25012515    GET_IMM16(OP1);
25022516    cpustate->RB(dst) = RDPORT_B(cpustate,  0, imm16);
r15139r15140
25082522 ******************************************/
25092523static void Z3A_dddd_0101_imm16(z8000_state *cpustate)
25102524{
2525    CHECK_PRIVILEGED_INSTR();
25112526    GET_DST(OP0,NIB2);
25122527    GET_IMM16(OP1);
25132528    cpustate->RB(dst) = RDPORT_B(cpustate,  1, imm16);
r15139r15140
25192534 ******************************************/
25202535static void Z3A_ssss_0110_imm16(z8000_state *cpustate)
25212536{
2537    CHECK_PRIVILEGED_INSTR();
25222538    GET_SRC(OP0,NIB2);
25232539    GET_IMM16(OP1);
25242540    WRPORT_B(cpustate,  0, imm16, cpustate->RB(src));
r15139r15140
25302546 ******************************************/
25312547static void Z3A_ssss_0111_imm16(z8000_state *cpustate)
25322548{
2549    CHECK_PRIVILEGED_INSTR();
25332550    GET_SRC(OP0,NIB2);
25342551    GET_IMM16(OP1);
25352552    WRPORT_B(cpustate,  1, imm16, cpustate->RB(src));
r15139r15140
25422559 ******************************************/
25432560static void Z3A_ssss_1000_0000_aaaa_dddd_x000(z8000_state *cpustate)
25442561{//@@@
2562    CHECK_PRIVILEGED_INSTR();
25452563   GET_SRC(OP0,NIB2);
25462564   GET_CNT(OP1,NIB1);
25472565   GET_DST(OP1,NIB2);
r15139r15140
25592577 ******************************************/
25602578static void Z3A_ssss_1001_0000_aaaa_dddd_x000(z8000_state *cpustate)
25612579{//@@@
2580    CHECK_PRIVILEGED_INSTR();
25622581   GET_SRC(OP0,NIB2);
25632582   GET_CNT(OP1,NIB1);
25642583   GET_DST(OP1,NIB2);
r15139r15140
25762595 ******************************************/
25772596static void Z3A_ssss_1010_0000_aaaa_dddd_x000(z8000_state *cpustate)
25782597{//@@@
2598    CHECK_PRIVILEGED_INSTR();
25792599   GET_SRC(OP0,NIB2);
25802600   GET_CNT(OP1,NIB1);
25812601   GET_DST(OP1,NIB2);
r15139r15140
25932613 ******************************************/
25942614static void Z3A_ssss_1011_0000_aaaa_dddd_x000(z8000_state *cpustate)
25952615{//@@@
2616    CHECK_PRIVILEGED_INSTR();
25962617   GET_SRC(OP0,NIB2);
25972618   GET_CNT(OP1,NIB1);
25982619   GET_DST(OP1,NIB2);
r15139r15140
26102631 ******************************************/
26112632static void Z3B_ssss_0000_0000_aaaa_dddd_x000(z8000_state *cpustate)
26122633{//@@@
2634    CHECK_PRIVILEGED_INSTR();
26132635   GET_SRC(OP0,NIB2);
26142636    GET_CNT(OP1,NIB1);
26152637   GET_DST(OP1,NIB2);
r15139r15140
26272649 ******************************************/
26282650static void Z3B_ssss_0001_0000_aaaa_dddd_x000(z8000_state *cpustate)
26292651{//@@@
2652    CHECK_PRIVILEGED_INSTR();
26302653   GET_SRC(OP0,NIB2);
26312654    GET_CNT(OP1,NIB1);
26322655   GET_DST(OP1,NIB2);
r15139r15140
26442667 ******************************************/
26452668static void Z3B_ssss_0010_0000_aaaa_dddd_x000(z8000_state *cpustate)
26462669{//@@@
2670    CHECK_PRIVILEGED_INSTR();
26472671   GET_SRC(OP0,NIB2);
26482672    GET_CNT(OP1,NIB1);
26492673   GET_DST(OP1,NIB2);
r15139r15140
26612685 ******************************************/
26622686static void Z3B_ssss_0011_0000_aaaa_dddd_x000(z8000_state *cpustate)
26632687{//@@@
2688    CHECK_PRIVILEGED_INSTR();
26642689   GET_SRC(OP0,NIB2);
26652690    GET_CNT(OP1,NIB1);
26662691   GET_DST(OP1,NIB2);
r15139r15140
26772702 ******************************************/
26782703static void Z3B_dddd_0100_imm16(z8000_state *cpustate)
26792704{
2705    CHECK_PRIVILEGED_INSTR();
26802706    GET_DST(OP0,NIB2);
26812707    GET_IMM16(OP1);
26822708   cpustate->RW(dst) = RDPORT_W(cpustate,  0, imm16);
r15139r15140
26882714 ******************************************/
26892715static void Z3B_dddd_0101_imm16(z8000_state *cpustate)
26902716{
2717    CHECK_PRIVILEGED_INSTR();
26912718    GET_DST(OP0,NIB2);
26922719    GET_IMM16(OP1);
26932720   cpustate->RW(dst) = RDPORT_W(cpustate,  1, imm16);
r15139r15140
26992726 ******************************************/
27002727static void Z3B_ssss_0110_imm16(z8000_state *cpustate)
27012728{
2729    CHECK_PRIVILEGED_INSTR();
27022730    GET_SRC(OP0,NIB2);
27032731    GET_IMM16(OP1);
27042732   WRPORT_W(cpustate,  0, imm16, cpustate->RW(src));
r15139r15140
27102738 ******************************************/
27112739static void Z3B_ssss_0111_imm16(z8000_state *cpustate)
27122740{
2741    CHECK_PRIVILEGED_INSTR();
27132742    GET_SRC(OP0,NIB2);
27142743    GET_IMM16(OP1);
27152744   WRPORT_W(cpustate,  1, imm16, cpustate->RW(src));
r15139r15140
27222751 ******************************************/
27232752static void Z3B_ssss_1000_0000_aaaa_dddd_x000(z8000_state *cpustate)
27242753{//@@@
2754    CHECK_PRIVILEGED_INSTR();
27252755   GET_SRC(OP0,NIB2);
27262756    GET_CNT(OP1,NIB1);
27272757   GET_DST(OP1,NIB2);
r15139r15140
27392769 ******************************************/
27402770static void Z3B_ssss_1001_0000_aaaa_dddd_x000(z8000_state *cpustate)
27412771{//@@@
2772    CHECK_PRIVILEGED_INSTR();
27422773   GET_SRC(OP0,NIB2);
27432774    GET_CNT(OP1,NIB1);
27442775   GET_DST(OP1,NIB2);
r15139r15140
27562787 ******************************************/
27572788static void Z3B_ssss_1010_0000_aaaa_dddd_x000(z8000_state *cpustate)
27582789{//@@@
2790    CHECK_PRIVILEGED_INSTR();
27592791   GET_SRC(OP0,NIB2);
27602792    GET_CNT(OP1,NIB1);
27612793   GET_DST(OP1,NIB2);
r15139r15140
27732805 ******************************************/
27742806static void Z3B_ssss_1011_0000_aaaa_dddd_x000(z8000_state *cpustate)
27752807{//@@@
2808    CHECK_PRIVILEGED_INSTR();
27762809   GET_SRC(OP0,NIB2);
27772810    GET_CNT(OP1,NIB1);
27782811   GET_DST(OP1,NIB2);
r15139r15140
27892822 ******************************************/
27902823static void Z3C_ssss_dddd(z8000_state *cpustate)
27912824{//@@@check
2825    CHECK_PRIVILEGED_INSTR();
27922826   GET_SRC(OP0,NIB2);
27932827   GET_DST(OP0,NIB3);
27942828   cpustate->RB(dst) = RDPORT_B(cpustate,  0, RDMEM_W(cpustate,  cpustate->RW(src)));
r15139r15140
28002834 ******************************************/
28012835static void Z3D_ssss_dddd(z8000_state *cpustate)
28022836{//@@@check
2837    CHECK_PRIVILEGED_INSTR();
28032838   GET_SRC(OP0,NIB2);
28042839   GET_DST(OP0,NIB3);
28052840   cpustate->RW(dst) = RDPORT_W(cpustate,  0, RDMEM_W(cpustate,  cpustate->RW(src)));
r15139r15140
28112846 ******************************************/
28122847static void Z3E_dddd_ssss(z8000_state *cpustate)
28132848{//@@@check
2849    CHECK_PRIVILEGED_INSTR();
28142850   GET_DST(OP0,NIB2);
28152851   GET_SRC(OP0,NIB3);
28162852   WRPORT_B(cpustate,  0, RDMEM_W(cpustate,  cpustate->RW(dst)), cpustate->RB(src));
r15139r15140
28222858 ******************************************/
28232859static void Z3F_dddd_ssss(z8000_state *cpustate)
28242860{//check
2861    CHECK_PRIVILEGED_INSTR();
28252862   GET_DST(OP0,NIB2);
28262863   GET_SRC(OP0,NIB3);
28272864   WRPORT_W(cpustate,  0, RDMEM_W(cpustate,  cpustate->RW(dst)), cpustate->RW(src));
r15139r15140
44604497 ******************************************/
44614498static void Z79_0000_0000_addr(z8000_state *cpustate)
44624499{
4500    CHECK_PRIVILEGED_INSTR();
44634501   GET_ADDR(OP1);
44644502   UINT16 fcw;
44654503    //printf("LDPS from 0x%x: old pc: 0x%x\n", addr, cpustate->pc);
r15139r15140
44814519 ******************************************/
44824520static void Z79_ssN0_0000_addr(z8000_state *cpustate)
44834521{
4522    CHECK_PRIVILEGED_INSTR();
44844523   GET_SRC(OP0,NIB2);
44854524   GET_ADDR(OP1);
44864525   UINT16 fcw;
r15139r15140
45024541 ******************************************/
45034542static void Z7A_0000_0000(z8000_state *cpustate)
45044543{
4544    CHECK_PRIVILEGED_INSTR();
45054545   cpustate->irq_req |= Z8000_HALT;
45064546   if (cpustate->icount > 0) cpustate->icount = 0;
45074547}
r15139r15140
45134553static void Z7B_0000_0000(z8000_state *cpustate)
45144554{
45154555   UINT16 tag, fcw;
4556    CHECK_PRIVILEGED_INSTR();
45164557   tag = POPW(cpustate, SP);   /* get type tag */
45174558   fcw = POPW(cpustate, SP);   /* get cpustate->fcw  */
45184559    if (segmented_mode(cpustate))
r15139r15140
45304571 ******************************************/
45314572static void Z7B_0000_1000(z8000_state *cpustate)
45324573{
4574    CHECK_PRIVILEGED_INSTR();
45334575   /* set mu-0 line */
45344576}
45354577
r15139r15140
45394581 ******************************************/
45404582static void Z7B_0000_1001(z8000_state *cpustate)
45414583{
4584    CHECK_PRIVILEGED_INSTR();
45424585   /* reset mu-0 line */
45434586}
45444587
r15139r15140
45484591 ******************************************/
45494592static void Z7B_0000_1010(z8000_state *cpustate)
45504593{
4594    CHECK_PRIVILEGED_INSTR();
45514595   /* test mu-I line */
45524596}
45534597
r15139r15140
45574601 ******************************************/
45584602static void Z7B_dddd_1101(z8000_state *cpustate)
45594603{
4604    CHECK_PRIVILEGED_INSTR();
45604605   /* test mu-I line, invert cascade to mu-0  */
45614606}
45624607
r15139r15140
45664611 ******************************************/
45674612static void Z7C_0000_00ii(z8000_state *cpustate)
45684613{
4614    CHECK_PRIVILEGED_INSTR();
45694615   GET_IMM2(OP0,NIB3);
45704616   UINT16 fcw = cpustate->fcw;
45714617   fcw &= ~(imm2 << 11);
r15139r15140
45784624 ******************************************/
45794625static void Z7C_0000_01ii(z8000_state *cpustate)
45804626{
4627    CHECK_PRIVILEGED_INSTR();
45814628   GET_IMM2(OP0,NIB3);
45824629   UINT16 fcw = cpustate->fcw;
45834630   fcw |= imm2 << 11;
r15139r15140
45904637 ******************************************/
45914638static void Z7D_dddd_0ccc(z8000_state *cpustate)
45924639{//@@@
4640    CHECK_PRIVILEGED_INSTR();
45934641   GET_IMM3(OP0,NIB3);
45944642   GET_DST(OP0,NIB2);
45954643   switch (imm3) {
r15139r15140
46054653      case 5:
46064654         cpustate->RW(dst) = cpustate->psapoff;
46074655         break;
4656      case 6:
4657         cpustate->RW(dst) = cpustate->nspseg;
4658         break;
46084659      case 7:
46094660         cpustate->RW(dst) = cpustate->nspoff;
46104661         break;
r15139r15140
46194670 ******************************************/
46204671static void Z7D_ssss_1ccc(z8000_state *cpustate)
46214672{//@@@
4673    CHECK_PRIVILEGED_INSTR();
46224674   GET_IMM3(OP0,NIB3);
46234675   GET_SRC(OP0,NIB2);
46244676   switch (imm3) {
r15139r15140
46384690      case 5:
46394691         cpustate->psapoff = cpustate->RW(src);
46404692         break;
4693      case 6:
4694         cpustate->nspseg = cpustate->RW(src);
4695         break;
46414696      case 7:
46424697         cpustate->nspoff = cpustate->RW(src);
46434698         break;
r15139r15140
49695024 ******************************************/
49705025static void Z8E_imm8(z8000_state *cpustate)
49715026{
5027    CHECK_EXT_INSTR();
49725028   GET_IMM8(0);
49735029   LOG(("Z8K '%s' %04x: ext8e  $%02x\n", cpustate->device->tag(), cpustate->pc, imm8));
49745030    if (cpustate->fcw & F_EPU) {
r15139r15140
49835039 ******************************************/
49845040static void Z8F_imm8(z8000_state *cpustate)
49855041{
5042    CHECK_EXT_INSTR();
49865043   GET_IMM8(0);
49875044   LOG(("Z8K '%s' %04x: ext8f  $%02x\n", cpustate->device->tag(), cpustate->pc, imm8));
49885045    if (cpustate->fcw & F_EPU) {
r15139r15140
50075064 flags:  ------
50085065 ******************************************/
50095066static void Z91_ddN0_ssss(z8000_state *cpustate)
5010{//@@@
5067{
50115068    GET_SRC(OP0,NIB3);
50125069    GET_DST(OP0,NIB2);
50135070    PUSHL(cpustate, dst, cpustate->RL(src));
src/emu/cpu/z8000/z8000tbl.c
r15139r15140
359359{0x7d01,0x7df1,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,ctrl1",            0},
360360{0x7d02,0x7df2,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,fcw",            0},
361361{0x7d03,0x7df3,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,refresh",         0},
362{0x7d04,0x7df4,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,ctrl4",            0},
363{0x7d05,0x7df5,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,psap",            0},
364{0x7d06,0x7df6,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,ctrl6",            0},
365{0x7d07,0x7df7,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,nsp",            0},
362{0x7d04,0x7df4,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,psapseg",            0},
363{0x7d05,0x7df5,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,psapoff",            0},
364{0x7d06,0x7df6,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,nspseg",            0},
365{0x7d07,0x7df7,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,nspoff",            0},
366366{0x7d08,0x7df8,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   ctrl0,%rw2",            0},
367367{0x7d09,0x7df9,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   ctrl1,%rw2",            0},
368368{0x7d0a,0x7dfa,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   fcw,%rw2",            0},
369369{0x7d0b,0x7dfb,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   refresh,%rw2",         0},
370{0x7d0c,0x7dfc,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   ctrl4,%rw2",            0},
371{0x7d0d,0x7dfd,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   psap,%rw2",            0},
372{0x7d0e,0x7dfe,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   ctrl6,%rw2",            0},
373{0x7d0f,0x7dff,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   nsp,%rw2",            0},
370{0x7d0c,0x7dfc,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   psapseg,%rw2",            0},
371{0x7d0d,0x7dfd,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   psapoff,%rw2",            0},
372{0x7d0e,0x7dfe,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   nspseg,%rw2",            0},
373{0x7d0f,0x7dff,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   nspoff,%rw2",            0},
374374{0x7e00,0x7eff, 1,1, 10,Z7E_imm8,                         "rsvd7e  %#b1",               0},
375375{0x7f00,0x7fff, 1,1, 33,Z7F_imm8,                         "sc      %#b1",               0},
376376{0x8000,0x80ff, 1,1,  4,Z80_ssss_dddd,                      "addb    %rb3,%rb2",            0},
r15139r15140
389389{0x8c02,0x8cf2,16,1,  7,Z8C_dddd_0010,                      "negb    %rb2",               0},
390390{0x8c04,0x8cf4,16,1,  7,Z8C_dddd_0100,                      "testb   %rb2",               0},
391391{0x8c06,0x8cf6,16,1,  7,Z8C_dddd_0110,                      "tsetb   %rb2",               0},
392
393{0x8c01,0x8cf1,16,1,  7,Z8C_dddd_0001,                      "ldctlb  %rb2,flags",               0},
394
392{0x8c01,0x8cf1,16,1,  7,Z8C_dddd_0001,                      "ldctlb  %rb2,flags",            0},
395393{0x8c08,0x8cf8,16,1,  7,Z8C_dddd_1000,                      "clrb    %rb2",               0},
396
397{0x8c09,0x8cf9,16,1,  7,Z8C_dddd_1001,                      "ldctlb  flags,%rb2",               0},
398
394{0x8c09,0x8cf9,16,1,  7,Z8C_dddd_1001,                      "ldctlb  flags,%rb2",            0},
399395{0x8d00,0x8df0,16,1,  7,Z8D_dddd_0000,                      "com     %rw2",               0},
400396{0x8d01,0x8df1,16,1,  7,Z8D_imm4_0001,                      "setflg  %f2",                  0},
401397{0x8d02,0x8df2,16,1,  7,Z8D_dddd_0010,                      "neg     %rw2",               0},
src/emu/cpu/z8000/z8000.h
r15139r15140
1515};
1616
1717/* Interrupt Types that can be generated by outside sources */
18#define Z8000_TRAP      0x4000   /* internal trap */
18#define Z8000_EPU      0x8000   /* extended instruction trap */
19#define Z8000_TRAP      0x4000   /* privileged instruction trap */
1920#define Z8000_NMI      0x2000   /* non maskable interrupt */
2021#define Z8000_SEGTRAP   0x1000   /* segment trap (Z8001) */
2122#define Z8000_NVI      0x0800   /* non vectored interrupt */
src/mess/drivers/m20.c
r15139r15140
9292   return 0;
9393}
9494
95/* from the M20 hardware reference manual:
96   M20 memory is configured according to the following scheme:
97   Segment   Contents
98         0   PCOS kernel
99         1   Basic interpreter and PCOS utilities
100         2   PCOS variables, Basic stock and tables, user memory
101         3   Screen bitmap
102         4   Diagnostics and Bootstrap
103*/
95104static ADDRESS_MAP_START(m20_mem, AS_PROGRAM, 16, m20_state)
96105   ADDRESS_MAP_UNMAP_HIGH
97106   AM_RANGE( 0x00000, 0x01fff ) AM_RAM AM_SHARE("mainram")
98    AM_RANGE( 0x02000, 0x03fff ) AM_RAM
107    AM_RANGE( 0x02000, 0x0ffff ) AM_RAM
108    AM_RANGE( 0x10000, 0x1ffff ) AM_RAM
99109    AM_RANGE( 0x20000, 0x2ffff ) AM_RAM
100110   AM_RANGE( 0x30000, 0x33fff ) AM_RAM AM_SHARE("p_videoram")//base vram
101111   AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_REGION("maincpu", 0x10000)
102    AM_RANGE( 0x60000, 0x6ffff ) AM_RAM
103    AM_RANGE( 0xa8000, 0xaffff ) AM_RAM
112    AM_RANGE( 0x44000, 0x4bfff ) AM_RAM
113    AM_RANGE( 0x50000, 0x5bfff ) AM_RAM
114    AM_RANGE( 0x60000, 0x67fff ) AM_RAM
115    AM_RANGE( 0x80000, 0x8ffff ) AM_RAM
116    AM_RANGE( 0x90000, 0x9ffff ) AM_RAM
117    AM_RANGE( 0xa0000, 0xaffff ) AM_RAM
118    AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM
119    AM_RANGE( 0xc0000, 0xc3fff ) AM_RAM
104120//  AM_RANGE( 0x34000, 0x37fff ) AM_RAM //extra vram for bitmap mode
105121//  AM_RANGE( 0x20000, 0x2???? ) //work RAM?
106122ADDRESS_MAP_END

Previous 15994 Revisions Next


© 1998-2018 The MESS Team