ee161aba@sdcc18.ucsd.EDU (David L. Smith) (01/09/87)
Several people have been looking for these parameters, so here are the parameters used on my hercules clone: Graphics pages B0000-B7FFFh page 1 B8000-BFFFFh page 2 I/O ports 03B4 - 6845 Index Register 03B5 - 6845 Data Register 03B8 - Display Mode Control Port 03BA - Display Status Port 6845 Registers To access these, load the 6845 Index Register with the register number you wish to access and then do something to the 6845 Data Register 0 - Total chars per row including SYNC less 1 1 - Number of visible chars per row 2 - Position of the first character during SYNC, less 1 3 - Number of characters during SYNC per row, less 1 4 - Number of rows less 1 including the row during vertical retrace 5 - Number of scans (row fractions) in addition to total number of rows 6 - Number of visible rows 7 - Row number to begin the retrace less 1. (This will always last 16 scans) 8 - Always set to 2 (magic cookie) 9 - Number of scans per row, less 1 10 - First scan where the cursor will overlay a character 11 - last scan where the cursor will overlay a character 12 - Always set to 0 13 - Always set to 0 14 - Offset of the cursor position in the display buffer high 15 - Offset low 16 - Offset when light pen tripped high 17 - Offset low (I have no better explanations for the 6845 registers, either find the chip data or just follow the "standard settings" given further on) Display Control Port (03B8) Bit Option 0 Unused 1 0 = text, 1= graphics (*BE SURE TO SET 6845 PARAMETERS when changing) 2 Unused 3 0 = Blank the screen, 1 turns it on 4 Unused 5 0 = No blinking, 1 = blinking on 6 Unused 7 0 = Use page 0, 1 = page 1 Display Status Port Bit Condition 0 0 = Normal character, 1=SYNC (screen is temporarily blanked) 1,2 Unused 3 0 = dots off, 1= dots on 4,5,6 Unused 7 0 = Vertical retrace (screen is temporarily blanked) 0=active display Configuration Switch (03BF) (Some cards may not have this) Bit Option 0 0 = inhibit graphics mode, 1 = allow graphics mode to be set 1 0 = Mask page 1 (B8000-BFFFF) out of memory map and inhibit it's selection. 1 = Put back in memory map and allow selection 2-7 Unused The text page occupies 4K, from B0000 - B0FFF To place a character, use the formula character offset = 160*(line-1)+2*(column-1) attribute offset = 160*(line-1)+2*(column-1)+1 (1<=line<=25) (1<column<80) Attributes are set as follows: Bit 7 is the blink bit, bit 3 is the bold bit B000I000 - Don't display B000I001 - Underline B000I111 - normal B111I000 - reverse video Graphics To place a dot in the graphics screen, use Byte offset = 2000h * (y mod 4) + 90 * int(y/4) + int (x/8) Bit position in byte is 7 - (x mod 8) (0 < x < 719) (0 < y < 347) Standard settings for 6845 register 0 - 11 Text 61, 50, 52, 0f, 19, 06, 19, 19, 02, 0d, 0b, 0c Graphics 35, 2d, 2e, 07, 5b, 02, 57, 57, 02, 03, 00 ,00 To flip modes, it is suggested to blank the screen, set the mode, set the parameters, turn the screen back on. -- Cheers, David L. Smith {ucbvax, ihnp4}!sdcsvax!sdcc18!ee161aba "Consistency is the hobgoblin of little minds"