99_cclib_gb2312.asm

来自「汇编语言 参考书 包含作业与答案 从入门到精通 通俗易懂」· 汇编 代码 · 共 56 行

ASM
56
字号
		.model small
		.stack 100h
		.data	
				file_cclib	db	'd:\dos\cclib\hzk16',0
				handle		dw	?				;文件句柄
				file_buff	db	32 DUP(?),'$'
				msg_err1	db	'File open wrong!','$'
				msg_err2	db	'File read wrong!','$'
		.code
		.startup
start:
		mov ax,@data
		mov ds,ax
		
		lea	dx,file_cclib
		mov	al,0
		mov	ah,3dh
		INT	21h
		jc	error1
		mov	handle,ax		
		
		mov bx,handle
		mov	cx,0
		mov	dx,0b040h
		mov	al,00h
		mov	ah,42h
		INT	21h
		
		mov	bx,handle
		mov cx,32
		lea	dx,file_buff
		mov	ah,3fh
		INT	21h
		jc	error2
		
close:
		mov	bx,handle
		mov	ah,3eh
		INT	21h
		jmp	done
		
error1:
		lea	dx,msg_err1
		mov	ah,9h
		INT	21h
		jmp	done

error2:
		lea	dx,msg_err2
		mov ah,9h
		INT 21h
		jmp	done

done:	
		.exit
		end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?