home *** CD-ROM | disk | FTP | other *** search
- target equ 0d8h
- source equ 0b0h
- code_seg segment
- assume cs:code_seg,ds:code_seg,es:code_seg
- org 100h
- start: jmp direx
- prompt db 'D=Delete P=Protect U=Unprotect C=Copy <Space>=Mark'
- db ' N=New Dir Q=Quits$'
- copy_prompt db 'Pathname to copy marked files to : $'
- new_dir_prompt db 'New Pathname : $'
- full_msg db '*** TARGET DISK FULL! ***$'
- del_msg db 'Delete marked files (Y/N) ? $'
- copy_flag db 0 ; set when doing copies.
- dl_flag db 0 ; in DISPLAY, not DSPLAY@
- disp_flag db 0 ; set when initial display done.
- full_flag db 0 ; disk full flag
- nofile_flag db 0 ; l-->No filename given.
- source_handle dw 0 ; source file handle
- target_handle dw 0 ; target file handle
- source_path_end dw 0b0h ; end of path -- put filenames here
- target_path_end dw 0dbh ; same for target
- test_path_end dw 0 ; same for target
- bytes_read dw ? ; bytes read -- for copy
- bytes_asked dw ? ; bytes requested to be read.
- marked db ? ; file marked ?
- attrib db ? ; screen attribute
- wildcards db '*.*',0
- cursor_x db ? ; reverse vid.cursor position x
- cursor_y db ? ; same for y
- tempx db ? ; temporary storage for x,y positions
- tempy db ?
- filename db 10 dup(0) ; Store given filename here
- db 'Copyright 1986 Ziff-Davis Publishing Co.',1ah
- db 'Programmed by Steven Holzner',1ah
-
-
-
- direx proc near
- call display ;Setup -- put dir on screen.
- mov si,source_path_end ; Light up first filename
- call get_file_name
- topper: mov attrib,70h
- call color
- top: mov ah,0 ; read a character w/o echo
- int 16h
- space: cmp al,20h ; space ? mark a file ?
- jne right
- mov ah,8
- mov bx,0
- add cursor_x,12
- call set_cursor
- int 10h
- cmp al,0ffh
- je opp
- mov al,0ffh
- jmp ppo
- opp: mov al,0
- ppo: mov ah,10
- mov cx,1
- int 10h
- sub cursor_x,12
- call set_cursor
- jmp top
- right: cmp ah,4dh
- jne left
- mov attrib,7
- call color
- call inc_cursor
- mov attrib,70h
- call color
- jmp top
- left: cmp ah,4bh
- jne up
- mov dl,cursor_x
- mov dh,cursor_y
- mov attrib,7
- call color
- sub dl,13
- jnc ok
- mov dl,5*13
- sub dh,1
- jnc ok
- mov dl,cursor_x
- mov dh,cursor_y
- ok: mov cursor_x,dl
- mov cursor_y,dh
- call set_cursor
- mov attrib,70h
- call color
- jmp top
- up: cmp ah,48h
- jne down
- mov dl,cursor_x
- mov dh,cursor_y
- mov attrib,7
- call color
- sub dh,1
- jnc nottop
- add dh,1
- nottop: mov cursor_x,dl
- mov cursor_y,dh
- call set_cursor
- mov attrib,70h
- call color
- jmp top
- down: cmp ah,50h
- jne letters
- mov attrib,7
- call color
- inc cursor_y
- call set_cursor
- mov si,source_path_end
- call get_file_name
- cmp byte ptr ds:[si],' '
- ja go
- nogo: dec cursor_y
- call set_cursor
- go: mov attrib,70h
- call color
- jmp top
- letters:cmp al,'Z'
- jl gol
- sub al,'a'-'A'
- gol: cmp al,'Q'
- jne del
- mov cx,25
- mov cursor_x,0
- mov cursor_y,0
- call set_cursor
- wipe2: push cx
- call set_cursor
- mov cx,80
- mov ah,9
- mov bx,7
- mov al,0
- int 10h
- pop cx
- inc cursor_y
- loop wipe2
- mov cursor_x,0
- mov cursor_y,0
- call set_cursor
- jmp out
- del: cmp al,'D'
- je okd
- jmp pro
- okd: mov attrib,7
- call color
- mov cursor_x,0
- mov cursor_y,24
- call set_cursor
- mov ah,9
- mov cx,80
- mov al,' '
- mov bx,7
- int 10h
- mov cursor_x,0
- mov cursor_y,24
- call set_cursor
- mov ah,9
- mov dx,offset del_msg
- int 21h
- mov ah,1
- int 21h
- cmp al,'Z'
- jl checky
- sub al,'a'-'A'
- checky: cmp al,'Y'
- je godel
- call dsplay2
- mov attrib,70h
- call color
- jmp top
- godel: mov cursor_x,0
- mov cursor_y,0
- call set_cursor
- loopd: call get_marked_file
- mov dx,source
- mov ah,41h
- int 21h
- call inc_cursor
- cmp dx,0ffh
- je find
- cmp cx,0ffh
- jne loopd
- find: call dsplay2
- mov attrib,70h
- call color
- jmp top
- pro: cmp al,'P'
- jne unpro
- mov attrib,7
- call color
- mov cursor_x,0
- mov cursor_y,0
- call set_cursor
- loopp: call get_marked_file
- mov dx,source
- mov ah,43h
- mov al,01
- mov cx,1
- int 21h
- call inc_cursor
- cmp dx,0ffh
- je finp
- cmp cx,0ffh
- jne loopp
- finp: call dsplay2
- mov attrib,70h
- call color
- jmp top
- unpro: cmp al,'U'
- jne copy
- mov attrib,7
- call color
- mov cursor_x,0
- mov cursor_y,0
- call set_cursor
- loopu: call get_marked_file
- mov dx,source
- mov ah,43h
- mov al,01
- mov cx,0
- int 21h
- call inc_cursor
- cmp dx,0ffh
- je finu
- cmp cx,0ffh
- jne loopu
- finu: call dsplay2
- mov attrib,70h
- call color
- jmp top
- copy: cmp al,'C'
- je goc
- jmp new_dir
- goc: mov attrib,7
- mov full_flag,0
- call color
- mov cursor_x,0
- mov cursor_y,24
- call set_cursor
- mov ah,9
- mov cx,80
- mov al,' '
- mov bx,7
- int 10h
- mov cursor_x,0
- mov cursor_y,24
- call set_cursor
- mov ah,9
- mov dx,offset copy_prompt
- int 21h
- mov ah,0ah
- mov bx,target-2
- mov dx,target-2
- mov byte ptr [bx],32
- int 21h
- mov si,target
- trans: cmp byte ptr [si],13
- je slash2
- inc si
- jmp trans
- slash2: cmp byte ptr [si-1],'\'
- je filer2
- mov byte ptr [si],'\'
- inc si
- filer2: mov target_path_end,si
- mov attrib,7
- call color
- mov cursor_x,0
- mov cursor_y,0
- call set_cursor
- loopc: mov copy_flag,1
- call get_marked_file
- mov copy_flag,0
- cmp cx,0ffh
- jne open
- jmp finc
- open: mov dx,source
- mov ax,3d00h
- int 21h
- jc botc
- mov source_handle,ax
- mov dx,target
- mov ah,3ch
- mov cx,0
- int 21h
- jc botc
- mov target_handle,ax
- stuff: mov dx,offset data
- mov cx,62*1024
- mov ah,3fh
- mov bx,source_handle
- int 21h
- mov bytes_read,ax
- mov cx,ax
- mov bytes_asked,cx
- mov ah,40h
- mov bx,target_handle
- mov dx,offset data
- int 21h
- cmp ax,bytes_read
- jne full
- cmp bytes_read,62*1024
- je stuff
- jmp botc
- full: mov cursor_x,0
- mov cursor_y,24
- call set_cursor
- lea dx,full_msg
- mov ah,9
- int 21h
- mov full_flag,1
- mov cursor_x,0
- mov cursor_y,0
- call set_cursor
- botc: mov ah,3eh
- mov bx,source_handle
- int 21h
- mov ah,3eh
- mov bx,target_handle
- int 21h
- cmp full_flag,1
- jne notfull
- mov dx,target
- mov ah,41h
- int 21h
- jmp topper
- notfull:call inc_cursor
- cmp dx,0ffh
- je finc
- jmp loopc
- finc: call dsplay2
- mov attrib,70h
- call color
- jmp top
- new_dir:cmp al,'N'
- je gon
- jmp top
- gon: mov attrib,7
- call color
- mov cursor_x,0
- mov cursor_y,24
- call set_cursor
- mov ah,9
- mov cx,80
- mov al,' '
- mov bx,7
- int 10h
- mov cursor_x,0
- mov cursor_y,24
- call set_cursor
- mov ah,9
- mov dx,offset new_dir_prompt
- int 21h
- mov ah,0ah
- mov bx,80h
- mov dx,80h
- mov byte ptr [bx],32
- int 21h
- jmp direx
- out: int 20h
- direx endp
-
- get_marked_file proc near
- begi: mov ah,8
- add cursor_x,12
- call set_cursor
- mov bx,0
- int 10h
- sub cursor_x,12
- call set_cursor
- cmp al,0ffh
- je fini
- call inc_cursor
- cmp dx,0ffh
- jne begi
- mov cx,0ffh
- jmp outer
- fini: mov cx,0
- mov si,source_path_end
- call get_file_name
- cmp copy_flag,1
- jne outer
- mov si,target_path_end
- call get_file_name
- outer: ret
- get_marked_file endp
-
- get_file_name proc near
- push cx
- push si
- push word ptr cursor_x
- mov ah,8
- mov bx,0
- mov cx,12
- loopb: mov ah,8
- int 10h
- inc cursor_x
- call set_cursor
- mov ds:[si],al
- inc si
- loop loopb
- mov byte ptr ds:[si],0
- pop word ptr cursor_x
- pop si
- call set_cursor
- pop cx
- ret
- get_file_name endp
-
- color proc near
- push cx
- push word ptr cursor_x
- mov cx,12
- cmp attrib,7
- jne here
- mov ah,8
- add cursor_x,12
- call set_cursor
- mov bx,0
- int 10h
- sub cursor_x,12
- call set_cursor
- cmp al,0ffh
- je fine
- here: mov bx,0
- mov ah,8
- int 10h
- push cx
- mov cx,1
- mov bl,attrib
- mov ah,9
- int 10h
- pop cx
- inc cursor_x
- call set_cursor
- loop here
- fine: pop word ptr cursor_x
- call set_cursor
- pop cx
- ret
- color endp
-
- display proc near
- mov di,source
- mov dl_flag,1
- mov si,82h
- mov source_path_end,source
- mov bx,80h
- cmp byte ptr [bx],0
- je dsplay2
- trans2: cmp byte ptr [si],13
- je put0
- movsb
- cmp byte ptr [si-1],'\'
- je stor
- cmp byte ptr [si-1],':'
- jne trans2
- stor: mov source_path_end,di
- push si
- push di
- lea di,filename
- mov cx,10
- mov al,0
- rep stosb
- lea di,filename
- mov cx,9
- oneby: cmp byte ptr [si],13
- jne move
- mov byte ptr [di],0
- jmp short fin0
- move: movsb
- loop oneby
- fin0: pop di
- pop si
- jmp trans2
- put0: mov byte ptr [di],0
- mov test_path_end,di
- mov nofile_flag,0
- jmp chkfil
- dsplay2:mov dl_flag,0
- cmp filename,0
- jne chkfil
- mov nofile_flag,1
- chkfil: mov cx,25
- mov cursor_x,0
- mov cursor_y,0
- call set_cursor
- wipe: push cx
- call set_cursor
- mov cx,80
- mov ah,9
- mov bx,7
- mov al,0
- int 10h
- pop cx
- inc cursor_y
- loop wipe
- mov cursor_x,6
- mov cursor_y,24
- call set_cursor
- mov ah,9
- mov dx,offset prompt
- int 21h
- mov cursor_x,0
- mov cursor_y,0
- call set_cursor
- mov di,test_path_end
- cmp nofile_flag,1
- je tslash
- cmp byte ptr [di-1],'\'
- je nofile
- cmp dl_flag,1
- je puta
- cmp filename,0
- je puta
- mov cx,10
- mov si,offset filename
- mov di,source_path_end
- rep movsb
- puta: mov ah,4eh
- mov dx,source
- int 21h
- nofile: mov filename,0
- tslash: cmp test_path_end,0
- jne slash
- mov source_path_end,source
- mov di,source_path_end
- jmp putw
- slash: mov di,test_path_end
- mov source_path_end,di
- cmp byte ptr [di-1],'\'
- je putw
- mov byte ptr [di],'\'
- inc di
- inc source_path_end
- putw: mov cx,4
- mov si,offset wildcards
- rep movsb
- src: mov ah,4eh
- mov dx,source
- int 21h
- jc ender
- match1: mov dx,0
- mov ah,2
- int 10h
- call print
- mov cx,120
- looper: mov ah,4fh
- int 21h
- jc ender
- mov disp_flag,0ffh
- call inc_cursor
- mov disp_flag,0
- call print
- mov dx,offset source
- loop looper
- ender: mov cursor_x,0
- mov cursor_y,0
- call set_cursor
- ret
- display endp
-
- inc_cursor proc near
- push cx
- mov dl,cursor_x
- mov dh,cursor_y
- mov tempx,dl
- mov tempy,dh
- add dl,13
- cmp dl,75
- jl fin
- mov dl,0
- inc dh
- fin: mov cursor_x,dl
- mov cursor_y,dh
- mov dx,0
- call set_cursor
- cmp disp_flag,0
- jne set
- mov si,source_path_end
- call get_file_name
- cmp byte ptr ds:[si],' '
- ja set
- sub cursor_x,13
- cmp cursor_x,0
- jg leav
- mov dl,tempx
- mov cursor_x,dl
- mov dh,tempy
- mov cursor_y,dh
- leav: call set_cursor
- mov dx,0ffh
- set: pop cx
- ret
- inc_cursor endp
-
- set_cursor proc near
- push ax
- mov dl,cursor_x
- mov dh,cursor_y
- mov ah,2
- int 10h
- pop ax
- ret
- set_cursor endp
-
- print proc near
- push cx
- mov dx,80h+30
- mov bx,dx
- mov cx,13
- loopa: cmp byte ptr [bx],0
- je found
- inc bx
- loop loopa
- found: mov byte ptr ds:[bx+1],'$'
- mov ah,9
- int 21h
- pop cx
- ret
- print endp
-
- data:
- code_seg ends
- end start
-
-