汇编 – 如何在屏幕上以tasm打印SVGA信息?

我是装配和图形的完整初学者,任何帮助将不胜感激.我得到了svga信息,但是当我打印它时,它不会打印任何东西.如果有人能解释为什么那会很棒.这是代码.如果我已完成所需的解释,请告诉我

.MODEL SMALL
.STACK 64
.DATA
getinfo:
 VbeSignature       db  'VESA'   ; VESA
 VbeVersion         dw  0000h    ; Version
 OemStringPtr       dd  ?        ; Producer
 Capabilities       db  4 dup (?); Reserved
 VideoModePtr       dd  ?        ; Modes
 TotalMemory        dw  ?        ; Blocks
 OemSoftwareRev     dw  ?
 OemVendorNamePtr   dd  ?
 OemProductNamePtr  dd  ?
 OemProductRevPtr   dd  ?
 _Reserved_         db 222 dup (?)
 OemData            db 256 dup (?)

.CODE

Entry:

mov ax, @data   ;make DS point to our DATA ;segment
mov es, ax

mov ax, offset getinfo
mov es, ax
mov ax, 4f00h ;this is the call to read the svga info, and im assuming it is 
               ;stored in getinfo
mov di, offset getinfo
int 10h

xor bx, bx ;make bx zero
mov si, offset getinfo 

loopy:
    mov dl, [si + bx] ;dl is the char to print
    cmp dl, 24h
    je done
    push dx ;before calling print put all the arguments on the stack
    call print
    inc bx          ;point to next char   
    jmp loopy       ;loop if string not finished

jmp done

print:
    pop cx ;take the return address out of the stack
    pop dx ;take the character to print out of the stack
     mov ah, 02h 
        int 21h         ;ask DOS to output a single char
     jmp cx ;jump back to the return address

done:
    mov ax, 4c00h
    int 21h         ;DOS exit program with al = exit code

END Entry
好吧,我在我的档案中做了一些挖掘,发现了这个中断信息:

----------104F00-----------------------------
INT 10 - VESA SuperVGA BIOS - GET SuperVGA INFORMATION
    AX = 4F00h
    ES:DI -> 256-byte buffer for SuperVGA information (see below)
Return: AL = 4Fh function supported
    AH = status
        00h successful
        01h failed
SeeAlso: AX=4F01h,AX=7F00h

Format of SuperVGA information:
Offset  Size    Description
 00h  4 BYTEs   signature ('VESA')
 04h    WORD    VESA version number
 06h    DWORD   pointer to OEM name
        "761295520" for ATI
 0Ah  4 BYTEs   capabilities
 0Eh    DWORD   pointer to list of supported VESA and OEM video modes
        (list of words terminated with FFFFh)
 12h 238 BYTEs  reserved
----------104F01-----------------------------
INT 10 - VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION
    AX = 4F01h
    CX = SuperVGA video mode
    ES:DI -> 256-byte buffer mode information (see below)
Return: AL = 4Fh function supported
    AH = status
        00h successful
        01h failed
SeeAlso: AX=4F00h,AX=4F02h

Format of mode information:
Offset  Size    Description
 00h    WORD    mode attributes
        bit 0: mode supported
        bit 1: optional information available
        bit 2: BIOS output supported
        bit 3: set if color, clear if monochrome
        bit 4: set if graphics mode, clear if text mode
 02h    BYTE    window A attributes
        bit 0: exists
        bit 1: readable
        bit 2: writable
        bits 3-7 reserved
 03h    BYTE    window B attributes (as for window A)
 04h    WORD    window granularity in K
 06h    WORD    window size in K
 08h    WORD    start segment of window A
 0Ah    WORD    start segment of window B
 0Ch    DWORD   -> FAR window positioning function (equivalent to AX=4F05h)
 10h    WORD    bytes per scan line
---remainder is optional for VESA modes in v1.0/1.1, needed for OEM modes---
 12h    WORD    width in pixels
 14h    WORD    height in pixels
 16h    BYTE    width of character cell in pixels
 17h    BYTE    height of character cell in pixels
 18h    BYTE    number of memory planes
 19h    BYTE    number of bits per pixel
 1Ah    BYTE    number of banks
 1Bh    BYTE    memory model type
        00h text
        01h CGA graphics
        02h HGC graphics
        03h 16-color (EGA) graphics
        04h packed pixel graphics
        05h "sequ 256" (non-chain 4) graphics
        06h direct color (HiColor, 24-bit color)
        07h YUV
        08h-0Fh reserved for VESA
        10h-FFh OEM memory models
 1Ch    BYTE    size of bank in K
 1Dh    BYTE    number of image pages
 1Eh    BYTE    reserved (0)
---VBE v1.2+---
 1Fh    BYTE    red mask size
 20h    BYTE    red field position
 21h    BYTE    green mask size
 22h    BYTE    green field size
 23h    BYTE    blue mask size
 24h    BYTE    blue field size
 25h    BYTE    reserved mask size
 26h    BYTE    reserved mask position
 27h    BYTE    direct color mode info
 28h    BYTE    reserved (0)
----------104F02-----------------------------
INT 10 - VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE
    AX = 4F02h
    BX = mode
        bit 15 set means don't clear video memory
Return: AL = 4Fh function supported
    AH = status
        00h successful
        01h failed
SeeAlso: AX=4F01h,AX=4F03h

Values for VESA video mode:
 00h-FFh OEM video modes (see AH=00h)
 100h   640x400x256
 101h   640x480x256
 102h   800x600x16
 103h   800x600x256
 104h   1024x768x16
 105h   1024x768x256
 106h   1280x1024x16
 107h   1280x1024x256
 108h   80x60 text
 109h   132x25 text
 10Ah   132x43 text
 10Bh   132x50 text
 10Ch   132x60 text
---VBE v1.2---
 10Dh   320x200x32K
 10Eh   320x200x64K
 10Fh   320x200x16M
 110h   640x480x32K
 111h   640x480x64K
 112h   640x480x16M
 113h   800x600x32K
 114h   800x600x64K
 115h   800x600x16M
 116h   1024x768x32K
 117h   1024x768x64K
 118h   1024x768x16M
 119h   1280x1024x32K
 11Ah   1280x1024x64K
 11Bh   1280x1024x16M

Values for S3 OEM video mode:
 201h   640x480x256
 202h   800x600x16
 203h   800x600x256
 204h   1024x768x16
 205h   1024x768x256
 206h   1280x960x16
 208h   1280x1024x16
 301h   640x480x32K
----------104F03-----------------------------
INT 10 - VESA SuperVGA BIOS - GET CURRENT VIDEO MODE
    AX = 4F03h
Return: AL = 4Fh function supported
    AH = status
        00h successful
        01h failed
    BX = video mode (see AX=4F02h)
SeeAlso: AX=4F02h
----------104F04-----------------------------
INT 10 - VESA SuperVGA BIOS - SAVE/RESTORE SuperVGA VIDEO STATE
    AX = 4F04h
    DL = subfunction
        00h get state buffer size
        Return: BX = number of 64-byte blocks needed
        01h save video states
        ES:BX -> buffer
        02h restore video states
        ES:BX -> buffer
    CX = flags for states to save/restore
        bit 0: video hardware state
        bit 1: video BIOS data state
        bit 2: video DAC state
        bit 3: SuperVGA state
Return: AL = 4Fh function supported
    AH = status
        00h successful
        01h failed
----------104F05-----------------------------
INT 10 - VESA SuperVGA BIOS - CPU VIDEO MEMORY CONTROL
    AX = 4F05h
    BH = subfunction
        00h select video memory window
        DX = window address in video memory (in granularity units)
        01h get video memory window
        Return: DX = window address in video memory (in gran. units)
    BL = window number
        00h window A
        01h window B
Return: AL = 4Fh function supported
    AH = status
        00h successful
        01h failed
SeeAlso: AX=4F01h,AX=4F06h,AX=4F07h,AX=7000h/BX=0004h
----------104F06-----------------------------
INT 10 - VESA SuperVGA BIOS v1.1 - GET/SET LOGICAL SCAN LINE LENGTH
    AX = 4F06h
    BL = function
        00h set scan line length
        CX = desired width in pixels
        01h get scan line length
Return: AL = 4Fh if function supported
    AH = status
        00h successful
        01h failed
    BX = bytes per scan line
    CX = number of pixels per scan line
    DX = maximum number of scan lines
Notes:  if the desired width is not achievable, the next larger width will be
      set
    the scan line may be wider than the visible area of the screen
    this function is valid in text modes, provided that values are
      multiplied by the character cell width/height
SeeAlso: AX=4F01h,AX=4F05h,AX=4F07h
----------104F07BH00-------------------------
INT 10 - VESA SuperVGA BIOS v1.1 - GET/SET DISPLAY START
    AX = 4F07h
    BH = 00h (reserved)
    BL = 00h set display start
        CX = leftmost displayed pixel in scan line
        DX = first displayed scan line
       = 01h get display start
        Return: BH = 00h
            CX = leftmost displayed pixel in scan line
            DX = first displayed scan line
Return: AL = 4Fh if function supported
    AH = status
        00h successful
        01h failed
Note:   this function is valid in text modes, provided that values are
      multiplied by the character cell width/height
SeeAlso: AX=4F01h,AX=4F05h,AX=4F06h
----------104F08-----------------------------
INT 10 - VESA SuperVGA BIOS v1.2+ - GET/SET DAC PALETTE CONTROL
    AX = 4F08h
    BL = function
        00h set DAC palette width
        BH = desired number of bits per primary color
        01h get DAC palette width
Return: AL = 4Fh if function supported
    AH = status
    BH = current number of bits per primary (06h = standard VGA)
----------104FFF-----------------------------
INT 10 - VESA SuperVGA BIOS - Everex - TURN VESA ON/OFF
    AX = 4FFFh
    DL = new state (00h off, 01h on)
Return: AX = 0000h if successful

连同我的MS-DOS VESATEST.COM的NASM源代码(测试所有txt / gfx模式):

[BITS 16]
[ORG 100h]

[SEGMENT .text]         
main     push cs             ;init es,ds=cs
     pop  ds
     push cs
     pop  es
     call tabscr         ;init txtscr,mesages,tab format...

     push ds         ;tab init...from VESA driver tab of sup.modes
     mov  si,[cs:vesalst+0]
     lea  di,[tab]
     sub  bx,bx
modes0   mov  ds,[cs:vesalst+2]
     lodsw
     cmp  ax,65535
     jz   modes1
     call vesamod
     push si
     push cs
     pop  ds
     lea  si,[vesamodi]
     mov  cx,19
     rep  movsb
     pop  si
     inc  bx
     cmp  bx,3000        ;max number of video modes in table
     jnz  modes0
modes1   pop  ds
     mov  [tablen],bx

     mov  ax,0           ;init tab(beg/end)
     mov  [tabptr],ax
     call prtab
     call prkur
tabl0    mov  ax,256
     int  16h
     jz   tabl0
     mov  ax,0
     int  16h
     mov  [key],ax

     cmp  ax,4800h  ;up
     jnz  tabr0
     mov  ax,[tabbeg]
     cmp  ax,[tabptr]
     jz   tabr_a
     dec  word [tabptr]
     call prkur
     jmp  tabr0
tabr_a   mov  ax,[tabbeg]
     or   ax,ax
     jz   tabr0
     dec  ax
     dec  word [tabptr]
     call prtab
     call prkur

tabr0    mov  ax,[key]
     cmp  ax,4900h  ;pg-up
     jnz  tabr1
     mov  ax,[tabbeg]
     sub  ax,20
     jnc  tabr0a
     sub  ax,ax
tabr0a   call prtab
     mov  ax,[tabbeg]
     mov  [tabptr],ax
     call prkur

tabr1    mov  ax,[key]
     cmp  ax,5000h  ;down
     jnz  tabr2
     mov  ax,[tabend]
     dec  ax
     cmp  ax,[tabptr]
     jz   tabr1a
     inc  word [tabptr]
     call prkur
     jmp  tabr2
tabr1a   mov  ax,[tabend]
     cmp  ax,[tablen]
     jz   tabr2
     mov  ax,[tabbeg]
     inc  ax
     inc  word [tabptr]
     call prtab
     call prkur

tabr2    mov  ax,[key]
     cmp  ax,5100h  ;pg-down
     jnz  tabr3
     mov  ax,[tabbeg]
     add  ax,20
     call prtab
     mov  ax,[tabend]
     dec  ax
     mov  [tabptr],ax
     call prkur

tabr3    mov  ax,[key]
     cmp  al,13     ;enter
     jnz  tabr4
     call window
     call tabscr
     mov  ax,[tabbeg]
     call prtab
     call prkur

tabr4    mov  ax,[key]
     cmp  al,'A'
     jz  tabr4a
     cmp  al,'a'
     jnz  tabr5
tabr4a   lea  si,[tabdet]
         sub  di,di
         call print
         call detect
         call tabscr
     sub  ax,ax
     mov  [tabptr],ax
     call prtab
     call prkur

tabr5   

tabrx    mov  ax,[key]
     cmp  ax,11bh   ;esc
     jz   exit
     cmp  al,'q'    ;q,Q... just in case ESC is incompatible (scan code)
     jz   exit
     cmp  al,'Q'
     jz   exit
     jmp  tabl0
exit     mov  ax,3
         int  16
         ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Subroutines: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
detect   pusha
         lea  di,[tab]
         mov  ax,100h
         mov  bx,0
detect0  call vesamod
         lea  si,[vesamodi]
         cmp  [si+8],byte 0
         jz   detect1
         mov  cx,19
         rep  movsb
         inc  bx
detect1  inc  ax
         cmp  ax,3000+100h              ;max number of videomodes
         jnz  detect0
         mov  [tablen],bx
         popa
         ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
tabscr   pusha
     mov  ax,3
     int  16
     mov  ah,2
     sub  bh,bh
     mov  dx,25*256+0
     int  16
     lea  si,[log]       ;Spektra logo
     sub  di,di
     call print
     add  di,80*2        ;info about VESA ver and chip...
     call vesainf
     lea  si,[vesaver]
     call print
     add  di,10*2
     lea  si,[vesaoem]
     call print
     add  di,(160-10)*2
     lea  si,[tabmsg]    ;tab format
     call print
     popa
     ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
window   pusha
     push es
     lea  si,[tab]
     mov  ax,19
     mul  word [tabptr]  ;max 3k
     add  si,ax
     mov  ax,4f02h
     mov  bx,[si]
     int  16
     or   ah,ah
     jnz  win0

     mov  es,[si+13]     ;segment
     sub  di,di
     mov  ax,[si+9]      ;granularity [KB]
     mov  dx,1024
     mul  dx
     mov  [windat],ax    ;maxdi for bank
     mov  bx,[si+2]      ;x
     mov  dx,[si+4]      ;y

     sub  al,al
     mov  [winpag],al
     call vesabank
     mov  cx,dx
     mov  al,[si+7]
     cmp  al,0
     jz   wintxt
     mov  al,[si+6]

     cmp  al,4
     jz   winr4     ;render 4.bits
     cmp  al,8
     jz   winr8     ;... 8
     cmp  al,16
     jz   winr16    ;... 16
     cmp  al,24
     jz   winr24    ;... 24
     cmp  al,32
     jz   winr32    ;... 32
         ;more bits not yet supotred...                     
     jmp  winx

wintxt   push word 0B800h    ;Some VESA cards returns wrong segment
         pop  es             ;they report 0A000h and should 0B800h !!!
         mov  cx,bx
         mov  ah,7
wintxt0  mov  al,cl
         add  al,dl
         stosw
         loop wintxt0
         dec  dx
         jnz  wintxt

winx     mov  ax,0
         int  16h
win0     pop  es
         popa
         ret
windat   dw 0
winpag   db 0,0    ;current,max
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; win renders: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
winr4    ;same as winr8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
winr8
winr8l1  mov  cx,bx
winr8l0  mov  al,cl
     add  al,dl
     stosb
     call winrpag
         loop winr8l0
     dec  dx
     jnz  winr8l1
     jmp  winx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
winr15   ;same as winr16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
winr16
winr16l1 mov  cx,bx
winr16l0 mov  ax,cx
     add  ax,dx
     xor  ax,cx
     stosb
     call winrpag
     xchg al,ah
     stosb
     call winrpag
         loop winr16l0
     dec  dx
     jnz  winr16l1
     jmp  winx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
winr24
winr24l1 mov  cx,bx
winr24l0 mov  al,cl
     stosb
     call winrpag
     add  al,cl
     stosb
     call winrpag
     add  al,cl
     stosb
     call winrpag
         loop winr24l0
     dec  dx
     jnz  winr24l1
     jmp  winx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
winr32
winr32l1 mov  cx,bx
winr32l0 mov  al,cl
     stosb
     call winrpag
     xor  al,ch
     stosb
     call winrpag
     add  al,dl
     stosb
     call winrpag
     xor  al,dh
     stosb
     call winrpag
         loop winr32l0
     dec  dx
     jnz  winr32l1
     jmp  winx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
winrpag  cmp  di,[windat]
     jnz  winrpagr
     sub  di,di
     inc  byte [winpag]
     mov  al,[winpag]
     call vesabank
winrpagr ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
prkur    pusha          ;set attr according to tab:beg/end/ptr
         push es
     push word 0B800h
     pop  es
     mov  di,(5*80)*2+1
     mov  bx,[tabbeg]
     mov  dx,[tabend]
     mov  al,7
     mov  cx,72
perkur1  pusha
     cmp  bx,[tabptr]
     jnz  perkur0
     shl  al,4
perkur0  stosb
     inc  di
     loop perkur0
     popa
     add  di,80*2
     inc  bx
     cmp  bx,dx
     jnz  perkur1
     pop  es
     popa
     ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
prtab    pusha          ;ax=start line of tab
     cmp  ax,[tablen]
     jb   prtab0
     sub  ax,20
     jnc  prtab0
     sub  ax,ax
prtab0   lea  si,[tab]
     mov  di,(5*80+4)*2
     mov  cx,20
     mov  bx,19
     mov  [tabbeg],ax
     xchg ax,bx
     mul  bx        ;bx must be less than 64k/19...max 3k
     add  si,ax
prtab1   call prmodinf
     add  di,80*2
     add  si,19
     inc  bx
     mov  [tabend],bx
     cmp  bx,[tablen]
     jz   prtab2
     loop prtab1
     popa
     ret
prtab2   push es
         push word 0B800h
         pop  es
         mov  ax,0720h
prtab2l  mov  cx,80
     rep  stosw
     cmp  di,80*25*2
     jb   prtab2l
     pop  es
     popa
     ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
prmodinf pusha               ;mode [si] >>scr>> [di]
     push di
     lea  di,[cache]
     mov  al,32
     mov  cx,80
     rep  stosb
     lea  di,[cache]
     lodsw               ;mod num
     call numhex
     add  di,6
     lodsw               ;x
     call numdec
     add  di,6
     mov  al,'x'
     stosb
     lodsw               ;y
     call numdec
     add  di,6
     sub  ah,ah
     lodsb               ;bits
     call numdec
     add  di,6
     mov eax,'bits'
     stosd
     lodsw               ;text/graphic,suport yes/no
     mov  bx,ax
     mov  eax,' txt'
     or   bl,bl
     jz   prmodi0
     mov  eax,' gfx'
prmodi0  stosd
     mov  eax,' Yes'
     or   bh,bh
     jnz  prmodi1
     mov  eax,' No '
prmodi1  stosd
     add  di,2
     lodsw               ;granularity
     call numdec
     add  di,6
     mov  eax,'KB  '
     stosd
     lodsw               ;bank size
     call numdec
     add  di,6
     mov  eax,'KB  '
     stosd
     lodsw               ;segment
     call numhex
     add  di,5
     mov al,0
     stosb
     lea  si,[cache]
     pop  di
     call print
     popa
     ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Vesa: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
vesainf  push es        ;init info of VESA(oem name,version,list of modes).
     push ds
     pusha
     push cs
     pop  es
     lea  di,[cache]
     mov  ax,4f00h
     int  16
     or   ah,ah          ;error ?
     jnz  vesainf0
     mov  ds,[cs:cache+8] ;copy VESA OEM name
     mov  si,[cs:cache+6]
     lea  di,[vesaoem]
     mov  cx,32
     rep  movsb
     push cs             ;iba ak je format VESA ver: hi.lo  !!!
     pop  ds
     lea  si,[cache+4]
     lea  di,[vesaver+5]
     lodsw
     xchg al,ah
     add  ax,3030h
     stosb
     mov  al,'.'
     stosw
     lea si,[cache+0eh]  ;list videomodov
     lea di,[vesalst]
     movsd
vesainf0 popa
     pop  ds
     pop  es
     ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
vesamod  pusha          ;init info of videomode AX
     push es
     push ds
     push cs
     pop  es
     push cs
     pop  ds
     lea  di,[vesamodi]  ;mode num
     stosw
     lea  di,[cache]
     mov  cx,ax
     mov  ax,4f01h
     int  16
     or   ah,ah
     jnz  vesamod1
     lea  si,[cache+12h] ;x,y resolution
     lea  di,[vesamodi+2]
     movsd
     lea  si,[cache+19h] ;bits
     movsb
     lea  si,[cache+1bh] ;memory model (0=text)
     movsb
     lea  si,[cache]     ;support=1
     and  [si],byte 1
     movsb
     lea  si,[cache+4]   ;window:granularity,size[Kb],segment
     movsd
     movsw
vesamod0 pop  ds
     pop  es
     popa
     ret
vesamod1 lea  di,[vesamodi+2]     ;reset if error
     mov  cx,13
     mov  al,0
     rep  stosb
     jmp  vesamod0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
vesabank pusha               ;al=page  switch vesa video page
     mov  dl,al
     sub  dh,dh
     sub  bx,bx
     mov  ax,4f05h       ; window A
     int  16
     popa
     ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
vesaver  db   'VESA xxx',0                            ;version
vesaoem  db   'No VESA driver or error.        ',0    ;name 32 chars+`\0`
vesalst  dw   0,0                                     ;address of list of modes
vesamodi dw   0,0,0                                   ;mod,x,y
     db   0,0,0                                   ;bits,gfx=1,suport=1
     dw   0,0,0                                   ;win:granul,size,segment
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Text: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
print   pusha           ;ds:si >>> es:di
    push    es
    push    word 0B800h
    pop     es
print1  lodsb
    or      al,al
    jz      print0
    stosb
    inc     di
    jmp     print1
print0  pop     es
    popa
    ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
numhex  pusha       ;ax[num] >>> es:di[text/hex]
    mov     bx,ax
    mov     al,bh
    shr     al,4
    call    numhex0
    mov     al,bh
    and     al,15
    call    numhex0
    mov     al,bl
    shr     al,4
    call    numhex0
    mov     al,bl
    and     al,15
    call    numhex0
    mov     ax,'h '
    stosw
    sub     al,al
    stosb
    popa
    ret
numhex0 cmp     al,9
    ja      numhex1
    add     al,'0'-'A'+10
numhex1 add     al,'A'-10
    stosb
    ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
numdec  pusha           ;ax[num] >>> es:di[text/dec]
    sub     bl,bl   ;sign of zeroes...(0/space)
    mov     cx,10000
    call    numdec0
    mov     cx,1000
    call    numdec0
    mov     cx,100
    call    numdec0
    mov     cx,10
    call    numdec0
    add     al,'0'
    stosb
    mov     ax,' '
    stosw
    popa
    ret
numdec0 mov     dx,0
    div     cx
    or      al,al
    jnz     numdec1
    or      bl,bl
    jnz     numdec1
    mov     al,' '
    stosb
    mov     ax,dx
    ret
numdec1 inc     bl
    add     al,'0'
    stosb
    mov     ax,dx
    ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Data: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
key  dw   0
tabdet   db   'Detecting VESA videomodes 0100h..0CB8h   ... please wait ...                  ',0
log      db   'Spektra software & hardware VESA mode detector 1.2    Press A for auto detect.',0
tabmsg   db   '     mode   resolution     colors   support   granul.   bank  segment',0
tablen   dw   0    ;pocet riadkov-1
tabbeg   dw   0    ;zac.vypisanej tab
tabend   dw   0    ;kon.vypisanej tab
tabptr   dw   0    ;ptr.vypisanej tab
tab      ;modes tab 19*n bytes ... for now n=3000
cache    equ  250*256 ;buffer for all... min 256b...stack is on its topside
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; End. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

并预览:

preview

您可以从中提取您想要的内容,只需记住源代码在NASM中,因此TASM有一些语法差异……

相关文章
相关标签/搜索