Previous 15994 Revisions Next

r8413 Tuesday 6th July, 2010 at 20:52:08 UTC by Angelo Salese
[PASOPIA7] Basic work
[src/mess/drivers]pasopia.c

src/mess/drivers/pasopia.c
r8412r8413
88
99#include "emu.h"
1010#include "cpu/z80/z80.h"
11#include "sound/ay8910.h"
12#include "video/mc6845.h"
1113
14static UINT8 vram_sel;
15static UINT8 *p7_vram;
16
17static VIDEO_START( paso7 )
18{
19}
20
21static VIDEO_UPDATE( paso7 )
22{
23   int x,y;
24   int count;
25
26   count = 0x10;
27
28   for(y=0;y<25;y++)
29   {
30      for(x=0;x<40;x++)
31      {
32         int tile = p7_vram[count];
33
34         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,0,0,0,x*8,y*8);
35
36         count+=8;
37      }
38   }
39
40
41    return 0;
42}
43
44static READ8_HANDLER( vram_r )
45{
46   if(vram_sel)
47      return 0xff;
48
49   return p7_vram[offset];
50}
51
52static WRITE8_HANDLER( vram_w )
53{
54   if(!vram_sel)
55      p7_vram[offset] = data;
56}
57
1258// sketchy port 0x3c implementation to see what the CPU does...
1359// however, it writes 0x11 - in theory setting BASIC+BIOS in the lower banks
14// and then it writes at 0x0000... maybe bank1 should be RAM? or
60// and then it writes at 0x0000... maybe bank1 should be RAM? or
1561// should we have writes to RAM and only reads to BIOS/BASIC?
1662static WRITE8_HANDLER( paso7_bankswitch )
1763{
r8412r8413
2066
2167   if (BIT(data, 0))
2268   {
23      memory_unmap_write(space, 0x0000, 0x7fff, 0, 0);
2469      memory_set_bankptr(space->machine, "bank1", basic);
2570      memory_set_bankptr(space->machine, "bank2", cpu + 0x10000);
71      memory_unmap_write(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0);
2672   }
2773   else if (BIT(data, 1))
2874   {
29      memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank1");
30      memory_install_write_bank(space, 0x4000, 0x7fff, 0, 0, "bank2");
3175      memory_set_bankptr(space->machine, "bank1", cpu);
3276      memory_set_bankptr(space->machine, "bank2", cpu + 0x4000);
77      memory_install_write_bank(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, "bank1");
78      memory_install_write_bank(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, "bank2");
3379   }
34   else
80   else
3581   {
36      memory_unmap_write(space, 0x0000, 0x7fff, 0, 0);
3782      memory_set_bankptr(space->machine, "bank1", cpu + 0x10000);
3883      memory_set_bankptr(space->machine, "bank2", cpu + 0x10000);
84      memory_unmap_write(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0);
3985   }
4086
41   if (BIT(data, 2))
42      memory_unmap_readwrite(space, 0x8000, 0xbfff, 0, 0);
43   else
44   {
45      memory_install_write_bank(space, 0x8000, 0xbfff, 0, 0, "bank3");
46      memory_set_bankptr(space->machine, "bank3", cpu + 0x8000);
47   }
48   // bit 2 also selects vram
87   vram_sel = data & 4;
4988
5089   // bit 3? PIO2 port C
5190
5291   // bank4 is always RAM
5392}
5493
94static READ8_HANDLER( test_r )
95{
96   return mame_rand(space->machine);
97}
98
99
100#if 0
101static WRITE8_HANDLER( test_w )
102{
103   printf("%02x %02x\n",offset,data);
104}
105#endif
106
107static READ8_HANDLER( test2_r )
108{
109   return 0xff;
110}
111
55112static ADDRESS_MAP_START(paso7_mem, ADDRESS_SPACE_PROGRAM, 8)
56113   ADDRESS_MAP_UNMAP_HIGH
57114   AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1")
58115   AM_RANGE( 0x4000, 0x7fff ) AM_RAMBANK("bank2")
59   AM_RANGE( 0x8000, 0xbfff ) AM_RAMBANK("bank3")
116   AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(vram_r, vram_w ) AM_BASE(&p7_vram)
60117   AM_RANGE( 0xc000, 0xffff ) AM_RAMBANK("bank4")
61118ADDRESS_MAP_END
62119
63120static ADDRESS_MAP_START( paso7_io , ADDRESS_SPACE_IO, 8)
64121   ADDRESS_MAP_UNMAP_HIGH
65122   ADDRESS_MAP_GLOBAL_MASK(0xff)
123   AM_RANGE( 0x09, 0x09 ) AM_READ(test_r)
124   AM_RANGE( 0x10, 0x10 ) AM_DEVWRITE("crtc", mc6845_address_w)
125   AM_RANGE( 0x11, 0x11 ) AM_DEVWRITE("crtc", mc6845_register_w)
126   AM_RANGE( 0x22, 0x22 ) AM_READ(test2_r) AM_WRITENOP
66127   AM_RANGE( 0x3c, 0x3c ) AM_WRITE(paso7_bankswitch)
67#if 0
68   AM_RANGE( 0x08, 0x0b )  // PIO0
69   AM_RANGE( 0x0c, 0x0f )  // PIO1
70   AM_RANGE( 0x10, 0x11 )  // CRTC
71   AM_RANGE( 0x20, 0x23 )  // PIO2
72   AM_RANGE( 0x28, 0x2b )  // CTC
73   AM_RANGE( 0x3a, 0x3a )  // PSG0
74   AM_RANGE( 0x3b, 0x3b )  // PSG1
75   AM_RANGE( 0xe0, 0xe6 )  // FLOPPY
76#endif   
128//   AM_RANGE( 0x08, 0x0b )  // PIO0
129//   AM_RANGE( 0x0c, 0x0f )  // PIO1
130//   AM_RANGE( 0x20, 0x23 )  // PIO2
131//   AM_RANGE( 0x28, 0x2b )  // CTC
132//   AM_RANGE( 0x3a, 0x3a )  // PSG0
133//   AM_RANGE( 0x3b, 0x3b )  // PSG1
134//   AM_RANGE( 0xe0, 0xe6 )  // FLOPPY
77135ADDRESS_MAP_END
78136
79137/* Input ports */
r8412r8413
84142{
85143}
86144
87static VIDEO_START( paso7 )
145static const gfx_layout p7_chars_8x8 =
88146{
89}
147   8,8,
148   RGN_FRAC(1,1),
149   1,
150   { 0 },
151   { 0, 1, 2, 3, 4, 5, 6, 7 },
152   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
153   8*8
154};
90155
91static VIDEO_UPDATE( paso7 )
156static const gfx_layout p7_chars_16x16 =
92157{
93    return 0;
94}
158   16,16,
159   RGN_FRAC(1,1),
160   1,
161   { 0 },
162   { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
163   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
164   16*16
165};
95166
167static GFXDECODE_START( pasopia7 )
168   GFXDECODE_ENTRY( "font",   0x00000, p7_chars_8x8,    0, 1 )
169   GFXDECODE_ENTRY( "kanji",  0x00000, p7_chars_16x16,  0, 1 )
170GFXDECODE_END
171
172static const mc6845_interface mc6845_intf =
173{
174   "screen",   /* screen we are acting on */
175   8,         /* number of pixels per video memory address */
176   NULL,      /* before pixel update callback */
177   NULL,      /* row update callback */
178   NULL,      /* after pixel update callback */
179   DEVCB_NULL,   /* callback for display state changes */
180   DEVCB_NULL,   /* callback for cursor state changes */
181   DEVCB_NULL,   /* HSYNC callback */
182   DEVCB_NULL,   /* VSYNC callback */
183   NULL      /* update address callback */
184};
185
96186static MACHINE_DRIVER_START( paso7 )
97187    /* basic machine hardware */
98188    MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)
99189    MDRV_CPU_PROGRAM_MAP(paso7_mem)
100190    MDRV_CPU_IO_MAP(paso7_io)
191//   MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
101192
102193    MDRV_MACHINE_RESET(paso7)
103194
104195    /* video hardware */
105196    MDRV_SCREEN_ADD("screen", RASTER)
106    MDRV_SCREEN_REFRESH_RATE(50)
197    MDRV_SCREEN_REFRESH_RATE(60)
107198    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
108199    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
109200    MDRV_SCREEN_SIZE(640, 480)
110201    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
202   MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/4, mc6845_intf)   /* unknown clock, hand tuned to get ~60 fps */
111203    MDRV_PALETTE_LENGTH(2)
112204    MDRV_PALETTE_INIT(black_and_white)
113205
206   MDRV_GFXDECODE( pasopia7 )
207
114208    MDRV_VIDEO_START(paso7)
115209    MDRV_VIDEO_UPDATE(paso7)
116210MACHINE_DRIVER_END
r8412r8413
135229   UINT8 *bios = memory_region(machine, "maincpu");
136230   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
137231
138   memory_unmap_write(space, 0x0000, 0xbfff, 0, 0);
232   memory_unmap_write(space, 0x0000, 0x7fff, 0, 0);
139233   memory_set_bankptr(machine, "bank1", bios + 0x10000);
140234   memory_set_bankptr(machine, "bank2", bios + 0x10000);
141   memory_set_bankptr(machine, "bank3", bios + 0x10000);
235//   memory_set_bankptr(machine, "bank3", bios + 0x10000);
142236//   memory_set_bankptr(machine, "bank4", bios + 0x10000);
143237}
144238

Previous 15994 Revisions Next


© 1998-2018 The MESS Team