objnam BJSIZE.LIT ; created 3-Jan-85, last edited 4-Jan-85
; by Irv Bromberg, Medic/OS Consultants, Toronto, CANADA
; Medical and Operating Systems Software Consultants
RADIX 10
VEDIT=5
VMINOR=3
VMAJOR=1
VSUB=0
IF EQ,1
Under AMOS/L 1.3 BJSIZE.LIT 1.3(5) size=604 bytes, hash=654-363-176-350.
See BJMEM.DOC for more details.
Syntax: BJSIZE {bytes}{K}
Used only at system bootup time to set the boot job's memory partition
size to the specified amount. AMOS/L normally allocates less than 32K
to the boot job, the actual amount being 32K minus BM.SIZ less the
size of DSK0:BADBLK.SYS[1,2], where BM.SIZ=size of the temporary DSK0:
Bitmap input/output Dataset Driver Block and flags (106 bytes under
AMOS/L 1.3). This subtracted space is not needed after the first
DEVTBL command has been executed, thereafter the boot job's partition
can be increased to overlap this area. The boot job's partition end is
at MEMEND so there is no need to move the bootup INI command file that
is being executed -- simply move the partition base JOBBAS(JCB) to the
new address and either clear all modules by writing a longword zero to
the new base address or create a temporary module and let EXIT delete it.
Restrictions:
BJSIZE will not change the boot job's partition before the first
DEVTBL command has been executed or after the first SYSTEM command.
As a precaution the valid range for partition size is 16K-64K bytes.
Default:
As a default BJSIZE will move the boot job's partition base exactly
32K bytes away from MEMEND.
Hints:
BJSIZE deletes all modules in the boot job's partition if the
New Size is less than (Old Size +12). If the New Size is more
than 12 greater than the Old Size then BJSIZE creates a temporary
memory module between the new base and any modules that already
have been loaded. When BJSIZE EXITs this temporary memory module
is deleted and any modules that have been loaded slide down to
the new base. Thus as long as you are increasing the partition
size by more than 12 bytes no LOADed modules will be lost.
Warning:
Do not make the boot job's partition so large that another job's
partition will later overlap with it as it is allocated.
ENDC
SEARCH SYS
SEARCH SYSSYM
JCB=A0
Base=A1
Buffer=A2
Dev=A3
Atemp=A6
NewSize=D0
Number=D1
OldSize=D2
Diff=D3
Dtemp=D6
KB=1024
PHDR -1,0,PH$REE!PH$REU ; re-entrant & re-usable
MOV JOBCUR,JCB ; index this job's Job Control Block
MOV JOBTBL,Atemp ; check first job in JOBTBL
MOV @Atemp,Atemp
ChkJCB: CMP Atemp,JCB ; is this the boot job?
BEQ ChkSYS
TYPECR <?Only the boot job may execute this program>
EXIT
ChkSYS: MOV SYSBAS,Number ; any SYSTEM modules loaded?
BEQ ChkDEV
TYPECR <?Must preceed any SYSTEM commands>
EXIT
ChkDEV: MOV DEVTBL,Number ; has first DEVTBL been executed?
CMP Number,MEMBAS
BLO ChkSIZ
TYPECR <?Must not be used before DEVTBL command>
EXIT
ChkSIZ: MOV #32*KB,Number ; pre-set default=32K
LIN ; size specified?
JEQ ChkMem ; no, use default
GTDEC ; yes, get specified size
BMI NoGood
TST Number ; could be 0 if syntax bad
BNE Kilo
NoGood: TYPECR <?Invalid partition size specified>
EXIT
Kilo: CMPB @Buffer,#'K ; kilobytes specified?
BNE Even
MUL Number,#KB ; yes, multiply by 1K
Even: INC Number ; round up to even number
BCLR #0,Number
Chk64: CMP Number,#64*KB ; >64K?
BLOS Chk16
TYPECR <?Partition size cannot exceed 64K bytes>
EXIT
Chk16: CMP Number,#16*KB
BHIS ChkMem
TYPECR <?Partition size cannot be less than 16K bytes>
EXIT
ChkNew: MOV Number,NewSize ; save a copy
MOV JOBSIZ(JCB),OldSize
MOV NewSize,Diff
SUB OldSize,Diff ; calculate the difference in size
BNE DoIt ; =0 if no change being made
TYPE <%Partition size is already>
DCVT 0,OT$TRM!OT$LSP!OT$TSP
TYPECR <bytes, no action taken>
EXIT
DoIt: MOV MEMEND,Base ; index end of physical memory
SUB NewSize,Base ; calculate new partition base addr
MOV Base,JOBBAS(JCB) ; set new partition base address
MOV NewSize,JOBSIZ(JCB) ; set new partition size
CMP Diff,#12
BGE MakeTMP ; take a signed comparison >=
TYPECR <%All memory modules deleted>
CLR @Base
BR ShowSize
MakeTMP:MOV Diff,@Base ; make temporary module at base
CLRW 4(Base) ; clear its flag word so EXIT will DEL it
ShowSize:MOV NewSize,Number ; restore register for DCVT
TYPE <[>
DCVT 0,OT$TRM!OT$TSP
TYPE <bytes allocated at >
MOV Base,Number ; copy for OCVT
OCVT 0,OT$TRM
TYPECR <]>