|
Xemu [doxygen]
hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
|
Go to the documentation of this file.
20 #ifndef XEMU_MEGA65_VIC4_H_INCLUDED
21 #define XEMU_MEGA65_VIC4_H_INCLUDED
25 #define VIC_BAD_IOMODE 2
29 #define PAL_LINE_FREQ 31250.0
30 #define NTSC_LINE_FREQ 31468.5
32 #define PAL_FRAME_TIME 20000
33 #define NTSC_FRAME_TIME ((int)(16683.35))
41 #define TEXTURE_WIDTH 800
42 #define TEXTURE_HEIGHT 625
44 #define PHYSICAL_RASTERS_DEFAULT PHYSICAL_RASTERS_NTSC
45 #define SCREEN_HEIGHT_VISIBLE_DEFAULT SCREEN_HEIGHT_VISIBLE_NTSC
46 #define SCREEN_HEIGHT_VISIBLE_NTSC 480
47 #define SCREEN_HEIGHT_VISIBLE_PAL 576
48 #define PHYSICAL_RASTERS_NTSC 526
49 #define PHYSICAL_RASTERS_PAL 624
50 #define FRAME_H_FRONT 0
51 #define RASTER_CORRECTION 3
52 #define VIC4_BLINK_INTERVAL 30
61 #define REG_EBM (vic_registers[0x11] & 0x40)
62 #define REG_MCM (vic_registers[0x16] & 0x10)
63 #define REG_BMM (vic_registers[0x11] & 0x20)
64 #define REG_SPRITE_ENABLE vic_registers[0x15]
65 #define REG_BORDER_COLOR (vic_registers[0x20] & vic_color_register_mask)
66 #define REG_SCREEN_COLOR (vic_registers[0x21] & vic_color_register_mask)
67 #define REG_MULTICOLOR_1 (vic_registers[0x22] & vic_color_register_mask)
68 #define REG_MULTICOLOR_2 (vic_registers[0x23] & vic_color_register_mask)
70 #define REG_H640 (vic_registers[0x31] & 128)
71 #define REG_V400 (vic_registers[0x31] & 8)
72 #define REG_VICIII_ATTRIBS (vic_registers[0x31] & 0x20)
73 #define REG_RSEL (vic_registers[0x11] & 8)
74 #define REG_CSEL (vic_registers[0x16] & 8)
75 #define REG_DISPLAYENABLE (vic_registers[0x11] & 0x10)
76 #define REG_VIC2_XSCROLL (vic_registers[0x16] & 7)
77 #define REG_VIC2_YSCROLL (vic_registers[0x11] & 7)
79 #define REG_TBRDPOS (vic_registers[0x48])
80 #define REG_SPRBPMEN_0_3 (vic_registers[0x49] >> 4)
81 #define REG_SPRBPMEN_4_7 (vic_registers[0x4B] >> 4)
82 #define REG_TBRDPOS_U4 (vic_registers[0x49] & 0xF)
83 #define REG_BBRDPOS (vic_registers[0x4A])
84 #define REG_BBRDPOS_U4 (vic_registers[0x4B] & 0xF)
85 #define REG_TEXTXPOS (vic_registers[0x4C])
86 #define REG_TEXTXPOS_U4 (vic_registers[0x4D] & 0xF)
87 #define REG_SPRTILEN ((vic_registers[0x4D] >> 4) | (vic_registers[0x4F] & 0xF0))
88 #define REG_TEXTYPOS (vic_registers[0x4E])
89 #define REG_TEXTYPOS_U4 (vic_registers[0x4F] & 0xF)
92 #define REG_FNRST (vic_registers[0x53] & 0x80)
93 #define REG_16BITCHARSET (vic_registers[0x54] & 1)
94 #define REG_FCLRLO (vic_registers[0x54] & 2)
95 #define REG_FCLRHI (vic_registers[0x54] & 4)
96 #define REG_SPR640 (vic_registers[0x54] & 0x10)
97 #define REG_SPRHGHT (vic_registers[0x56])
99 #define REG_CHRYSCL (vic_registers[0x5B])
100 #define REG_SIDBDRWD (vic_registers[0x5C])
101 #define REG_SIDBDRWD_U5 (vic_registers[0x5D] & 0x3F)
102 #define REG_HOTREG (vic_registers[0x5D] & 0x80)
103 #define REG_LINESTEP vic_registers[0x58]
104 #define REG_LINESTEP_U8 vic_registers[0x59]
105 #define REG_CHARXSCALE vic_registers[0x5A]
106 #define REG_CHRCOUNT vic_registers[0x5E]
107 #define REG_SCRNPTR_B0 vic_registers[0x60]
108 #define REG_SCRNPTR_B1 vic_registers[0x61]
109 #define REG_SCRNPTR_B2 vic_registers[0x62]
110 #define REG_SCRNPTR_B3 (vic_registers[0x63] & 0xF)
111 #define REG_COLPTR vic_registers[0x64]
112 #define REG_COLPTR_MSB vic_registers[0x65]
113 #define REG_CHARPTR_B0 vic_registers[0x68]
114 #define REG_CHARPTR_B1 vic_registers[0x69]
115 #define REG_CHARPTR_B2 vic_registers[0x6A]
116 #define REG_SPRPTR_B0 vic_registers[0x6C]
117 #define REG_SPRPTR_B1 vic_registers[0x6D]
118 #define REG_SPRPTR_B2 (vic_registers[0x6E] & 0x7F)
119 #define REG_SPRITE_Y_ADJUST vic_registers[0x72]
129 #define SINGLE_SIDE_BORDER (((Uint16)REG_SIDBDRWD) | (REG_SIDBDRWD_U5) << 8)
130 #define BORDER_Y_TOP (((Uint16)REG_TBRDPOS) | (REG_TBRDPOS_U4) << 8)
131 #define BORDER_Y_BOTTOM (((Uint16)REG_BBRDPOS) | (REG_BBRDPOS_U4) << 8)
132 #define CHARGEN_Y_START (((Uint16)REG_TEXTYPOS) | (REG_TEXTYPOS_U4) << 8)
133 #define CHARGEN_X_START (((Uint16)REG_TEXTXPOS) | (REG_TEXTXPOS_U4) << 8)
134 #define LINESTEP_BYTES (((Uint16)REG_LINESTEP) | (REG_LINESTEP_U8) << 8)
136 #define SCREEN_ADDR ((Uint32)REG_SCRNPTR_B0 | (REG_SCRNPTR_B1<<8) | (REG_SCRNPTR_B2 <<16) | (REG_SCRNPTR_B3 << 24))
137 #define CHARSET_ADDR ((Uint32)REG_CHARPTR_B0 | (REG_CHARPTR_B1<<8) | (REG_CHARPTR_B2 <<16))
138 #define VIC2_BITMAP_ADDR ((CHARSET_ADDR) & 0xFFE000)
139 #define SPRITE_POINTER_ADDR ((Uint32)REG_SPRPTR_B0 | (REG_SPRPTR_B1<<8) | (REG_SPRPTR_B2 <<16))
140 #define COLOUR_RAM_OFFSET ((((Uint16)REG_COLPTR) | (REG_COLPTR_MSB) << 8))
143 #define SPRITE_POS_Y(n) (((Uint16)vic_registers[1 + (n)*2]) | \
144 ( (vic_registers[0x77] & (1 << (n)) ? 0x100 : 0)) | \
145 ( (vic_registers[0x78] & (1 << (n)) ? 0x200 : 0)))
146 #define SPRITE_POS_X(n) (((Uint16)vic_registers[(n)*2]) | \
147 ( (vic_registers[0x10] & (1 << (n)) ? 0x100 : 0)) | \
148 ( (vic_registers[0x5f] & (1 << (n)) ? 0x200 : 0)))
149 #define SPRITE_COLOR(n) (vic_registers[0x27+(n)] & vic_color_register_mask)
150 #define SPRITE_COLOR_4BIT(n) (vic_registers[0x27+(n)] & 0xF)
151 #define SPRITE_MULTICOLOR_1 (vic_registers[0x25] & vic_color_register_mask)
152 #define SPRITE_MULTICOLOR_2 (vic_registers[0x26] & vic_color_register_mask)
153 #define SPRITE_IS_BACK(n) (vic_registers[0x1B] & (1 << (n)))
154 #define SPRITE_HORZ_2X(n) (vic_registers[0x1D] & (1 << (n)))
155 #define SPRITE_VERT_2X(n) (vic_registers[0x17] & (1 << (n)))
156 #define SPRITE_MULTICOLOR(n) (vic_registers[0x1C] & (1 << (n)))
157 #define SPRITE_16COLOR(n) (vic_registers[0x6B] & (1 << (n)))
158 #define SPRITE_EXTWIDTH(n) (SPRITE_16COLOR(n) | (vic_registers[0x57] & (1 << (n))))
159 #define SPRITE_EXTHEIGHT(n) (vic_registers[0x55] & (1 << (n)))
160 #define SPRITE_BITPLANE_ENABLE(n) (((REG_SPRBPMEN_4_7) << 4 | REG_SPRBPMEN_0_3) & (1 << (n)))
161 #define SPRITE_16BITPOINTER (vic_registers[0x6E] & 0x80)
162 #define SPRITE_V400(n) (vic_registers[0x76] & (1 << (n)))
166 #define VIC3_ATTR_BLINK(c) ((c) & 0x1)
167 #define VIC3_ATTR_REVERSE(c) ((c) & 0x2)
168 #define VIC3_ATTR_BOLD(c) ((c) & 0x4)
169 #define VIC3_ATTR_UNDERLINE(c) ((c) & 0x8)
170 #define CHAR_IS256_COLOR(ch) (REG_FCLRLO && (ch) < 0x100) || (REG_FCLRHI && (ch) > 0x0FF)
175 #define SXA_TRIM_RIGHT_BITS012(sw) ((sw) >> 13)
176 #define SXA_VERTICAL_FLIP(cw) ((cw) & 0x8000)
177 #define SXA_HORIZONTAL_FLIP(cw) ((cw) & 0x4000)
179 #define SXA_GOTO_X(cw) ((cw) & 0x1000)
180 #define SXA_4BIT_PER_PIXEL(cw) ((cw) & 0x0800)
181 #define SXA_TRIM_RIGHT_BIT3(cw) ((cw) & 0x0400)
182 #define SXA_ATTR_BOLD(cw) ((cw) & 0x0040)
183 #define SXA_ATTR_REVERSE(cw) ((cw) & 0x0020)
189 #define SET_11BIT_REG(basereg,x) do { \
190 vic_registers[((basereg)+1)] = (Uint8) ((((Uint16)(x)) & 0x700) >> 8); \
191 vic_registers[(basereg)] = (Uint8) ((Uint16)(x)) & 0x00FF; \
193 #define SET_12BIT_REG(basereg,x) do { \
194 vic_registers[((basereg)+1)] = (Uint8) ((((Uint16)(x)) & 0xF00) >> 8); \
195 vic_registers[(basereg)] = (Uint8) ((Uint16)(x)) & 0x00FF; \
197 #define SET_14BIT_REG(basereg,x) do { \
198 vic_registers[((basereg)+1)] = (Uint8) ((((Uint16)(x)) & 0x3F00) >> 8); \
199 vic_registers[(basereg)] = (Uint8) ((Uint16)(x)) & 0x00FF; \
205 #define SET_16BIT_REG(basereg,x) do { \
206 vic_registers[((basereg) + 1)] = (Uint8) ((((Uint16)(x)) & 0xFF00) >> 8); \
207 vic_registers[(basereg)]= ((Uint16)(x)) & 0x00FF; \
212 #define SET_PHYSICAL_RASTER(x) SET_11BIT_REG(0x52, (x))
217 #define SET_BORDER_Y_TOP(x) SET_12BIT_REG(0x48, (x))
218 #define SET_BORDER_Y_BOTTOM(x) SET_12BIT_REG(0x4A, (x))
219 #define SET_CHARGEN_X_START(x) SET_12BIT_REG(0x4C, (x))
220 #define SET_CHARGEN_Y_START(x) SET_12BIT_REG(0x4E, (x))
224 #define SET_COLORRAM_BASE(x) SET_16BIT_REG(0x64,(x))
225 #define SET_LINESTEP_BYTES(x) SET_16BIT_REG(0x58,(x))
229 #define SPRITE_FIRST_X 31
258 #ifdef XEMU_SNAPSHOT_SUPPORT
260 extern int vic4_snapshot_load_state (
const struct xemu_snapshot_definition_st *def ,
struct xemu_snapshot_block_st *
block );
261 extern int vic4_snapshot_save_state (
const struct xemu_snapshot_definition_st *def );
void vic4_open_frame_access(void)
const char * iomode_names[4]
void vic4_close_frame_access(void)
Uint8 vic_read_reg(unsigned int addr)
float videostd_1mhz_cycles_per_scanline
int vic_readjust_sdl_viewport
void vic_write_reg(unsigned int addr, Uint8 data)
int vic4_render_scanline(void)
const char * videostd_name
int vic4_disallow_video_std_change