Commit 1f0b9bb0 authored by Bjorn Astrom's avatar Bjorn Astrom
Browse files

Add some temporary registers for changing preset/custom video mode data

parent cb5e3fa2
......@@ -1018,6 +1018,9 @@ int main() {
int request_video_align=0;
int vblank=0;
int custom_video_mode = ZZVMODE_CUSTOM;
int custom_vmode_param = VMODE_PARAM_HRES;
while (1) {
u32 zstate = mntzorro_read(MNTZ_BASE_ADDR, MNTZORRO_REG3);
zstate_raw = zstate;
......@@ -1349,13 +1352,51 @@ int main() {
case 0x50: { // Copy crap from scratch area
for (int i = 0; i < rect_y1; i++) {
memcpy ((uint32_t*) ((u32) framebuffer + framebuffer_pan_offset + (i * rect_x1)),
(uint32_t*) ((u32)0x33F0000 + (i * rect_x1)),
(uint32_t*) ((u32)Z3_SCRATCH_ADDR + (i * rect_x1)),
rect_x1);
}
Xil_DCacheFlush();
break;
}
case 0x52: // Custom video mode param
custom_vmode_param = zdata;
break;
case 0x54: { // Custom video mode data
int *target = &preset_video_modes[custom_video_mode].hres;
switch(custom_vmode_param) {
case VMODE_PARAM_VRES: target = &preset_video_modes[custom_video_mode].vres; break;
case VMODE_PARAM_HSTART: target = &preset_video_modes[custom_video_mode].hstart; break;
case VMODE_PARAM_HEND: target = &preset_video_modes[custom_video_mode].hend; break;
case VMODE_PARAM_HMAX: target = &preset_video_modes[custom_video_mode].hmax; break;
case VMODE_PARAM_VSTART: target = &preset_video_modes[custom_video_mode].vstart; break;
case VMODE_PARAM_VEND: target = &preset_video_modes[custom_video_mode].vend; break;
case VMODE_PARAM_VMAX: target = &preset_video_modes[custom_video_mode].vmax; break;
case VMODE_PARAM_POLARITY: target = &preset_video_modes[custom_video_mode].polarity; break;
case VMODE_PARAM_MHZ: target = &preset_video_modes[custom_video_mode].mhz; break;
case VMODE_PARAM_PHZ: target = &preset_video_modes[custom_video_mode].phz; break;
case VMODE_PARAM_VHZ: target = &preset_video_modes[custom_video_mode].vhz; break;
case VMODE_PARAM_HDMI: target = &preset_video_modes[custom_video_mode].hdmi; break;
case VMODE_PARAM_MUL: target = &preset_video_modes[custom_video_mode].mul; break;
case VMODE_PARAM_DIV: target = &preset_video_modes[custom_video_mode].div; break;
case VMODE_PARAM_DIV2: target = &preset_video_modes[custom_video_mode].div2; break;
default: break;
}
*target = zdata;
break;
}
case 0x56: // Set custom video mode index
custom_video_mode = zdata;
break;
case 0x58: // Set custom video mode without any questions asked.
// This assumes that the custom video mode is 640x480 or higher resolution.
video_mode_init(custom_video_mode, scalemode, colormode);
break;
case REG_ZZ_P2C: {
uint8_t draw_mode = blitter_colormode >> 8;
uint8_t planes = (zdata & 0xFF00) >> 8;
......
enum zz_video_modes {
ZZVMODE_1280x720,
ZZVMODE_800x600,
ZZVMODE_640x480,
ZZVMODE_1024x768,
ZZVMODE_1280x1024,
ZZVMODE_1920x1080_60,
ZZVMODE_720x576, // 50Hz
ZZVMODE_1920x1080_50, // 50Hz
ZZVMODE_720x480,
ZZVMODE_640x512,
ZZVMODE_NUM,
ZZVMODE_1280x720,
ZZVMODE_800x600,
ZZVMODE_640x480,
ZZVMODE_1024x768,
ZZVMODE_1280x1024,
ZZVMODE_1920x1080_60,
ZZVMODE_720x576, // 50Hz
ZZVMODE_1920x1080_50, // 50Hz
ZZVMODE_720x480,
ZZVMODE_640x512,
ZZVMODE_CUSTOM,
ZZVMODE_NUM,
};
struct zz_video_mode {
int hres, vres;
int hstart, hend, hmax;
int vstart, vend, vmax;
int polarity;
int mhz, phz, vhz;
int hdmi;
int mul, div, div2;
int hres, vres;
int hstart, hend, hmax;
int vstart, vend, vmax;
int polarity;
int mhz, phz, vhz;
int hdmi;
int mul, div, div2;
};
enum custom_vmode_params {
VMODE_PARAM_HRES,
VMODE_PARAM_VRES,
VMODE_PARAM_HSTART,
VMODE_PARAM_HEND,
VMODE_PARAM_HMAX,
VMODE_PARAM_VSTART,
VMODE_PARAM_VEND,
VMODE_PARAM_VMAX,
VMODE_PARAM_POLARITY,
VMODE_PARAM_MHZ,
VMODE_PARAM_PHZ,
VMODE_PARAM_VHZ,
VMODE_PARAM_HDMI,
VMODE_PARAM_MUL,
VMODE_PARAM_DIV,
VMODE_PARAM_DIV2,
VMODE_PARAM_NUM,
};
struct zz_video_mode preset_video_modes[ZZVMODE_NUM] = {
// HRES VRES HSTART HEND HMAX VSTART VEND VMAX POLARITY MHZ PIXELCLOCK HZ VERTICAL HZ HDMI NUL/DIV/DIV2
{ 1280, 720, 1390, 1430, 1650, 725, 730, 750, 0, 75, 75000000, 60, 0, 15, 1, 20 },
{ 800, 600, 840, 968, 1056, 601, 605, 628, 0, 40, 40000000, 60, 0, 14, 1, 35 },
{ 640, 480, 656, 752, 800, 490, 492, 525, 0, 25, 25175000, 60, 0, 15, 1, 60 },
{ 1024, 768, 1048, 1184, 1344, 771, 777, 806, 0, 65, 65000000, 60, 0, 13, 1, 20 },
{ 1280, 1024, 1328, 1440, 1688, 1025, 1028, 1066, 0, 108, 108000000, 60, 0, 54, 5, 10 },
{ 1920, 1080, 2008, 2052, 2200, 1084, 1089, 1125, 0, 150, 150000000, 60, 0, 15, 1, 10 },
{ 720, 576, 732, 796, 864, 581, 586, 625, 1, 27, 27000000, 50, 0, 45, 2, 83 },
{ 1920, 1080, 2448, 2492, 2640, 1084, 1089, 1125, 0, 150, 150000000, 50, 0, 15, 1, 10 },
{ 720, 480, 720, 752, 800, 490, 492, 525, 0, 25, 25175000, 60, 0, 15, 1, 60 },
{ 640, 512, 840, 968, 1056, 601, 605, 628, 0, 40, 40000000, 60, 0, 14, 1, 35 },
// HRES VRES HSTART HEND HMAX VSTART VEND VMAX POLARITY MHZ PIXELCLOCK HZ VERTICAL HZ HDMI MUL/DIV/DIV2
{ 1280, 720, 1390, 1430, 1650, 725, 730, 750, 0, 75, 75000000, 60, 0, 15, 1, 20 },
{ 800, 600, 840, 968, 1056, 601, 605, 628, 0, 40, 40000000, 60, 0, 14, 1, 35 },
{ 640, 480, 656, 752, 800, 490, 492, 525, 0, 25, 25175000, 60, 0, 15, 1, 60 },
{ 1024, 768, 1048, 1184, 1344, 771, 777, 806, 0, 65, 65000000, 60, 0, 13, 1, 20 },
{ 1280, 1024, 1328, 1440, 1688, 1025, 1028, 1066, 0, 108, 108000000, 60, 0, 54, 5, 10 },
{ 1920, 1080, 2008, 2052, 2200, 1084, 1089, 1125, 0, 150, 150000000, 60, 0, 15, 1, 10 },
{ 720, 576, 732, 796, 864, 581, 586, 625, 1, 27, 27000000, 50, 0, 45, 2, 83 },
{ 1920, 1080, 2448, 2492, 2640, 1084, 1089, 1125, 0, 150, 150000000, 50, 0, 15, 1, 10 },
{ 720, 480, 720, 752, 800, 490, 492, 525, 0, 25, 25175000, 60, 0, 15, 1, 60 },
{ 640, 512, 840, 968, 1056, 601, 605, 628, 0, 40, 40000000, 60, 0, 14, 1, 35 },
// The final exntry here is the custom video mode, accessible through registers for debug purposes.
{ 1280, 720, 1390, 1430, 1650, 725, 730, 750, 0, 75, 75000000, 60, 0, 15, 1, 20 },
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment