prog7_22.asm
来自「汇编语言-王爽 源代码 加 卜艳萍版源代码」· 汇编 代码 · 共 60 行
ASM
60 行
stack segment stack
dw 64 dup(?)
stack ends
data segment
filename db 'filerw.txt',0
buf1 db 'ABCDEFGabcdefg'
buf2 db 100 dup('$')
str1 db 'please read file:',0dh,0ah,'$'
str2 db 'error','$'
data ends
code segment
assume cs:code,ds:data,ss:stack
main proc far
start:push ds
mov ax,0
push ax
mov ax,data
mov ds,ax
mov dx,offset filename
mov ah,3ch
mov cx,0
int 21h
mov ah,3dh
mov al,1
int 21h
mov bx,ax
mov dx,offset buf1
mov cx,10
mov ah,40h
int 21h
mov ah,3eh
int 21h
lea dx,filename
mov ah,3dh
mov al,2
int 21h
mov bx,ax
mov ah,3fh
mov cx,10
mov dx,offset buf2
int 21h
cmp ax,cx
jnz a1
lea dx,str1
mov ah,9
int 21h
lea dx,buf2
mov ah,9
int 21h
jmp a2
a1:lea dx,str2
mov ah,9
int 21h
a2:ret
main endp
code ends
end start
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?