?? list.asm
字號:
public list
Psize equ 8
Rsize equ 49
data1 segment para 'data1'
myfcb label byte
fcbdriv db 0
fcbname db 'students'
fcbext db 'txt'
fcbblk dw 0
fcbrcsz dw 0
dd ?
dw ?
dt ?
fcbwqrc db 0
dd ?
dtapar label byte
maxl db 49
act db ?
dta db 49 dup(?)
num db 6 dup(?)
names db 10 dup(?)
sex db ?
birth db 8 dup(?)
place db 3 dup(?)
score1 db 5 dup(?)
score2 db 5 dup(?)
score3 db 5 dup(?)
total db 5 dup(?)
lst1 db ' NUM NAME SEX BIRTH PLACE ENGLISH '
db 'CHINESE MATHS TOTAL',0AH,0DH,'$'
pc db 0
err_fopen db 0ah,0dh," File open error! $"
err_fcreat db 0ah,0dh," File creat error!$"
err_fread1 db 0ah,0dh," File read error in sequence manner! $"
err_fread2 db 0ah,0dh," File read error in random manner !$"
err_fclose db 0ah,0dh," File close error !$"
continue db 0ah,0dh," Press space to continue...$"
crlf db 13,10,'$'
data1 ends
show macro addrs
;display a line started at addrs.
push dx
lea dx,addrs
mov ah,09h
int 21h
pop dx
endm
show_item macro addrs,count1,count2
local iloop,spacelp
push ax
push bx
push cx
push dx
mov bx,0
iloop:
mov dl,&addrs&[bx]
mov ah,2
int 21h
inc bx
cmp bx,count1
jl iloop
mov cx,count2
spacelp:
mov dl," "
mov ah,2
int 21h
loop spacelp
pop dx
pop cx
pop bx
pop ax
endm
code1 segment
assume cs:code1,ds:data1,es:data1
list proc far
push ds
push es
mov ax,data1
mov es,ax
mov ds,ax
call list_all
call closef
pop es
pop ds
ret
list endp
;********************************************
;list_all procedure lists the document *
;file in a page manner *
;********************************************
list_all proc near
show lst1
show crlf
call openf
or al,al
jz list_loop
jmp ext
list_loop:
lea dx,myfcb
mov ah,14h
int 21h ;read a record in sequence manner.
cmp al,01
jne n3
jmp file_end ;(al)=1:meets the end of file.
n3:
cmp al,0
je n4
cmp al,03
je n4
show err_fread1 ;read error
mov dl,"0"
add dl,al
mov ah,2
int 21h ;show error no.
jmp file_end
n4:
mov bx,0
moving:
mov al,dta[bx]
mov num[bx],al
inc bx
cmp bx,RSize
jl moving
show crlf
call show_rec
show crlf
jmp list_loop
file_end:
call closef
ext:
ret
list_all endp
show_rec proc near
push ax
push bx
push cx
push dx
show_item num,6,2
show_item names,10,2
show_item sex,1,2
show_item birth,8,3
show_item place,3,3
show_item score1,5,4
show_item score2,5,4
show_item score3,5,4
show_item total,5,2
pop dx
pop cx
pop bx
pop ax
ret
show_rec endp
openf proc near
mov ah,0fh
lea dx,myfcb
int 21h
or al,al
jz found
show err_fopen
found: mov fcbrcsz,49
mov ah,1ah
lea dx,dta
int 21h
ret
openf endp
closef proc near
mov ah,10h
lea dx,myfcb
int 21h
ret
closef endp
code1 ends
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -