Previous 15994 Revisions Next

r10062 Sunday 16th January, 2011 at 20:24:03 UTC by Angelo Salese
[PC-8801]: Added preliminary cursor drawing emulation
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r10061r10062
99     later models at some point.
1010   - macros for the various rom / ram areas, it might require various attempts in order to finally get a reasonable arrangement ...
1111   - dipswitches are WRONG
12   - currently it's too slow ... why?
1312   - implement proper i8214 routing, also add irq latch mechanism.
1413   - below notes states that plain PC-8801 doesn't have a disk CPU, but the BIOS clearly checks the floppy ports. Wrong info?
14   - cursor is 8 x 10, not 8 x 8 as current implementation.
1515
1616   Notes:
1717   - BIOS disk ROM defines what kind of floppies you could load:
r10061r10062
116116static UINT8 window_offset_bank;
117117static UINT8 layer_mask;
118118
119/*
120CRTC command params:
1210. CRTC reset
122
123[0] -xxx xxxx screen columns (+2)
124[1] xx-- ---- blink speed (in frame unit) (+1, << 3)
125[1] --xx xxxx screen lines (+1)
126[2] x--- ---- "skip line"
127[2] -x-- ---- cursor style (reverse on / underscore off)
128[2] --x- ---- cursor blink on/off
129
130[4] x--- ---- attribute not separate flag
131[4] -x-- ---- attribute color flag
132[4] --x- ---- attribute not special flag
133*/
134
135#define blink_speed ((((crtc.param[0][1] & 0xc0) >> 6) + 1) << 3)
136
137static struct
138{
139   UINT8 cmd,param_count,cursor_on;
140   UINT8 param[8][5];
141}crtc;
142
119143#define NBASIC_BASE 0x20000
120144#define N88BASIC_BASE 0x28000
121145#define WRAM_BASE 0x00000
r10061r10062
126150
127151}
128152
153static UINT8 calc_cursor_pos(running_machine *machine,int x,int y,int yi)
154{
155   if(!(crtc.cursor_on)) // don't bother if cursor is off
156      return 0;
157
158   if(x == crtc.param[4][0] && y == crtc.param[4][1]) /* check if position matches */
159   {
160      /* don't pass through if we are using underscore */
161      if((!(crtc.param[0][2] & 0x40)) && yi != 7)
162         return 0;
163
164      /* finally check if blinking is currently active high */
165      if(!(crtc.param[0][2] & 0x20))
166         return 1;
167
168      if(((machine->primary_screen->frame_number() / blink_speed) & 1) == 0)
169         return 1;
170
171      return 0;
172   }
173
174   return 0;
175}
176
129177static VIDEO_UPDATE( pc8801 )
130178{
131179   int x,y;
r10061r10062
133181   UINT8 *vram = screen->machine->region("maincpu")->base() + WRAM_BASE;
134182   UINT8 *gvram = screen->machine->region("maincpu")->base() + GRAM_BASE;
135183   UINT32 count;
184   UINT8 is_cursor;
136185
137186   count = 0;
138187
r10061r10062
177226                  res_x = x*8+xi;
178227                  res_y = y*8+yi;
179228
180                  color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? 7 : -1;
229                  is_cursor = calc_cursor_pos(screen->machine,x,y,yi);
181230
231                  if(is_cursor)
232                     color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? -1 : 7;
233                  else
234                     color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? 7 : -1;
235
182236                  if((res_x)<=screen->machine->primary_screen->visible_area().max_x && (res_y)<=screen->machine->primary_screen->visible_area().max_y)
183237                     if(color != -1)
184238                        *BITMAP_ADDR16(bitmap, res_y, res_x) = screen->machine->pens[color];
r10061r10062
488542
489543static WRITE8_HANDLER( pc88_crtc_param_w )
490544{
545   if(crtc.param_count < 5)
546   {
547      crtc.param[crtc.cmd][crtc.param_count] = data;
548      crtc.param_count++;
549   }
491550}
492551
493552static READ8_HANDLER( pc8801_crtc_status_r )
r10061r10062
495554   return 0xff;
496555}
497556
498/*
499  CRTC_RESET      = 0,
500  CRTC_STOP_DISPLAY   = 0,
501  CRTC_START_DISPLAY,
502  CRTC_SET_INTERRUPT_MASK,
503  CRTC_READ_LIGHT_PEN,
504  CRTC_LOAD_CURSOR_POSITION,
505  CRTC_RESET_INTERRUPT,
506  CRTC_RESET_COUNTERS,
507  CRTC_READ_STATUS,
508*/
509
510557static const char *const crtc_command[] =
511558{
512559   "Reset / Stop Display",            // 0
r10061r10062
521568
522569static WRITE8_HANDLER( pc88_crtc_cmd_w )
523570{
571   crtc.cmd = (data & 0xe0) >> 5;
572   crtc.param_count = 0;
573
574   if(crtc.cmd == 4) // load cursor position ON/OFF
575      crtc.cursor_on = data & 1;
576
524577   if((data >> 5) != 4)
525578      printf("CRTC cmd %s polled\n",crtc_command[data >> 5]);
526
527579}
528580
529581static ADDRESS_MAP_START( pc8801_io, ADDRESS_SPACE_IO, 8 )
r10061r10062
10501102      for(i=0;i<0x10000;i++)
10511103         gvram[i] = 0x00;
10521104   }
1105
1106   {
1107      crtc.param_count = 0;
1108      crtc.cmd = 0;
1109   }
10531110}
10541111
10551112static PALETTE_INIT( pc8801 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team