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

📄 video.asm

📁 分形源程序集合 分形源程序集合 分形源程序集合
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;       Generic assembler routines having to do with video adapter
;
; ---- Video Routines
;
;       setvideomode()
;       setvideotext()
;       getcolor()
;       putcolor_a()
;       gettruecolor()
;       puttruecolor()
;       out_line()
;       drawbox()
;       home()
;       movecursor()
;       keycursor()
;       putstring()
;       setattr()
;       scrollup()
;       scrolldown()
;       putstr()
;       loaddac()
;       spindac()
;       adapter_init
;       adapter_detect
;       setnullvideo
;
; ---- Help (Video) Support
;
;       setfortext()
;       setforgraphics()
;       setclear()
;       findfont()
;

;                        required for compatibility if Turbo ASM
IFDEF ??version
        MASM51
        QUIRKS
ENDIF

        .MODEL  medium,c

        .8086

        ; these must NOT be in any segment!!
        ; this get's rid of TURBO-C fixup errors

        extrn   startvideo:far          ; start your-own-video routine
        extrn   readvideo:far           ; read  your-own-video routine
        extrn   writevideo:far          ; write your-own-video routine
        extrn   endvideo:far            ; end   your-own-video routine
        extrn   readvideopalette:far    ; read-your-own-palette routine
        extrn   writevideopalette:far   ; write-your-own-palette routine

        extrn   startdisk:far           ; start disk-video routine
        extrn   readdisk:far            ; read  disk-video routine
        extrn   writedisk:far           ; write disk-video routine
        extrn   enddisk:far             ; end   disk-video routine

        extrn   buzzer:far              ; nyaah, nyaah message

        extrn   getakey:far             ; for keycursor routine
        extrn   keypressed:far          ;  ...

; TARGA 28 May 80 - j mclain
        extrn   StartTGA  :far          ; start TARGA
        extrn   ReadTGA   :far          ; read  TARGA
        extrn   WriteTGA  :far          ; write TARGA
        extrn   EndTGA    :far          ; end   TARGA
        extrn   ReopenTGA :far          ; restart TARGA

; TARGA+ Mark Peterson 2-12-91
        extrn   MatchTPlusMode:far
        extrn   CheckForTPlus:far
        extrn   WriteTPlusBankedPixel:far
        extrn   ReadTPlusBankedPixel:far
        extrn   TPlusLUT:far

; 8514/A routines               ; changed 8514/A routines to near JCO 4/11/92
;   And back to far, JCO 4/13/97
        extrn   open8514  :far     ; start 8514a
        extrn   reopen8514:far     ; restart 8514a
        extrn   close8514 :far     ; stop 8514a
        extrn   fr85wdot  :far     ; 8514a write dot
        extrn   fr85wbox  :far     ; 8514a write box
        extrn   fr85rdot  :far     ; 8514a read dot
        extrn   fr85rbox  :far     ; 8514a read box
        extrn   w8514pal  :far     ; 8514a pallete update

; HW Compatible 8514/A routines    ; AW, made near JCO 4/11/92
;   And back to far, JCO 4/13/97
        extrn   open8514hw  :far      ; start 8514a
        extrn   reopen8514hw:far      ; restart 8514a
        extrn   close8514hw :far      ; stop 8514a
        extrn   fr85hwwdot  :far      ; 8514a write dot
        extrn   fr85hwwbox  :far      ; 8514a write box
        extrn   fr85hwrdot  :far      ; 8514a read dot
        extrn   fr85hwrbox  :far      ; 8514a read box
        extrn   w8514hwpal  :far      ; 8514a pallete update

; Hercules Routines
        extrn   inithgc   :far      ; Initialize Hercules card graphics mode
        extrn   termhgc   :far      ; Terminate Hercules card graphics mode
        extrn   writehgc  :far      ; Hercules write dot
        extrn   readhgc   :far      ; Hercules read dot

; setforgraphics/setfortext textsafe=save
        extrn   savegraphics    :far
        extrn   restoregraphics :far

.DATA

; ************************ External variables *****************************

        extrn   oktoprint: word         ; flag: == 1 if printf() will work
        extrn   videoentry:byte         ; video table entry flag
        extrn   dotmode: word           ; video mode (see the comments
                                        ; in front of the internal video
                                        ; table for legal dot modes)
        extrn   textsafe2: word         ; textsafe over-ride from videotable

        extrn   sxdots:word,sydots:word ; physical screen number of dots
        extrn   sxoffs:word,syoffs:word ; logical screen top left
        extrn   colors:word             ; colors
        extrn   cyclelimit:word         ; limiting factor for DAC-cycler
        extrn   debugflag:word          ; for debugging purposes only

        extrn   boxcount:word           ; (previous) box pt counter: 0 if none.

        extrn   cpu:word                ; CPU type (86, 186, 286, or 386)
        extrn   extraseg:word           ; location of the EXTRA segment

        extrn   suffix:word             ; (safe place during video-mode switches)

        extrn   swaplength:word         ; savegraphics/restoregraphics stuff
        extrn   swapoffset:dword        ; ...
        extrn   swapvidbuf:dword        ; ...
        extrn   swaptotlen:dword        ; ...

        extrn   rotate_lo:word, rotate_hi:word

        extrn   bios_palette:word
        extrn   paldata:byte

        extrn   xdots:word
        extrn   ydots:word
        extrn   colors:word
        extrn   NonInterlaced:word
        extrn   PixelZoom:word
        extrn   MaxColorRes:word
        extrn   TPlusFlag:WORD          ; TARGA+ Mark Peterson 2-12-91
        extrn   ai_8514:byte            ;flag for 8514a afi JCO 4/11/92

; ************************ Public variables *****************************

public          andcolor                ; used by 'calcmand'
public          videotable
public          loadPalette             ; flag for loading VGA/TARGA palette from disk
public          dacbox                  ; GIF saves use this
public          daclearn, daccount      ; Rotate may want to use this
public          rowcount                ; row-counter for decoder and out_line
public          gotrealdac              ; loaddac worked, really got a dac
public          reallyega               ; "really an EGA" (faking a VGA) flag
public          diskflag                ; disk video active flag
public          video_type              ; video adapter type
public          svga_type               ; SuperVGA video adapter type
public          mode7text               ; for egamono and hgc
public          textaddr                ; text segment
public          textsafe                ; setfortext/setforgraphics logic
public          goodmode                ; video mode ok?
public          text_type               ; current mode's type of text
public          textrow                 ; current row in text mode
public          textcol                 ; current column in text mode
public          textrbase               ; textrow is relative to this
public          textcbase               ; textcol is relative to this

public          color_dark              ; darkest color in palette
public          color_bright            ; brightest color in palette
public          color_medium            ; nearest to medbright grey in palette

public          swapsetup               ; for savegraphics/restoregraphics

public          TPlusInstalled

public          vesa_detect             ; set to 0 to disable VESA-detection

public          vxdots                  ; virtual scan line length

public		istruecolor		; 1 if VESA truecolor mode, 0 otherwise

;               arrays declared here, used elsewhere
;               arrays not used simultaneously are deliberately overlapped

; ************************ Internal variables *****************************

vxdots          dw      0               ; virtual scan line length (bytes)

goodmode        dw      0               ; if non-zero, OK to read/write pixels
dotwrite        dw      0               ; write-a-dot routine:  mode-specific
dotread         dw      0               ; read-a-dot routine:   mode-specific
linewrite       dw      0               ; write-a-line routine: mode-specific
lineread        dw      0               ; read-a-line routine: mode-specific
swapsetup       dd      0               ; setfortext/graphics setup routine
andcolor        dw      0               ; "and" value used for color selection
color           db      0               ; the color to set a pixel
videoflag       db      0               ; special "your-own-video" flag
tgaflag         db      0               ; TARGA 28 May 89 - j mclain
loadPalette     db      0               ; TARGA/VGA load palette from disk

f85flag         db      0               ;flag for 8514a

HGCflag         db      0               ;flag for Hercules Graphics Adapter

TPlusInstalled  dw      0

xga_pos_base    dw      0               ; MCA Pos Base value
xga_cardid      dw      0               ; MCA Card ID value
xga_reg_base    dw      -1              ; XGA IO Reg Base (-1 means dunno yet)
xga_1mb         dd      0               ; XGA 1MB aperture address
xga_4mb         dd      0               ; XGA 4MB aperture address
xga_result      dw      0               ; XGA_detect result code
xga_isinmode    dw      0               ; XGA is in this mode right now
xga_iscolors    dw      0               ; XGA using this many colors (0=64K)
xga_clearvideo  db      0               ; set to 80h to prevent video-clearing
xga_loaddac     db      0               ; set to 1 to load 'dacbox' on modesw
xga_xdots       dw      0               ; pixels per scan line

                align   2
tmpbufptr       dd      0
color_dark      dw      0               ; darkest color in palette
color_bright    dw      0               ; brightest color in palette
color_medium    dw      0               ; nearest to medbright grey in palette
;                                       ; Zoom-Box values (2K x 2K screens max)
reallyega       dw      0               ; 1 if its an EGA posing as a VGA
gotrealdac      dw      0               ; 1 if loaddac has a dacbox
diskflag        dw      0               ; special "disk-video" flag
palettega       db      17 dup(0)       ; EGA palette registers go here
dacnorm         db      0               ; 0 if "normal" DAC update
daclearn        dw      0               ; 0 if "learning" DAC speed
daccount        dw      0               ; DAC registers to update in 1 pass
dacbox          db      773 dup(0)      ; DAC goes here
;;saved_dacreg  dw      0ffffh,0,0,0    ; saved DAC register goes here

orvideo         db      0               ; "or" value for setvideo
                align   2
rowcount        dw      0               ; row-counter for decoder and out_line

videomem        dw      0a000h          ; VGA videomemory
videoax         dw      0               ; graphics mode values: ax
videobx         dw      0               ; graphics mode values: bx
videocx         dw      0               ; graphics mode values: cx
videodx         dw      0               ; graphics mode values: dx

video_type      dw      0               ; actual video adapter type:
                                        ;   0  = type not yet determined
                                        ;   1  = Hercules
                                        ;   2  = CGA (assumed if nothing else)
                                        ;   3  = EGA
                                        ;   4  = MCGA
                                        ;   5  = VGA
                                        ;   6  = VESA (not yet checked)
                                        ;  11  = 8514/A (not yet checked)
                                        ;  12  = TIGA   (not yet checked)
                                        ;  13  = TARGA  (not yet checked)
svga_type       dw      0               ;  (forced) SVGA type
                                        ;   1 = ahead "A" type
                                        ;   2 = ATI
                                        ;   3 = C&T
                                        ;   4 = Everex
                                        ;   5 = Genoa
                                        ;   6 = Ncr
                                        ;   7 = Oak-Tech
                                        ;   8 = Paradise
                                        ;   9 = Trident
                                        ;  10 = Tseng 3000
                                        ;  11 = Tseng 4000
                                        ;  12 = Video-7
                                        ;  13 = ahead "B" type
                                        ;  14 = "null" type (for testing only)
mode7text       dw      0               ; nonzero for egamono and hgc
textaddr        dw      0b800h          ; b800 for mode 3, b000 for mode 7

⌨️ 快捷键说明

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