From 720b56814204aec44521cd687d1644786e001070 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Mon, 4 Apr 2016 16:40:42 -0500 Subject: [PATCH] horizintal? ^^ --- src/lib/modex16.c | 46 ++++++++++++++++++++++++++++++++++++---------- src/lib/modex16.h | 2 +- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/lib/modex16.c b/src/lib/modex16.c index cb4c5312..0d106037 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -92,9 +92,7 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) dword far*ptr=(dword far*)VGA; /* used for faster screen clearing */ int CRTParmCount; /* common mode X initiation stuff~ */ - modexsetBaseXMode(gv->video.page); - vga_enable_256color_modex(); // VGA mode X - update_state_from_vga(); + modexsetBaseXMode(); switch(vq) { @@ -112,7 +110,33 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) struct vga_mode_params cm; vga_read_crtc_mode(&cm); +// 0x5f00, /* Horizontal total */ +// 0x4f01, /* horizontal display enable end */ +// 0x5002, /* Start horizontal blanking */ +// 0x8203, /* End horizontal blanking */ +// 0x5404, /* Start horizontal retrace */ +// 0x8005, /* End horizontal retrace */ +// 0x0d06, /* vertical total */ +// 0x3e07, /* overflow (bit 8 of vertical counts) */ +// 0x4109, /* cell height (2 to double-scan */ +// 0xea10, /* v sync start */ +// 0xac11, /* v sync end and protect cr0-cr7 */ +// 0xdf12, /* vertical displayed */ +// 0x2813, /* offset/logical width */ +// 0x0014, /* turn off dword mode */ +// 0xe715, /* v blank start */ +// 0x0616, /* v blank end */ +// 0xe317 /* turn on byte mode */ + // 320x240 mode 60Hz + cm.horizontal_total=0x5f; /* CRTC[0] -5 */ + cm.horizontal_display_end=0x4f; /* CRTC[1] -1 */ + cm.horizontal_blank_start=0x50; /* CRTC[2] */ + cm.horizontal_blank_end=0x82; /* CRTC[3] bit 0-4 & CRTC[5] bit 7 */ + cm.horizontal_start_retrace=0x54;/* CRTC[4] */ + cm.horizontal_end_retrace=0x80; /* CRTC[5] bit 0-4 */ + //cm.horizontal_start_delay_after_total=0x3e; /* CRTC[3] bit 5-6 */ + //cm.horizontal_start_delay_after_retrace=0x41; /* CRTC[5] bit 5-6 */ cm.vertical_total = 525; cm.vertical_start_retrace = 0x1EA; cm.vertical_end_retrace = 0x1EC; @@ -190,8 +214,8 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) void modexLeave() { - /* TODO restore original mode and palette */ - vgaSetMode(TEXT_MODE); + /* TODO restore original mode and palette */ + vgaSetMode(TEXT_MODE); } // setBaseXMode() does the initialization to make the VGA ready to @@ -199,23 +223,24 @@ modexLeave() { // involves enabling writes to index 0 to 7 of the CRT controller (port // 0x3D4), by clearing the most significant bit (bit 7) of index 0x11. void -modexsetBaseXMode(page_t *page) +modexsetBaseXMode() { - word temp; /* TODO save current video mode and palette */ vgaSetMode(VGA_256_COLOR_MODE); + vga_enable_256color_modex(); + /* disable chain4 mode */ - outpw(SC_INDEX, 0x0604); + //outpw(SC_INDEX, 0x0604); /* synchronous reset while setting Misc Output */ - outpw(SC_INDEX, 0x0100); + //outpw(SC_INDEX, 0x0100); /* select 25 MHz dot clock & 60 Hz scanning rate */ outp(MISC_OUTPUT, 0xe3); /* undo reset (restart sequencer) */ - outpw(SC_INDEX, 0x0300); + //outpw(SC_INDEX, 0x0300); /* reprogram the CRT controller */ outp(CRTC_INDEX, 0x11); /* VSync End reg contains register write prot */ @@ -223,6 +248,7 @@ modexsetBaseXMode(page_t *page) // outp(CRTC_INDEX, 0x11); outp(CRTC_DATA, 0x7f); /* get current write protect on varios regs */ // outp(CRTC_DATA, temp); /* get current write protect on varios regs */ + update_state_from_vga(); } page_t diff --git a/src/lib/modex16.h b/src/lib/modex16.h index 312912c6..fff256c3 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -91,7 +91,7 @@ void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv); void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv); long vgaGetMode(); void modexLeave(); -void modexsetBaseXMode(page_t *page); +void modexsetBaseXMode(); page_t modexDefaultPage(page_t *p); page_t modexNextPage(page_t *p); page_t modexNextPageFlexibleSize(page_t *p, word x, word y); -- 2.39.5