;*; Updated on 06-Dec-91 at 9:36 AM by Michele Tonti; edit time: 0:00:10 ;*************************** AMUS Program Label ****************************** ; Filename: ER.M68 Date: 12/6/91 ; Category: UTIL Hash Code: 362-350-257-564 Version: ; Initials: KUNI/AM Name: RENE S HOLLAN ; Company: UDISCO LTD. Telephone #: 5144818107 ; Related Files: ERSET.M68,ER.DOC,ER.HLP,SAVERS.CMD,E.DO ; Min. Op. Sys.: Expertise Level: ; Special: All related files in self-extracting archive ER.LIT ; Description: Allows user to reserve free space for ersatz definitions upon ; booting, thereby being able to add definitions later without rebooting. ; ;***************************************************************************** ;************************************************************************* ;* * ;* ER COMMAND PROGRAM - Ver. 1.0 * ;* * ;************************************************************************* ; ; NOTICE ; ;All rights reserved. This software is the property of UDISCO LTD. and ;the material contained herein is the proprietary property and trade ;secrets of UDISCO LTD., embodying substantial creative efforts and ;confidential information, ideas and expressions, no part of which may be ;reproduced or transmitted in any form or by any means, electronic, ;mechanical, or otherwise, including photocopying or input into any ;information storage or retrieval system without the express written ;permission of UDISCO LTD. ; ;Permission to copy and use is granted to AMUS members for non commercial ;purposes only. ; ; ; ER: Replacement for ERSATZ that allows one to restrict ; the displayed list to those disks (and drives) specified. ; ; Calling Syntax: ER []{/} ; ; Where: is the name of the disk and drive number or ; name of an existing ersatz table entry, ; ; is an option flag: ; ; C indicates that the first line of the comment file ; is to be displayed beside each item, ; ; D indicates that the entire comment file is to be ; displayed beneath each item, ; ; O:fspec indicates that output should be written to ; fspec. .LST is default extention. ERSATZ.INI in the ; current PPN is the defaut fspec if just O: is present. ; ; The comment file is COMENT.ERS, in the PPN indicated by ; each applicable ersatz table entry. CPU number ersatz entries do ; not have such optional comment files. ; ; Author: Rene S. Hollan ; ; COPYRIGHT (C) - 1989 - UDISCO LTD. ; ; Edit History ; ------------ ; ; [105] 28 April 1990 ; Don't try to look for a COMENT.ERS file on devices without PPN's ; (like, for example, VCR0:, eh?) /RSH ; ; [104] 3 January 1990 ; Change deleted entry in ersatz table to [ $$$$]. Log program ; only tested first word for zero to end table when reporting ersatz ; name. ; ; Add report of used/total entries at end of list. /RSH ; ; [103] 28 December 1989 ; Add /O:fspec option to write list to file. ; ; [102] 22 December 1989 ; Check for ersatz entry before device spec. ; ; [101] 21 December 1989 ; Add /C and /D options. ; ; [100] 21 December 1989 ; Coding starts. /RSH ; ; SEARCH SYS SEARCH SYSSYM EZ.LEN = 20. ; lenngth of ersatz table entry ; Impure area .OFINI .OFDEF ER.NAM, 4 ; potential matching ersatz name .OFDEF ER.DEV, 2 ; Device spec. (RAD50) .OFDEF ER.UNT, 2 ; Unit spec. .OFDEF ER.DDB, D.DDB ; Comment file DDB .OFDEF ER.OUT, D.DDB ; Output file DDB .OFDEF ER.FLG, 1 ; Flag ERF$DV = 0 ; device present ERF$CM = 1 ; comment line ERF$DS = 2 ; full description ERF$ER = 3 ; single ersatz item ERF$OF = 4 ; output to a file .OFDEF ER.BUF, 80. ; Output buffer .OFSIZ ER.LEN ; size of ER impure area NUL = 0. ; NUL equate TAB = 9. ; TAB equate SPACE = 32. ; SPACE equate VMAJOR=1 ; major version VMINOR=0 ; minor version VSUB=0 ; sub version VEDIT=105. ; edit version ER: PHDR -1,PV$RSM,PH$REU!PH$REE ; program header GETIMP ER.LEN,A0 ; get impure memory BYP ; skip blanks MOVW #-1.,ER.DEV(A0) ; mark default drive MOVW #-1.,ER.UNT(A0) ; mark default unit TRM BEQ 20$ ; nope CMPB @A2,#'/ ; do options come right away? BEQ 12$ ; yup! CALL ERRGET ; get a valid ersatz name BTST #ERF$ER,ER.FLG(A0) ; is there one? BNE 12$ ; yup! - get options LEA A1,ER.DEV(A0) ; A1 -> device name PACK ; pack RAD50 device name GTDEC ; get unit number JMI 90$ ; error CMP D1,#65535. ; too big? JGT 90$ ; yup! MOVW D1,ER.UNT(A0) ; save unit number 12$: CALL PARSE ; parse for options BTST #ERF$ER,ER.FLG(A0) ; is there an ersatz name? BNE 32$ ; yup! - display it! 20$: MOV ERSATZ,A1 ; A1 -> ersatz table MOV A1,D7 ; is there an ersatz table? JEQ 92$ ; nope BTST #ERF$OF,ER.FLG(A0) ; is there an output file? BEQ 22$ ; nope INIT ER.OUT(A0) ; init the output file OPENO ER.OUT(A0) ; open the output file 22$: MOVW ER.DEV(A0),D0 ; D0 = matching device MOVW ER.UNT(A0),D2 ; D2 = matching unit 30$: TST EZ.NAM(A1) ; at end of table? JEQ 50$ ; yup! CTRLC 50$ ; in case user is bored CMPW D0,#-1. ; do we display every device? BEQ 32$ ; yup! CMPW D0,EZ.DEV(A1) ; do we display this device? JNE 40$ ; nope CMPW D2,EZ.UNT(A1) ; do we display this unit? JNE 40$ ; nope 32$: MOVW EZ.NAM(A1),D7 ; is this a deleted entry? CMPW D7,#33 ; ... JEQ 40$ ; yup LEA A2,ER.BUF(A0) ; A2 --> display buffer UNPACK ; unpack ersatz name UNPACK ; ... CALL BACKSP ; eat up spaces MOVB #':,(A2)+ ; ... MOVB #9.,(A2)+ ; ... MOVB #'=,(A2)+ ; ... MOVB #32.,(A2)+ ; ... MOV @A1,D1 ; D1 = default CPU number BEQ 33$ ; none DCVT 0,OT$MEM ; ... MOVB #'-,(A2)+ ; ... 33$: LEA A1,4(A1) ; skip over CPU number TSTW @A1 ; is there a device name? BNE 331$ ; yup! LEA A1,4(A1) ; skip over device and unit BCLR #ERF$DV,ER.FLG(A0) ; clear device flag BR 332$ ; ... 331$: UNPACK ; unpack device name BSET #ERF$DV,ER.FLG(A0) ; set device flag MOVW @A1,D1 ; output unit number DCVT 0,OT$MEM ; ... MOVB #':,(A2)+ ; ... LEA A1,2(A1) ; skip over unit number 332$: TST @A1 ; is there a file name? BEQ 34$ ; nope CALL UNP ; unpack file name CALL UNP ; ... MOVB #'.,(A2)+ ; ... CALL UNP ; unpack extension BR 36$ 34$: LEA A1,6(A1) ; skip over file name 36$: TSTW @A1 ; is there a PPN? BEQ 35$ ; nope MOVB #'[,(A2)+ ; output PPN MOVB 1(A1),D1 ; ... OCVT 0,OT$MEM ; ... MOVB #',,(A2)+ ; ... MOVB @A1,D1 ; ... OCVT 0,OT$MEM ; ... MOVB #'],(A2)+ ; ... 35$: LEA A1,2(A1) ; skip over PPN MOVB #0,@A2 ; add trailing null BTST #ERF$OF,ER.FLG(A0) ; do we output to a file? BNE 352$ ; nope TTYL ER.BUF(A0) ; type line BR 353$ ; ... 352$: LEA A2,ER.OUT(A0) ; A2 -> outut DDB OUTL ER.BUF(A0),OT$DDB ; output line to file 353$: BTST #ERF$DV,ER.FLG(A0) ; is this a device? BEQ 37$ ; nope BTST #ERF$CM,ER.FLG(A0) ; is there a comment or description? BEQ 37$ ; nope LEA A1,-20.(A1) ; A1 -> Ersatz name CALL TYPCOM ; type comment LEA A1,20.(A1) ; A1 -> past current entry BTST #ERF$DS,ER.FLG(A0) ; do we do a complete description? BNE 38$ ; yup! - skip CRLF 37$: BTST #ERF$OF,ER.FLG(A0) ; output to a file? BEQ 372$ ; nope MOVB #13.,D1 ; CRLF to file FILOTB ER.OUT(A0) ; ... MOVB #10.,D1 ; ... FILOTB ER.OUT(A0) ; ... BR 38$ ; ... 372$: TYPECR 38$: BTST #ERF$ER,ER.FLG(A0) ; is this an ersatz match? JEQ 30$ ; nope - do next table entry 50$: BTST #ERF$OF,ER.FLG(A0) ; output to a file? BEQ 55$ ; nope CLOSE ER.OUT(A0) ; close output file 55$: CALL SCAN ; display usage report EXIT 40$: LEA A1,20.(A1) ; skip over this table entry JMP 30$ ; and do next one 90$: TYPECR EXIT 92$: TYPECR EXIT ; UNP - unpack conditionally ; ; Entry: A1 -> packed word ; A2 -> unpack buffer ; ; Exit: A1 -> past packed word ; A2 -> past unpacked entry (if not zero) ; UNP: TSTW @A1 ; is there an entry? BEQ 10$ ; nope UNPACK ; unpack entry BR BACKSP ; back up over spaces 10$: LEA A1,2(A1) ; skip over empty entry RTN ; BACKSP - backup over spaces in buffer ; ; Entry: A2 -> buffer end ; ; Exit: A2 -> past last non-space in buffer ; BACKSP: CMPB -1(A2),#32. ; is last byte a space? BNE 7$ ; nope DEC A2 ; go back a byte BR BACKSP 7$: RTN ; TYPCOM - type comment for ersatz device ; ; Entry: A1 -> Ersatz name ; A0 -> impure area ; ; Uses: ER.BUF(A0), ER.DDB(A0) ; ; TYPCOM: SAVE D1,A1-A3 LEA A2,ER.BUF(A0) ; A2 -> temporary buffer CALL UNP ; unpack ersatz name CALL UNP ; ... LEA A3,10$ ; A3 --> ersatz file name OUTL @A3,OT$MEM ; add to FSPEC buffer MOVB #0,(A2) ; terminate string LEA A2,ER.BUF(A0) ; open comment file FSPEC ER.DDB(A0) ; ... TSTW ER.DDB+D.PPN(A0) ; is there a PPN? JEQ 40$ ; nope - ignore INIT ER.DDB(A0) ; ... ORB #,ER.DDB+D.FLG(A0) OPENI ER.DDB(A0),F.WAT ; ... TSTB ER.DDB+D.ERR(A0) ; error? JNE 40$ ; yup! - ignore BTST #ERF$DS,ER.FLG(A0) ; do we provide whole description? BNE 24$ ; yup! BTST #ERF$OF,ER.FLG(A0) ; output to a file? BEQ 18$ ; nope MOVB #32.,D1 ; output a space to a file FILOTB ER.OUT(A0) ; ... BR 20$ ; ... 18$: TYPESP 20$: FILINB ER.DDB(A0) ; read a byte TST ER.DDB+D.SIZ(A0) ; end of file? BEQ 30$ ; yup! CMPB D1,#10. ; line feed? BEQ 20$ ; yup! - ignore CMPB D1,#13. ; end of line? BEQ 22$ ; yup BTST #ERF$OF,ER.FLG(A0) ; output to a file? BEQ 21$ ; nope FILOTB ER.OUT(A0) ; output a CR BR 20$ ; ... 21$: TTY ; display byte BR 20$ ; and loop for more 22$: BTST #ERF$DS,ER.FLG(A0) ; do we do a full description? BEQ 30$ ; nope 24$: BTST #ERF$OF,ER.FLG(A0) ; do we output to a file? BEQ 26$ ; nope MOVB #13.,D1 ; advance to next line FILOTB ER.OUT(A0) ; ... MOVB #10.,D1 ; ... FILOTB ER.OUT(A0) ; ... MOVB #9.,D1 ; ... FILOTB ER.OUT(A0) ; ... BR 20$ ; ... 26$: CRLF ; yup! - advance to next line TAB ; ... BR 20$ ; ... 30$: CLOSE ER.DDB(A0) ; close comment file PUSH ; free file buffer PUSH ER.DDB+D.BUF(A0) ; ... DELMEM @SP ; ... POP ; ... POP ; ... ANDB #<-1+D$INI>,ER.DDB+D.FLG(A0) ; ... 40$: BTST #ERF$DS,ER.FLG(A0) ; did we try a full description? BEQ 42$ ; nope BTST #ERF$OF,ER.FLG(A0) ; did we output to a file? BEQ 41$ ; nope MOVB #13.,D1 ; advance to next line FILOTB ER.OUT(A0) ; ... MOVB #10.,D1 ; ... FILOTB ER.OUT(A0) ; ... BR 42$ ; ... 41$: TYPECR 42$: REST D1,A1-A3 RTN 10$: ASCIZ /:COMENT.ERS/ ; ersatz comment file name ; PARSE - parse options from command line ; ; Entry: A2 -> command line tail ; A0 -> impure area ; ; Uses: ER.FLG(A0) ; ; PARSE: BCLR #ERF$CM,ER.FLG(A0) ; clear comment flag BCLR #ERF$DS,ER.FLG(A0) ; clear description flag BCLR #ERF$OF,ER.FLG(A0) ; cleart output file flag CMPB @A2,#': ; trailing colon? BNE 5$ ; nope INC A2 ; bypass trailing colon 5$: CMPB @A2,#'/ ; parameter follows? BNE 10$ ; nope INC A2 ; bypass slash CMPB @A2,#'C ; comment option? BEQ 82$ ; yup! CMPB @A2,#'D ; description option? BEQ 80$ ; yup! CMPB @A2,#'O ; output to a file? BNE 70$ ; nope INC A2 ; bypass colon, if any CMPB @A2,#': ; ... BNE 20$ ; ... INC A2 ; bypass colon 20$: TRM ; at end of line? BNE 22$ ; nope LEA A2,90$ ; A2 -> default output file 22$: FSPEC ER.OUT(A0),LST ; get the output file spec BSET #ERF$OF,ER.FLG(A0) ; set output file flag BR 5$ ; loop for more 70$: TYPECR EXIT 10$: RTN 80$: BSET #ERF$DS,ER.FLG(A0) ; set description flag 82$: BSET #ERF$CM,ER.FLG(A0) ; and comment flag INC A2 ; skip option BR 5$ ; and parse for more 90$: ASCII /ERSATZ.INI/ ; default output file name ; ERRGET - get matching ersatz entry ; ; Entry: A2 -> possible ersatz name ; A0 -> impure area ; ; Exit: A1 -> matching ersatz table entry, ERF$ER set, if present, ; ERF$ER clear otherwise ; ER.NAM(A0) = potential ersatz name ; ; A2 is advanced past the ersatz name if it was in the table. ; ERRGET: SAVE D1 PUSH A2 BCLR #ERF$ER,ER.FLG(A0) ; clear ersatz bit LEA A1,ER.NAM(A0) ; A1 -> ersatz name PACK ; pack potential ersatz name PACK ; ... CALL FIND ; find entry in ersatz table MOV A1,D1 ; was it found? BEQ 10$ ; nope MOV ER.NAM(A0),D1 ; does it match? CMP D1,EZ.NAM(A1) ; ... BNE 10$ ; nope BSET #ERF$ER,ER.FLG(A0) ; set ersatz bit POP ; through away saved A2 BR 20$ 10$: POP A2 20$: REST D1 RTN ; FIND - find matching ersatz table entry ; ; Entry: ER.NAM(A0) = packed name to search for ; ; Exit: A1 -> matching entry, if found, else ; -> " $$$$', if empty entry available, else ; = 0, if no match and no empty entry ; FIND: SAVE A2,D0-D1 MOV ERSATZ,A2 ; A2 -> base of system ersatz table MOV #0,A1 ; assume no match or empty entry found MOV A2,D1 ; is there an ersatz table? BEQ 90$ ; nope MOV ER.NAM(A0),D1 ; D1 = name to match MOV #<[$$$]+33_16.>,D0 ; D0 = empty entry 10$: TST EZ.NAM(A2) ; end of table? BEQ 90$ ; yup CMP D1,EZ.NAM(A2) ; do entry names match? BNE 20$ ; nope MOV A2,A1 ; A1 -> matching entry BR 90$ 20$: CMP D0,EZ.NAM(A2) ; is this an empty entry? BNE 80$ ; nope MOV A2,A1 ; A1 -> empty entry 80$: LEA A2,EZ.LEN(A2) ; A2 -> next table entry BR 10$ ; and loop for more 90$: REST A2,D0-D1 RTN ; SCAN - scan table for used/total entries ; ; Entry: A0 -> impure area ; SCAN: SAVE A1,D0-D2 CLR D1 ; clear used entries CLR D2 ; clear total entries MOVW #33,D0 ; D0 = deleted entry marker MOV ERSATZ,A1 ; A1 -> ersatz table MOV A1,D7 ; is there a table? BEQ 90$ ; nope 10$: TST EZ.NAM(A1) ; at end of table? BEQ 90$ ; yup! INC D2 ; increment total number of entries CMPW D0,EZ.NAM(A1) ; deleted entry? BEQ 20$ ; yup! INC D1 ; increment number of used entries 20$: LEA A1,EZ.LEN(A1) ; advance to next entry BR 10$ ; and loop 90$: CRLF ; produce report DCVT 0,2 TYPE < ersatz table entries used of > MOV D2,D1 DCVT 0,2 TYPECR < entries allocated.> REST A0,D0-D2 RTN END .