pop dx pop cx ret
dely endp code ends
end move
程序二静止复合图形显示程序:
stack segment stack
db 256 dup(0)
stack ends data segment chrtab dw 7
db 0dbh,0,0,0dbh,0,1 db 0dbh,0,1,52h,0,1 db 1,-1,-1,9,2,0 db 9,0,-2
data ends code segment
assume cs:code,ss:stack,ds:data
start: mov ax,data
mov ds,ax mov cx,0 mov dx,184fh mov bh,7 mov ax,0618h int 10h
lea di,chrtab mov cx,[di] mov dx,400h add di,2
next: add dh,[di+1]
add dl,[di+2] mov ah,2 mov bh,0 int 10h push cx mov cx,1 mov ah,10 mov al,[di] int 10h pop cx add di,3 loop next mov ah,4ch int 21h
10
code
ends
end start
实验报告:
1、自编程序。
2、调试中产生的问题。
11
实验六 磁盘文件操作程序
实验目的:
1、掌握利用FCB进行磁盘文件读写的方法。 2、掌握利用HANDLE进行磁盘文件读写的方法。
3、INT 21H 0FH,10H,14H,15H,16H,1AH号功能调用。 4、INT 21H 3CH,3DH,3FH,40H号功能调用。 实验内容:
一、文本文件内容显示程序:
stack segment stack
db 100h dup(?)
stack ends data segment fcb db 36 dup(0) count db 0 char db 0 dta db 0 errmsg db 'file access error' data ends code segment main proc far
assume cs:code,ss:stack
start: push ds
sub ax,ax push ax
mov ax,data mov es,ax assume es:data mov si,5ch
mov di,offset fcb mov cx,12 cld
rep movsb mov ds,ax assume ds:data
mov dx,offset dta mov ah,1ah int 21h
mov dx,offset fcb mov ah,0fh int 21h cmp al,0 jnz error
mov word ptr fcb+0ch,0 mov word ptr fcb+0eh,1
12
again:
tab:
eof:
error:
display disp1:
mov fcb+20h,0 lea dx,fcb mov ah,14h int 21h cmp al,0 jnz error mov al,dta cmp al,1ah jz eof cmp al,9 jz tab
call dispchar inc char cmp dta,0ah jnz again mov char,0 inc count cmp count,24 jnz again mov ah,0 int 16h mov count,0 jmp again mov al,' ' call dispchar inc char test char,7 jz again jmp tab lea dx,fcb mov ah,10h int 21h ret lea bx,errmsg call display
ret proc mov cx,30 mov al,[bx] call dispchar inc bx loop disp1 mov al,0dh call dispchar mov
al,0ah
13
call dispchar ret
display endp dispchar proc
push bx mov bx,0 mov ah,14 int 10h pop bx ret
dispchar endp main endp code ends
end start
1、输入,汇编,连接此程序,用DEBUG将目的程序带参数调入,用D命令观看并记录 PSP中的FCB内容。 2、运行此程序。
二、磁盘文件拷贝程序(参考):
stack segment stack
db 100h dup(9)
stack ends ; data segment sfile db 64
db ? db 64 dup(' ')
dfile db 64
db ? db 64 dup(' ')
ask1 db 0ah,0dh,'please input source'
db 'file name:','$'
ask2 db 0ah,0dh,'please input destnation'
db 'file name:','$'
note db 0ah,0dh,'please insert diskettes'
db 'and strike any when ready ','$'
er1 db 0ah,0dh,'create error $' er2 db 0ah,0dh,'open error$' er3 db 0ah,0dh,'read error$' er4 db 0ah,0dh,'write error$' er5 db 0ah,0dh,'close source file error' er6 db 0ah,0dh,'close dest file error' bufr dw ? data ends code segment
assume cs:code,ds:data,ss:stack
14