comment | Definitions for purifying and relocating variables into impure low core. BVAR and EVAR should bracket each group of variables, which by definition are impure. LVAR may be used for single-line variable definitions. PURPGB specifies page no. beginning pure code; VARBEG specifies loc beginning variable (impure) code. Note that PURPGB is a page number, while VARBEG is a location. VARCHK is a macro which should be called at the end of the program to ensure that pure and impure storage areas do not overlap, and to put MIDAS variables (foo', .scalar foo, etc) in the impure area. It may be called more than at various places throughout the program, and each time will define PURPGE to be the first page unused by pure core. TMPLOC ,{text} will assemble specified text at and restore the loc counter automatically. To purify, use something like: MOVE A,[,,purpgb] .CALL [SETZ ? 'CORBLK ? 1000,,%CBNDR 1000,,%JSELF ? A ? SETZI %JSELF] | ifndef purpgb, purpgb==1 ; 1st pure page normally 1; single impure at 0. ifndef varbeg, varbeg==100 ; Variables normally start at location 100 ; Initialize internal syms for B/EVAR %%pbeg==2000*purpgb ; Loc of 1st pure wd %%pend==%%pbeg ; Used to remember pure loc while assembling variables. %%vend==varbeg ; Current first unused loc for vars %%vflg==0 ; 1 when assembling into var area, 0 otherwise. loc %%pbeg ; Start assembling into pure! define bvar ifn %%vflg,.err BVAR inside BVAR! .m"%%vflg==1 .m"%%pend==. loc %%vend termin define evar ife %%vflg,.err EVAR without BVAR! .m"%%vflg==0 .m"%%vend==. loc %%pend termin define lvar -line bvar line evar termin ifndef tmploc,{ define tmploc val,?arg %%%tlc==. loc val arg loc %%%tlc termin } define errmac a,b,c,d,e,f .err a!b!c!d!e!f termin define varchk lvar variables ; Do this first; LVAR will set %%PEND properly .m"purpge==<%%pend+1777>/2000 ifg varbeg-%%pbeg,{ifl .-varbeg,{ errmac [Pure overflow! ]\<.-varbeg>,[ words needed, increase VARBEG to ]\.,[?] } } ifle varbeg-%%pbeg,{ifl %%pbeg-%%vend,{ errmac [Impure overflow! ]\<%%vend-%%pbeg>,[ words needed, increase PURPGB to ]\<<1777+%%vend>/2000>,[?] } } termin