37 #define RGB(r,g,b) rgb_palette[((r) << 8) | ((g) << 4) | (b)]
38 #define COLMEMPTR (memory + 0x1F800)
39 #define IS_H640 (vic3_registers[0x31] & 0x80)
40 #define IS_BPM (vic3_registers[0x31] & 0x10)
41 #define BLINK_COUNTER_INIT 25
43 #ifdef VIC_CACHE_COLOURS
44 #define VIC_REG_COLOUR(n) vic_reg_palette_cache[(n) - 0x20]
46 #define VIC_REG_COLOUR(n) palette[vic3_registers[n]]
50 #ifdef VIC_CACHE_COLOURS
51 #warning "VIC_CACHE_COLOURS feature has not been implemented, yet!"
52 static Uint32 vic_reg_palette_cache[15];
54 static Uint32 rgb_palette[4096];
55 static Uint32 vic3_palette[0x100];
56 static Uint32 vic3_rom_palette[0x100];
58 static Uint8 vic3_palette_nibbles[0x300];
59 static Uint32 red_colour, black_colour;
65 static int compare_raster;
66 static int interrupt_status;
67 static int blink_phase;
68 static int blink_counter;
69 static Uint8 attributes;
73 static Uint32 *pixel_end, *pixel_start;
76 static int video_counter;
77 static int video_counter_inc;
79 static int vic2_bank_number = 0;
80 static void (*renderer_func)(void);
84 static Uint8 *vicptr_video_40;
85 static Uint8 *vicptr_video_80;
86 static Uint8 *vicptr_chargen;
87 static Uint8 *vicptr_bank16k;
88 static Uint8 *vicptr_bank32k;
89 static Uint8 *vicptr_bitmap_320;
90 static Uint8 *vicptr_bitmap_640;
91 static Uint8 *vicptr_idlefetch_p;
94 static int bitplane_addr_320[8];
95 static int bitplane_addr_640[8];
97 static int warn_sprites = 0, warn_ctrl_b_lo = 1;
110 FATAL(
"tail_sdl is not zero!");
116 static void vic3_interrupt_checker (
void )
118 int vic_irq_old = cpu65.irqLevel & 2;
121 interrupt_status |= 128;
124 interrupt_status &= 127;
127 if (vic_irq_old != vic_irq_new) {
128 DEBUG(
"VIC3: interrupt change %s -> %s" NL, vic_irq_old ?
"active" :
"inactive", vic_irq_new ?
"active" :
"inactive");
132 cpu65.irqLevel &= ~2;
140 if (scanline == compare_raster)
141 interrupt_status |= 1;
143 interrupt_status &= 0xFE;
144 vic3_interrupt_checker();
148 #define STATIC_COLOUR_RENDERER(colour, size) do { \
149 register int a = size; \
151 *(pixel++) = colour; \
155 static void renderer_disabled_screen (
void )
161 static void renderer_invalid_mode (
void )
170 #define VIC3_ADJUST_BY_HARDWARE_ATTRIBUTES( has_attrib_condition, colour_var, vdata_var ) do { \
171 if (has_attrib_condition) { \
172 if ((colour_var & 0xF0) == 0x10) { \
176 } else if ((!(colour_var & 0x10)) || blink_phase) { \
177 if ((colour_var & 0x80) && (row_counter == 7)) \
179 if (colour_var & 0x20) \
181 if (colour_var & 0x40) \
182 colour_var = 0x10 | (colour_var & 15); \
193 static void renderer_text_40 (
void )
195 Uint8 *vp = vicptr_video_40 + video_counter;
201 for (a = 0; a < 40; a++) {
202 Uint8 vdata = chargen[(*(vp++)) << 3];
206 fg_colour = palette[
colour];
207 pixel[ 0] = pixel[ 1] = vdata & 0x80 ? fg_colour : bg_colour;
208 pixel[ 2] = pixel[ 3] = vdata & 0x40 ? fg_colour : bg_colour;
209 pixel[ 4] = pixel[ 5] = vdata & 0x20 ? fg_colour : bg_colour;
210 pixel[ 6] = pixel[ 7] = vdata & 0x10 ? fg_colour : bg_colour;
211 pixel[ 8] = pixel[ 9] = vdata & 0x08 ? fg_colour : bg_colour;
212 pixel[10] = pixel[11] = vdata & 0x04 ? fg_colour : bg_colour;
213 pixel[12] = pixel[13] = vdata & 0x02 ? fg_colour : bg_colour;
214 pixel[14] = pixel[15] = vdata & 0x01 ? fg_colour : bg_colour;
221 static void renderer_text_80 (
void )
223 Uint8 *vp = vicptr_video_80 + video_counter;
229 for (a = 0; a < 80; a++) {
230 Uint8 vdata = chargen[(*(vp++)) << 3];
234 fg_colour = palette[
colour];
235 *(pixel++) = vdata & 0x80 ? fg_colour : bg_colour;
236 *(pixel++) = vdata & 0x40 ? fg_colour : bg_colour;
237 *(pixel++) = vdata & 0x20 ? fg_colour : bg_colour;
238 *(pixel++) = vdata & 0x10 ? fg_colour : bg_colour;
239 *(pixel++) = vdata & 0x08 ? fg_colour : bg_colour;
240 *(pixel++) = vdata & 0x04 ? fg_colour : bg_colour;
241 *(pixel++) = vdata & 0x02 ? fg_colour : bg_colour;
242 *(pixel++) = vdata & 0x01 ? fg_colour : bg_colour;
248 static void renderer_ecmtext_40 (
void )
250 Uint8 *vp = vicptr_video_40 + video_counter;
261 for (a = 0; a < 40; a++) {
262 Uint8 vdata = *(vp++);
264 Uint32 fg_colour = palette[*(cp++) & 15];
266 pixel[ 0] = pixel[ 1] =
data & 0x80 ? fg_colour : bg_colours[vdata];
267 pixel[ 2] = pixel[ 3] =
data & 0x40 ? fg_colour : bg_colours[vdata];
268 pixel[ 4] = pixel[ 5] =
data & 0x20 ? fg_colour : bg_colours[vdata];
269 pixel[ 6] = pixel[ 7] =
data & 0x10 ? fg_colour : bg_colours[vdata];
270 pixel[ 8] = pixel[ 9] =
data & 0x08 ? fg_colour : bg_colours[vdata];
271 pixel[10] = pixel[11] =
data & 0x04 ? fg_colour : bg_colours[vdata];
272 pixel[12] = pixel[13] =
data & 0x02 ? fg_colour : bg_colours[vdata];
273 pixel[14] = pixel[15] =
data & 0x01 ? fg_colour : bg_colours[vdata];
280 static void renderer_ecmtext_80 (
void )
282 Uint8 *vp = vicptr_video_80 + video_counter;
293 for (a = 0; a < 80; a++) {
294 Uint8 vdata = *(vp++);
296 Uint32 fg_colour = palette[*(cp++) & 15];
298 pixel[0] =
data & 0x80 ? fg_colour : bg_colours[vdata];
299 pixel[1] =
data & 0x40 ? fg_colour : bg_colours[vdata];
300 pixel[2] =
data & 0x20 ? fg_colour : bg_colours[vdata];
301 pixel[3] =
data & 0x10 ? fg_colour : bg_colours[vdata];
302 pixel[4] =
data & 0x08 ? fg_colour : bg_colours[vdata];
303 pixel[5] =
data & 0x04 ? fg_colour : bg_colours[vdata];
304 pixel[6] =
data & 0x02 ? fg_colour : bg_colours[vdata];
305 pixel[7] =
data & 0x01 ? fg_colour : bg_colours[vdata];
312 static void renderer_mcmtext_40 (
void )
314 Uint8 *vp = vicptr_video_40 + video_counter;
325 for (a = 0; a < 40; a++) {
326 Uint8 vdata = chargen[(*(vp++)) << 3];
327 Uint8 coldata = (*(cp++));
330 colours[3] = palette[coldata & 7];
331 pixel[ 0] = pixel[ 1] = pixel[ 2] = pixel[ 3] =
colours[ vdata >> 6 ];
332 pixel[ 4] = pixel[ 5] = pixel[ 6] = pixel[ 7] =
colours[(vdata >> 4) & 3];
333 pixel[ 8] = pixel[ 9] = pixel[10] = pixel[11] =
colours[(vdata >> 2) & 3];
334 pixel[12] = pixel[13] = pixel[14] = pixel[15] =
colours[ vdata & 3];
337 colours[3] = palette[coldata & 7];
353 static void renderer_mcmtext_80 (
void )
355 Uint8 *vp = vicptr_video_80 + video_counter;
366 for (a = 0; a < 80; a++) {
367 Uint8 vdata = chargen[(*(vp++)) << 3];
368 Uint8 coldata = (*(cp++));
371 colours[3] = palette[coldata & 7];
372 pixel[0] = pixel[1] =
colours[ vdata >> 6 ];
373 pixel[2] = pixel[3] =
colours[(vdata >> 4) & 3];
374 pixel[4] = pixel[5] =
colours[(vdata >> 2) & 3];
375 pixel[6] = pixel[7] =
colours[ vdata & 3];
378 colours[3] = palette[coldata & 7];
394 static void renderer_bitmap_320 (
void )
396 Uint8 *vp = vicptr_video_40 + video_counter;
397 Uint8 *bp = vicptr_bitmap_320 + (video_counter << 3) + row_counter;
400 for (a = 0; a < 40; a++) {
405 pixel[ 0] = pixel[ 1] =
data & 0x80 ? fg_colour : bg_colour;
406 pixel[ 2] = pixel[ 3] =
data & 0x40 ? fg_colour : bg_colour;
407 pixel[ 4] = pixel[ 5] =
data & 0x20 ? fg_colour : bg_colour;
408 pixel[ 6] = pixel[ 7] =
data & 0x10 ? fg_colour : bg_colour;
409 pixel[ 8] = pixel[ 9] =
data & 0x08 ? fg_colour : bg_colour;
410 pixel[10] = pixel[11] =
data & 0x04 ? fg_colour : bg_colour;
411 pixel[12] = pixel[13] =
data & 0x02 ? fg_colour : bg_colour;
412 pixel[14] = pixel[15] =
data & 0x01 ? fg_colour : bg_colour;
420 static void renderer_bitmap_640 (
void )
422 Uint8 *vp = vicptr_video_80 + video_counter;
423 Uint8 *bp = vicptr_bitmap_640 + (video_counter << 3) + row_counter;
426 for (a = 0; a < 80; a++) {
431 pixel[0] =
data & 0x80 ? fg_colour : bg_colour;
432 pixel[1] =
data & 0x40 ? fg_colour : bg_colour;
433 pixel[2] =
data & 0x20 ? fg_colour : bg_colour;
434 pixel[3] =
data & 0x10 ? fg_colour : bg_colour;
435 pixel[4] =
data & 0x08 ? fg_colour : bg_colour;
436 pixel[5] =
data & 0x04 ? fg_colour : bg_colour;
437 pixel[6] =
data & 0x02 ? fg_colour : bg_colour;
438 pixel[7] =
data & 0x01 ? fg_colour : bg_colour;
446 static void renderer_mcmbitmap_320 (
void )
448 Uint8 *vp = vicptr_video_40 + video_counter;
449 Uint8 *bp = vicptr_bitmap_320 + (video_counter << 3) + row_counter;
455 for (a = 0; a < 40; a++) {
459 colours[3] = palette[(*(cp++)) & 15];
461 pixel[ 0] = pixel[ 1] = pixel[ 2] = pixel[ 3] =
colours[
data >> 6 ];
462 pixel[ 4] = pixel[ 5] = pixel[ 6] = pixel[ 7] =
colours[(
data >> 4) & 3];
463 pixel[ 8] = pixel[ 9] = pixel[10] = pixel[11] =
colours[(
data >> 2) & 3];
464 pixel[12] = pixel[13] = pixel[14] = pixel[15] =
colours[
data & 3];
472 static void renderer_mcmbitmap_640 (
void )
474 Uint8 *vp = vicptr_video_80 + video_counter;
475 Uint8 *bp = vicptr_bitmap_640 + (video_counter << 3) + row_counter;
481 for (a = 0; a < 80; a++) {
485 colours[3] = palette[(*(cp++)) & 15];
498 static void renderer_bitplane_320 (
void )
500 Uint8 *bp =
memory + (video_counter << 3) + row_counter;
503 for (a = 0; a < 40; a++) {
506 bp[bitplane_addr_320[0]], bp[bitplane_addr_320[1]], bp[bitplane_addr_320[2]], bp[bitplane_addr_320[3]],
507 bp[bitplane_addr_320[4]], bp[bitplane_addr_320[5]], bp[bitplane_addr_320[6]], bp[bitplane_addr_320[7]]
509 for (bitpos = 128; bitpos; bitpos >>= 1) {
511 pixel[0] = pixel[1] = palette[((
512 ((fetch[0] & bitpos) ? 1 : 0) |
513 ((fetch[1] & bitpos) ? 2 : 0) |
514 ((fetch[2] & bitpos) ? 4 : 0) |
515 ((fetch[3] & bitpos) ? 8 : 0) |
516 ((fetch[4] & bitpos) ? 16 : 0) |
517 ((fetch[5] & bitpos) ? 32 : 0) |
518 ((fetch[6] & bitpos) ? 64 : 0) |
519 ((fetch[7] & bitpos) ? 128 : 0)
529 static void renderer_bitplane_640 (
void )
531 Uint8 *bp =
memory + (video_counter << 3) + row_counter;
534 for (a = 0; a < 80; a++) {
537 bp[bitplane_addr_640[0]], bp[bitplane_addr_640[1]], bp[bitplane_addr_640[2]], bp[bitplane_addr_640[3]],
538 bp[bitplane_addr_640[4]], bp[bitplane_addr_640[5]], bp[bitplane_addr_640[6]], bp[bitplane_addr_640[7]]
540 for (bitpos = 128; bitpos; bitpos >>= 1)
542 *(pixel++) = palette[((
543 ((fetch[0] & bitpos) ? 1 : 0) |
544 ((fetch[1] & bitpos) ? 2 : 0) |
545 ((fetch[2] & bitpos) ? 4 : 0) |
546 ((fetch[3] & bitpos) ? 8 : 0) |
547 ((fetch[4] & bitpos) ? 16 : 0) |
548 ((fetch[5] & bitpos) ? 32 : 0) |
549 ((fetch[6] & bitpos) ? 64 : 0) |
550 ((fetch[7] & bitpos) ? 128 : 0)
559 static void sprite_renderer (
void );
562 static inline void drive_led_renderer (
void )
565 for (
int y = 0;
y < 8;
y++)
566 for (
int x = 0;
x < 8;
x++)
576 }
else if (scanline < 50) {
578 renderer_disabled_screen();
581 }
else if (scanline < 250) {
587 video_counter += video_counter_inc;
595 renderer_disabled_screen();
598 }
else if (scanline == 311) {
606 blink_phase = ~blink_phase;
610 FATAL(
"Renderer failure: pixel=%p != end=%p (diff=%d) height=%d", pixel, pixel_end, (
int)(pixel_end - pixel),
SCREEN_HEIGHT);
613 drive_led_renderer();
616 FATAL(
"Renderer failure: pixel=%p != start=%p", pixel, pixel_start);
628 static void select_renderer_func (
void )
637 video_counter &= 1023;
638 video_counter_inc = 40;
640 video_counter_inc = 80;
644 renderer_func = renderer_disabled_screen;
649 renderer_func =
IS_H640 ? renderer_bitplane_640 : renderer_bitplane_320;
656 renderer_func =
IS_H640 ? renderer_text_80 : renderer_text_40;
659 renderer_func =
IS_H640 ? renderer_mcmtext_80 : renderer_mcmtext_40;
662 renderer_func =
IS_H640 ? renderer_bitmap_640 : renderer_bitmap_320;
665 renderer_func =
IS_H640 ? renderer_mcmbitmap_640 : renderer_mcmbitmap_320;
668 renderer_func =
IS_H640 ? renderer_ecmtext_80 : renderer_ecmtext_40;
674 renderer_func = renderer_invalid_mode;
681 static void select_chargen (
void )
686 if ((!(vic2_bank_number & 1)) && ((
vic3_registers[0x18] & 0x0C) == 4)) {
695 vicptr_chargen = vicptr_bank16k + ((
vic3_registers[0x18] & 0x0E) << 10);
702 static void select_vic2_memory (
void )
705 vicptr_video_40 = vicptr_bank16k + ((
vic3_registers[0x18] & 0xF0) << 6);
706 vicptr_video_80 = vicptr_bank16k + ((
vic3_registers[0x18] & 0xE0) << 6);
709 vicptr_bitmap_320 = vicptr_bank16k + ((
vic3_registers[0x18] & 8) << 10);
714 vicptr_bitmap_640 = vicptr_bank32k + ((
vic3_registers[0x18] & 8) << 11);
724 if (bank != vic2_bank_number) {
725 vic2_bank_number = bank;
727 vicptr_bank16k =
memory + bank;
728 vicptr_idlefetch_p = vicptr_bank16k + 0x3FFF;
729 vicptr_bank32k =
memory + (bank & 0x8000);
730 select_vic2_memory();
740 return (
x << 3) + (
y & 7) + (
IS_H640 ? bitplane_addr_640[bpn] + (
y >> 3) * 640 : bitplane_addr_320[bpn] + (
y >> 3) * 320);
751 DEBUG(
"VIC3: switched into NEW I/O access mode :)" NL);
754 DEBUG(
"VIC3: switched into OLD I/O access mode :(" NL);
758 DEBUG(
"VIC3: ignoring writing register $%02X (with data $%02X) because of old I/O access mode selected" NL,
addr,
data);
764 select_renderer_func();
765 compare_raster = (compare_raster & 0xFF) | ((
data & 0x80) << 1);
766 DEBUG(
"VIC3: compare raster is now %d" NL, compare_raster);
769 compare_raster = (compare_raster & 0xFF00) |
data;
770 DEBUG(
"VIC3: compare raster is now %d" NL, compare_raster);
774 select_renderer_func();
778 select_vic2_memory();
781 interrupt_status = interrupt_status & (~
data) & 15;
782 vic3_interrupt_checker();
793 DEBUG(
"MEM: applying new memory configuration because of VIC3 $30 is written" NL);
798 DEBUG(
"MEM: no need for new memory configuration (because of VIC3 $30 is written): same ROM bit values are set" NL);
801 palette = (
data & 4) ? vic3_palette : vic3_rom_palette;
805 attributes = (
data & 32) ? 0xF0 : 0x00;
806 select_renderer_func();
816 if ((
data & 15) && warn_ctrl_b_lo) {
817 INFO_WINDOW(
"VIC3 control-B register V400, H1280, MONO and INT features are not emulated yet!\nThere will be no further warnings on this issue.");
829 bitplane_addr_320[
addr - 0x33] = ((
data & 14) << 12) + (
addr & 1 ? 0 : 0x10000);
830 bitplane_addr_640[
addr - 0x33] = ((
data & 12) << 12) + (
addr & 1 ? 0 : 0x10000);
858 DEBUG(
"VIC3: ignoring reading register $%02X because of old I/O access mode selected, answer is $FF" NL,
addr);
863 result = (
vic3_registers[0x11] & 0x7F) | ((scanline >> 1) & 0x80);
866 result = scanline & 0xFF;
872 result = interrupt_status | (64 + 32 + 16);
897 DEBUG(
"VIC3: read reg $%02X with result $%02X" NL,
addr, result);
908 vic3_palette_nibbles[num] =
data & 15;
910 vic3_palette[num & 0xFF] =
RGB(
911 vic3_palette_nibbles[ num & 0xFF],
912 vic3_palette_nibbles[(num & 0xFF) | 0x100],
913 vic3_palette_nibbles[(num & 0xFF) | 0x200]
921 vic3_rom_palette[num & 0xFF] = vic3_palette[num & 0xFF];
930 for (
r = 0, i = 0;
r < 16;
r++)
931 for (g = 0; g < 16; g++)
932 for (b = 0; b < 16; b++)
933 rgb_palette[i++] = SDL_MapRGBA(
sdl_pix_fmt,
r * 17, g * 17, b * 17, 0xFF);
934 red_colour = SDL_MapRGBA(
sdl_pix_fmt, 0xFF, 0x00, 0x00, 0xFF);
935 black_colour = SDL_MapRGBA(
sdl_pix_fmt, 0x00, 0x00, 0x00, 0xFF);
943 interrupt_status = 0;
944 palette = vic3_rom_palette;
952 for (i = 0; i < 0x100; i++) {
955 vic3_rom_palette[i] = vic3_palette[i] = rgb_palette[0];
956 vic3_palette_nibbles[i] = 0;
957 vic3_palette_nibbles[i + 0x100] = 0;
958 vic3_palette_nibbles[i + 0x200] = 0;
961 vic3_rom_palette[ 0] =
RGB( 0, 0, 0);
962 vic3_rom_palette[ 1] =
RGB(15, 15, 15);
963 vic3_rom_palette[ 2] =
RGB(15, 0, 0);
964 vic3_rom_palette[ 3] =
RGB( 0, 15, 15);
965 vic3_rom_palette[ 4] =
RGB(15, 0, 15);
966 vic3_rom_palette[ 5] =
RGB( 0, 15, 0);
967 vic3_rom_palette[ 6] =
RGB( 0, 0, 15);
968 vic3_rom_palette[ 7] =
RGB(15, 15, 0);
969 vic3_rom_palette[ 8] =
RGB(15, 6, 0);
970 vic3_rom_palette[ 9] =
RGB(10, 4, 0);
971 vic3_rom_palette[10] =
RGB(15, 7, 7);
972 vic3_rom_palette[11] =
RGB( 5, 5, 5);
973 vic3_rom_palette[12] =
RGB( 8, 8, 8);
974 vic3_rom_palette[13] =
RGB( 9, 15, 9);
975 vic3_rom_palette[14] =
RGB( 9, 9, 15);
976 vic3_rom_palette[15] =
RGB(11, 11, 11);
978 bitplane_addr_320[0] = bitplane_addr_320[2] = bitplane_addr_320[4] = bitplane_addr_320[6] =
979 bitplane_addr_640[0] = bitplane_addr_640[2] = bitplane_addr_640[4] = bitplane_addr_640[6] = 0;
980 bitplane_addr_320[1] = bitplane_addr_320[3] = bitplane_addr_320[5] = bitplane_addr_320[7] =
981 bitplane_addr_640[1] = bitplane_addr_640[3] = bitplane_addr_640[5] = bitplane_addr_640[7] = 0x10000;
983 vic2_bank_number = -1;
986 select_renderer_func();
987 DEBUG(
"VIC3: has been initialized." NL);
991 #define SPRITE_X_START_SCREEN 24
992 #define SPRITE_Y_START_SCREEN 50
1002 static void render_one_sprite (
int sprite_no,
int sprite_mask,
Uint8 *
data,
Uint32 *p )
1009 int lim_y = sprite_y + ((expand_y) ? 42 : 21);
1019 for (
y = sprite_y;
y < lim_y;
y += (expand_y ? 2 : 1), p +=
SCREEN_WIDTH * (expand_y ? 2 : 1))
1020 if (y < 0 || y >= 200)
1023 int mask, a,
x = sprite_x;
1024 for (a = 0; a < 3; a++) {
1029 if (
x >= 0 &&
x < 640) {
1030 p[
x] = p[
x + 1] = p[
x + 2] = p[
x + 3] = col;
1031 if (expand_y &&
y < 200)
1035 if (expand_x &&
x >= 0 &&
x < 640) {
1036 p[
x] = p[
x + 1] = p[
x + 2] = p[
x + 3] = col;
1037 if (expand_y &&
y < 200)
1042 x += expand_x ? 8 : 4;
1047 if (
x >= 0 &&
x < 640) {
1049 if (expand_y &&
y < 200)
1053 if (expand_x &&
x >= 0 &&
x < 640) {
1055 if (expand_y &&
y < 200)
1060 x += expand_x ? 4 : 2;
1073 static void sprite_renderer (
void )
1077 static const char search_this[] =
"SYMMEK";
1078 for (
int a = 0; a < 128000; a++) {
1079 int d1 =
memory[a + 0] - search_this[5];
1080 int d2 =
memory[a + 1] - search_this[4];
1081 int d3 =
memory[a + 2] - search_this[3];
1082 int d4 =
memory[a + 3] - search_this[2];
1083 int d5 =
memory[a + 4] - search_this[1];
1084 int d6 =
memory[a + 5] - search_this[0];
1085 if (d1 == d2 && d2 == d3 && d3 == d4 && d4 == d5 && d5 == d6) {
1092 if (sprites_enabled) {
1094 INFO_WINDOW(
"WARNING: Sprite emulation is really bad! (enabled_mask=$%02X)", sprites_enabled);
1097 Uint8 *sprite_bank, *sprite_pointers;
1102 sprite_pointers =
memory + bitplane_addr_640[2] + 0x4000 - 8;
1105 sprite_pointers = vicptr_video_80 + 0x7F8;
1106 sprite_bank = vicptr_bank16k;
1110 sprite_pointers =
memory + bitplane_addr_320[2] + 0x2000 - 8;
1113 sprite_pointers = vicptr_video_40 + 0x3F8;
1114 sprite_bank = vicptr_bank16k;
1119 sprite_pointers =
memory + 0x07f8;
1125 DEBUGPRINT(
"YAY-FOUND: sprite pointers are: %02X %02X %02X %02X %02X %02X %02X %02X" NL,
1137 for (
int a = 7; a >= 0; a--) {
1139 if ((sprites_enabled &
mask))
1140 render_one_sprite(a,
mask, sprite_bank + (sprite_pointers[a] << 6), pixel_start);
1149 #ifdef XEMU_SNAPSHOT_SUPPORT
1153 #define SNAPSHOT_VIC3_BLOCK_VERSION 0
1154 #define SNAPSHOT_VIC3_BLOCK_SIZE 0x400
1156 int vic3_snapshot_load_state (
const struct xemu_snapshot_definition_st *def,
struct xemu_snapshot_block_st *
block )
1158 Uint8 buffer[SNAPSHOT_VIC3_BLOCK_SIZE];
1160 if (
block->block_version != SNAPSHOT_VIC3_BLOCK_VERSION ||
block->sub_counter ||
block->sub_size !=
sizeof buffer)
1161 RETURN_XSNAPERR_USER(
"Bad VIC3 block syntax");
1162 a = xemusnap_read_file(buffer,
sizeof buffer);
1165 for (a = 0; a < 0x80; a++) {
1169 for (a = 0; a < 0x300; a++)
1172 interrupt_status = (int)P_AS_BE32(buffer + 129);
1177 int vic3_snapshot_save_state (
const struct xemu_snapshot_definition_st *def )
1179 Uint8 buffer[SNAPSHOT_VIC3_BLOCK_SIZE];
1180 int a = xemusnap_write_block_header(def->idstr, SNAPSHOT_VIC3_BLOCK_VERSION);
1182 memset(buffer, 0xFF,
sizeof buffer);
1185 memcpy(buffer + 0x100, vic3_palette_nibbles, 0x300);
1187 U32_AS_BE(buffer + 129, interrupt_status);
1188 return xemusnap_write_sub_block(buffer,
sizeof buffer);