;*************************** AMUS Program Label ******************************
; Filename: IDXCHE.M68 Date: 1/29/92
; Category: UTIL Hash Code: 177-424-030-164 Version: 1.0(101)
; Initials: TREE/AM Name: DELL COLEMAN
; Company: Alpha Automation Incorporated Telephone #: 7138778039
; Related Files: AAI.M68
; Min. Op. Sys.: ??? Expertise Level: BEG
; Special: Use 2.0 assembler. May or may not run before 2.0
; Description: Lock first block of contiguous files into CACHE. Assumes
; extension of IDX but works for any file. Will increase CACHE hit rate
; dramatically.
;*****************************************************************************
;*ML IDXCHE- Lock things into disk cache
;
; Written by:
; Dell Coleman
; Alpha Automation Incorporated
; 2000 West Loop South
; Houston, Texas 77027
; (713) 877-8039
; and copyrighted by the same in 1991.
;
; For a description of the workings of CMDLIN.SYS look at articles
; 3.4.5 & 3.4.7 in the software volume of the AMTS Journal
;
; Register Usage:
; A2 - Input line address
; A4 - Address of DDB for DCACHE
; A5 - Impure area address
;
; Edit history
;[101] 10 June 1991 Dell Coleman
; Allow command line input
;
;[100] 22 April 1991 Dell Coleman
; Program written.
;
ASECT ; Our Impure area starts here
.=IMP.SZ ; Continue from CMDSYM
INDDB: BLKB D.DDB ; Used for input files
INBUF: BLKB 512. ; Buffer for input files
IMP.SZ=. ; IMP.SZ is inpure area size
.=0 ; Beginning of program
PSECT
IDXCHE: PHDR -1,0,PH$REE!PH$REU
GETIMP IMP.SZ,A5,NOMEM ; Branch to NOMEM if not enough memory
LEA A4,INDDB(A5) ; Address of DDB to A4 for DCACHE
LEA A6,INBUF(A5) ; Initialize INPUT DDB
MOV A6,D.BUF+INDDB(A5)
MOV #512.,D.SIZ+INDDB(A5)
MOVB #D$INI,D.FLG+INDDB(A5)
INIT INDDB(A5)
.CMLOC INDDB(A5) ; Locate CMDLIN.SYS (load if necessary)
LEA A0,ALL.IDX ; Default is ALL:[]*.IDX [101]
MOV #<OP$PRT>,D7 ; Command flags for .CMINI
.CMINI ; Initialize CMDLIN.SYS (no switches)
JNE ERRXIT ; Exit on err (after setting err flg)
10$: CTRLC EXIT ; Check for ^C
.CMNXT INDDB(A5) ; Get filespec
JNE ABORT ; Abort on error
AND #NX$END,D7 ; At end?
JNE EXIT ; Branch if yes
; CMP INDDB+D.FIL(A5),#<<[FIL]_16.>![NAM]> ; Skip FILNAM.IDX
; BEQ 10$
PFILE INDDB(A5) ; Print file name
LOOKUP INDDB(A5) ; Make sure file is random
TST INDDB+D.LSZ+2(A5)
BMI 20$ ; Branch if it is
TYPECR < File is sequential, skipping>
BR 10$
20$: .CMQRY ; Check for query answer
BEQ 10$ ; Branch if user does NOT want this file
MOV INDDB+D.BAS(A5),INDDB+D.REC(A5) ; Get 1st block of file (Direct access)
READ INDDB(A5)
BNE ABORT ; Abort on error
MOV #DC.LB,D7 ; Lock 1st block of file into cache
MOV DCACHE,A6 ; Address of DCACHE.SYS to A6
CALL @A6
JEQ 10$ ; Branch if no errors
ERRMSG INDDB+D.ERR(A5),OT$LDQ!OT$TRM ; Print error message
BR ERRXIT
; Error exits
ABORT:
ERRXIT: JOBIDX A6 ; Address of our JCB to A6
TSTW JOBERR(A6) ; Error flag already set?
BNE EXIT ; Branch if yes
SETERR 0,JE$MSC ; Set error flag
EXIT: EXIT
NOMEM: TYPECR <Insufficient free memory to execute>
BR ERRXIT
NOINPT: TYPECR <At least one input file is required.>
JMP ERRXIT