⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 long_filename.txt

📁 想学习汇编语言的
💻 TXT
字号:
TITLE Read a text file         (Readfile.asm)

; Last update: 9/11/01

INCLUDE Irvine16.inc

.data
BufSize = 5000

fileName BYTE "myfile.txt",0
inHandle WORD ?
buffer   BYTE BufSize DUP(?)
bytesRead WORD ?

.code
main PROC
    mov  ax,@data
    mov  ds,ax

; Open input file
	mov ah,3Dh    	; function: open file
	mov al,0      	; input mode
	mov dx,OFFSET fileName
	int 21h       	; call DOS
	jc  quit
	mov inHandle,ax

; Read the input file
	mov ah,3Fh	; read file or device
	mov bx,inHandle
	mov cx,BufSize
	mov dx,OFFSET buffer
	int 21h
	jc  quit
	mov bytesRead,ax

; Display the buffer
	mov ah,40h
	mov bx,1	; console output
	mov cx,bytesRead
	mov dx,OFFSET buffer
	int 21h
	jc  quit

; Close the file
	mov  ah,3Eh    	; function: close file
	int  21h       	; call DOS
	call Crlf
quit:
    .exit
main ENDP
END main

⌨️ 快捷键说明

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