home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
utils
/
dskutl
/
bback622.lbr
/
ARCH.AQM
/
ARCH.AZÍ
Wrap
Text File
|
1986-04-27
|
6KB
|
136 lines
;;01-20-85
;
; ARCH.AZM (ARCH.PAT)
;Eric Gans
;French Dep't UCLA
;Los Angeles CA 90024
;
; This program was written for the Kaypro-10 CP/M v. 2.2F.
;All addresses should be checked before using on another system.
;
; Patching BDOS is a fairly drastic action. I think it's worth it
;because of the extreme usefulness of the "archive" principle. Whether you
;do word-processing or programming, spreadsheets, etc., you are bound to
;collect large numbers of similarly typed files, and it is all too easy
;to forget to back them up if you have to remember which ones you have
;written to since last time and then (at the very least) tag each file
;separately for backup. It's also very useful to have the date entered
;automatically at the beginning of the file. I autoload CAL.COM so that
;it's sure to contain the current date for use in BBACK.
;
; 1. This patch assumes that you have a free area of 48 bytes in
;high memory where you can remove the BDOS stack. If not, you won't be
;able to use it.
;
; 2. The principle of the patch is very simple; to zero the "archive"
;bit when the file directory information is written back to the disk. This
;allows BBACK (or a similar program) to selctively back up only files that
;have changed since last backup. (See BBACK.DOC for details.) What compli-
;cates matters is that separate patches are necessary for sequential and
;random file writes; this patch was arrived at only after much experimen-
;tation (and disassembly of the BIOS).
;
; 3. This file was written for the Z80MR assembler; it can easily be
;modified for any z80 assembler like M80, ZASM etc., or you can enter the
;code directly with DDT, SID etc.
;
; INSTRUCTIONS
;
; 1. Check patch area; should be all 0's. This is the BDOS stack
;area, so the stack will have to be moved elsewhere.
;
; ****************************************************************************
; * KAYPRO-10 NOTE: The K-10 makes it easy by having over a kilobyte of un- *
; * used memory above the BIOS, which ends (in my version) at 0f0d2h. *
; ****************************************************************************
;
; 2. Assemble the patch.
;
; 3. Load PUTSYS, SYSGEN or whatever file contains an image of the
;BDOS to be written to the system tracks of your (hard or floppy) disk under
;DDT, SID etc. (It doesn't have to be a z80 debugger since its only
;function is to read in a HEX file.)
;
; 4. Read in ARCH.HEX (the DDT command is: iarch.hex <CR> r <CR>)
;
; 5. After checking the patch area, exit the debugger and SAVE the
;memory image (don't forget to calculate the appropriate number of pages).
;Use a new name for the SAVEd file so you don't lose your original in case
;something goes wrong.
;
; 6. Run the patched PUTSYS/SYSGEN program and reset the computer.
;
; 7. Test the patch by running BBACK on a file then writing to it,
;etc. (The NSWP or DA utilities will show if the archive bit is set.)
;Try using various application programs to see if the archive bit is reset
;when the file is written to. (LU should only reset this bit for a library
;that has been modified, not just read from; Wordstar will reset it whenever
;the file is saved; MBasic resets it even without the patch since the "save"
;command creates a new file...)
;
;
; If you don't have a z80 assembler, the only instruction that will
;give you trouble is the RES 7,(HL); you'll have to do this with: mov a,m|
;and 7fh|mov m,a . The JR instruction will also lose you a byte; but with
;the stack out of the way you have plenty of room.
;
; Make sure to check all addresses before assembly: remember,
;the size of your CP/M system is not necessarily the size of your RAM.
;
size equ 60
bdosp equ 3c00h+(size-20)*1024 ;=0dc00h on the K-10
ibdosp equ 1180h ;SYSGEN-type programs put the BDOS image here
inewst equ ibdosp+25h ;=11a5h Image of addr of BDOS stack
patch1 equ bdosp+311h ;=0df11h Area freed by removal of stack
ipatch equ ibdosp+311h ;=1491h Image of patch area
dirch equ bdosp+810h ;=0e410h Start of directory write rtn
clcont equ bdosp+8a2h ;=0e4a2h Cont. of close rtine
icload equ ibdosp+91dh ;=1a9dh Image of jump addr in close rtn (2)
iclrtn equ ibdosp+0ca9h ;=1e29h Image of jump addr in close rtn (1)
dirbf equ bdosp+0db9h ;=0e9b9h Addr of CP/M directory buffer
ofstad equ bdosp+0de9h ;=0e9e9h Addr of offset to fcb in buffer
endbios equ 0f0d2h ;*** MUST BE CHECKED FOR YOUR SYSTEM ***
org inewst
dw endbios+30h ;BDOS stack has 48 bytes
org ipatch
;the first patch takes care of random writes (LU for example)
ld hl,(dirbf) ;addr of directory buffer
ld a,(ofstad) ;offset of file in buffer
add a,l
ld l,a
jr nc,nocar
inc h
nocar: ld de,11 ;get to last letter of filetype
add hl,de
res 7,(hl) ;set 't3 bit to 0
jp dirch ;jump to directory write rtn
;the second patch is for sequential writes where the file must be closed
;via BDOS function 16 (e.g., WordStar, other word-proc. programs)
;at the beginning of the close routine, hl holds the fcb address
;for the file
patch2 equ $+bdosp-1180h ;addr for second patch
ld de,11
add hl,de ;hl points to last char in fltype
res 7,(hl) ;reset 't3...
jp clcont ;continuation of close routine
org icload
dw patch1
org iclrtn
dw patch2 ;replace jump to clcont with
;jump to patch
end