;*************************************************************************
;* *
;* ERSET 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.
;
;
; ERSET: Make ersatz name assignments in global system ersatz
; table once system is up and running.
;
; Syntax: ERSET /r:<total table entries>
; /r:+<additional empty table entries>
; <name>[:][/d ]
; [=[<cpu>-][<dev><unit>:][<file>.<ext>][PPN]]
;
; Where: <name> is the ersatz entry name to define or replace,
;
; /d indicates that the named entry is to be removed,
;
; <cpu> is a CPU number,
; <dev> is a device name,
; <unit> is a unit number,
; <file> is a file name,
; <ext> is a file extention,
; <PPN> is a project-programmer number.
;
; Deleted entries have names that start with " $$$$".
;
; Author: Rene S. Hollan
;
; COPYRIGHT (C) - 1989 - UDISCO LTD.
;
; Edit History
; ------------
;
; [103] 3 January 1990
; Reserving entries during boot now works. /RSH
;
; [102] 28 December 1989
; Work starts on reserving entries during boot. /RSH
;
; [101] 28 December 1989
; Catch errors in command line fspec. /RSH
;
; [100] 22 December 1989
; Coding starts. /RSH
;
;
SEARCH SYS
SEARCH SYSSYM
EZ.LEN = 20. ; Length of ersatz table entry
; Impure area
OFINI
OFDEF ER.NAM, 4 ; Ersatz entry name
OFDEF ER.ENT, EZ.LEN ; Ersatz table entry
OFDEF ER.DDB, D.DDB ; DDB for file spec
OFDEF ER.NUM, 4 ; number of entries to add/reserve
OFDEF ER.FLG, 1 ; Flag
ERF$DL = 0 ; delete entry
ERF$MD = 1 ; modify entry
ERF$TS = 2 ; set total space
ERF$AS = 3 ; add more space
ERF$NA = 4 ; name specified
OFSIZ ER.LEN ; size of ER impure area
VMAJOR=1 ; major version
VMINOR=0 ; minor version
VSUB=0 ; sub version
VEDIT=103. ; edit version
ERSET: PHDR -1,PV$RSM!PV$WSM,PH$REU!PH$REE ; program header
GETIMP ER.LEN,A0 ; get impure memory
BYP ; skip blanks
TRM ; end of line?
JNE 10$ ; nope
; 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
TTYI
ASCII .ERSET: R option can only be used during system.
BYTE 13.,0
EVEN
TYPECR < initialization before programs are loaded>
TYPECR < into system memory.>
EXIT
10$: BTST #ERF$AS,ER.FLG(A0) ; add space?
BEQ 15$ ; nope, make up total
MOV ER.NUM(A0),D2 ; D2 = space to add
BR 18$ ; add them
15$: MOV A4,D1 ; compute entries in table
MOV A3,D7 ; ...
SUB D7,D1 ; ...
DIV D1,#EZ.LEN ; ...
SUB D0,D1 ; D1 = entries in table
MOV ER.NUM(A0),D2 ; compute entries to add
SUB D1,D2 ; D2 = entries to add
BMI 90$ ; already too much
SUB D0,D2 ; subtract already deleted entries
BMI 90$ ; too much
18$: BEQ 92$ ; nothing to do
20$: MOV #EZ.LEN,D1 ; clear out entry
30$: CLRB (A4)+ ; ...
SOB D1,30$ ; ....
; mark as deleted
MOV #<[$$$]+33_16.>,EZ.NAM-EZ.LEN(A4) ; ...
SOB D2,20$ ; repeat for next entry
90$: TYPECR <ERSET: more than specified total entries already>
TYPECR < in system ersatz table.>
RTN
; CHKMEM - check if ersatz memory is contiguous
;
; Exit: Zero flag set if ersatz table memory is contiguous
; If so, A3 -> start of ersatz memory table,
; A4 -> end of ersatz memory table,
; D0 = number of deleted entries.
;
CHKMEM: MOV SYSTEM,D7 ; is system up?
AND #SY$UP,D7 ; ...
BEQ 5$ ; nope!
RTN ; system already up, sorry!
5$: MOV #0,D0 ; clear deleted entries counter
MOV ERSATZ,D7 ; anything in system memory?
BEQ 90$ ; nope
MOV D7,A3 ; A3 -> start of ersatz area
MOV D7,A4 ; A4 -> current end of ersatz area
10$: MOV @A4,D7 ; end of table?
BEQ 20$ ; yup
TSTW EZ.NAM(A4) ; deleted entry?
BNE 12$ ; nope
INC D0 ; increment deleted entry count
12$: ADD #EZ.LEN,A4 ; A4 -> next entry
BR 10$
20$: MOV A4,D7 ; is ersatz table contiguous?
MOV MEMBAS,D6 ; ...
SUB #4,D6 ; ...
CMP D6,D7 ; ...
RTN ; ... return with status
90$: MOV MEMBAS,A3 ; nothing in memory
MOV A3,A4 ; A3,A4 -> start of ersatz table
LCC #PS.Z ; set zero flag
RTN