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

📄 lab10.txt

📁 3.1 磁盘存取简介 3.1.1 利用FCB(文件控制块)存取磁盘文件: (2) 在程序的数据段设置FCB和DAT(数据传输区)。 (3) 利用DOS功能调用打开文件(读)或建立文件(写)
💻 TXT
字号:
	.MODEL SMALL
	.STACK 64
;******************************************
	.DATA
	
path db 'information.dat',00H
handle dw ?
handle2 dw ?

stringn db 30 
stringl db ?
string  db 30 dup (' '),0dh,0ah

stringzero db 30 dup (' '),0dh,0ah;help string to bacame zero
stringpp db 'please input you table in this form:"id(tab)name(tab)mark',13,10,'$'
stringpt db 'choose what you want.  R.read  W.write  Q.quit',13,10,'$'

stringinfo db 'give the count you want to input:',13,10,'$'

stringal db 500 dup(' ')
reader db 500 dup(' '),'$' 

;******************************************
	.CODE

.CODE

begin PROC FAR

	mov ax,@data
	mov ds,ax
	mov es,ax
	
next:	mov ah,09h
            mov dx,seg stringpt
            mov ds,dx
            mov dx,offset stringpt 
            int 21h


w:	call input
	call creat
	call write
	call close


creat proc near

	mov ah,3cH
	mov cx,00
	lea dx,path
	int 21H
	
	mov handle,ax
	
	ret	
creat endp

;***********************************************

;write*******************************************

write proc near
	
	mov ah,40h
	mov bx,handle
	mov cx,500
	lea dx,stringal
	int 21h

;close*******************************************

close proc near

	mov ah,3eh
	mov bx,handle
	int 21h
	
	jmp next
	ret
close endp

;***********************************************

;input*******************************************

input proc near
	 
	 mov ah,09h
             mov dx,seg stringinfo
             mov ds,dx
             mov dx,offset stringinfo 
             int 21h
             
             mov ah,1
             int 21h
             cbw
                          
             sub cx,cx
             sub al,30h
	 mov cl,al	 

             call crlf

             mov ah,09h
             mov dx,seg stringpp
             mov ds,dx
             mov dx,offset stringpp 
             int 21h
             
	mov bx,0;flag,to point the whole string's next copy position 
	 	                      	 	 
            again:
                     call zero
            
                     lea dx,stringn
                     mov ah,0ah
                     int 21h
                               
                     call delete                                   
                     call crlf	
		
                     call store
		
	         sub bx,32
                     loop again
                                                                            
	 ret	           
input endp

;***********************************************
		
	ret
write endp

⌨️ 快捷键说明

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