Previous 15994 Revisions Next

r9425 Wednesday 20th October, 2010 at 23:14:54 UTC by Angelo Salese
[PC-88VA]: Added palette RAM and preliminary banking, it now uploads a palette and puts some graphics (not yet hooked up)
[src/mess/drivers]pc88va.c

src/mess/drivers/pc88va.c
r9424r9425
1616#include "cpu/nec/nec.h"
1717//#include "cpu/z80/z80.h"
1818
19static UINT16 *palram;
20static UINT16 bank_reg;
21
1922static VIDEO_START( pc88va )
2023{
2124
r9424r9425
2629   return 0;
2730}
2831
32static READ8_HANDLER( sys_mem_r )
33{
34   switch((bank_reg & 0xf00) >> 8)
35   {
36      case 0: // select bus slot
37         return 0xff;
38      case 1: // TVRAM
39      {
40         UINT8 *tvram = memory_region(space->machine, "tvram");
41         if((offset & 0x30000) == 0)
42            return tvram[offset];
43
44         return 0xff;
45      }
46      case 4:
47      {
48         UINT8 *gvram = memory_region(space->machine, "gvram");
49
50         return gvram[offset];
51      }
52      case 8: // kanji ROM
53      case 9:
54      {
55         UINT8 *knj_ram = memory_region(space->machine, "kanji");
56         UINT32 knj_offset;
57
58         knj_offset = offset + (((bank_reg & 0x100) >> 8)*0x40000);
59
60         /* 0x00000 - 0x3ffff Kanji ROM 1*/
61         /* 0x40000 - 0x4ffff Kanji ROM 2*/
62         /* 0x50000 - 0x53fff Kanji RAM */
63         /* anything else is a NOP (I presume?) */
64
65         return knj_ram[knj_offset];
66      }
67      break;
68      case 0xc: // Dictionary ROM
69      case 0xd:
70      {
71         UINT8 *dic_rom = memory_region(space->machine, "dictionary");
72         UINT32 dic_offset;
73
74         dic_offset = offset + (((bank_reg & 0x100) >> 8)*0x40000);
75
76         return dic_rom[dic_offset];
77      }
78   }
79
80   return 0xff;
81}
82
83static WRITE8_HANDLER( sys_mem_w )
84{
85   switch((bank_reg & 0xf00) >> 8)
86   {
87      case 0: // select bus slot
88         break;
89      case 1: // TVRAM
90      {
91         UINT8 *tvram = memory_region(space->machine, "tvram");
92
93         if((offset & 0x30000) == 0)
94            tvram[offset] = data;
95      }
96      break;
97      case 4: // TVRAM
98      {
99         UINT8 *gvram = memory_region(space->machine, "gvram");
100
101         gvram[offset] = data;
102      }
103      break;
104      case 8: // kanji ROM
105      case 9:
106      {
107         UINT8 *knj_ram = memory_region(space->machine, "kanji");
108         UINT32 knj_offset;
109
110         knj_offset = offset + (((bank_reg & 0x100) >> 8)*0x40000);
111
112         if(knj_offset >= 0x50000 && knj_offset <= 0x53fff)
113            knj_ram[knj_offset] = data;
114      }
115      break;
116      case 0xc: // Dictionary ROM
117      case 0xd:
118      {
119         // ...
120      }
121      break;
122   }
123}
124
29125static ADDRESS_MAP_START( pc88va_map, ADDRESS_SPACE_PROGRAM, 16 )
30126   AM_RANGE(0x00000, 0x7ffff) AM_RAM
31   AM_RANGE(0x80000, 0x9ffff) AM_RAM // EMM
32   AM_RANGE(0xe0000, 0xfffff) AM_ROM AM_REGION("boot_code",0)
127//   AM_RANGE(0x80000, 0x9ffff) AM_RAM // EMM
128   AM_RANGE(0xa0000, 0xdffff) AM_READWRITE8(sys_mem_r,sys_mem_w,0xffff)
129   AM_RANGE(0xe0000, 0xeffff) AM_ROMBANK("rom00_bank")
130   AM_RANGE(0xf0000, 0xfffff) AM_ROMBANK("rom10_bank")
33131ADDRESS_MAP_END
34132
133static READ8_HANDLER( idp_status_r )
134{
135/*
136    x--- ---- LP   Light-pen signal detection (with VA use failure)
137    -x-- ---- VB   Vertical elimination period
138    --x- ---- SC   Sprite control (sprite over/collision)
139    ---x ---- ER   Error occurrence
140    ---- x--- In the midst of execution of EMEN emulation development
141    ---- -x-- In the midst of BUSY command execution
142    ---- --x- OBF output data buffer full
143    ---- ---x IBF input data buffer full (command/parameter commonness)
144*/
145   return 0x00;
146}
147
148static WRITE8_HANDLER( idp_command_w )
149{
150   // ...
151}
152
153static WRITE8_HANDLER( idp_param_w )
154{
155   // ...
156}
157
158static WRITE16_HANDLER( palette_ram_w )
159{
160   int r,g,b;
161   COMBINE_DATA(&palram[offset]);
162
163   b = (palram[offset] & 0x001e) >> 1;
164   r = (palram[offset] & 0x03c0) >> 6;
165   g = (palram[offset] & 0x7800) >> 11;
166
167   palette_set_color_rgb(space->machine,offset,pal4bit(r),pal4bit(g),pal4bit(b));
168}
169
170static READ16_HANDLER( sys_port4_r )
171{
172   UINT8 vrtc;
173   vrtc = (space->machine->primary_screen->vpos() < 200) ? 0x20 : 0x00; // vblank
174
175   return vrtc;
176}
177
178static READ16_HANDLER( bios_bank_r )
179{
180   return bank_reg;
181}
182
183static WRITE16_HANDLER( bios_bank_w )
184{
185   /*
186   -x-- ---- ---- ---- SMM (compatibility mode)
187   ---x ---- ---- ---- GMSP (VRAM drawing Mode)
188   ---- xxxx ---- ---- SMBC (0xa0000 - 0xdffff RAM bank)
189   ---- ---- xxxx ---- RBC1 (0xf0000 - 0xfffff ROM bank)
190   ---- ---- ---- xxxx RBC0 (0xe0000 - 0xeffff ROM bank)
191   */
192   bank_reg = data;
193
194   /* RBC1 */
195   {
196      UINT8 *ROM10 = memory_region(space->machine, "rom10");
197
198      if((bank_reg & 0xe0) == 0x00)
199         memory_set_bankptr(space->machine, "rom10_bank", &ROM10[(bank_reg & 0x10) ? 0x10000 : 0x00000]);
200   }
201
202   /* RBC0 */
203   {
204      UINT8 *ROM00 = memory_region(space->machine, "rom00");
205
206      memory_set_bankptr(space->machine, "rom00_bank", &ROM00[(bank_reg & 0xf)*0x10000]); // TODO: docs says that only 0 - 5 are used, dunno why ...
207   }
208}
209
35210static ADDRESS_MAP_START( pc88va_io_map, ADDRESS_SPACE_IO, 16 )
36211//   AM_RANGE(0x0000, 0x000f) Keyboard ROW reading
37212//   AM_RANGE(0x0010, 0x0010) Printer / Calendar Clock Interface
r9424r9425
41216//   AM_RANGE(0x0032, 0x0032) (R) ? (W) System Port 2
42217//   AM_RANGE(0x0034, 0x0034) GVRAM Control Port 1
43218//   AM_RANGE(0x0035, 0x0035) GVRAM Control Port 2
44//   AM_RANGE(0x0040, 0x0040) (R) System Port 4 (W) System port 3 (strobe port)
219   AM_RANGE(0x0040, 0x0041) AM_READ(sys_port4_r) // (R) System Port 4 (W) System port 3 (strobe port)
45220//   AM_RANGE(0x0044, 0x0045) YM2203
46221//   AM_RANGE(0x0046, 0x0047) YM2203 mirror
47222//   AM_RANGE(0x005c, 0x005c) (R) GVRAM status
r9424r9425
70245//   AM_RANGE(0x0126, 0x0127) ? (related to Transparent Color of Graphic Screen 1)
71246//   AM_RANGE(0x012e, 0x012f) ? (related to Transparent Color of Text/Sprite)
72247//   AM_RANGE(0x0130, 0x0137) Picture Mask Parameter
73//   AM_RANGE(0x0142, 0x0143) Text Controller (IDP) - (R) Status (W) command
74//   AM_RANGE(0x0146, 0x0147) Text Controller (IDP) - (R/W) Parameter
248   AM_RANGE(0x0142, 0x0143) AM_READWRITE8(idp_status_r,idp_command_w,0x00ff) //Text Controller (IDP) - (R) Status (W) command
249   AM_RANGE(0x0146, 0x0147) AM_WRITE8(idp_param_w,0x00ff) //Text Controller (IDP) - (R/W) Parameter
75250//   AM_RANGE(0x0148, 0x0149) Text control port 1
76251//   AM_RANGE(0x014c, 0x014f) ? CG Port
77252//   AM_RANGE(0x0150, 0x0151) System Operational Mode
78//   AM_RANGE(0x0152, 0x0153) Memory Map Register
253   AM_RANGE(0x0152, 0x0153) AM_READWRITE(bios_bank_r,bios_bank_w) // Memory Map Register
79254//   AM_RANGE(0x0154, 0x0155) Refresh Register (wait states)
80255//   AM_RANGE(0x0156, 0x0157) ROM bank status
81256//   AM_RANGE(0x0158, 0x0159) Interruption Mode Modification
r9424r9425
95270//   AM_RANGE(0x0220, 0x023f) Frame buffer 1 control parameter
96271//   AM_RANGE(0x0240, 0x025f) Frame buffer 2 control parameter
97272//   AM_RANGE(0x0260, 0x027f) Frame buffer 3 control parameter
98//   AM_RANGE(0x0300, 0x033f) Palette RAM (xBBBBxRRRRxGGGG format)
273   AM_RANGE(0x0300, 0x033f) AM_RAM_WRITE(palette_ram_w) AM_BASE(&palram) // Palette RAM (xBBBBxRRRRxGGGG format)
99274
100275//   AM_RANGE(0x0500, 0x05ff) GVRAM
101276//   AM_RANGE(0x1000, 0xfeff) user area (???)
r9424r9425
115290static INPUT_PORTS_START( pc88va )
116291INPUT_PORTS_END
117292
293static MACHINE_RESET( pc88va )
294{
295   UINT8 *ROM00 = memory_region(machine, "rom00");
296   UINT8 *ROM10 = memory_region(machine, "rom10");
297
298   memory_set_bankptr(machine, "rom10_bank", &ROM10[0x00000]);
299   memory_set_bankptr(machine, "rom00_bank", &ROM00[0x00000]);
300
301   bank_reg = 0x4100;
302}
303
118304static MACHINE_CONFIG_START( pc88va, driver_device )
119305
120306   MDRV_CPU_ADD("maincpu", V30, 8000000)        /* 8 MHz */
r9424r9425
130316   MDRV_SCREEN_ADD("screen", RASTER)
131317   MDRV_SCREEN_REFRESH_RATE(60)
132318   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
133   MDRV_SCREEN_SIZE(640, 480)
134   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
319   MDRV_SCREEN_SIZE(640, 256)
320   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
135321   MDRV_PALETTE_LENGTH(32)
136322//   MDRV_PALETTE_INIT( pc8801 )
137323
138324   MDRV_VIDEO_START( pc88va )
139325   MDRV_VIDEO_UPDATE( pc88va )
140326
327   MDRV_MACHINE_RESET( pc88va )
328
141329MACHINE_CONFIG_END
142330
143331
r9424r9425
146334
147335   ROM_REGION( 0x100000, "subcpu", ROMREGION_ERASEFF )
148336
149   ROM_REGION( 0xc0000, "rom", 0 )
150   ROM_LOAD( "varom00.rom",   0x00000, 0x80000, CRC(98c9959a) SHA1(bcaea28c58816602ca1e8290f534360f1ca03fe8) )   // multiple banks to be loaded at 0x0000?
151   ROM_LOAD( "varom08.rom",   0x80000, 0x20000, CRC(eef6d4a0) SHA1(47e5f89f8b0ce18ff8d5d7b7aef8ca0a2a8e3345) )   // multiple banks to be loaded at 0x8000?
152   ROM_LOAD( "varom1.rom",    0xa0000, 0x20000, CRC(7e767f00) SHA1(dd4f4521bfbb068f15ab3bcdb8d47c7d82b9d1d4) )
337   ROM_REGION( 0x100000, "rom00", ROMREGION_ERASEFF ) // 0xe0000 - 0xeffff
338   ROM_LOAD( "varom00.rom",   0x00000, 0x80000, CRC(98c9959a) SHA1(bcaea28c58816602ca1e8290f534360f1ca03fe8) )
339   ROM_LOAD( "varom08.rom",   0x80000, 0x20000, CRC(eef6d4a0) SHA1(47e5f89f8b0ce18ff8d5d7b7aef8ca0a2a8e3345) )
153340
154   ROM_REGION( 0x20000, "boot_code", 0 )
155   ROM_COPY( "rom", 0xb0000, 0x00000, 0x10000 )
156   ROM_COPY( "rom", 0xa0000, 0x10000, 0x10000 )
341   ROM_REGION( 0x20000, "rom10", 0 ) // 0xf0000 - 0xfffff
342   ROM_LOAD( "varom1.rom",    0x00000, 0x20000, CRC(7e767f00) SHA1(dd4f4521bfbb068f15ab3bcdb8d47c7d82b9d1d4) )
157343
158344   ROM_REGION( 0x2000, "sub", 0 )      // not sure what this should do...
159345   ROM_LOAD( "vasubsys.rom", 0x0000, 0x2000, CRC(08962850) SHA1(a9375aa480f85e1422a0e1385acb0ea170c5c2e0) )
r9424r9425
162348   ROM_REGION( 0x2000, "audiocpu", 0)
163349   ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP )
164350
165   ROM_REGION( 0x50000, "gfx1", 0 )
166   ROM_LOAD( "vafont.rom", 0x00000, 0x50000, BAD_DUMP CRC(b40d34e4) SHA1(a0227d1fbc2da5db4b46d8d2c7e7a9ac2d91379f) )
351   ROM_REGION( 0x80000, "kanji", ROMREGION_ERASEFF )
352   ROM_LOAD( "vafont.rom", 0x00000, 0x50000, BAD_DUMP CRC(b40d34e4) SHA1(a0227d1fbc2da5db4b46d8d2c7e7a9ac2d91379f) ) // should be splitted
167353
168354   /* 32 banks, to be loaded at 0xc000 - 0xffff */
169355   ROM_REGION( 0x80000, "dictionary", 0 )
170356   ROM_LOAD( "vadic.rom", 0x00000, 0x80000, CRC(a6108f4d) SHA1(3665db538598abb45d9dfe636423e6728a812b12) )
357
358   ROM_REGION( 0x10000, "tvram", ROMREGION_ERASE00 )
359
360   ROM_REGION( 0x40000, "gvram", ROMREGION_ERASE00 )
171361ROM_END
172362
173363COMP( 1987, pc88va,         0,      0,     pc88va,   pc88va,  0,    "Nippon Electronic Company",  "PC-88VA", GAME_NOT_WORKING | GAME_NO_SOUND)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team