lab10.txt

来自「3.1 磁盘存取简介 3.1.1 利用FCB(文件控制块)存取磁盘文件: (」· 文本 代码 · 共 134 行

TXT
134
字号
	.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 + =
减小字号Ctrl + -
显示快捷键?