终极指南:5分钟搭建你的专属电子书阅读器
2025/12/17 14:54:42
在16位MS-DOS编程中,我们可以进行一系列的操作,包括文件的读写、数组的填充与显示等。下面是一段示例代码,展示了如何填充数组、显示数组、创建文件以及读取文件:
fileName fileHandle commaStr BYTE "binary array file .bin",0 WORD ? BYTE" ",0 ; Set CreateFile to zero if you just want to ; read and display the existing binary file. CreateFile = 1 .code main PROC mov ax,@data mov ds,ax .IF CreateFile EQ 1 call FillTheArray call DisplayTheArray call CreateTheFile call WaitMsg call Crlf .ENDIF call ReadTheFile call DisplayTheArray quit: call Crlf exit main ENDP ReadTheFile PROC ; Open and read the binary file. ; Receives: nothing. ; Returns: nothing mov ax,716Ch mov bx,0 mov cx,0 mov dx,1 mov si,OFFSET fileName int 21h jc quit mov fileHandle,ax ; Read the input file, then