33 #define SCREEN_COLOUR vic_cpal[0]
34 #define BORDER_COLOUR vic_cpal[1]
35 #define SRAM_COLOUR vic_cpal[2]
36 #define AUX_COLOUR vic_cpal[3]
54 static Uint8 *vic_address_space_hi4[16 + 3];
55 static Uint8 *vic_address_space_lo8[16 + 3];
56 static Uint8 vic_registers[16];
59 static int pixels_tail;
60 static int first_active_scanline;
61 static int vic_vertical_area;
63 static int char_height_minus_one;
64 static int char_height_shift;
65 static int first_active_dotpos;
66 static int text_columns;
68 static int sram_colour_index;
69 static int vic_vid_addr;
70 static int vic_vid_addr_bit9;
71 static int vic_chr_addr;
72 static int vic_vid_counter;
73 static int vic_row_counter;
78 #if ((SCREEN_ORIGIN_DOTPOS) & 1) != 0
79 # error "SCREEN_ORIGIN_DOTPOS must be an even number!"
81 #if (SCREEN_FIRST_VISIBLE_DOTPOS) & 1 != 0
82 # error "SCREEN_FIRST_VISIBLE_DOTPOS must be an even number!"
84 #if (SCREEN_LAST_VISIBLE_DOTPOS) & 1 != 1
85 # error "SCREEN_LAST_VISIBLE_DOTPOS must be an odd number!"
87 #if SCREEN_LAST_VISIBLE_SCANLINE > LAST_SCANLINE
88 # error "SCREEN_LAST_VISIBLE_SCANLINE cannot be greater than LAST_SCANLINE!"
99 return (vic_registers[3] & 0x7F) | ((
scanline & 1) ? 0x80 : 0);
101 return vic_registers[
addr];
119 text_columns =
data & 0x7F;
120 if (text_columns > 32)
122 vic_vid_addr_bit9 = ((
data & 128) ? 0x200 : 0);
123 vic_vid_addr = (vic_vid_addr & 0xFDFF) | vic_vid_addr_bit9;
126 char_height_minus_one = (
data & 1) ? 15 : 7;
127 char_height_shift = (
data & 1) ? 4 : 3;
128 text_rows = (
data >> 1) & 0x3F;
133 vic_chr_addr = (
data & 15) << 10;
134 vic_vid_addr = ((
data & 0xF0) << 6) | vic_vid_addr_bit9;
143 sram_colour_index = 2;
146 sram_colour_index = 0;
161 vic_vertical_area = 1;
176 for (a = 0; a < 16 + 3; a++) {
179 vic_address_space_lo8[a] = lo8_pointers[a & 15] - (a << 10);
180 vic_address_space_hi4[a] = hi4_pointers[a & 15] - (a << 10);
187 return vic_address_space_lo8[
addr >> 10][
addr];
194 return vic_address_space_hi4[
addr >> 10][
addr];
202 int v_columns, v_vid, dotpos, visible_scanline, mcm, bitp, chr;
204 if (vic_row_counter >= text_rows && vic_vertical_area == 0)
205 vic_vertical_area = 2;
206 else if (
scanline == first_active_scanline && vic_vertical_area == 1)
207 vic_vertical_area = 0;
210 if (vic_vertical_area) {
211 if (visible_scanline) {
221 v_columns = text_columns;
222 v_vid = vic_vid_counter;
225 if (dotpos < first_active_dotpos) {
233 chr = vic_read_mem_lo8((vic_read_mem_lo8(vic_vid_addr + v_vid) << char_height_shift) + vic_chr_addr + charline);
234 mcm = vic_read_mem_hi4(vic_vid_addr + v_vid);
236 vic_cpal[sram_colour_index] =
vic_palette[mcm & 7];
241 if (visible_dotpos) {
260 }
else if (visible_dotpos)
264 if (charline >= char_height_minus_one) {
266 vic_vid_counter += text_columns;