⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video.asm

📁 分形源程序集合 分形源程序集合 分形源程序集合
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;               29) True Color Auto-Detect

;       (Several entries have been commented out - they should/did work,
;       but are handled by alternative entries.  Where multiple SuperVGA
;       entries are covered by a single SuperVGA Autodetect mode, the
;       individual modes have been commented out.  Where a SuperVGA
;       Autodetect mode covers only one brand of adapter, the Autodetect
;       mode has been commented out to avoid confusion.)

;               |--Adapter/Mode-Name------|-------Comments-----------|

;               |------INT 10H------|Dot-|--Resolution---|
;           |key|--AX---BX---CX---DX|Mode|--X-|--Y-|Color|

        db      "IBM 16-Color EGA         ",0,"Standard EGA hi-res mode ",0
        dw 1060,  10h,   0,   0,   0,   2, 640, 350,  16
        db      "IBM 256-Color VGA/MCGA   ",0,"Quick and LOTS of colors ",0
        dw 1061,  13h,   0,   0,   0,   3, 320, 200, 256
        db      "IBM 16-Color VGA         ",0,"Nice high resolution     ",0
        dw 1062,  12h,   0,   0,   0,   2, 640, 480,  16
        db      "IBM 4-Color CGA          ",0,"(Ugh - Yuck - Bleah)     ",0
        dw 1063,   4h,   0,   0,   0,  13, 320, 200,   4
        db      "IBM Hi-Rez B&W CGA       ",0,"('Hi-Rez' Ugh - Yuck)    ",0
        dw 1064,   6h,   0,   0,   0,  13, 640, 200,   2
        db      "IBM B&W EGA              ",0,"(Monochrome EGA)         ",0
        dw 1065,  0fh,   0,   0,   0,   2, 640, 350,   2
        db      "IBM B&W VGA              ",0,"(Monochrome VGA)         ",0
        dw 1066,  11h,   0,   0,   0,   2, 640, 480,   2
        db      "IBM Low-Rez EGA          ",0,"Quick but chunky         ",0
        dw 1067,  0dh,   0,   0,   0,   2, 320, 200,  16
        db      "IBM VGA (non-std)        ",0,"Register Compatibles ONLY",0
        dw 1068,   0h,   0,   0,   9,   7, 320, 400, 256
        db      "IBM VGA (non-std)        ",0,"Register Compatibles ONLY",0
        dw 1084,   0h,   0,   0,   8,   7, 360, 480, 256
        db      "SuperVGA/VESA Autodetect ",0,"Works with most SuperVGA ",0
        dw 1085,    0,   0,   0,   0,  27, 800, 600,  16
        db      "SuperVGA/VESA Autodetect ",0,"Works with most SuperVGA ",0
        dw 1086,    0,   0,   0,   0,  27,1024, 768,  16
        db      "SuperVGA/VESA Autodetect ",0,"Works with most SuperVGA ",0
        dw 1087,    0,   0,   0,   0,  27, 640, 400, 256
        db      "SuperVGA/VESA Autodetect ",0,"Works with most SuperVGA ",0
        dw 1088,    0,   0,   0,   0,  27, 640, 480, 256
        db      "SuperVGA/VESA Autodetect ",0,"Works with most SuperVGA ",0
        dw 1089,    0,   0,   0,   0,  27, 800, 600, 256
        db      "SuperVGA/VESA Autodetect ",0,"Works with most SuperVGA ",0
        dw 1090,    0,   0,   0,   0,  27,1024, 768, 256
        db      "VESA Standard interface  ",0,"OK: Andy Fu - Chips&Tech ",0
        dw 1091,4f02h,106h,   0,   0,  28,1280,1024,  16
        db      "VESA Standard interface  ",0,"OK: Andy Fu - Chips&Tech ",0
        dw 1092,4f02h,107h,   0,   0,  28,1280,1024, 256
        db      "8514/A Low  Res          ",0,"HW/AI (AI Reqs HDILOAD)  ",0
        dw 1093,   3h,   0,   0,   1,  12, 640, 480, 256
        db      "8514/A High Res          ",0,"HW/AI (AI Reqs HDILOAD)  ",0
        dw 1094,   3h,   0,   0,   1,  12,1024, 768, 256
        db      "8514/A Low  W/Border     ",0,"HW/AI (AI Reqs HDILOAD)  ",0
        dw 1095,   3h,   0,   0,   1,  12, 632, 474, 256
        db      "8514/A High W/Border     ",0,"HW/AI (AI Reqs HDILOAD)  ",0
        dw 1096,   3h,   0,   0,   1,  12,1016, 762, 256
        db      "IBM Med-Rez EGA          ",0,"(Silly but it's there!)  ",0
        dw 1097,  0eh,   0,   0,   0,   2, 640, 200,  16
        db      "IBM VGA (non-std)        ",0,"Register Compatibles ONLY",0
        dw 1098,   0h,   0,   0,  18,   7, 320, 480, 256
        db      "Hercules Graphics        ",0,"OK: Timothy Wegner       ",0
        dw 1099,   8h,   0,   0,   0,  10, 720, 348,   2
        db      "Tandy 1000               ",0,"OK: Joseph Albrecht      ",0
        dw 1100,   9h,   0,   0,   0,  14, 320, 200,  16
        db      "Pdise/AST/COMPAQ VGA     ",0,"OK: Phil Wilson          ",0
        dw 1101,  59h,   0,   0,   0,   1, 800, 600,   2
        db      140     dup(0)  ; 2 unused slots here default table
        db      "Disk/RAM 'Video'         ",0,"Full-Page L-Jet @  75DPI ",0
        dw 1104,   3h,   0,   0,   0,  11, 800, 600,   2
        db      "Disk/RAM 'Video'         ",0,"Full-Page L-Jet @ 150DPI ",0
        dw 1105,   3h,   0,   0,   0,  11,1600,1200,   2
        db      "Disk/RAM 'Video'         ",0,"Full-Page Epson @ 120DPI ",0
        dw 1106,   3h,   0,   0,   0,  11, 768, 960,   2
        db      "Disk/RAM 'Video'         ",0,"Full-Page Paintjet 90DPI ",0
        dw 1107,   3h,   0,   0,   0,  11, 960, 720, 256
        db      "Disk/RAM 'Video'         ",0,"For Background Fractals  ",0
        dw 1108,   3h,   0,   0,   0,  11, 800, 600, 256
        db      "Disk/RAM 'Video'         ",0,"For Background Fractals  ",0
        dw 1109,   3h,   0,   0,   0,  11,2048,2048, 256
        db      280     dup(0)  ; 4 unused slots here default table
        db       70     dup(0)  ; 1 slot reserved for unassigned current mode


bios_savebuf db 256 dup(0)  ; enough for 4 blocks (64 bytes/block)

.code

;               XGA Graphics mode setup values
;               (the first two entries in each line
;               indicate where the table values are to be stored)
;
;               1024x768x256 vvv
;               1024x768x16  -----vvvv
;               640x480x256  -----------vvvv
;               640x480x65536 ----------------vvvv
;               800x600x16   -----------------------vvvv
;               800x600x256  -----------------------------vvvv
;               800x600x65536 ----------------------------------vvvv

xga_twidth dw   9                                       ; width of these tables

xga_requir dw      0,    0,  0dh,  05h,  01h,  09h,  01h,  01h,  09h    ; adapter requirements
xga_colors dw      0,    0,  256,   16,  256,    0,   16,  256,    0    ; 0 means 64K colors
xga_swidth dw      0,    0, 1024,  512,  640, 1280,  400,  800, 1600    ; bytes / scan line

xga_val db      004h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; interrupt enable
        db      005h, 000h, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh    ; interrupt status
        db      000h, 000h, 004h, 004h, 004h, 004h, 004h, 004h, 004h    ; operating mode
        db      00ah, 064h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; palette mask
        db      001h, 000h, 001h, 001h, 001h, 001h, 001h, 001h, 001h    ; vid mem aper cntl
        db      008h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; vid mem aper indx
        db      006h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; virt mem ctl
        db      009h, 000h, 003h, 002h, 003h, 004h, 002h, 003h, 004h    ; mem access mode
        db      00ah, 050h, 001h, 001h, 001h, 001h, 001h, 001h, 001h    ; disp mode 1
        db      00ah, 050h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; disp mode 1
        db      00ah, 010h, 09dh, 09dh, 063h, 063h, 088h, 088h, 088h    ; horiz tot lo.
        db      00ah, 011h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; horiz tot hi.
        db      00ah, 012h, 07fh, 07fh, 04fh, 04fh, 063h, 063h, 063h    ; hor disp end lo
        db      00ah, 013h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; hor disp end hi
        db      00ah, 014h, 080h, 080h, 050h, 050h, 064h, 064h, 064h    ; hor blank start lo
        db      00ah, 015h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; hor blank start hi
        db      00ah, 016h, 09ch, 09ch, 062h, 062h, 087h, 087h, 087h    ; hor blank end lo
        db      00ah, 017h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; hor blank end hi
        db      00ah, 018h, 087h, 087h, 055h, 055h, 06ah, 06ah, 06ah    ; hor sync start lo
        db      00ah, 019h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; hor sync start hi
        db      00ah, 01ah, 09ch, 09ch, 061h, 061h, 084h, 084h, 084h    ; hor sync end lo
        db      00ah, 01bh, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; hor sync end hi
        db      00ah, 01ch, 040h, 040h, 000h, 000h, 000h, 000h, 000h    ; hor sync pos
        db      00ah, 01eh, 004h, 004h, 000h, 000h, 000h, 000h, 000h    ; hor sync pos
        db      00ah, 020h, 030h, 030h, 00ch, 00ch, 086h, 086h, 086h    ; vert tot lo
        db      00ah, 021h, 003h, 003h, 002h, 002h, 002h, 002h, 002h    ; vert tot hi
        db      00ah, 022h, 0ffh, 0ffh, 0dfh, 0dfh, 057h, 057h, 057h    ; vert disp end lo
        db      00ah, 023h, 002h, 002h, 001h, 001h, 002h, 002h, 002h    ; vert disp end hi
        db      00ah, 024h, 000h, 000h, 0e0h, 0e0h, 058h, 058h, 058h    ; vert blank start lo
        db      00ah, 025h, 003h, 003h, 001h, 001h, 002h, 002h, 002h    ; vert blank start hi
        db      00ah, 026h, 02fh, 02fh, 00bh, 00bh, 085h, 085h, 085h    ; vert blank end lo
        db      00ah, 027h, 003h, 003h, 002h, 002h, 002h, 002h, 002h    ; vert blank end hi
        db      00ah, 028h, 000h, 000h, 0eah, 0eah, 058h, 058h, 058h    ; vert sync start lo
        db      00ah, 029h, 003h, 003h, 001h, 001h, 002h, 002h, 002h    ; vert sync start hi
        db      00ah, 02ah, 008h, 008h, 0ech, 0ech, 06eh, 06eh, 06eh    ; vert sync end
        db      00ah, 02ch, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh    ; vert line comp lo
        db      00ah, 02dh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh    ; vert line comp hi
        db      00ah, 036h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; sprite cntl
        db      00ah, 040h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; start addr lo
        db      00ah, 041h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; start addr me
        db      00ah, 042h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; start addr hi
        db      00ah, 043h, 080h, 040h, 050h, 0a0h, 032h, 064h, 0c8h    ; pixel map width lo
        db      00ah, 044h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; pixel map width hi
        db      00ah, 054h, 00dh, 00dh, 000h, 000h, 001h, 001h, 001h    ; clock sel
        db      00ah, 051h, 003h, 002h, 003h, 004h, 002h, 003h, 004h    ; display mode 2
        db      00ah, 070h, 000h, 000h, 000h, 000h, 080h, 080h, 080h    ; ext clock sel
        db      00ah, 050h, 00fh, 00fh, 0c7h, 0c7h, 007h, 007h, 007h    ; display mode 1
        db      00ah, 055h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; Border Color
        db      00ah, 060h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; Sprite Pal Lo
        db      00ah, 061h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; Sprite Pal hi
        db      00ah, 062h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; Sprite Pre Lo
        db      00ah, 063h, 000h, 000h, 000h, 000h, 000h, 000h, 000h    ; Sprite Pre hi
        db      00ah, 064h, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh    ; Palette Mask
        db      0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh    ; end of the list


xga_newbank     proc                    ; XGA-specific bank-switching routine
        cmp     xga_isinmode,2          ; are we in an XGA-specific mode?
        jl      return                  ;  nope.  bail out.
        mov     curbk,ax                ; save the new current bank value
        mov     dx,xga_reg_base         ; Select Page
        add     dx,08h
        out     dx,al                   ; assumes bank number is in al
return: ret
xga_newbank     endp

xga_16linewrite proc    near            ; 16-color Line Write
        mov     bx,ax                   ; calculate the # of columns
        sub     bx,cx
        mov     ax,xga_xdots            ; this many dots / line
        mul     dx                      ; times this many lines - ans in dx:ax
        push    cx                      ; save the X-value for a tad
        shr     cx,1                    ; and adjust for two bits per pixel
        add     ax,cx                   ; plus this many x-dots
        adc     dx,0                    ; answer in dx:ax - dl=bank, ax=offset
        mov     di,ax                   ; save offset in DI
        pop     cx                      ; restore the X-value
        mov     ax,dx                   ; xga_newbank expects bank in al
new_bank:
        call    far ptr xga_newbank
same_bank:
        mov     ah,es:[di]              ; grab the old byte value
        mov     al,[si]                 ; and the new color value
        and     al,0fh                  ; isolate the bits we want
        test    cx,1                    ; odd pixel address?
        jnz     xga_sk1                 ;  yup
        and     ah,0f0h                 ; isolate the low-order
        jmp     short   xga_sk2
xga_sk1:and     ah,0fh                  ; isolate the high-order
        shl     al,1
        shl     al,1
        shl     al,1
        shl     al,1
xga_sk2:or      al,ah                   ; combine the two nibbles
        mov     es:[di],al              ; write the dot
        inc     si                      ; increment the source addr
        dec     bx                      ; more to go?
        jz      done                    ; nope
        inc     cx                      ; next pixel
        test    cx,1                    ; odd pixel?
        jnz     same_bank               ;  yup
        inc     di                      ; increment the destination
        cmp     di,0                    ; segment wrap?
        jnz     same_bank               ;  nope
        mov     ax,curbk                ; update the bank cvalue
        inc     ax
        jmp     new_bank
done:   ret
xga_16linewrite         endp

xga_super16addr proc near               ; can be put in-line but shared by
                                        ; read and write routines
        clc                             ; clear carry flag
        push    ax                      ; save this for a tad
        mov     ax,xga_xdots            ; this many dots / line
        mul     dx                      ; times this many lines - ans in dx:ax
        push    cx                      ; save the X-value for a tad
        shr     cx,1                    ; and adjust for two bits per pixel
        add     ax,cx                   ; plus this many x-dots
        adc     dx,0                    ; answer in dx:ax - dl=bank, ax=offset
        pop     cx                      ; restore the X-value
        mov     bx,ax                   ; save this in BX
        cmp     dx,curbk                ; see if bank changed
        je      same_bank               ; jump if old bank ok
        mov     ax,dx                   ; xga_newbank expects bank in al
        call    far ptr xga_newbank
same_bank:
        pop     ax                      ; restore AX
        ret
xga_super16addr endp

xga_16write     proc near               ; XGA 256 colors write-a-dot
        call    xga_super16addr         ; calculate address and switch banks
        mov     ah,es:[bx]              ; grab the old byte value
        and     al,0fh                  ; isolate the bits we want
        test    cx,1                    ; odd pixel address?
        jnz     xga_sk1                 ;  yup
        and     ah,0f0h                 ; isolate the low-order
        jmp     short   xga_sk2
xga_sk1:and     ah,0fh                  ; isolate the high-order
        shl     al,1
        shl     al,1
        shl     al,1
        shl     al,1
xga_sk2:or      al,ah                   ; combine the two nibbles
        mov     es:[bx],al              ; write the dot
        ret                             ; we done.
xga_16write     endp

xga_16read      proc near               ; XGA 256 colors read-a-dot
        call    xga_super16addr         ; calculate address and switch banks
        mov     al,es:[bx]              ; read the dot
        test    cx,1                    ; odd number of pixels?
        jz      xga_sk1                 ;  nope
        shr     ax,1                    ; adjust for odd pixel count
        shr     ax,1
        shr     ax,1
        shr     ax,1
xga_sk1:and     ax,0fh                  ; isolate the byte value
        ret                             ; we done.
xga_16read      endp

xga_clear       proc    uses es si di   ; clear the XGA memory
        cmp     xga_clearvideo,0        ; should we really do this?
        jne     return                  ;  nope.  skip it.
        mov     bx,xga_result           ; find out how much memory we have
        and     bx,08h                  ;  in 64K pages
        add     bx,08h
        mov     ax,0a000h               ; set up to clear 0a0000-0affff
        push    ax
        pop     es
xloop:  mov     ax,bx                   ; initialize the bank addr
        call    xga_newbank
        mov     ax,0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -