Previous 15994 Revisions Next

r8537 Sunday 18th July, 2010 at 16:11:28 UTC by Angelo Salese
[PASOPIA7]: Added a very preliminary graphic drawing, doesn't work yet due of T-BASIC flaws
[src/mess/drivers]pasopia.c

src/mess/drivers/pasopia.c
r8536r8537
1/***************************************************************************
1/**************************************************************************************************
22
33   Toshiba Pasopia 7 (c) 1983 Toshiba
44
r8536r8537
66
77   TODO:
88   - floppy support (but floppy images are unobtainable at current time)
9   - Z80PIO keyboard irq doesn't work at all, kludged keyboard inputs to work for now
10   - advanced BASIC commands (width 80, circle, line ...) makes the emulation to go to la-la-land
11   - some text garbage pops up in place, first example is when you type "10 for a=0 to n"
912
10****************************************************************************/
13***************************************************************************************************/
1114
1215#include "emu.h"
1316#include "cpu/z80/z80.h"
r8536r8537
1821#include "video/mc6845.h"
1922
2023static UINT8 vram_sel,mio_sel;
21static UINT8 *p7_vram;
24static UINT8 *p7_vram,*p7_pal;
2225static UINT8 bank_reg;
2326static UINT16 cursor_addr;
2427static UINT8 cursor_blink;
25static UINT8 plane_reg,attr_data,attr_wrap,attr_latch;
28static UINT8 plane_reg,attr_data,attr_wrap,attr_latch,pal_sel,x_width;
2629
2730static VIDEO_START( paso7 )
2831{
2932   p7_vram = auto_alloc_array(machine, UINT8, 0x10000);
33   p7_pal = auto_alloc_array(machine, UINT8, 0x10);
3034}
3135
3236#define keyb_press(_val_,_charset_) \
r8536r8537
106110   keyb_press(KEYCODE_STOP, '.');
107111   keyb_shift_press(KEYCODE_STOP, ':');
108112   keyb_press(KEYCODE_BACKSPACE, 0x08);
113   keyb_press(KEYCODE_0_PAD, '@'); //@
114   keyb_press(KEYCODE_COMMA, ',');
115   keyb_shift_press(KEYCODE_COMMA, ';');
116   keyb_press(KEYCODE_MINUS_PAD, '-');
109117
110118}
111119
112120static VIDEO_UPDATE( paso7 )
113121{
114   int x,y;
122   int x,y,xi;
115123   int count;
124   int width;
116125
126   fake_keyboard_data(screen->machine);
127
128   width = x_width ? 80 : 40;
129
117130   count = 0x0000;
118131
119   fake_keyboard_data(screen->machine);
132   for(y=0;y<200;y++)
133   {
134      for(x=0;x<320;x+=8)
135      {
136         for(xi=0;xi<8;xi++)
137         {
138            int pen_b,pen_r,pen_g,color;
120139
140            pen_b = (p7_vram[count+0x0000]>>(7-xi)) & 1;
141            pen_r = (p7_vram[count+0x4000]>>(7-xi)) & 1;
142            pen_g = 0;//(p7_vram[count+0x8000]>>(7-xi)) & 1;
143
144            color =  pen_g<<2 | pen_r<<1 | pen_b<<0;
145
146            *BITMAP_ADDR16(bitmap, y, x+xi) = screen->machine->pens[color+0x20];
147         }
148         count++;
149      }
150   }
151
152   count = 0x0000;
153
121154   for(y=0;y<25;y++)
122155   {
123      for(x=0;x<40;x++)
156      for(x=0;x<width;x++)
124157      {
125158         int tile = p7_vram[count+0x8000];
126159         int color = p7_vram[count+0xc000];
127160
128         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8);
161         drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8,0);
129162
130163         if(((cursor_addr*8) == count) && !cursor_blink) // draw cursor
131            drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],0x5f,7,0,0,x*8,y*8);
164            drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x5f,7,0,0,x*8,y*8,0);
132165
133166         count+=8;
134167      }
r8536r8537
139172
140173static READ8_HANDLER( vram_r )
141174{
175   static UINT8 res;
176
142177   //if(!vram_sel)
143178   //   return 0xff;
144179
145   attr_latch = p7_vram[offset | 0xc000];
146   i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), 1,  (attr_latch << 4) | (attr_latch & 0x7));
180   if(pal_sel && (plane_reg & 0x70) == 0x00)
181      return p7_pal[offset & 0xf];
147182
148   return p7_vram[offset | 0x8000]; //TODO
183   res = 0xff;
184
185   if((plane_reg & 0x11) == 0x11)
186      res &= p7_vram[offset | 0x0000];
187   if((plane_reg & 0x22) == 0x22)
188      res &= p7_vram[offset | 0x4000];
189   if((plane_reg & 0x44) == 0x44)
190   {
191      res &= p7_vram[offset | 0x8000];
192      attr_latch = p7_vram[offset | 0xc000];
193      i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), 1,  (attr_latch << 4) | (attr_latch & 0x7));
194   }
195
196   return res;
149197}
150198
151199static WRITE8_HANDLER( vram_w )
152200{
153201   //if(vram_sel)
154202   {
155      if((plane_reg & 0x44) == 0x44)
203      if(pal_sel && (plane_reg & 0x70) == 0x00)
156204      {
157         p7_vram[offset | 0x8000] = data;
205         p7_pal[offset & 0xf] = data & 0xf;
206         return;
207      }
208
209      if(plane_reg & 0x10)
210         p7_vram[offset | 0x0000] = (plane_reg & 1) ? data : 0xff;
211      if(plane_reg & 0x20)
212         p7_vram[offset | 0x4000] = (plane_reg & 2) ? data : 0xff;
213      if(plane_reg & 0x40)
214      {
215         p7_vram[offset | 0x8000] = (plane_reg & 4) ? data : 0xff;
158216         attr_latch = attr_wrap ? attr_latch : attr_data;
159217         p7_vram[offset | 0xc000] = attr_latch;
160218         i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), 1, (attr_latch << 4) | (attr_latch & 0x7));
r8536r8537
240298   UINT8 *pac2_ram = memory_region(space->machine, "rampac1");
241299
242300   if(offset == 2)
301   {
243302      if(pac2_bank_select == 4)
303      {
244304         return pac2_ram[pac2_index[4]];
305      }
306      else
307      {
308         printf("%02x\n",pac2_bank_select);
309      }
310   }
245311
246312   return 0xff;
247313}
r8536r8537
441507
442508static WRITE8_DEVICE_HANDLER( screen_mode_w )
443509{
444   printf("GFX MODE %02x\n",data);
510   if(data & 0xdf)
511      printf("GFX MODE %02x\n",data);
512   x_width = data & 0x20;
445513}
446514
447515static WRITE8_DEVICE_HANDLER( plane_reg_w )
448516{
449   printf("PLANE %02x\n",data);
517   //if(data & 0x11)
518   //printf("PLANE %02x\n",data);
450519   plane_reg = data;
451520}
452521
453522static WRITE8_DEVICE_HANDLER( video_attr_w )
454523{
455   printf("VIDEO ATTR %02x | TEXT_PAGE %02x\n",data & 0xf,data & 0x70);
524   //printf("VIDEO ATTR %02x | TEXT_PAGE %02x\n",data & 0xf,data & 0x70);
456525   attr_data = data & 0xf;
457526}
458527
528//#include "debugger.h"
529
459530static WRITE8_DEVICE_HANDLER( video_misc_w )
460531{
461532   /*
r8536r8537
464535      ---- x--- pal disable
465536      ---- xx-- palette selector (both bits enables this, odd hook-up)
466537   */
467//   printf("VIDEO MISC REG %02x\n",data);
538//   if(data & 2)
539//   {
540//      printf("VIDEO MISC %02x\n",data);
541//      debugger_break(device->machine);
542//   }
468543   cursor_blink = data & 0x20;
469544   attr_wrap = data & 0x10;
470
545//   pal_sel = data & 0x02;
471546}
472547
473548static WRITE8_DEVICE_HANDLER( nmi_mask_w )
r8536r8537
478553   ---- --x- sound off
479554   ---- ---x reset NMI (writes to port B = clears bits 1 & 2) (???)
480555   */
481   printf("SYSTEM MISC %02x\n",data);
556//   printf("SYSTEM MISC %02x\n",data);
482557
483   if(data & 1)
484      i8255a_w(devtag_get_device(device->machine, "ppi8255_2"), 1, 0);
558//   if(data & 1)
559//      i8255a_w(devtag_get_device(device->machine, "ppi8255_2"), 1, 0);
485560
486561}
487562
r8536r8537
571646
572647      palette_set_color_rgb(machine, i, r,g,b);
573648   }
649   for( i = 0x000; i < 8; i++)
650      palette_set_color_rgb(machine, i+0x020, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
574651}
575652
576653static MACHINE_DRIVER_START( paso7 )
r8536r8537
598675    MDRV_SCREEN_SIZE(640, 480)
599676    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
600677   MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/4, mc6845_intf)   /* unknown clock, hand tuned to get ~60 fps */
601    MDRV_PALETTE_LENGTH(0x20)
678    MDRV_PALETTE_LENGTH(0x28)
602679    MDRV_PALETTE_INIT(pasopia7)
603680
604681   MDRV_GFXDECODE( pasopia7 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team