Previous 15994 Revisions Next

r8017 Wednesday 12th May, 2010 at 00:33:00 UTC by Angelo Salese
[M20]: Hooked up MC6845 registers, more z8001 work
[src/emu/cpu/z8000]z8000.c z8000ops.c z8000tbl.c
[src/mess/drivers]m20.c

src/emu/cpu/z8000/z8000.c
r8016r8017
6868struct _z8000_state
6969{
7070    UINT16  op[4];      /* opcodes/data of current instruction */
71   UINT16   ppc;      /* previous program counter */
72    UINT16  pc;         /* program counter */
71   UINT32   ppc;      /* previous program counter */
72    UINT32  pc;         /* program counter */
7373    UINT16  psap;       /* program status pointer */
7474    UINT16  fcw;        /* flags and control word */
7575    UINT16  refresh;    /* refresh timer/counter */
r8016r8017
114114    return res;
115115}
116116
117INLINE UINT8 RDMEM_B(z8000_state *cpustate, UINT16 addr)
117INLINE UINT8 RDMEM_B(z8000_state *cpustate, UINT32 addr)
118118{
119119   return memory_read_byte_16be(cpustate->program, addr);
120120}
121121
122INLINE UINT16 RDMEM_W(z8000_state *cpustate, UINT16 addr)
122INLINE UINT16 RDMEM_W(z8000_state *cpustate, UINT32 addr)
123123{
124124   addr &= ~1;
125125   return memory_read_word_16be(cpustate->program, addr);
126126}
127127
128INLINE UINT32 RDMEM_L(z8000_state *cpustate, UINT16 addr)
128INLINE UINT32 RDMEM_L(z8000_state *cpustate, UINT32 addr)
129129{
130130   UINT32 result;
131131   addr &= ~1;
r8016r8017
400400   cpustate->fcw = RDMEM_W(cpustate,  2); /* get reset cpustate->fcw */
401401   if(cpustate->fcw & F_SEG)
402402   {
403      //cpustate->seg_pc = RDMEM_W(cpustate, 4);
404      cpustate->pc = RDMEM_W(cpustate,  6);
403      cpustate->pc = ((RDMEM_W(cpustate,  4) & 0x0700) << 8) | (RDMEM_W(cpustate, 6) & 0xffff); /* get reset cpustate->pc  */
405404   }
406405   else
407406   {
r8016r8017
665664            cpustate->fcw & 0x0001 ? '?':'.');
666665            break;
667666
668      case CPUINFO_STR_REGISTER + Z8000_PC:         sprintf(info->s, "pc :%04X", cpustate->pc);      break;
667      case CPUINFO_STR_REGISTER + Z8000_PC:         sprintf(info->s, "pc :%08X", cpustate->pc);      break;
669668      case CPUINFO_STR_REGISTER + Z8000_NSP:         sprintf(info->s, "SP :%04X", cpustate->nsp);   break;
670669      case CPUINFO_STR_REGISTER + Z8000_FCW:         sprintf(info->s, "fcw:%04X", cpustate->fcw);   break;
671670      case CPUINFO_STR_REGISTER + Z8000_PSAP:         sprintf(info->s, "nsp:%04X", cpustate->psap);   break;
src/emu/cpu/z8000/z8000ops.c
r8016r8017
18651865   cpustate->RB(dst) = RDMEM_B(cpustate,  cpustate->RW(src));
18661866}
18671867
1868static void Z20_ssN0_dddd_seg(z8000_state *cpustate)
1869{
1870   UINT32 addr;
1871   GET_DST(OP0,NIB3);
1872   GET_SRC(OP0,NIB2);
1873   addr = (cpustate->RW(src) & 0x0007) << 16;
1874   addr|= cpustate->RW(src+1) & 0xffff;
1875   cpustate->RB(dst) = RDMEM_B(cpustate,  addr);
1876   //cycles?
1877}
1878
18681879/******************************************
18691880 ld      rd,imm16
18701881 flags:  ------
src/emu/cpu/z8000/z8000tbl.c
r8016r8017
610610{0x1d10,0x1dff, 1,1, 11,Z1D_ddN0_ssss,                      "ldl     @%rw2,%rl3",            0},
611611{0x1e10,0x1eff, 1,1, 10,Z1E_ddN0_cccc,                      "jp      %c3,@%rl2",            0},
612612{0x1f10,0x1ff0,16,1, 10,Z1F_ddN0_0000,                      "call    %rw2",               DASMFLAG_STEP_OVER},
613{0x2010,0x20ff, 1,1,  7,Z20_ssN0_dddd,                      "ldb     %rb3,@%rw2",            0},
613{0x2010,0x20ff, 1,1,  7,Z20_ssN0_dddd_seg,                   "ldb     %rb3,@%rw2",            0},
614614{0x2100,0x210f, 1,2,  7,Z21_0000_dddd_imm16,                "ld      %rw3,%#w1",            0},
615615{0x2110,0x21ff, 1,1,  7,Z21_ssN0_dddd,                      "ld      %rw3,@%rw2",            0},
616616{0x2200,0x220f, 1,2, 10,Z22_0000_ssss_0000_dddd_0000_0000,       "resb    %rb5,%rw3",            0},
src/mess/drivers/m20.c
r8016r8017
1717#include "emu.h"
1818#include "cpu/z8000/z8000.h"
1919#include "cpu/i86/i86.h"
20#include "video/mc6845.h"
2021
2122#define MAIN_CLOCK 4000000 /* 4 MHz */
23#define PIXEL_CLOCK XTAL_4_433619MHz
2224
2325
2426static ADDRESS_MAP_START(m20_mem, ADDRESS_SPACE_PROGRAM, 16)
2527   ADDRESS_MAP_UNMAP_HIGH
26   AM_RANGE( 0x0000, 0x1fff ) AM_ROM AM_REGION("maincpu",0x10000)
27   AM_RANGE( 0x8000, 0x9fff ) AM_ROM AM_REGION("maincpu",0x10000)
28   AM_RANGE( 0x00000, 0x01fff ) AM_ROM AM_REGION("maincpu",0x10000)
29   AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_REGION("maincpu",0x10000) //mirror
2830
2931//   AM_RANGE( 0x30000, 0x33fff ) AM_RAM //base vram
3032//   AM_RANGE( 0x34000, 0x37fff ) AM_RAM //extra vram for bitmap mode
r8016r8017
3234//
3335ADDRESS_MAP_END
3436
35static ADDRESS_MAP_START( m20_io , ADDRESS_SPACE_IO, 16)
37static ADDRESS_MAP_START( m20_io , ADDRESS_SPACE_IO, 8)
3638   ADDRESS_MAP_UNMAP_HIGH
37   // 0x61 - crtc address
38   // 0x63 - crtc data
39   AM_RANGE(0x61, 0x61) AM_DEVWRITE8("crtc", mc6845_address_w, 0x00ff)
40   AM_RANGE(0x63, 0x63) AM_DEVWRITE8("crtc", mc6845_register_w, 0x00ff)
3941   // 0x81 / 0x87 - i8255A
4042   // 0xa1 - i8251 keyboard data
4143   // 0xa3 - i8251 keyboard status / control
r8016r8017
4345   // 0xc3 - i8251 TTY / printer status / control
4446   // 0x121 / 0x127 - pit8253 (TTY/printer, keyboard, RTC/NVI)
4547
46   // 0x21?? / 0x21? - fdc
48   // 0x21?? / 0x21? - fdc ... seems to control the screen colors???
4749ADDRESS_MAP_END
4850
4951static ADDRESS_MAP_START(m20_apb_mem, ADDRESS_SPACE_PROGRAM, 16)
r8016r8017
9698   GFXDECODE_ENTRY( "maincpu",   0x11614, m20_chars_8x8,    0x000, 1 )
9799GFXDECODE_END
98100
101static const mc6845_interface mc6845_intf =
102{
103   "screen",   /* screen we are acting on */
104   8,         /* number of pixels per video memory address */
105   NULL,      /* before pixel update callback */
106   NULL,      /* row update callback */
107   NULL,      /* after pixel update callback */
108   DEVCB_NULL,   /* callback for display state changes */
109   DEVCB_NULL,   /* callback for cursor state changes */
110   DEVCB_NULL,   /* HSYNC callback */
111   DEVCB_NULL,   /* VSYNC callback */
112   NULL      /* update address callback */
113};
114
99115static MACHINE_DRIVER_START( m20 )
100116    /* basic machine hardware */
101117    MDRV_CPU_ADD("maincpu", Z8001, MAIN_CLOCK)
r8016r8017
109125
110126   MDRV_MACHINE_RESET(m20)
111127
128   MDRV_MC6845_ADD("crtc", MC6845, PIXEL_CLOCK/8, mc6845_intf)   /* hand tuned to get ~50 fps */
129
112130    /* video hardware */
113131    MDRV_SCREEN_ADD("screen", RASTER)
114132    MDRV_SCREEN_REFRESH_RATE(60)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team