Previous 15994 Revisions Next

r9014 Thursday 2nd September, 2010 at 09:22:53 UTC by Angelo Salese
[PASOPIA7]: Variable refactoring
[src/mess/drivers]pasopia.c

src/mess/drivers/pasopia.c
r9013r9014
1919#include "video/mc6845.h"
2020
2121static UINT8 vram_sel,mio_sel;
22static UINT8 *p7_vram,*p7_pal;
22static UINT8 *p7_pal;
2323static UINT8 bank_reg;
2424static UINT16 cursor_addr;
2525static UINT8 cursor_blink,cursor_raster;
r9013r9014
2727
2828static VIDEO_START( paso7 )
2929{
30   p7_vram = auto_alloc_array(machine, UINT8, 0x10000);
3130   p7_pal = auto_alloc_array(machine, UINT8, 0x10);
3231}
3332
r9013r9014
117116
118117static VIDEO_UPDATE( paso7 )
119118{
119   static UINT8 *vram = memory_region(screen->machine, "vram");
120120   int x,y,xi;
121121   int count;
122122   int width;
r9013r9014
137137         {
138138            int pen_b,pen_r,pen_g,color;
139139
140            pen_b = (p7_vram[count+0x0000]>>(7-xi)) & 1;
141            pen_r = (p7_vram[count+0x4000]>>(7-xi)) & 1;
140            pen_b = (vram[count+0x0000]>>(7-xi)) & 1;
141            pen_r = (vram[count+0x4000]>>(7-xi)) & 1;
142142            pen_g = 0;//(p7_vram[count+0x8000]>>(7-xi)) & 1;
143143
144144            color =  pen_g<<2 | pen_r<<1 | pen_b<<0;
r9013r9014
155155   {
156156      for(x=0;x<width;x++)
157157      {
158         int tile = p7_vram[count+0x8000];
159         int color = p7_vram[count+0xc000];
158         int tile = vram[count+0x8000];
159         int color = vram[count+0xc000];
160160
161161         drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8,0);
162162
r9013r9014
194194
195195static READ8_HANDLER( vram_r )
196196{
197   static UINT8 *vram = memory_region(space->machine, "vram");
197198   static UINT8 res;
198199
199200   if(vram_sel == 0)
200201   {
201      UINT8 *cpu = memory_region(space->machine, "maincpu");
202      UINT8 *work_ram = memory_region(space->machine, "maincpu");
202203
203      return cpu[offset+0x8000];
204      return work_ram[offset+0x8000];
204205   }
205206
206207   if(pal_sel && (plane_reg & 0x70) == 0x00)
r9013r9014
209210   res = 0xff;
210211
211212   if((plane_reg & 0x11) == 0x11)
212      res &= p7_vram[offset | 0x0000];
213      res &= vram[offset | 0x0000];
213214   if((plane_reg & 0x22) == 0x22)
214      res &= p7_vram[offset | 0x4000];
215      res &= vram[offset | 0x4000];
215216   if((plane_reg & 0x44) == 0x44)
216217   {
217      res &= p7_vram[offset | 0x8000];
218      attr_latch = p7_vram[offset | 0xc000];
218      res &= vram[offset | 0x8000];
219      attr_latch = vram[offset | 0xc000];
219220      i8255a_w(space->machine->device("ppi8255_0"), 1,  (attr_latch << 4) | (attr_latch & 0x7));
220221   }
221222
r9013r9014
224225
225226static WRITE8_HANDLER( vram_w )
226227{
228   static UINT8 *vram = memory_region(space->machine, "vram");
229
227230   if(vram_sel)
228231   {
229232      if(pal_sel && (plane_reg & 0x70) == 0x00)
r9013r9014
233236      }
234237
235238      if(plane_reg & 0x10)
236         p7_vram[offset | 0x0000] = (plane_reg & 1) ? data : 0xff;
239         vram[offset | 0x0000] = (plane_reg & 1) ? data : 0xff;
237240      if(plane_reg & 0x20)
238         p7_vram[offset | 0x4000] = (plane_reg & 2) ? data : 0xff;
241         vram[offset | 0x4000] = (plane_reg & 2) ? data : 0xff;
239242      if(plane_reg & 0x40)
240243      {
241         p7_vram[offset | 0x8000] = (plane_reg & 4) ? data : 0xff;
244         vram[offset | 0x8000] = (plane_reg & 4) ? data : 0xff;
242245         attr_latch = attr_wrap ? attr_latch : attr_data;
243         p7_vram[offset | 0xc000] = attr_latch;
246         vram[offset | 0xc000] = attr_latch;
244247         i8255a_w(space->machine->device("ppi8255_0"), 1, (attr_latch << 4) | (attr_latch & 0x7));
245248      }
246249   }
247250   else
248251   {
249      UINT8 *cpu = memory_region(space->machine, "maincpu");
252      UINT8 *work_ram = memory_region(space->machine, "maincpu");
250253
251      cpu[offset+0x8000] = data;
254      work_ram[offset+0x8000] = data;
252255   }
253256}
254257
255258static WRITE8_HANDLER( pasopia7_memory_ctrl_w )
256259{
257   UINT8 *cpu = memory_region(space->machine, "maincpu");
260   UINT8 *work_ram = memory_region(space->machine, "maincpu");
258261   UINT8 *basic = memory_region(space->machine, "basic");
259262
260263   switch(data & 3)
261264   {
262265      case 0:
263266      case 3: //select Basic ROM
264         memory_set_bankptr(space->machine, "bank1", basic + 0x00000);
265         memory_set_bankptr(space->machine, "bank2", basic + 0x04000);
267         memory_set_bankptr(space->machine, "bank1", basic    + 0x00000);
268         memory_set_bankptr(space->machine, "bank2", basic    + 0x04000);
266269         break;
267270      case 1: //select Basic ROM + BIOS ROM
268         memory_set_bankptr(space->machine, "bank1", basic + 0x00000);
269         memory_set_bankptr(space->machine, "bank2", cpu   + 0x10000);
271         memory_set_bankptr(space->machine, "bank1", basic    + 0x00000);
272         memory_set_bankptr(space->machine, "bank2", work_ram + 0x10000);
270273         break;
271274      case 2: //select Work RAM
272         memory_set_bankptr(space->machine, "bank1", cpu   + 0x00000);
273         memory_set_bankptr(space->machine, "bank2", cpu   + 0x04000);
275         memory_set_bankptr(space->machine, "bank1", work_ram + 0x00000);
276         memory_set_bankptr(space->machine, "bank2", work_ram + 0x04000);
274277         break;
275278   }
276279
r9013r9014
354357/* writes always occurs to the RAM banks, even if the ROMs are selected. */
355358static WRITE8_HANDLER( ram_bank_w )
356359{
357   UINT8 *cpu = memory_region(space->machine, "maincpu");
360   UINT8 *work_ram = memory_region(space->machine, "maincpu");
358361
359   cpu[offset] = data;
362   work_ram[offset] = data;
360363}
361364
362365static WRITE8_HANDLER( pasopia7_6845_w )
r9013r9014
753756
754757   ROM_REGION( 0x8000, "rampac2", ROMREGION_ERASEFF )
755758//  ROM_LOAD( "rampac2.bin", 0x0000, 0x8000, CRC(0e4f09bd) SHA1(4088906d57e4f6085a75b249a6139a0e2eb531a1) )
759
760   ROM_REGION( 0x10000, "vram", ROMREGION_ERASE00 )
756761ROM_END
757762
758763static DRIVER_INIT( paso7 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team