Код:
org 100h
mov ax,4F00h
mov di,VESAInfoBlock
int 10h
cmp ax,4Fh
je short @f
mov si,errorstr
jmp putstr
@@:
mov al,[major]
aam 10
add al,"0"
mov [majordigit],al
mov al,[minor]
aam 10
add al,"0"
mov [minordigit],al
mov si,vesastr
call putstr
cmp [major],2
jb short @f
inc si
call putstr
lds si,[productnameptr]
call putstr
push es
pop ds
@@:
lds si,[modelistptr]
xor dx,dx
jmp .start
.next:
push ds
push es
pop ds
add si,2
push si
inc dx
push dx
and dx,0Fh
jnz short @f
push cx
mov si,contstr
call putstr
mov ah,0
int 16h
pop cx
@@:
mov al,ch
call hexbyte
mov [high],ax
mov al,cl
call hexbyte
mov [low],ax
xor ax,ax ; for ancient versions
mov [width],ax
mov [height],ax
mov [depth],al
mov ax,4F01h
mov di,ModeInfoBlock
int 10h
mov si,term
cmp ax,4Fh
je short @f
mov word [si],"?"
jmp .display
@@:
mov ax,[width]
call usword
mov byte [si],"x"
inc si
mov ax,[height]
call usword
mov byte [si],"x"
inc si
mov al,[depth] ; ah=0
call usword
mov [si],ah
.display:
mov si,modestr
call putstr
pop dx
pop si
pop ds
.start:
mov cx,[si]
cmp cx,0FFFFh
jne short .next
push es
pop ds
mov si,exitstr
call putstr
mov ah,0
int 16h
ret
@@:
mov bx,7
mov ah,0Eh
push si
int 10h
pop si
inc si
putstr:
mov al,[si]
and al,al
jg short @b
ret
hexbyte:
aam 10h
cmp al,0Ah
sbb al,69h
das
xchg al,ah
cmp al,0Ah
sbb al,69h
das
ret
usword:
mov bx,10
xor cx,cx
@@:
xor dx,dx
div bx
inc cx
push dx
and ax,ax
jnz short @b
@@:
pop ax
add al,"0"
mov [si],al
inc si
loop @b
ret
errorstr:
db 13,10,"Cannot get VESA info!",32,0
vesastr:
db 13,10,"VESA ?.?",0,32,"on",32,0
label majordigit byte at vesastr+7
label minordigit byte at vesastr+9
modestr:
db 13,10,"0x????:",32,6+6+4 dup ?
label high word at modestr+4
label low word at modestr+6
label term word at modestr+10
contstr:
db 13,10,"Press any key to continue...",32,0
exitstr:
db 13,10,"Press any key to exit...",32,0
align 4
VESAInfoBlock:
db "VBE2"
rb 508
label minor byte at VESAInfoBlock+4
label major byte at VESAInfoBlock+5
label modelistptr dword at VESAInfoBlock+14
label productnameptr dword at VESAInfoBlock+26
ModeInfoBlock:
rb 256
label width word at ModeInfoBlock+18
label height word at ModeInfoBlock+20
label depth byte at ModeInfoBlock+25