您的位置:首页 > 职场人生

汇编中结构的运用(输入文件内容,处理,输出结果)

2008-10-02 16:24 751 查看




其中的一部分是自己写的,算半原创

assume cs:code,ds:data
count=10
score struc
no dw ?
sname db 8 dup(' ')
chn db 0
math db 0
eng db 0
score ends
item struc
nos dw 0
sum dw 0
item ends
data segment
buffer score <>
stable item count dup (<>)
fname1 db 'D:\score.dat',0
fname2 db 'd:\score.sum',0
data ends
code segment
start:mov ax,data
mov ds,ax
mov dx,offset fname1
mov ax,3d00h
int 21h
mov bx,ax
mov di,count
mov si,offset stable
read:mov dx,offset buffer
mov cx,type score
mov ah,3fh
int 21h
mov al,buffer.chn
xor ah,ah
add al,buffer.math
adc ah,0
add al,buffer.eng
adc ah,0
sub ax,84h
push cx
push ax
mov cl,4h
shr al,cl
add al,30h
mov dl,al
mov cl,0fh
pop ax
and al,cl
add al,30h
mov ah,al
pop cx
mov al,dl
mov [si].sum,ax
mov ax,buffer.no
mov [si].nos,ax
add si,type item
dec di
jnz read
mov ah,3eh
int 21h
mov dx,offset fname2
mov cx,0
mov ah,3ch
int 21h
mov bx,ax
mov dx,offset stable
mov cx,(type item)*count
mov ah,40h
int 21h
mov ah,3eh
int 21h
mov ax,4c00h
int 21h
code ends
end start
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐