OBJNAM GETMEM.LIT ; Created 14-May-87, edited 14-May-87 ; by Irv Bromberg, Medic/OS Consultants, Toronto, Canada ; Allows the size of any module in user's MEM: area to be changed relatively ; or absolutely. RADIX 10 VMAJOR=1 VMINOR=0 VEDIT=1 SEARCH SYS SEARCH SYSSYM if eq,1 Syntax examples: GETMEM MODULE.DAT 10 ; create module MODULE.DAT = 10 bytes GETMEM MODULE.DAT 10K ; create module MODULE.DAT = 10 kilobytes GETMEM MODULE.DAT 101 ; rounded up to even size = 102 bytes Of course any valid filename name may be substituted for MODULE.DAT (the default extension for the module name is ".DAT"). The module cannot already exist. A size of zero is allowed but not terribly useful (unless the CHGMEM command is use later to increase it). The created module is pre-cleared to nulls. Possible messages: ?Improper file name - MEM:filnam.ext ?Duplicate file name - MEM:filnam.ext ?Memory allocation failed ?Missing size parameter GETMEM.LIT is re-entrant and re-useable. endc JCB=A0 Buffer=A2 Name=A3 Module=A5 Size=D0 Char=D1 Number=D1 PHDR -1,0,PH$REE!PH$REU MOV JOBCUR,JCB ; use JOBRBK as work area LEA Name,JOBRBK(JCB) CLR @Name ; pre-clear filename in case CLR 4(Name) ; of invalid entry FILNAM @Name,DAT Search: TST @Name ; name received? BNE 10$ TYPE <?Improper> BR 20$ 10$: SRCH @Name,Module,F.USR ; module already in MEM:? BNE GetSiz ; no, OK to create it TYPE <?Duplicate> 20$: TYPE < file name - MEM:> PRNAM @Name CRLF EXIT GetSiz: BYP ; allow blank or tab separators MOVB @Buffer,Char ; check for absolute specifier "=" CMPB Char,#'= BEQ SkipIt ChkComma:CMPB Char,#', ; allow comma BNE GetNum SkipIt: INCW Buffer ; skip comma BYP ; bypass possibly more whitespace GetNum: LIN ; should not be at end of line BNE 10$ TYPECR <?Missing size parameter> EXIT 10$: GTDEC MOV Number,Size Kilo: CMPB @Buffer,#'K ; kilobytes? BNE FixSiz MUL Size,#1024 ; yes, convert to KB FixSiz: INC Size ; make it even BCLR #0,Size PUSH Size PUSH GETMEM @SP BNE Done ; NE=failed, errmsg on screen POP Module POP MOV (Name)+,-6(Module) ; save filename.ext MOVW @Name,-2(Module) ORW #FIL,-8(Module) ; keep it around please Done: EXIT END