setVideo:
; This is based on the TANDOTS 640x200x16 demo, but tries to leave as much
; of the actual register-twiddling up to the BIOS as possible.
mov ax, 0x000a ; Set 640x200x4 mode and try to tweak registers from there.
int 0x10
mov si, videoRegisterTable
.lp:
lodsw ; Get port #
test ax, ax ; If port = 0, it's the end of the list.
jz .done
mov dx, ax
lodsb ; Get register value
out dx, al
jmp .lp
.done:
ret
videoRegisterTable:
dw 0x03d8 ; Disable video display while loading control registers.
db 0x13
; CRTC registers
;dw 0x03d4 ; I've commented out all the ones that seem to be taken care of
;db 0x10 ; by the BIOS, but I'm leaving 'em in just in case.
;dw 0x03d5
;db 0x18
;dw 0x03d4
;db 0x00
;dw 0x03d5
;db 0x71
;dw 0x03d4
;db 0x01
;dw 0x03d5
;db 0x50
;dw 0x03d4
;db 0x02
;dw 0x03d5
;db 0x5a
;dw 0x03d4
;db 0x03
;dw 0x03d5
;db 0x0e
;dw 0x03d4
;db 0x04
;dw 0x03d5
;db 0xff
;dw 0x03d4
;db 0x05
;dw 0x03d5
;db 0x06
dw 0x03d4
db 0x06
dw 0x03d5
db 0xc8
;dw 0x03d4
;db 0x07
;dw 0x03d5
;db 0xe2
dw 0x03d4
db 0x09
dw 0x03d5
db 0x00
;dw 0x03d4
;db 0x0c
;dw 0x03d5
;db 0x00
;dw 0x03d4
;db 0x0d
;dw 0x03d5
;db 0x00
;dw 0x03d4
;db 0x11
;dw 0x03d5
;db 0x00
;dw 0x03d4
;db 0x12
;dw 0x03d5
;db 0x46
dw 0x03da ; Palette mask
db 0x01
dw 0x03de
db 0x0f
dw 0x03da ; Border color
db 0x02
dw 0x03de
db 0x00
dw 0x03da ; Control register (enable 16 colors)
db 0x03
dw 0x03de
db 0x10
dw 0x03da ; What are video array registers 5 and 8? They're undocumented.
db 0x05
dw 0x03de
db 0x01
dw 0x03da
db 0x08
dw 0x03de
db 0x02
dw 0x03d9 ; Set border color (?). (See docs.)
db 0x00
dw 0x03dd ; Set extended RAM paging off.
db 0x00 ; (This may need to be tweaked depending on where we want VRAM.)
dw 0x03df ; Set the addressing mode, select page 2.
db 0x24
; Reset palette entries 1-3 to colors 1-3, rather than the CGA defaults.
dw 0x03da
db 0x11
dw 0x03de
db 0x01
dw 0x03da
db 0x12
dw 0x03de
db 0x02
dw 0x03da
db 0x13
dw 0x03de
db 0x03
dw 0x03d8 ; Reenable video.
db 0x1b
dw 0x0000