src/mess/video/smsvdp.c
| r6312 | r6313 | |
| 59 | 59 | #define STATUS_SPRCOL 0x20 /* Object collision flag */ |
| 60 | 60 | #define STATUS_HINT 0x02 /* Pending horizontal interrupt flag */ |
| 61 | 61 | |
| 62 | #define HINT_HPOS 24 |
| 63 | #define VINT_HPOS 1 /* docs says should be near HINT time */ |
| 64 | |
| 62 | 65 | #define GG_CRAM_SIZE 0x40 /* 32 colors x 2 bytes per color = 64 bytes */ |
| 63 | 66 | #define SMS_CRAM_SIZE 0x20 /* 32 colors x 1 bytes per color = 32 bytes */ |
| 64 | 67 | #define MAX_CRAM_SIZE 0x40 |
| r6312 | r6313 | |
| 282 | 285 | /* Check if we're on the last line of a frame */ |
| 283 | 286 | if (vpos == vpos_limit - 1) |
| 284 | 287 | { |
| 288 | smsvdp->line_counter = smsvdp->reg[0x0a]; |
| 285 | 289 | if (smsvdp->pause_callback) |
| 286 | 290 | smsvdp->pause_callback(machine); |
| 287 | | // sms_check_pause_button(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM)); |
| 291 | |
| 288 | 292 | return; |
| 289 | 293 | } |
| 290 | 294 | |
| r6312 | r6313 | |
| 293 | 297 | /* Check if we're below the bottom border */ |
| 294 | 298 | if (vpos >= vpos_limit) |
| 295 | 299 | { |
| 300 | smsvdp->line_counter = smsvdp->reg[0x0a]; |
| 296 | 301 | return; |
| 297 | 302 | } |
| 298 | 303 | |
| r6312 | r6313 | |
| 311 | 316 | if (smsvdp->reg[0x00] & 0x10) |
| 312 | 317 | { |
| 313 | 318 | /* 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); |
| 315 | 320 | } |
| 316 | 321 | } |
| 317 | | |
| 322 | else |
| 323 | { |
| 324 | smsvdp->line_counter -= 1; |
| 325 | } |
| 318 | 326 | } |
| 327 | else |
| 328 | { |
| 329 | smsvdp->line_counter = smsvdp->reg[0x0a]; |
| 330 | } |
| 319 | 331 | |
| 320 | 332 | if (vpos == vpos_limit + 1) |
| 321 | 333 | { |
| r6312 | r6313 | |
| 324 | 336 | if (smsvdp->reg[0x01] & 0x20) |
| 325 | 337 | { |
| 326 | 338 | /* 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); |
| 328 | 340 | } |
| 329 | 341 | } |
| 330 | 342 | |
| r6312 | r6313 | |
| 352 | 364 | /* Check if we're in the active display area */ |
| 353 | 365 | if (vpos >= vpos_limit) |
| 354 | 366 | { |
| 367 | rgb_t border_color; |
| 368 | |
| 355 | 369 | if (vpos == vpos_limit) |
| 356 | 370 | { |
| 357 | | smsvdp->line_counter = smsvdp->reg[0x0a]; |
| 358 | 371 | smsvdp->reg9copy = smsvdp->reg[0x09]; |
| 359 | 372 | } |
| 360 | 373 | |
| r6312 | r6313 | |
| 366 | 379 | if (smsvdp->reg[0x00] & 0x10) |
| 367 | 380 | { |
| 368 | 381 | /* 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); |
| 370 | 383 | } |
| 371 | 384 | } |
| 372 | 385 | else |
| r6312 | r6313 | |
| 378 | 391 | |
| 379 | 392 | /* Check if display is disabled */ |
| 380 | 393 | 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; |
| 387 | 395 | 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]]; |
| 393 | 397 | |
| 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 | |
| 400 | 410 | return; |
| 401 | 411 | } |
| 402 | 412 | |
| r6312 | r6313 | |
| 405 | 415 | /* Check if we're in the top border area */ |
| 406 | 416 | if (vpos >= vpos_limit) |
| 407 | 417 | { |
| 418 | smsvdp->line_counter = smsvdp->reg[0x0a]; |
| 408 | 419 | sms_update_palette(smsvdp); |
| 409 | 420 | |
| 410 | 421 | /* Draw left border */ |
| r6312 | r6313 | |
| 662 | 673 | sprite_height = (smsvdp->reg[0x01] & 0x02 ? 16 : 8); |
| 663 | 674 | sprite_zoom = 1; |
| 664 | 675 | |
| 665 | | if (smsvdp->reg[0x01] & 0x01) |
| 666 | | /* sprite doubling */ |
| 676 | if (smsvdp->reg[0x01] & 0x01) /* sprite doubling */ |
| 667 | 677 | sprite_zoom = 2; |
| 668 | 678 | |
| 669 | 679 | sprite_buffer_count = 0; |
| r6312 | r6313 | |
| 680 | 690 | { |
| 681 | 691 | sprite_buffer[sprite_buffer_count] = sprite_index; |
| 682 | 692 | } |
| 683 | | else |
| 693 | else if (line >= 0 && line < smsvdp->sms_frame_timing[ACTIVE_DISPLAY_V]) |
| 684 | 694 | { |
| 685 | 695 | /* Too many sprites per line */ |
| 686 | 696 | smsvdp->status |= STATUS_SPROVR; |
| r6312 | r6313 | |
| 689 | 699 | } |
| 690 | 700 | } |
| 691 | 701 | |
| 702 | /* Check if display is disabled */ |
| 703 | if (!(smsvdp->reg[0x01] & 0x40)) |
| 704 | return; |
| 705 | |
| 692 | 706 | if (sprite_buffer_count > 8) |
| 693 | 707 | sprite_buffer_count = 8; |
| 694 | 708 | |
| r6312 | r6313 | |
| 868 | 882 | { |
| 869 | 883 | sprite_buffer[sprite_buffer_count] = sprite_index; |
| 870 | 884 | } |
| 871 | | else |
| 885 | else if (line >= 0 && line < smsvdp->sms_frame_timing[ACTIVE_DISPLAY_V]) |
| 872 | 886 | { |
| 873 | 887 | /* Too many sprites per line */ |
| 874 | 888 | smsvdp->status |= STATUS_SPROVR; |
| r6312 | r6313 | |
| 877 | 891 | } |
| 878 | 892 | } |
| 879 | 893 | |
| 894 | /* Check if display is disabled */ |
| 895 | if (!(smsvdp->reg[0x01] & 0x40)) |
| 896 | return; |
| 897 | |
| 880 | 898 | if (sprite_buffer_count > 4) |
| 881 | 899 | sprite_buffer_count = 4; |
| 882 | 900 | |
| r6312 | r6313 | |
| 1154 | 1172 | int x; |
| 1155 | 1173 | int *blitline_buffer = smsvdp->line_buffer; |
| 1156 | 1174 | |
| 1157 | | if (line >= 0 && line < smsvdp->sms_frame_timing[ACTIVE_DISPLAY_V]) |
| 1175 | switch( smsvdp->vdp_mode ) |
| 1158 | 1176 | { |
| 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; |
| 1164 | 1180 | |
| 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; |
| 1168 | 1184 | |
| 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; |
| 1174 | 1189 | } |
| 1175 | | else |
| 1190 | |
| 1191 | if (line < 0 || line >= smsvdp->sms_frame_timing[ACTIVE_DISPLAY_V]) |
| 1176 | 1192 | { |
| 1177 | 1193 | for (x = 0; x < 256; x++) |
| 1178 | 1194 | { |
| 1179 | 1195 | blitline_buffer[x] = smsvdp->current_palette[BACKDROP_COLOR]; |
| 1180 | 1196 | } |
| 1181 | 1197 | } |
| 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 | } |
| 1182 | 1206 | |
| 1183 | 1207 | if (IS_GAMEGEAR_VDP && smsvdp->gg_sms_mode) |
| 1184 | 1208 | { |
docs/messnew.txt
| r6312 | r6313 | |
| 33 | 33 | - Epson HX20 |
| 34 | 34 | - NeXT |
| 35 | 35 | - Robotron A7150 |
| 36 | - SGI IP6 4D/PI workstation |
| 36 | 37 | |
| 38 | |
| 37 | 39 | System Driver Changes: |
| 38 | 40 | ---------------------- |
| 39 | 41 | - [A5200] Changed default start button mapping to match other drivers |
| 40 | 42 | ("1" key by default). [Justin Kerk] |
| 41 | 43 | |
| 42 | | - [APPLE2] Fixed Bugzilla #1842, "Corrupt lo-res graphics". [Harmony] |
| 44 | - [APPLE2] Fixed corrupt lo-res graphics (bug #1842). [Harmony] |
| 43 | 45 | |
| 44 | 46 | - [AT] Fixed keyboard for at486 driver, so it boots into bios.[Miodrag |
| 45 | 47 | Milanovic] |
| r6312 | r6313 | |
| 70 | 72 | * Theoretically conatins the extra 1MByte of RAM of a DVC cartridge. |
| 71 | 73 | * Supports savestates. |
| 72 | 74 | |
| 75 | - [CDI] Split LCD into a secondary screen, added appropriate default |
| 76 | layouts. [Carlos] |
| 77 | |
| 73 | 78 | - [CDTV] Added workaround for crash due to CDDA failing initialization |
| 74 | 79 | (more work needed to properly fix this) and fixed CIA0 problem which |
| 75 | 80 | was crashing MESS with some games (e.g. Turrican). [Fabio Priuli] |
| r6312 | r6313 | |
| 102 | 107 | - [EINSTEIN] Made it possible to select single or double sided disk |
| 103 | 108 | drives. [Dirk Best] |
| 104 | 109 | |
| 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) |
| 110 | 114 | |
| 111 | 115 | - [EXIDY] Added SNP support for the 6 games commonly found on the net. |
| 112 | 116 | [RObbbert] |
| r6312 | r6313 | |
| 131 | 135 | * Added crosshairs, and mouseclick for stylus touch. |
| 132 | 136 | * Lights Out game works, while some other games show title screens. |
| 133 | 137 | |
| 134 | | - [GAMEGEAR] Added hacky LCD persistence support, fixes Bugzilla #65 [Harmony] |
| 138 | - [GAMEGEAR] Added hacky LCD persistence support (bug #65) [Harmony] |
| 135 | 139 | |
| 136 | 140 | - [GBCOLOR] Added BIOS. [Wilbert Pol] |
| 137 | 141 | |
| r6312 | r6313 | |
| 143 | 147 | - [I386] Implemented SLDT & STR opcodes (needed by PC98 as well) [Angelo |
| 144 | 148 | Salese] |
| 145 | 149 | |
| 146 | | - [INTV] Fixed bug 1884 - Multisession problem [Robbbert] |
| 150 | - [INTV] Fixed multisession problem (bug #1884) [Robbbert] |
| 147 | 151 | |
| 148 | 152 | - [IP22] Fixed crash in Indy driver: boot tune works, and you can get in |
| 149 | 153 | the boot menus. [Harmony] |
| r6312 | r6313 | |
| 204 | 208 | * Added (very) preliminary support for the following UNIF only boards: |
| 205 | 209 | BMC-GS2004, BMC-GS2013, UNL-8237, UNL-KOF97. |
| 206 | 210 | |
| 207 | | - [ODYSSEY2] Fixed a multisession issue, Bugzilla #1517 [Harmony] |
| 211 | - [ODYSSEY2] Fixed a multisession issue (bug #1517) [Harmony] |
| 208 | 212 | |
| 209 | 213 | - [PC] Fixed some booting issues with Amstrad PC clones. [Miodrag Milanovic] |
| 210 | 214 | |
| r6312 | r6313 | |
| 229 | 233 | * Implemented basic peripherals |
| 230 | 234 | * Implemented LCD |
| 231 | 235 | * Implemented ROM banking |
| 236 | * Implemented correct interrupts |
| 232 | 237 | * Driver supports savestates |
| 233 | 238 | |
| 234 | 239 | - [PX4] Added external cassette support. [Dirk Best] |
| r6312 | r6313 | |
| 239 | 244 | |
| 240 | 245 | - [SAMCOUPE] Improved Mode 1 graphics. [Dirk Best] |
| 241 | 246 | |
| 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. |
| 244 | 254 | |
| 245 | | - [SMS] Added Light Phaser support. (Bug #1123) [Enik Land] |
| 246 | | |
| 247 | 255 | - [SMS] Converted SMS VDP to be a device [Fabio Priuli] |
| 248 | 256 | |
| 249 | 257 | - [SNES] Added Capcom CX4 emulation [Harmony] |
| r6312 | r6313 | |
| 263 | 271 | - [SPECIAL] Fixed floppy for Special MX, regressed since 0.124. |
| 264 | 272 | [Miodrag Milanovic] |
| 265 | 273 | |
| 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] |
| 267 | 275 | |
| 268 | 276 | - [SUPERGB] Added BIOS. [Wilbert Pol] |
| 269 | 277 | |