各位大哥帮小弟看一下那里错了!!!!
data segment
fname db 'c:\masm\myasm.asm'
filesize dw ?
handle dw ?
buff db 1024 dup (?)
error db 'file error'
tab dw handle,fname,buff,filesize
data ends
stack segment stack 'stack'
dw 100 dup (?)
stack ends
;-------------------------code1--------------------------
code1 segment
assume cs:code1
assume ds:data
assume ss:stack
errorp proc far
mov ah,4ch
int 21h
ret
errorp endp
openfile proc far
push ds
push ax
push dx
pushf
mov ah,3dh
mov al,0
mov di,[tab+2]
mov dx,[di]
int 21h
jnc win
call errorp
win:
mov di,[tab]
mov [di],ax
popf
pop dx
pop ax
pop ds
ret
openfile endp
code1 ends
end
;--------------------code2-----------------------
code2 segment
assume ds:data
assume cs:code2
assume ss:stack
redfile proc far
mov ah,42h
mov al,2
mov di,[tab]
mov bx,[di]
mov cx,0
mov cx,0
int 21h
jnc win2
call errorp
win2:
mov [tab+6],ax
mov ah,3fh
mov di,[tab]
mov bx,[di]
mov di,[tab+6]
mov cx,[di]
mov di,[tab+4]
mov dx,[di]
jnc win21
call errorp
win21:
mov ah,3eh
mov di,[tab]
mov bx,[di]
int 21h
ret
redfile endp
code2 ends
end
;-------------------------code3-----------------------
code3 segment
assume cs:code3
assume ds:data
assume ss:stack
creafile proc far
mov ah,3ch
mov di,[tab+2]
mov cx,0
mov si,'1'
mov [di+13],si
mov dx,[di]
int 21h
jnc win3
call errorp
win3:
mov di,[tab]
mov [di],ax
ret
creafile endp
;---------------------------------------
wifile proc far
mov ah,40h
mov di,[tab]
mov bx,[di]
mov di,[tab+6]
mov cx,[di]
mov di,[tab+4]
mov dx,[di]
int 21h
jnc win4
call errorp
win4:
mov ah,3eh
mov di,[tab]
mov bx,[di]
int 21h
ret
wifile endp
errorp proc far
mov ah,4ch
int 21h
ret
errorp endp
code3 ends
end
;------------------------maincode------------------------
code segment
assume cs:code
assume ds:data
assume ss:stack
main proc far
call openfile
call redfile
call carafile
call wifile
mov ah,4ch
int 21h
ret
main endp
end