.model small
.386
.stack
.data
a_table DB '0123456789ABCDEF'
ven db 0dh,0ah,'vid:','$'
.code
.startup
mov dx,offset ven
call chang
CLI
mov dx,0cf8h
mov eax,8000E000h ;bus=0 dev=1c fun=0
out dx,eax
mov dx,0cfch
in ax, dx
jmp $+2
call hexput
jmp $+2
jmp z
z:
mov dx,0cfdh
in ax, dx
jmp $+2
call hexput
jmp $+2
mov ah,4ch
int 21h
;------------------------------------------------
hexput:
push bx
push dx
push ax
mov bx,OFFSET a_table
mov cl,04h
shr al,cl
xlatb
mov dl,al
mov ah,02h
int 21h
pop ax
push ax
and al,00001111b
xlatb
mov dl,al
mov ah,02h
int 21h
mov ah,09h
int 21h
pop ax
pop dx
pop bx
ret
;--------------------------------------
chang:
mov ah,09h ;字串
int 21h
ret
;-------------------------------
.stack
.exit
end
3 个解决方案
#1
没有初始化ds,程序开头加上:
mov ax, @data
mov ds, ax
另外:
mov ah,09h
int 21h
pop ax
pop dx
pop bx
ret
这里调用int 21h之前没有给dx赋值。
mov ax, @data
mov ds, ax
另外:
mov ah,09h
int 21h
pop ax
pop dx
pop bx
ret
这里调用int 21h之前没有给dx赋值。
#2
在这里显示Vendor ID不能用int 21h的9号功能,要用这个功能,我给你举个例子:
.model small
.stack
.386
.data
var byte 'cnzdgs$' ;记得以美元符号$结尾
.code
main proc
mov ah,9
mov dx,offset var
int 21h
;返回DOS
mov ah,4ch
int 21h
main endp
end main
以下是一段显示Vendor ID的code,其他的请参阅自己写,生成执行档运行后会显示8086.
.model small
.stack
.386
.data
.code
main proc
mov eax,8000xf900h ;Device31,Function0,SB上没有D31,F3这种设备
mov dx,0cf8h
out dx,eax
mov dx,0cfch
in eax,dx ;读取信息
call show_ax ;show
mov ah,4ch
int 21h
main endp
;以十六进制show message
show_ax proc
push ax
mov al,ah
call show_al
pop ax
show_al::
push ax
shr al,4
call show_nibble
pop ax
show_nibble::
and al,0fh
add al,30h
cmp al,3ah
jc short @f
add al,7
@@:
call bios_display
ret
show_ax endp
bios_display proc
push ax
push bx
mov ah,0eh
mov bx,000fh
int 10h
pop bx
pop ax
ret
bios_display endp
end main
.model small
.stack
.386
.data
var byte 'cnzdgs$' ;记得以美元符号$结尾
.code
main proc
mov ah,9
mov dx,offset var
int 21h
;返回DOS
mov ah,4ch
int 21h
main endp
end main
以下是一段显示Vendor ID的code,其他的请参阅自己写,生成执行档运行后会显示8086.
.model small
.stack
.386
.data
.code
main proc
mov eax,8000xf900h ;Device31,Function0,SB上没有D31,F3这种设备
mov dx,0cf8h
out dx,eax
mov dx,0cfch
in eax,dx ;读取信息
call show_ax ;show
mov ah,4ch
int 21h
main endp
;以十六进制show message
show_ax proc
push ax
mov al,ah
call show_al
pop ax
show_al::
push ax
shr al,4
call show_nibble
pop ax
show_nibble::
and al,0fh
add al,30h
cmp al,3ah
jc short @f
add al,7
@@:
call bios_display
ret
show_ax endp
bios_display proc
push ax
push bx
mov ah,0eh
mov bx,000fh
int 10h
pop bx
pop ax
ret
bios_display endp
end main
#3
.startup
mov ax,@data
mov ds,ax
mov dx,offset ven
call chang
CLI
mov dx,0cf8h
mov eax,8000E000h ;bus=0 dev=1c fun=0
out dx,eax
mov dx,0cfch
in ax, dx
jmp $+2
call hexput
jmp $+2
jmp z
z:
mov dx,0cfdh
in ax, dx
jmp $+2
call hexput
jmp $+2
mov ah,4ch
int 21h
;------------------------------------------------
hexput:
push bx
push dx
push ax
;mov bx,OFFSET a_table
mov cl,04h
shr al,cl
xlatb
mov dl,al
mov ah,02h
int 21h
pop ax
push ax
and al,00001111b
xlatb
mov dl,al
mov ah,02h
int 21h
;mov ah,09h
; int 21h
pop ax
pop dx
pop bx
ret
mov ax,@data
mov ds,ax
mov dx,offset ven
call chang
CLI
mov dx,0cf8h
mov eax,8000E000h ;bus=0 dev=1c fun=0
out dx,eax
mov dx,0cfch
in ax, dx
jmp $+2
call hexput
jmp $+2
jmp z
z:
mov dx,0cfdh
in ax, dx
jmp $+2
call hexput
jmp $+2
mov ah,4ch
int 21h
;------------------------------------------------
hexput:
push bx
push dx
push ax
;mov bx,OFFSET a_table
mov cl,04h
shr al,cl
xlatb
mov dl,al
mov ah,02h
int 21h
pop ax
push ax
and al,00001111b
xlatb
mov dl,al
mov ah,02h
int 21h
;mov ah,09h
; int 21h
pop ax
pop dx
pop bx
ret
#1
没有初始化ds,程序开头加上:
mov ax, @data
mov ds, ax
另外:
mov ah,09h
int 21h
pop ax
pop dx
pop bx
ret
这里调用int 21h之前没有给dx赋值。
mov ax, @data
mov ds, ax
另外:
mov ah,09h
int 21h
pop ax
pop dx
pop bx
ret
这里调用int 21h之前没有给dx赋值。
#2
在这里显示Vendor ID不能用int 21h的9号功能,要用这个功能,我给你举个例子:
.model small
.stack
.386
.data
var byte 'cnzdgs$' ;记得以美元符号$结尾
.code
main proc
mov ah,9
mov dx,offset var
int 21h
;返回DOS
mov ah,4ch
int 21h
main endp
end main
以下是一段显示Vendor ID的code,其他的请参阅自己写,生成执行档运行后会显示8086.
.model small
.stack
.386
.data
.code
main proc
mov eax,8000xf900h ;Device31,Function0,SB上没有D31,F3这种设备
mov dx,0cf8h
out dx,eax
mov dx,0cfch
in eax,dx ;读取信息
call show_ax ;show
mov ah,4ch
int 21h
main endp
;以十六进制show message
show_ax proc
push ax
mov al,ah
call show_al
pop ax
show_al::
push ax
shr al,4
call show_nibble
pop ax
show_nibble::
and al,0fh
add al,30h
cmp al,3ah
jc short @f
add al,7
@@:
call bios_display
ret
show_ax endp
bios_display proc
push ax
push bx
mov ah,0eh
mov bx,000fh
int 10h
pop bx
pop ax
ret
bios_display endp
end main
.model small
.stack
.386
.data
var byte 'cnzdgs$' ;记得以美元符号$结尾
.code
main proc
mov ah,9
mov dx,offset var
int 21h
;返回DOS
mov ah,4ch
int 21h
main endp
end main
以下是一段显示Vendor ID的code,其他的请参阅自己写,生成执行档运行后会显示8086.
.model small
.stack
.386
.data
.code
main proc
mov eax,8000xf900h ;Device31,Function0,SB上没有D31,F3这种设备
mov dx,0cf8h
out dx,eax
mov dx,0cfch
in eax,dx ;读取信息
call show_ax ;show
mov ah,4ch
int 21h
main endp
;以十六进制show message
show_ax proc
push ax
mov al,ah
call show_al
pop ax
show_al::
push ax
shr al,4
call show_nibble
pop ax
show_nibble::
and al,0fh
add al,30h
cmp al,3ah
jc short @f
add al,7
@@:
call bios_display
ret
show_ax endp
bios_display proc
push ax
push bx
mov ah,0eh
mov bx,000fh
int 10h
pop bx
pop ax
ret
bios_display endp
end main
#3
.startup
mov ax,@data
mov ds,ax
mov dx,offset ven
call chang
CLI
mov dx,0cf8h
mov eax,8000E000h ;bus=0 dev=1c fun=0
out dx,eax
mov dx,0cfch
in ax, dx
jmp $+2
call hexput
jmp $+2
jmp z
z:
mov dx,0cfdh
in ax, dx
jmp $+2
call hexput
jmp $+2
mov ah,4ch
int 21h
;------------------------------------------------
hexput:
push bx
push dx
push ax
;mov bx,OFFSET a_table
mov cl,04h
shr al,cl
xlatb
mov dl,al
mov ah,02h
int 21h
pop ax
push ax
and al,00001111b
xlatb
mov dl,al
mov ah,02h
int 21h
;mov ah,09h
; int 21h
pop ax
pop dx
pop bx
ret
mov ax,@data
mov ds,ax
mov dx,offset ven
call chang
CLI
mov dx,0cf8h
mov eax,8000E000h ;bus=0 dev=1c fun=0
out dx,eax
mov dx,0cfch
in ax, dx
jmp $+2
call hexput
jmp $+2
jmp z
z:
mov dx,0cfdh
in ax, dx
jmp $+2
call hexput
jmp $+2
mov ah,4ch
int 21h
;------------------------------------------------
hexput:
push bx
push dx
push ax
;mov bx,OFFSET a_table
mov cl,04h
shr al,cl
xlatb
mov dl,al
mov ah,02h
int 21h
pop ax
push ax
and al,00001111b
xlatb
mov dl,al
mov ah,02h
int 21h
;mov ah,09h
; int 21h
pop ax
pop dx
pop bx
ret