DRAMs Speed Up/BoosterAssembler/8086

Here are two small gems concerning video speed bootsup. One for Cirrus Logic and one for S3.
You can obtain better performance with a Cirrus Logic 542x, if you add these lines in your code (even with Mode X):

        mov     dx,3c4h
	mov     al,0fh
	out     dx,al
	inc     dl
	in      al,dx
	and     al,NOT(8+16+32)
        or      al,(6 SHL 3)    ; 32 bit mode + CRT FIFO depth control
	out     dx,al

	dec     dl
	mov     al,16h
	out     dx,al
	inc     dl
	in      al,dx
	and     al,15
	or      al,(0 SHL 4)+(2 SHL 6) ; delay for mem Write I/O
        out     dx,al
It basically reduces the DRAMs wait states. I think that Complex used a similar trick in Dope. Normally there are no problems, but it's always a good idea to allow the user to disable the booster.

S3 cards can be accelerated by the following code:

; read(port, index, value)      ; write(port, index, value)
; dx = port                     ; dx = port
; al = index                    ; al = index
; value -> ah                   ; ah = value
PROC    Read3D4 NEAR            PROC    Write3D4	NEAR
        mov     dx,3d4h                 mov     dx,3d4h
        out     dx,al                   out     dx,al
        mov     ah,al                   xchg    ah,al
        inc     dx                      inc     dx
        in      al,dx                   out     dx,al
        xchg    ah,al                   xchg    ah,al
        dec     dx                      dec     dx
        ret                             ret
ENDP    Read3D4                 ENDP	Write3D4  ENDP

; enable extensions
PROC    ExtON   NEAR
        mov     ax,4838h        ; extensions enable (enable extended registers)
        call    Write3D4        ; write(3d4h, 38h, 48h)
        mov     ax,0A039h       ; extensions enable2
        call    Write3D4        ; write(3d4h, 39h, a0h)
        ret
ENDP    ExtON

; disable extensions
PROC    ExtOFF  NEAR
        mov     ax,0038h        ; disable extended registers
        call    Write3D4        ; write(3d4h, 38h, 00h)
        mov     ax,0039h        ; disable2
        call    Write3D4        ; write(3d4h, 39h, 00h)
        ret
ENDP    ExtOFF

; enable linear and set vidmem to 0a0000h
PROC	MAP_A000H       NEAR
        pusha
        mov     bl,0ECh
        mov     bh,10h
        mov     cx,000Ah
        call    ExtON           ; enable extensions
        mov     al,058h         ; linear aperture options / bit 2
        call    Read3D4         ; ah = read(3d4h, 58h)
        and     ah,0ECh         ; clear bit 0,1 and 4
        call    Write3D4        ; write(3d4h, 58h, new AH)
        mov     al,059h         ; bit 0-1: linear memory address bit 8-9
        mov     ah,ch
        call    Write3D4        ; write(3d4h, 59h, 00h)
        inc     al              ; 05Ah : bit 0-7 = linear mem address bit 0-7
        mov     ah,cl           ; in 64k units ???
        call    Write3D4        ; write(3d4h, 5Ah, 0Ah)
        mov     al,058h         ; linear aperture options
        call    Read3D4         ; ah = read(3d4h, 58h)
        and     ah,bl           ; and ah,ECh -> clear bit 0,1 and 4
        or      ah,bh           ; or ah,10h (OR or ah,00h) -> set bit 4
        call    Write3D4        ; write(3d4h, 58h, new AH)
        call    ExtOFF          ; disable extensions
        popa
        ret
ENDP    MAP_A000H

PROC	FAST_WRITE_BUFFER_ON    NEAR
        pusha
        call    ExtON           ; enable extensions
        mov     al,40h          ; bit 0: if set enables 8514/A mode
        call    Read3D4         ;   * 3: (801,805,928) Fast Write Buffer ON *
        or      ah,08h          ;     6: (801,805,928) Zero Wait State OFF (EISA)
        call    Write3D4        ; set bit 3 to ON
        call    ExtOFF          ; disable extensions
        popa
        ret
ENDP    FAST_WRITE_BUFFER_ON
If you want to boost an SVGA mode banked, just type:
        call    MAP_A000h
        call    FAST_WRITE_BUFFER_ON
If you want to boost an SVGA mode FLAT linear, just type:
        call    FAST_WRITE_BUFFER_ON
Gem writer: Laurent Lardinois
last updated: 1998-03-16