jump macro selector,offsetv
db 0eah
dw offsetv
dw selector
endm
echoch macro ascii
mov ah,2
mov dl,ascii
int 21h
endm
descriptor struc
limitl dw 0
basel dw 0
basem db 0
attributes dw 0
baseh db 0
descriptor ends
pdesc struc
limit dw 0
base dd 0
pdesc ends
.386p
data segment use16
gdt label byte
dummy descriptor <>
code_des descriptor <0ffffh,0,0,98h,0>
code_sel = code_des - gdt
datad_des descriptor <0ffffh,0,0,92h,0>
datad_sel = datad_des - gdt
datas_des descriptor <0ffffh,0,11h,92h,0>
datas_sel = datas_des - gdt
gdtlen = $-gdt
vgdtr pdesc
bufferlen = 256
buffer db bufferlen dup(0)
data ends
code segment use16
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov bx,16
mul bx
add ax,offset gdt
adc dx,0
mov word ptr vgdtr.base,ax
mov word ptr vgdtr.base+2,dx
mov ax,cs
mul bx
mov code_des.basel,ax
mov code_des.basem,dl
mov code_des.baseh,dh
mov ax,ds
mul bx
add ax,offset buffer
adc dx,0
mov datad_des.basel,ax
mov datad_des.basem,dl
mov datad_des.baseh,dh
lgdt qword ptr vgdtr
clicall ea20
mov eax,cr0
or eax,1
mov cr0,eax
jump ,
virtual:
mov ax,datas_sel
mov ds,ax
mov ax,datad_sel
mov es,ax
cldxor si,si
xor di,di
mov cx,bufferlen/4
repz movsd
mov eax,cr0
and eax,0fffffffeh
mov cr0,eax
jump ,
real:
call da20
stimov ax,data
mov ds,ax
mov si,offset buffer
cldmov bp,bufferlen/16
nextline:
mov cx,16
nextch:
lodsb
push ax
shr al,4
call toascii
echoch al
pop ax
call toascii
echoch al
echoch ' '
loop nextch
echoch 0dh
echoch 0ah
dec bp
jnz nextline
mov ah,4ch
int 21h
toascii proc
and al,0fh
add al,90h
daaadc al,40h
daaret
toascii endp
ea20 proc
push ax
in al,92h
or al,2
out 92h,al
pop ax
ret
ea20 endp
da20 proc
push ax
in al,92h
and al,0fdh
out 92h,ax
pop ax
retda20 endp
code ends
end start
楊季文 80x86組合語言程式設計 例項二
jump16 macro selector,offsetv db 0eah dw offsetv dw selector endm ju 2 macro selector,offsetv db 0eah dw offsetv dw 0 dw selector endm descriptor stru...
80x86組合語言 分類統計
組合語言的程式設計題!急 有100個學生成績,存放在以data為首址的位元組儲存單元中。試統計其中90 含90 以上的人數,60 90 含60 之間的人數,60以下的人數,分別存入max,middle,min三個變數中。15 分鐘前 做而論道 十七級 最快回答 assume ds qq,cs cc ...
組合語言 80x86定址方式
1 立即定址方式 立即定址方式中指令的運算元是8位或16位立即數,並直接出現在指令中。例如 mov al,10h 源運算元為立即定址 執行後al 10h mov ax,0a48h 源運算元為立即定址 執行後ax 0a48h 立即定址只能用於源運算元,不能用於目的運算元。2 暫存器定址方式 暫存器定址...