Previous 15994 Revisions Next

r6313 Friday 6th November, 2009 at 10:11:09 UTC by Fabio Priuli
[SMS] fixes by Enik Land
* Fixed border and sprite problems (affecting e.g. Fantastic Dizzy, bug #1773).
* Improved Line IRQ Hcount emulation.
* Fixed various Hcounter problems.
[docs]messnew.txt
[src/mess/video]smsvdp.c

src/mess/video/smsvdp.c
r6312r6313
5959#define STATUS_SPRCOL         0x20   /* Object collision flag */
6060#define STATUS_HINT           0x02   /* Pending horizontal interrupt flag */
6161
62#define HINT_HPOS             24
63#define VINT_HPOS             1   /* docs says should be near HINT time */
64
6265#define GG_CRAM_SIZE          0x40   /* 32 colors x 2 bytes per color = 64 bytes */
6366#define SMS_CRAM_SIZE         0x20   /* 32 colors x 1 bytes per color = 32 bytes */
6467#define MAX_CRAM_SIZE         0x40
r6312r6313
282285   /* Check if we're on the last line of a frame */
283286   if (vpos == vpos_limit - 1)
284287   {
288      smsvdp->line_counter = smsvdp->reg[0x0a];
285289      if (smsvdp->pause_callback)
286290         smsvdp->pause_callback(machine);
287//      sms_check_pause_button(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM));
291
288292      return;
289293   }
290294
r6312r6313
293297   /* Check if we're below the bottom border */
294298   if (vpos >= vpos_limit)
295299   {
300      smsvdp->line_counter = smsvdp->reg[0x0a];
296301      return;
297302   }
298303
r6312r6313
311316            if (smsvdp->reg[0x00] & 0x10)
312317            {
313318               /* Delay triggering of interrupt to allow software to read the status bit before the irq */
314               timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen) + 1), smsvdp, 0, smsvdp_set_irq);
319               timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, vpos, HINT_HPOS), smsvdp, 0, smsvdp_set_irq);
315320            }
316321         }
317
322         else
323         {
324            smsvdp->line_counter -= 1;
325         }
318326      }
327      else
328      {
329         smsvdp->line_counter = smsvdp->reg[0x0a];
330      }
319331
320332      if (vpos == vpos_limit + 1)
321333      {
r6312r6313
324336         if (smsvdp->reg[0x01] & 0x20)
325337         {
326338            /* Delay triggering of interrupt to allow software to read the status bit before the irq */
327            timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen) + 1), smsvdp, 0, smsvdp_set_irq);
339            timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, vpos, VINT_HPOS), smsvdp, 0, smsvdp_set_irq);
328340         }
329341      }
330342
r6312r6313
352364   /* Check if we're in the active display area */
353365   if (vpos >= vpos_limit)
354366   {
367      rgb_t border_color;
368
355369      if (vpos == vpos_limit)
356370      {
357         smsvdp->line_counter = smsvdp->reg[0x0a];
358371         smsvdp->reg9copy = smsvdp->reg[0x09];
359372      }
360373
r6312r6313
366379         if (smsvdp->reg[0x00] & 0x10)
367380         {
368381            /* Delay triggering of interrupt to allow software to read the status bit before the irq */
369            timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen) + 1), smsvdp, 0, smsvdp_set_irq);
382            timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, vpos, HINT_HPOS), smsvdp, 0, smsvdp_set_irq);
370383         }
371384      }
372385      else
r6312r6313
378391
379392      /* Check if display is disabled */
380393      if (!(smsvdp->reg[0x01] & 0x40))
381      {
382         /* set whole line to backdrop color */
383         rec.min_x = LBORDER_START;
384         rec.max_x = LBORDER_START + LBORDER_X_PIXELS + 255 + RBORDER_X_PIXELS;
385         bitmap_fill(smsvdp->tmpbitmap, &rec, machine->pens[smsvdp->current_palette[BACKDROP_COLOR]]);
386      }
394         border_color = RGB_BLACK;
387395      else
388      {
389         /* Draw left border */
390         rec.min_x = LBORDER_START;
391         rec.max_x = LBORDER_START + LBORDER_X_PIXELS - 1;
392         bitmap_fill(smsvdp->tmpbitmap, &rec, machine->pens[smsvdp->current_palette[BACKDROP_COLOR]]);
396         border_color = machine->pens[smsvdp->current_palette[BACKDROP_COLOR]];
393397
394         /* Draw right border */
395         rec.min_x = LBORDER_START + LBORDER_X_PIXELS + 256;
396         rec.max_x = rec.min_x + RBORDER_X_PIXELS - 1;
397         bitmap_fill(smsvdp->tmpbitmap, &rec, machine->pens[smsvdp->current_palette[BACKDROP_COLOR]]);
398         sms_refresh_line(machine, smsvdp, smsvdp->tmpbitmap, LBORDER_START + LBORDER_X_PIXELS, vpos_limit, vpos - vpos_limit);
399      }
398      /* Draw left border */
399      rec.min_x = LBORDER_START;
400      rec.max_x = LBORDER_START + LBORDER_X_PIXELS - 1;
401      bitmap_fill(smsvdp->tmpbitmap, &rec, border_color);
402
403      /* Draw right border */
404      rec.min_x = LBORDER_START + LBORDER_X_PIXELS + 256;
405      rec.max_x = rec.min_x + RBORDER_X_PIXELS - 1;
406      bitmap_fill(smsvdp->tmpbitmap, &rec, border_color);
407
408      sms_refresh_line(machine, smsvdp, smsvdp->tmpbitmap, LBORDER_START + LBORDER_X_PIXELS, vpos_limit, vpos - vpos_limit);
409
400410      return;
401411   }
402412
r6312r6313
405415   /* Check if we're in the top border area */
406416   if (vpos >= vpos_limit)
407417   {
418      smsvdp->line_counter = smsvdp->reg[0x0a];
408419      sms_update_palette(smsvdp);
409420
410421      /* Draw left border */
r6312r6313
662673   sprite_height = (smsvdp->reg[0x01] & 0x02 ? 16 : 8);
663674   sprite_zoom = 1;
664675
665   if (smsvdp->reg[0x01] & 0x01)
666      /* sprite doubling */
676   if (smsvdp->reg[0x01] & 0x01)      /* sprite doubling */
667677      sprite_zoom = 2;
668678
669679   sprite_buffer_count = 0;
r6312r6313
680690         {
681691            sprite_buffer[sprite_buffer_count] = sprite_index;
682692         }
683         else
693         else if (line >= 0 && line < smsvdp->sms_frame_timing[ACTIVE_DISPLAY_V])
684694         {
685695            /* Too many sprites per line */
686696            smsvdp->status |= STATUS_SPROVR;
r6312r6313
689699      }
690700   }
691701
702   /* Check if display is disabled */
703   if (!(smsvdp->reg[0x01] & 0x40))
704      return;
705
692706   if (sprite_buffer_count > 8)
693707      sprite_buffer_count = 8;
694708
r6312r6313
868882         {
869883            sprite_buffer[sprite_buffer_count] = sprite_index;
870884         }
871         else
885         else if (line >= 0 && line < smsvdp->sms_frame_timing[ACTIVE_DISPLAY_V])
872886         {
873887            /* Too many sprites per line */
874888            smsvdp->status |= STATUS_SPROVR;
r6312r6313
877891      }
878892   }
879893
894   /* Check if display is disabled */
895   if (!(smsvdp->reg[0x01] & 0x40))
896      return;
897
880898   if (sprite_buffer_count > 4)
881899      sprite_buffer_count = 4;
882900
r6312r6313
11541172   int x;
11551173   int *blitline_buffer = smsvdp->line_buffer;
11561174
1157   if (line >= 0 && line < smsvdp->sms_frame_timing[ACTIVE_DISPLAY_V])
1175   switch( smsvdp->vdp_mode )
11581176   {
1159      switch( smsvdp->vdp_mode )
1160      {
1161      case 0:
1162         sms_refresh_line_mode0(smsvdp, blitline_buffer, line);
1163         break;
1177   case 0:
1178      sms_refresh_line_mode0(smsvdp, blitline_buffer, line);
1179      break;
11641180
1165      case 2:
1166         sms_refresh_line_mode2(smsvdp, blitline_buffer, line);
1167         break;
1181   case 2:
1182      sms_refresh_line_mode2(smsvdp, blitline_buffer, line);
1183      break;
11681184
1169      case 4:
1170      default:
1171         sms_refresh_line_mode4(smsvdp, blitline_buffer, line);
1172         break;
1173      }
1185   case 4:
1186   default:
1187      sms_refresh_line_mode4(smsvdp, blitline_buffer, line);
1188      break;
11741189   }
1175   else
1190
1191   if (line < 0 || line >= smsvdp->sms_frame_timing[ACTIVE_DISPLAY_V])
11761192   {
11771193      for (x = 0; x < 256; x++)
11781194      {
11791195         blitline_buffer[x] = smsvdp->current_palette[BACKDROP_COLOR];
11801196      }
11811197   }
1198   /* Check if display is disabled */
1199   else if (!(smsvdp->reg[0x01] & 0x40))
1200   {
1201      for (x = 0; x < 256; x++)
1202      {
1203         blitline_buffer[x] = 0;
1204      }
1205   }
11821206
11831207   if (IS_GAMEGEAR_VDP && smsvdp->gg_sms_mode)
11841208   {
docs/messnew.txt
r6312r6313
3333- Epson HX20
3434- NeXT
3535- Robotron A7150
36- SGI IP6 4D/PI workstation
3637
38
3739System Driver Changes:
3840----------------------
3941- [A5200] Changed default start button mapping to match other drivers
4042  ("1" key by default). [Justin Kerk]
4143
42- [APPLE2] Fixed Bugzilla #1842, "Corrupt lo-res graphics". [Harmony]
44- [APPLE2] Fixed corrupt lo-res graphics (bug #1842). [Harmony]
4345
4446- [AT] Fixed keyboard for at486 driver, so it boots into bios.[Miodrag
4547  Milanovic]
r6312r6313
7072  * Theoretically conatins the extra 1MByte of RAM of a DVC cartridge.
7173  * Supports savestates.
7274
75- [CDI] Split LCD into a secondary screen, added appropriate default
76  layouts. [Carlos]
77
7378- [CDTV] Added workaround for crash due to CDDA failing initialization
7479  (more work needed to properly fix this) and fixed CIA0 problem which
7580  was crashing MESS with some games (e.g. Turrican). [Fabio Priuli]
r6312r6313
102107- [EINSTEIN] Made it possible to select single or double sided disk
103108  drives.  [Dirk Best]
104109
105- [ELWRO800] Update :
106   * reworked keyboard mapping, added keys with Polish characters
107   * added network id
108   * added support for NMI firing (not used yet, as Junet is not working)
109   [Mariusz Wojcieszek]
110- [ELWRO800] Updates: [Mariusz Wojcieszek]
111  * reworked keyboard mapping, added keys with Polish characters
112  * added network id
113  * added support for NMI firing (not used yet, as Junet is not working)   
110114
111115- [EXIDY] Added SNP support for the 6 games commonly found on the net.
112116  [RObbbert]
r6312r6313
131135  * Added crosshairs, and mouseclick for stylus touch.
132136  * Lights Out game works, while some other games show title screens.
133137
134- [GAMEGEAR] Added hacky LCD persistence support, fixes Bugzilla #65 [Harmony]
138- [GAMEGEAR] Added hacky LCD persistence support (bug #65) [Harmony]
135139
136140- [GBCOLOR] Added BIOS. [Wilbert Pol]
137141
r6312r6313
143147- [I386] Implemented SLDT & STR opcodes (needed by PC98 as well) [Angelo
144148  Salese]
145149
146- [INTV] Fixed bug 1884 - Multisession problem [Robbbert]
150- [INTV] Fixed multisession problem (bug #1884) [Robbbert]
147151
148152- [IP22] Fixed crash in Indy driver: boot tune works, and you can get in
149153  the boot menus. [Harmony]
r6312r6313
204208  * Added (very) preliminary support for the following UNIF only boards:
205209    BMC-GS2004, BMC-GS2013, UNL-8237, UNL-KOF97.
206210
207- [ODYSSEY2] Fixed a multisession issue, Bugzilla #1517 [Harmony]
211- [ODYSSEY2] Fixed a multisession issue (bug #1517) [Harmony]
208212
209213- [PC] Fixed some booting issues with Amstrad PC clones. [Miodrag Milanovic]
210214
r6312r6313
229233  * Implemented basic peripherals
230234  * Implemented LCD
231235  * Implemented ROM banking
236  * Implemented correct interrupts
232237  * Driver supports savestates
233238 
234239- [PX4] Added external cassette support.  [Dirk Best]
r6312r6313
239244
240245- [SAMCOUPE] Improved Mode 1 graphics.  [Dirk Best]
241246
242- [SMS] Fixed rapid-fire to only fire when buttons are pressed. (Bug #1864) 
243  [Enik Land]
247- [SMS] Various improvements: [Enik Land]
248  * Added Light Phaser support. (bug #1123)
249  * Fixed border and sprite problems (affecting e.g. Fantastic Dizzy,
250    bug #1773).
251  * Fixed rapid-fire to only fire when buttons are pressed. (bug #1864) 
252  * Improved Line IRQ Hcount emulation.
253  * Fixed various Hcounter problems.
244254
245- [SMS] Added Light Phaser support. (Bug #1123)  [Enik Land]
246
247255- [SMS] Converted SMS VDP to be a device [Fabio Priuli]
248256
249257- [SNES] Added Capcom CX4 emulation [Harmony]
r6312r6313
263271- [SPECIAL] Fixed floppy for Special MX, regressed since 0.124.
264272  [Miodrag Milanovic]
265273
266- [SPECTRUM] Fixed bug #803 48K SNA load routine bad PC. [Miodrag Milanovic]
274- [SPECTRUM] Fixed 48K SNA load routine bad PC (bug #803). [Miodrag Milanovic]
267275
268276- [SUPERGB] Added BIOS.  [Wilbert Pol]
269277

Previous 15994 Revisions Next


© 1998-2018 The MESS Team