         << LINES .001/.009 ARE RESERVED FOR SYSTEMS INTEGRATION >>     00000001
$PAGE "MPE Caching Global Defines"                                      00010000
<<************************************************************>>        00015000
<<************ MPE Caching Global Defines ********************>>        00020000
<<************************************************************>>        00025000
                                                                        00030000
<< File INCLSF (System Failures) is required to complete      >>        00035000
<< these defines.                                             >>        00040000
                                                                        00045000
<< SYSGLOB cells >>                                                     00050000
define CACHE'DST     = absolute(%1273)#,<< Cache DST number   >>        00055000
       CACHE'DST'BANK= absolute(%1274)#,<< Cache DST bank #   >>        00060000
       CACHE'DST'OFST= absolute(%1275)#;<< Cache DST bk offset>>        00065000
                                                                        00070000
<< Memory management page size (in words) >>                            00075000
equate MMPAGESIZE = 128;   <<256>> <<512>>                              00080000
                                                                        00085000
<< These are the default minimum fetch size used >>                     00090000
<< for access methods (reads) when caching is    >>                     00095000
<< first enabled on the system.  The value is the>>                     00100000
<< the number of sectors to fetch.               >>                     00105000
equate CACHE'SEQUENTIAL = 96,  << 24K bytes >>                          00110000
       CACHE'RANDOM     = 16;  <<  4K bytes >>                          00115000
                                                                        00120000
<< This array is used to access the CDT with DB pointing to it.  >>     00125000
integer array CDT'ARRAY(*) = DB + 0;                                    00130000
double  array CDT'DARRAY(*)= DB + 0;                                    00135000
                                                                        00140000
<< This integer will be used wherever CACHING routines access the>>     00145000
<< index register explicitly.                                    >>     00150000
integer CDT'X = X;                                                      00155000
                                                                        00160000
<< The CDT entry size has been increased by two words because>><<s2300>>00161000
<< the Cached Device entry need one word to determine how    >><<s2300>>00161100
<< many bits CDT'SHIFT'DA requires to execute the DLSL       >><<s2300>>00161200
<< instruction and one more word to make the size even in    >><<s2300>>00161300
<< order to accommodate the access method of CDT'DARRAY.     >><<s2300>>00161400
                                                               <<s2300>>00161500
equate CDT'ENTRY'SIZE  = 26;  << CDT Entries are 26 words long <<s2300>>00165000
                                                               <<s2300>>00166000
equate EAGLE'SUBTYPE   = 10,  << Device subtype for HP7937     <<s2300>>00166100
       CS80'TYPE      = 3;    <<Device type for CS80 disc drive<<s2314>>00166200
$edit void=00166600                                            <<s2314>>00166300
                                                                        00170000
<<************ Cache DST Equates and Defines *****************>>        00175000
<<NOTE: Items beginning with DBL must be on a dbl word boundry>>        00180000
<<************************************************************>>        00185000
                                                                        00190000
<< DST Header Entry >>                                                  00195000
equate CDT'ENTRIES    = 0,                        <<Entries in table  >>00200000
       CDT'SIZE       = CDT'ENTRIES + 1,          <<Entry size        >>00205000
       CDT'FREE'COUNT = CDT'SIZE + 1,             <<# free entries    >>00210000
       CDT'FREE'HEAD  = CDT'FREE'COUNT + 1,       <<First free entry  >>00215000
       CDT'FREE'TAIL  = CDT'FREE'HEAD + 1,        <<Last free entry   >>00220000
       CDT'MAX'USED   = CDT'FREE'TAIL + 1,        <<Max entries used  >>00225000
       CDT'NUM'LDEVS  = CDT'MAX'USED + 1,         <<Num LDEVs cached  >>00230000
       CDT'DISC'HEAD  = CDT'NUM'LDEVS + 1,        <<First cached LDEV >>00235000
       CDT'DST'WORDS  = CDT'DISC'HEAD + 1,        <<Number of DST wds >>00240000
       CDT'STOP'PND   = CDT'DST'WORDS+1,  <<TRUE if stopcache >>        00245000
       CDT'SEQ'MINFTCH= CDT'STOP'PND+1,   <<# sectors seq ftch>>        00250000
       CDT'RND'MINFTCH= CDT'SEQ'MINFTCH+1,<<# secs random ftch>>        00255000
       CDT'FORCE'POST = CDT'RND'MINFTCH+1,<<TRUE-wait wrt comp>>        00260000
       CDT'STOP'QUEUE = CDT'FORCE'POST+1, <<Head PIN on impede>>        00265000
       CDT'END        = CDT'STOP'QUEUE+1; <<Len of entry      >>        00270000
                                                                        00275000
                                                               <<s2300>>00277000
<<***********************************************************>><<s2300>>00277100
<<******* WARNING ********* WARNING ********* WARNING *******>><<s2300>>00277200
<<***********************************************************>><<s2300>>00277300
<<**** CDT'ENTRY'SIZE must be an EVEN number in order    ****>><<s2300>>00277400
<<**** for Disc Caching to access the CDT Device entry   ****>><<s2300>>00277500
<<**** table and the Mapped Domain entry table correctly.****>><<s2300>>00277600
<<***********************************************************>><<s2300>>00277700
<<***********************************************************>><<s2300>>00277800
                                                               <<s2300>>00277900
<< Cached Disc Device Entry >>                                          00280000
equate CDT'DE'NEXT'LDEV = 0,                      <<Next cached LDEV  >>00285000
       CDT'DE'PREV'LDEV = CDT'DE'NEXT'LDEV+ 1,    <<Prev cached LDEV  >>00290000
       CDT'DE'LDEV = CDT'DE'PREV'LDEV + 1,        <<LDEV of disc      >>00295000
                                                               <<06407>>00300000
                                                               <<06407>>00305000
                                                               <<06407>>00310000
       CDT'DE'MAPD'PAGES= CDT'DE'LDEV     + 1,    <<Number of m<<06407>>00315000
                                                  <<pages now a<<06407>>00320000
       CDT'DE'MAPD'CNT  = CDT'DE'MAPD'PAGES+1,    <<# mapped CD<<06407>>00325000
       CDT'DE'MAPD'HEAD = CDT'DE'MAPD'CNT + 1,    <<Hd mapped CDT     >>00330000
       CDT'DE'MAPD'TAIL = CDT'DE'MAPD'HEAD + 1,   <<Tail mapped CDT   >>00335000
       CDT'DE'REGIONS   = CDT'DE'MAPD'TAIL + 1,   <<# of regions      >>00340000
<<dbl>>CDT'DE'REG'HD    = CDT'DE'REGIONS + 1,     <<Double abs reg hd >>00345000
<<dbl>>CDT'DE'REG'TL    = CDT'DE'REG'HD +2,       <<Double abs reg tl >>00350000
                                                                        00355000
<<dbl>>CDT'DE'RHIT      = CDT'DE'REG'TL + 2,      <<Cache read HIT cnt>>00360000
<<dbl>>CDT'DE'WHIT      = CDT'DE'RHIT + 2,        <<Cache wrt HIT coun>>00365000
<<dbl>>CDT'DE'RMISS     = CDT'DE'WHIT + 2,        <<Cache read misses >>00370000
<<dbl>>CDT'DE'WMISS     = CDT'DE'RMISS + 2,       <<Cache write misses>>00375000
<<dbl>>CDT'DE'STOP      = CDT'DE'WMISS + 2,       <<Cache I/O blocks  >>00380000
<<dbl>>CDT'DE'SCANPT    = CDT'DE'STOP   + 2,      <<Last ref domain pt>>00385000
       CDT'DE'SHIFT'CNT = CDT'DE'SCANPT + 2, <<Bits shift count<<s2300>>00386000
       CDT'DE'MAKE'EVEN = CDT'DE'SHIFT'CNT + 1, << empty cell  <<s2314>>00387000
       CDT'DE'END       = CDT'DE'MAKE'EVEN + 1; <<Entry length <<s2300>>00390000
                                                                        00395000
<< Mapped Disc Domain Entry >>                                          00400000
equate CDT'MD'PREV      = 0,                      <<Prev mapd CDT dom.>>00405000
       CDT'MD'NEXT      = CDT'MD'PREV + 1,        <<Next mapd CDT dom.>>00410000
<<dbl>>CDT'MD'SECTOR    = CDT'MD'NEXT + 1,        <<Sector base       >>00415000
<<dbl>>CDT'MD'END'SECTOR= CDT'MD'SECTOR + 2,      <<Sector limit      >>00420000
       CDT'MD'FLAGS     = CDT'MD'END'SECTOR + 2,  <<Misc flag bits    >>00425000
       CDT'MD'READ'CNT  = CDT'MD'FLAGS + 1,       <<# DISCREQ reading >>00430000
       CDT'MD'WRITE'CNT = CDT'MD'READ'CNT + 1,    <<# DISCREQ writing >>00435000
       CDT'MD'LKD'CDT   = CDT'MD'WRITE'CNT + 1,   <<CDT locked waiting>>00440000
       CDT'MD'IMPED'HD  = CDT'MD'LKD'CDT + 1,     <<Head LDR waited   >>00445000
       CDT'MD'LDR'HEAD  = CDT'MD'IMPED'HD + 1,    <<Head LDR active   >>00450000
<<dbl>>CDT'MD'MEM'ADDR  = CDT'MD'LDR'HEAD + 1,    <<Abs addr of region>>00455000
                                                  <<if present        >>00460000
       CDT'MD'DISCREQ   = CDT'MD'MEM'ADDR + 2,    <<Spare disc req    >>00465000
       CDT'MD'LK'CNT    = CDT'MD'DISCREQ + 1,     <<# of flushing CDTs>>00470000
       CDT'MD'LDEV      = CDT'MD'LK'CNT  + 1,     <<Domain's LDEV     >>00475000
       CDT'MD'IMPEDED   = CDT'MD'LDEV + 1,        <<Head impede<<06407>>00480000
       CDT'MD'DE        = CDT'MD'IMPEDED + 1,     <<Device entry #    >>00485000
       CDT'MD'END       = CDT'MD'DE      + 1;     <<Entry length      >>00490000
                                                                        00495000
<< Equates for CDT'MD'STATE - all possible 'states' a CDT can be in   >>00500000
equate CDT'AVAIL'STATE = 0, <<Available, no LDRs attached             >>00505000
       CDT'READ'STATE  = 1, <<Only read LDRs are attached             >>00510000
       CDT'WRITE'STATE = 2, <<Write and read LDRs are attached        >>00515000
       CDT'FLUSH'STATE = 3, <<All LDRs must be completed: purge CDT   >>00520000
       CDT'LOCK'STATE  = 4; <<CDT locked, awaiting other CDT flush(es)>>00525000
                                                                        00530000
<< Add equates for bit positions in CDT'MD'FLAGS word   >>              00535000
equate CDT'ABS'BIT         = 0,  << Absent bit          >>              00540000
       CDT'IMI'BIT         = 1,  << In-motion in        >>              00545000
       CDT'IMO'BIT         = 2,  << In-motion out ???   >>              00550000
       CDT'MISS'BIT        = 3,  << Miss on cache       >>              00555000
       CDT'LOCKED'BIT      = 4,  << Locked bit set      >>              00560000
       CDT'FWIP'BIT        = 5,  << Forced-write in prog>>              00565000
       CDT'ROC'BIT         = 6,  << Rec. overlay canidat>>              00570000
       CDT'VIRGIN'BIT      = 7,  << Region is virgin    >>              00575000
       CDT'WAIT'ON'NOPOST  = 8,  << Waiting on NOPOST wt>>              00580000
       CDT'SEQ'BIT         = 9,  << SEQ access to CDT   >>              00585000
       CDT'STATE'BITS      =13;  << (13:3) - state bits >>              00590000
                                                                        00595000
<< Defines for bits in FLAGS word of a mapped CDT entry >>              00600000
define CDT'ABSENT     = (CDT'ABS'BIT:1)#, <<Region is absent        >>  00605000
       CDT'IMI        = (CDT'IMI'BIT:1)#, <<In-motion in            >>  00610000
       CDT'IMO        = (CDT'IMO'BIT:1)#, <<ASK JOHN B!!!!!!        >>  00615000
       CDT'LOCKREQ'PND= (CDT'MISS'BIT:1)#, <<Lock request pending  >>   00620000
       CDT'LOCKED     = (CDT'LOCKED'BIT:1)#, <<Entry is locked      >>  00625000
       CDT'FWIP       = (CDT'FWIP'BIT:1)#, <<Forced write in-prog.  >>  00630000
       CDT'ROC        = (CDT'ROC'BIT:1)#, <<Recoverable overlay can.>>  00635000
       CDT'VIRGIN     = (CDT'VIRGIN'BIT:1)#,<<Region is VIRGIN      >>  00640000
       CDT'NOPOST     = (CDT'WAIT'ON'NOPOST:1)#,<<Wait NOPOST compl.>>  00645000
       CDT'MD'STATE   = (CDT'STATE'BITS:3)#;<<CDT state bits        >>  00650000
                                                                        00655000
<< Check that index passed is valid >>                                  00660000
<< DB must be pointing to the CDT and integer CDT'ENTRY is   >>         00665000
<< used to perform a validity check against.                 >>         00670000
define CDT'CHECK'INDEX =                                                00675000
if (CDT'ENTRY mod CDT'ENTRY'SIZE) <> 0 or                               00680000
   not (0 <= CDT'ENTRY <=                                               00685000
        (CDT'ARRAY(CDT'DST'WORDS) - 1)) then                            00690000
  SUDDENDEATH(CDT'BAD'INDEX)                                   <<06407>>00695000
else                                                           <<06407>>00700000
  if CDT'ARRAY(CDT'ENTRY) < 0 then                             <<06407>>00705000
    SUDDENDEATH(CDT'UNASSIGNED)#;                              <<06407>>00710000
                                                                        00715000
<< Check that entry passed is valid >>                                  00720000
<< DB must be pointing to the CDT and integer CDT'ENTRY is   >>         00725000
<< used to perform a validity check against.                 >>         00730000
define CDT'CHECK'ENTRY =                                                00735000
if not (0 <= CDT'ENTRY <= CDT'ARRAY(CDT'ENTRIES)) then                  00740000
  SUDDENDEATH(CDT'BAD'INDEX)                                   <<06407>>00745000
else                                                           <<06407>>00750000
  if CDT'ARRAY(CDT'ENTRY*CDT'ENTRY'SIZE) = -1 then             <<06407>>00755000
    SUDDENDEATH(CDT'BAD'INDEX)#;                               <<06407>>00760000
                                                                        00765000
<< The cache control sir is used to protect the ldev string (of ldevs>> 00770000
<< cached).  It is used when caching is enabled or disabled against  >> 00775000
<< a disc, or when a command executor wishes to display information  >> 00780000
<< about a specific device under caching control.                    >> 00785000
                                                                        00790000
equate CACHE'CONTROL'SIR = 2;                                           00795000
                                                                        00800000
<< This SHIFT instruction is used in KERNELC and in CACHESEG  ><<06407>>00805000
<< to optimize LLSH searching of disc addresses in caching.   ><<06407>>00810000
<< Since the high-order byte of a double-word disc address    ><<s2300>>00815000
<< is reserved for LDEV, we can always shift-over the disc    ><<06407>>00820000
<< address to overlay this field to increase the resolution of><<06407>>00825000
<< the LLSH instruction.  Worse case, this instruction will be><<06407>>00830000
<< DLSL(8), which merely overlays the LDEV portion of the HODA><<06407>>00835000
<< Since the HP7937 disc drive is currently our largest       ><<s2300>>00840000
<< capacity disc drive with 571 megabytes of disc memory and  ><<s2300>>00841000
<< uses only the lower 6 bits of the HODA to represent the    ><<s2300>>00845000
<< highest possible sector address, we will assume DLSL(10).  ><<s2300>>00850000
<< To tune Disc Caching performance and to allow larger discs ><<s2314>>00855000
<< to be added to the 3000 later, we now do a DESCRIBE through><<s2314>>00860000
<< P'ATTACHIO to obtain the maximum value of the single-vector><<s2314>>00861000
<< address.  Depending on what bit of the MSB of the HODA is  ><<s2314>>00862000
<< set, we'll store a corresponding number of bits to shift in><<s2314>>00863000
<< CDT'DE'SHIFT'CNT so that it can be used with the DLSL instr><<s2314>>00864000
define   CDT'SHIFT'DA =                                        <<s2300>>00865000
                                                               <<s2300>>00866000
         << Access the CDT Device entry table, get the bit >>  <<s2300>>00866100
         << shift count, and store it in the X register.   >>  <<s2300>>00866200
                                                               <<s2300>>00866300
             CDT'X := CDT'ARRAY(LDEV'OFFSET+CDT'DE'SHIFT'CNT); <<s2300>>00867000
             assemble(DLSL 0, X)#;                             <<s2300>>00868000
                                                               <<06407>>00870000
<< These subroutine defines are used in lieu of the procedures >>       00875000
<< in CACHESEG for performance reasons.  Note that no error    >>       00880000
<< checking is performed by these subroutines, and they will   >>       00885000
<< add to the procedure-local code size.                       >>       00890000
                                                                        00895000
integer CDT'SM3 = s-3,                                                  00900000
        CDT'SM4 = s-4,                                                  00905000
        CDT'SM5 = s-5,                                                  00910000
        CDT'SM6 = s-6,                                                  00915000
        CDT'SM7 = s-7,                                                  00920000
        CDT'SM8 = s-8;                                                  00925000
                                                                        00930000
double CDT'DSM4 = s-4,                                                  00935000
       CDT'DSM6 = s-6,                                                  00940000
       CDT'DSM10= s-10,                                                 00945000
       CDT'DSM12= s-12;                                                 00950000
                                                                        00955000
define CDT'ABS'ON'TOS =                                                 00960000
                                                                        00965000
tos := CACHE'DST'BANK;                                                  00970000
CDT'X := CDT'X + 1;                                                     00975000
tos := absolute(CDT'X)#;                                                00980000
                                                                        00985000
define DEF'OFST =                                                       00990000
                                                                        00995000
tos := CACHE'DST'BANK;                                                  01000000
tos := absolute(CDT'X:=CDT'X+1)+(CDT'SM4<<CD>>*CDT'ENTRY'SIZE)          01005000
                +CDT'SM3<<OFST>>#,                                      01010000
                                                                        01015000
DEF'DOFST =                                                             01020000
                                                                        01025000
tos := CACHE'DST'BANK;                                                  01030000
tos := absolute(CDT'X:=CDT'X+1)+(CDT'SM5<<CD>>*CDT'ENTRY'SIZE)          01035000
                +CDT'SM4<<OFST>>#,                                      01040000
                                                                        01045000
DEF'FOFST =                                                             01050000
                                                                        01055000
tos := CACHE'DST'BANK;                                                  01060000
tos := absolute(CDT'X:=CDT'X+1)+(CDT'SM4<<CD>>*CDT'ENTRY'SIZE)          01065000
                +CDT'MD'FLAGS#,                                         01070000
                                                                        01075000
DEF'FSOFST =                                                            01080000
                                                                        01085000
tos := CACHE'DST'BANK;                                                  01090000
tos := absolute(CDT'X:=CDT'X+1)+(CDT'SM5<<CD>>*CDT'ENTRY'SIZE)          01095000
                +CDT'MD'FLAGS#,                                         01100000
                                                                        01105000
DEF'GET'WORD =                                                          01110000
                                                                        01115000
integer subroutine CDT'GET'WORD(CD,OFST,VAL);                           01120000
value CD,OFST,VAL;                                                      01125000
integer CD,OFST,VAL;                                                    01130000
begin                                                                   01135000
                                                                        01140000
<< Load bank/offset on tos >>                                           01145000
DEF'OFST;                                                               01150000
                                                                        01155000
<< Load value on tos >>                                                 01160000
assemble(lsea);                                                         01165000
                                                                        01170000
<< Store in return value >>                                             01175000
CDT'SM7 := tos;                                                         01180000
                                                                        01185000
<< Remove stacked address >>                                            01190000
assemble(ddel);                                                         01195000
                                                                        01200000
end#,                                                                   01205000
                                                                        01210000
DEF'SET'WORD =                                                          01215000
                                                                        01220000
integer subroutine CDT'SET'WORD(CD,OFST,VAL);                           01225000
value CD,OFST,VAL;                                                      01230000
integer CD,OFST,VAL;                                                    01235000
begin                                                                   01240000
                                                                        01245000
<< Load bank/offset on tos >>                                           01250000
DEF'OFST;                                                               01255000
                                                                        01260000
<< Load value on tos >>                                                 01265000
assemble(lsea);                                                         01270000
                                                                        01275000
<< Store in return value >>                                             01280000
CDT'SM7 := tos;                                                         01285000
                                                                        01290000
<< Store new value >>                                                   01295000
tos := CDT'SM3; <<VAL>>                                                 01300000
assemble(ssea);                                                         01305000
                                                                        01310000
<< Remove stacked address >>                                            01315000
assemble(ddel);                                                         01320000
                                                                        01325000
end#,                                                                   01330000
                                                                        01335000
DEF'GET'DOUBLE =                                                        01340000
                                                                        01345000
double subroutine CDT'GET'DOUBLE(CD,OFST,VAL);                          01350000
value CD,OFST,VAL;                                                      01355000
integer CD,OFST;                                                        01360000
double VAL;                                                             01365000
begin                                                                   01370000
                                                                        01375000
<< Load bank/offset on tos >>                                           01380000
DEF'DOFST;                                                              01385000
                                                                        01390000
<< Load value on tos >>                                                 01395000
assemble(ldea);                                                         01400000
                                                                        01405000
<< Store in return value >>                                             01410000
CDT'DSM10 := tos;                                                       01415000
                                                                        01420000
<< Remove stacked address >>                                            01425000
assemble(ddel);                                                         01430000
                                                                        01435000
end#,                                                                   01440000
                                                                        01445000
DEF'SET'DOUBLE =                                                        01450000
                                                                        01455000
double subroutine CDT'SET'DOUBLE(CD,OFST,VAL);                          01460000
value CD,OFST,VAL;                                                      01465000
integer CD,OFST;                                                        01470000
double VAL;                                                             01475000
begin                                                                   01480000
                                                                        01485000
<< Load bank/offset on tos >>                                           01490000
DEF'DOFST;                                                              01495000
                                                                        01500000
<< Load value on tos >>                                                 01505000
assemble(ldea);                                                         01510000
                                                                        01515000
<< Store in return value >>                                             01520000
CDT'DSM10 := tos;                                                       01525000
                                                                        01530000
<< Store new value >>                                                   01535000
tos := CDT'DSM4; <<VAL>>                                                01540000
assemble(sdea);                                                         01545000
                                                                        01550000
<< Remove stacked address >>                                            01555000
assemble(ddel);                                                         01560000
                                                                        01565000
end#,                                                                   01570000
                                                                        01575000
DEF'ADD'DOUBLE =                                                        01580000
                                                                        01585000
double subroutine CDT'ADD'DOUBLE(CD,OFST,VAL);                          01590000
value CD,OFST,VAL;                                                      01595000
integer CD,OFST;                                                        01600000
double VAL;                                                             01605000
begin                                                                   01610000
                                                                        01615000
<< Load bank/offset on tos >>                                           01620000
DEF'DOFST;                                                              01625000
                                                                        01630000
<< Load value on tos >>                                                 01635000
assemble(ldea);                                                         01640000
                                                                        01645000
<< Add VAL to old value >>                                              01650000
tos := tos + CDT'DSM6;                                                  01655000
assemble(ddup);                                                         01660000
                                                                        01665000
<< Store in return value >>                                             01670000
CDT'DSM12 := tos;                                                       01675000
                                                                        01680000
<< Store new value >>                                                   01685000
assemble(sdea);                                                         01690000
                                                                        01695000
<< Remove stacked address >>                                            01700000
assemble(ddel);                                                         01705000
                                                                        01710000
end#,                                                                   01715000
                                                                        01720000
DEF'GET'BIT =                                                           01725000
                                                                        01730000
logical subroutine CDT'GET'BIT(CD,BIT'NO,VAL);                          01735000
value CD,BIT'NO,VAL;                                                    01740000
integer CD,BIT'NO,VAL;                                                  01745000
begin                                                                   01750000
                                                                        01755000
<< Load bank/offset on tos >>                                           01760000
DEF'FOFST;                                                              01765000
                                                                        01770000
<< Load value on tos >>                                                 01775000
assemble(lsea);                                                         01780000
                                                                        01785000
<< Store in return value >>                                             01790000
CDT'X := CDT'SM5;  <<BIT'NO>>                                           01795000
assemble(tbc 0,X);  << Test the corresponding bit >>                    01800000
if = then                                                               01805000
  CDT'SM7 := 0                                                          01810000
else                                                                    01815000
  CDT'SM7 := 1;                                                         01820000
                                                                        01825000
<< Remove stacked address >>                                            01830000
assemble(ddel,del);                                                     01835000
                                                                        01840000
end#,                                                                   01845000
                                                                        01850000
DEF'SET'BIT =                                                           01855000
                                                                        01860000
logical subroutine CDT'SET'BIT(CD,BIT'NO,VAL);                          01865000
value CD,BIT'NO,VAL;                                                    01870000
integer CD,BIT'NO,VAL;                                                  01875000
begin                                                                   01880000
                                                                        01885000
push(status);                                                           01890000
                                                                        01895000
                                                                        01900000
DEF'FSOFST;                                                             01905000
                                                                        01910000
<< Load value on tos >>                                                 01915000
DISABLE;                                                                01920000
assemble(lsea);                                                         01925000
                                                                        01930000
                                                                        01935000
CDT'X := CDT'SM6;  <<BIT'NO>>                                           01940000
if logical(CDT'SM5<<VAL>>) then                                         01945000
  assemble(tsbc 0,X)    << Turn on bit >>                               01950000
else                                                                    01955000
  assemble(trbc 0,X);   << Turn off bit >>                              01960000
                                                                        01965000
if = then                                                               01970000
  CDT'SM8 := 0         << Bit was off >>                                01975000
else                                                                    01980000
  CDT'SM8 := 1;        << Bit was on >>                                 01985000
                                                                        01990000
<< Store new value >>                                                   01995000
assemble(ssea);                                                         02000000
                                                                        02005000
                                                                        02010000
assemble(ddel);                                                         02015000
                                                                        02020000
if tos.(1:1) = 1 then                                                   02025000
  ENABLE;                                                               02030000
                                                                        02035000
end#,                                                                   02040000
                                                                        02045000
DEF'ADD'WORD =                                                          02050000
                                                                        02055000
integer subroutine CDT'ADD'WORD(CD,OFST,VAL);                           02060000
value CD,OFST,VAL;                                                      02065000
integer CD,OFST,VAL;                                                    02070000
begin                                                                   02075000
                                                                        02080000
<< Load bank/offset on tos >>                                           02085000
DEF'OFST;                                                               02090000
                                                                        02095000
<< Load value on tos >>                                                 02100000
assemble(lsea);                                                         02105000
                                                                        02110000
<< Add VAL to value on tos >>                                           02115000
tos:=tos+CDT'SM4;                                                       02120000
assemble(dup);                                                          02125000
                                                                        02130000
<< Store in return value >>                                             02135000
CDT'SM8 := tos;                                                         02140000
                                                                        02145000
<< Store new value >>                                                   02150000
assemble(ssea);                                                         02155000
                                                                        02160000
<< Remove stacked address >>                                            02165000
assemble(ddel);                                                         02170000
                                                                        02175000
end#,                                                                   02180000
                                                                        02185000
DEF'CACHE'ON'SUBROUTINE =                                               02190000
                                                                        02195000
   logical subroutine IS'LDEV'CACHE'ON;                                 02200000
   begin                                                                02205000
      if CACHE'DST = 0 then IS'LDEV'CACHE'ON := false                   02210000
      else                                                              02215000
        if CDT'FIND'DE(ldev) = 0                                        02220000
           then IS'LDEV'CACHE'ON := false                               02225000
      else IS'LDEV'CACHE'ON := true;                                    02230000
   end#;                                                                02235000
                                                                        02240000
<<***********************************************************>>         02245000
<<***********************************************************>>         02250000
<<***********************************************************>>         02255000
