16 22FL #SEG INSERTHR6 [ JUDY BIDGOOD 17 22_= #OPT K0INSERTHR=K0INSERT>K0ACCESS>K0FILESTORE>K0ALLGEO 7 23DW #LIS K0INSERTHR 7 23YG 8HINSERTHR 4 24D6 [ 12 24XQ SEGENTRY K1INSERTHR,X1INSERTHR 4 25CB [ 6 25X2 # ERRORS 5 26BL ZGEOER1 19 26W= GEOERR 1,BACKWARD [MARK SEVEN CODE BEING OBEYED 5 27*W ZGEOER2 19 27TG GEOERR 1,ZEROREC [ZERO RECORD MET UNEXPECTEDLY 5 28*6 ZGEOER3 21 28SQ GEOERR 1,AVERAGE! [AVERAGE CONTENTS OF BLOCK RIDICULOU 5 29#B ZGEOER4 20 29S2 GEOERR 1,EMPTYBIT [^EMPTY BLOCK^ BIT SET ON ENTRY. 5 2=?L ZGEOER5 20 2=R= GEOERR 1,FULLBGON [FULLB GONE.OUGHT TO BE PRESENT 5 2?=W ZGEOER6 20 2?QG GEOERR 1,ZERODOWN [UNEXPECTED ZERO MOVE IN INSERTHR 5 2#=6 ZGEOER7 21 2#PQ GEOERR 1,BIG REC [UNABLE TO SHARE BLOCKS SATISFACTORIL 5 2*9B ZGEOER8 20 2*P2 GEOERR 1,OVERFULL [>512 WORDS IN MIDDLE BLOCK ! 5 2B8L ZGEOER9 18 2BN= GEOERR 1,NO BLOCK [ERROR IN SFINDFURB S/R. 5 2C7W ZGEOER10 18 2CMG GEOERR 1,CARE ??? [FREADBLOCK UNREASONABLE 5 2D76 ZGEOER11 21 2DLQ GEOERR 1,ENDBLOCK [INSERT REACHED E.O.B. UNEXPECTEDLY. 4 2F6B # 5 2FL2 SFULLB 8 2G5L #HAL BSTB+FULLB,0 6 2GK= KXINSERTHR 4 2H4W X 20 2HJG +GSBS/4 [THISPARAMETER DECIDES THE MAXIMUM AMOUNT OF OEVRFLOW 16 2J46 [WE TRY TO FIT INTO AN ADJACENT BLOLK 6 2JHQ KPINSERTHR 5 2K3B PERCENT 20 2KH2 +GSBS*3/10 [THIS PARAMEJER DETERMINES THE MINIMUM'FULLNESS' 17 2L2L [BEYOND WHICH WE DON'T ^SHARE^ BLOCKS. 4 2LG= # 4 2L_W # 8 2MFG # SUBROUTINES 4 2M_6 # 4 2NDQ # 10 2NYB SFCB3 [SET X3-> FCB 8 2PD2 SMO FX2 9 2PXL LDX 0 AWORK2 15 2QC= SFSTACK 0,3 [X3 -> FCA 8 2QWW SMO FX2 14 2RBG STO 3 ACOMMUNE5 [STORE 8 2RW6 PSTAC 3,3 15 2S*Q BFCBX 3,3 [X3 -> FCB 7 2STB EXIT 6 0 4 2T*2 # 6 2TSL SENDBLOCK 18 2W#= LDX 1 3 [X3 &X1 -> NEXT RECORD 5 2WRW SEBLP 14 2X?G LDEX 0 FRH(1) [NEXT R.H 15 2XR6 ADS 0 1 [ADD INTO PTR 17 2Y=Q BNZ 0 SEBLP [J BACK IF NON ZERO 13 2YQB EXIT 7 0 [EXIT 4 2_=2 # 5 2_PL SFURB 8 329= SMO FX2 17 32NW LDX 0 AWORK2 [SET X2 - > FSTACK 8 338G SFSTACK 0,2 8 33N6 SMO FX2 14 347Q STO 2 ACOMMUNE5 [-> FCA 5 34MB SFFURB 8 3572 PSTAC 2,2 9 35LL BRN SFFULP 6 366= SFINDFURB 20 36KW # CALLED BY X1.THE WORD AFTER THE CALL CONTAINS THE TYPE/SUBTYPE 20 375G # WANTED.X3 ->FCB,X2 WILL POINT ON EXIT TO THE BLOCK REQUIRED. 17 37K6 LDX 2 FPTR(3) [J OVER FSTACK BLOCK 5 384Q SFFULP 15 38JB LDX 2 FPTR(2) [NEXT BLOCK 10 3942 BXE 2 CXFI,ZGEOER9 9 39HL LDX 0 ATYPE(2) 7 3=3= #SKI K6INSERT 12 3=GW BXE 0 FILEPLUSFCB,ZGEOER9 16 3?2G BXU 0 0(1),SFFULP [J IF WRONG TYPE 17 3?G6 EXIT 1 1 [EXIT ROUND TYPE-WORD 4 3?_Q # 4 3#FB # 16 3#_2 SFINDFULLB [SET X3 ->FCB,X2-> APPROPRIATE FULLB 21 3*DL # CALLED BY X6,OVERWRITES X2,WHICH POINTS TO AN APPROPRIATE FULLB 14 3*Y= # FOR THIS FILE ON SUCCESSFUL EXIT (+1) 10 3BCW # EXIT +0 => NO FULLB 9 3BXG # X3 POINTS TO FCB. 8 3CC6 SMO FX2 9 3CWQ LDX 0 AWORK2 17 3DBB SFSTACK 0,2,2 [FIND X2 -> FSTACK 15 3DW2 BFCBX 3,2 [X3 -> FCB 15 3F*L SFLP LDX 2 FPTR(2) [NEXT BLOCK 18 3FT= BXE 2 CXFI,(6) [J OUT IF END OF CHAIN 13 3G#W LDX 0 ATYPE(2) [TYPE 20 3GSG BXE 0 FILEPLUSFCB,(6) [EXIT FCB, SEARCH UNSUCCESSFUL 8 3H#6 SMO FX1 17 3HRQ BXU 0 SFULLB,SFLP [J IF NOT BSTB/FULLB 9 3J?B LDX 0 A1+1(2) 18 3JR2 BXU 0 BSPRE(3),SFLP [J IF WRONG B.S.PREFIX. 7 3K=L EXIT 6 1 4 3KQ= # 5 3L9W SFCA2 8 3LPG SMO FX2 14 3M96 LDX 0 AWORK2 [DEPTH 15 3MNQ SFSTACK 0,2 [X2 -> FCA 8 3N8B SMO FX2 9 3NN2 STO 2 ACOMMUNE5 8 3P7L EXIT 6 0 4 3PM= # 4 3Q6W # 6 3QLG SCAREFULA 20 3R66 # THIS ROUTINE DOES ALL THE CAREFUL UPDATING FOR 1 BLOCK HAVING 21 3RKQ # BEEN CHANGED. IF NECESSARY A BSTR/FULLB IS SET UP,OR ALTLEN'ED, 13 3S5B # AND THE BLOCK NO. IS SWAPPED OVER 4 3SK2 # 13 3T4L # OVERWRITES X1,2,3,6, CALLED BY X7 21 3TJ= # X4 THROUGHOUT INDICATES WHICH BLOCK NUMBER TO CHANGE (A FREADBLOCK 13 3W3W # TYPE PTR REL. TO AD OF THE FCB); 19 3WHG # ON EXIT X2 -> THE USAGE BLOCK; THIS IS ASSUMED TO BE A 9 3X36 # FI/INSERT4 BLOCK 4 3XGQ # 6 3Y2B SCAREFULA1 8 3YG2 #SKI K6INSERT>99-99 9 3Y_L TRACE 4,CAREFUL 8 3_F= #SKI K6INSERT<99$99 10 3_YW BXGE 4 BSBS,ZGEOER10 17 42DG JBC STEND,3,BFCARE [EXIT IF NOT CAREFUL 19 42Y6 LDX 0 4 [BLOCK WE'RE INTERESTED IN 14 43CQ SBN 0 FBLKS-1 [DATUMISE 20 43XB MAPBCH 0,3 [TEST IF BIT SET IN FMAPP BLOCK. 16 44C2 BNZ 0 STEND [EXIT IF IT IS 16 44WL SBX 7 FX1 [DATUMISE LINK 21 45B= JBC NEWFULLB,3,BFALTR [IF FILE NOT ALTERED,SET UP A FULLB 17 45TW CALL 6 SFINDFULLB [X2-> FULLB,X3-> FCB 18 46*G BRN NEWFULLB [J IF FULLB NOT PRESENT 16 46T6 LDX 6 ALOGLEN(2) [NOW ALTLEN FULLB 7 47#Q ADN 6 1 7 47SB LDX 3 2 15 48#2 ALTLEN 3,6 [BY ONE WORD 17 48RL CALL 6 SFINDFULLB [X2-> FULLB,X3->FCB 21 49?= CALL 0 ZGEOER5 [ERROR IF UNSUCCESSFUL,X0 TELLS US 19 49QW BRN SFULONG [WHENCE WE CAME FOR GEOERR. 5 4==G NEWFULLB 17 4=Q6 SETNCORE 3,1,BSTB,FULLB [SET UP FUUB,X1 -> IF 14 4?9Q CALL 6 SFCB3 [X3 ->FCB 15 4?PB LDX 2 3 [X1 -> FCB 4 4#92 XLP 19 4#NL LDX 2 FPTR(2) [NEXT BLOCK IN FILE CHAIN. 18 4*8= BXE 2 CXFI,SCHAIN [J IF END OF FILE CHAIN. 9 4*MW LDX 0 ATYPE(2) 18 4B7G BXE 0 FILEPLUSFCB,SCHAIN [J IF WE'VE REACHED FCB 18 4BM6 SMO FX1 [O/W SEARCH FOR FULLB. 16 4C6Q BXU 0 SFULLB,XLP [J IF NOT FULLB 5 4CLB SCHAIN 14 4D62 STO 1 6 [PRESERVE 19 4DKL CHAIN 1,BPTR(2) [CHAI> IN FRONT OF NEXT FCB 13 4F5= LDX 2 6 [FULLB PTR 17 4FJW LDX 0 BSPRE(3) [B.S. PREFIX OF FULLB 9 4G4G STO 0 A1+1(2) 13 4GJ6 LDN 0 2 [R.H. 16 4H3Q STO 0 A1(2) [R.H. OF FULLB 5 4HHB SFULONG 5 4J32 SGETBAC 9 4JGL LDX 3 BSPRE(3) 15 4K2= GETBACK 3 [GET 1 BLOCK 10 4KFW ADDSKIP I516A,BSGET 7 4K_G LDX 1 3 14 4LF6 CALL 6 SFCB3 [X3->FCB 21 4LYQ BXE 1 BSPRE(3),OKBLOK [JIF BSPRE HASN'T CHANGED OVER COOR 10 4MDB LDX 2 ACOMMUNE7(2) 15 4MY2 FREEBACK 1,2 [FREE BLOCK 10 4NCL ADDSKIP I516A,ADLFBL 8 4NX= CALL 6 SFCB3 9 4PBW BRN SGETBAC 5 4PWG OKBLOK 9 4QB6 LDX 2 FPTR(3) 15 4QTQ CALL 6 SFLP [X2 -> FULLB 9 4R*B CALL 0 ZGEOER5 7 4RT2 SMO 4 8 4S#L LDX 0 0(3) 17 4SS= SMO A1(2) [OLD BLOCK IN FULLB 8 4T?W STO 0 A1(2) 15 4TRG LDN 0 1 [UPDATE R.H 8 4W?6 ADS 0 A1(2) 8 4WQQ SMO FX2 15 4X=B LDX 6 ACOMMUNE7 [NEW BLOCK 7 4XQ2 SMO 4 16 4Y9L STO 6 0(3) [NGN BLOCK IN FCB 16 4YP= CALL 1 SFINDFURB [FIND USAGE BLOCK 8 4_8W #HAL FI+INSERT4,0 15 4_NG STO 6 BACK2(2) [BLOCK NUMBER 12 5286 LDX 0 BSPRE(3) [ 15 52MQ STO 0 BACK1(2) [B.S.PREFIX. 21 537B MBS 3,BFALTR,BFALTB [INDICATE FILE & BLOCK NOS. ALTERED 16 53M2 STO 2 6 [INSERT4 BLOCK 9 546L SBN 4 FBLKS-1 18 54L= MAPBSE 4,3 [SET BIT IN FMAPP BLOCK 9 555W ADN 4 FBLKS-1 7 55KG LDX 2 6 8 5656 ADX 7 FX1 7 56JQ EXIT 7 0 5 574B STEND 17 57J2 CALL 1 SFINDFURB [X2 -> INSERT4 BLOCK 8 583L #HAL FI+INSERT4,0 7 58H= EXIT 7 0 4 592W # 4 59GG # 21 5=26 # THIS S/R DOES THE CAREFUL UPDATING FOR A NEW BLOCK; A BIT HAS TO 20 5=FQ # BE INSERTED IN THE FMAP BLOCK,AND A BLOCK NO. INSERTED IN THE 6 5=_B # FCB 4 5?F2 # 21 5?YL # OVERWRITES X1,X2,X3,X6,X5; X4 POINTS TO BLOCK NO. BEFORE WHICH THE 21 5#D= # BLOCK IS TO BE INSERTED. IN THE CASE OF NON-CAREFUL FILES,WE 20 5#XW # CAN USE AN UNUSED BL.NO., IF ANY;O/W WE MUST GET A NEW ONE. 11 5*CG # X2 ON EXIT -> USAGE BLOCK 5 5*X6 SINSERT 5 5BBQ SINSERT1 8 5BWB SBX 7 FX1 17 5CB2 DOWN INSERTBL,2 [INSERT BLOCK NUMBER 11 5CTL TESTREP FILEFULL,SFULL 8 5D*= ADX 7 FX1 17 5DSW CALL 1 SFURB [X2 - START OF AREA TO BE MOVED 4 5KP6 # 6 5L8Q MOVEDOWNB 9 5LNB #SKI K6INSERT>199-199 4 5M82 ( 9 5MML TRACE 0,SIZE 9 5N7= TRACE 1,DOWN BY 4 5NLW ) 19 5P6G LDX 4 1 [SIZE OF SPACE TO BE CREATED 19 5PL6 [THIS IS AMOUNT WE HAVE TO 14 5Q5Q LDX 5 0 [MOVE DOWN BLOCK 20 5QKB ADX 5 3 [X5 POINTS TO THE BOTTOM OF THE 21 5R52 LDX 6 5 [AREA TO BE MOVED,X6 POINTS TO THE 7 5RJL ADX 6 1 21 5S4= SMO 6 [BOTTOM OF THE AREA TO BE MOVED INTO. 19 5SHW STOZ 0 [ZEROISE WORD AT END OF BLOCK 21 5T3G MOVELOOP [ WE CAN ONLY MOVE DOWN [X4]=[X1] WORDS AT A TIME(OR 21 5TH6 [LESS,OF COURSE),FOR FEAR OF OVERWRITING WE START AT THE 21 5W2Q BXL 0 4,MOVELAST [BOTTOM.J IF AMOUNT LEFT TO MOVE IS 18 5WGB [NOW LESS THAN MAXIMUM. 21 5X22 SBX 5 4 [MOVE POINTERS UP TO POINT TO NEXT 19 5XFL SBX 6 4 [AREAS TO BE MOVED TO & FROM. 8 5X_= MOVE 5 0(1) 21 5YDW BXE 5 3,(7) [EXIT IF AREA TO BE MOVED IS AN EXACT 17 5YYG [MULTIPLE OF [X4]. 20 5_D6 SBX 0 4 [DECREMENT SIZE OF AREA LEFT TO 21 5_XQ BRN MOVELOOP [MOVE AND JUMP BACK TO START OF LOOP 21 62CB MOVELAST [THIS CODE MOVES THE'REMAINDER' DOWN 17 62X2 LDX 1 0 [SIZE OF LAST MOVE 15 63BL LDX 5 3 [FROM HERE 7 63W= LDX 6 3 14 64*W ADX 6 4 [TO HERE 8 64TG MOVE 5 0(1) 7 65*6 EXIT 7 0 4 65SQ # 4 66#B # 4 66S2 # 21 67?L # THIS SEGMENTS EXPECTS A FI/INSERT1, A FI/INSERT3, AND THE INSERTE 20 67R= # -REPLACEE IN A FILE/FWB.IT SETS UP A FI/INSERT2 BLOCK, SMOOTHS 20 68=W # THE DATA IN THE FIRST THREE BLOCKS INTO THE THREE INSERT BLOX, 15 68QG # AND INSERTS THE EXTRA AT THE SAME TIME. 4 69=6 # 4 69PQ # 7 6=9B # ON ENTRY:- 4 6=P2 # 21 6?8L # AWORK1 :-BOTTOM 9 BITS = SIZE EXTRA NEEDED(I.E. SURPLUS OF REPL- 17 6?N= # ACER OVER REPLACEE,OR SIZE OF INSERTEE) 15 6#7W # AWORK3 :- B0-8:SIZE OF RECORD(FROM FWB) 16 6#MG # B15-23:A1+AREA USED IN INSERT1 BLOCK 15 6*76 # AWORK4 :-A1+ AREA USED IN INSERT3 BLOCK 4 6*LQ # 15 6B6B # X5 :- +1 IF FORWARD,-1 IF BACKWARD. 4 6BL2 # 6 6C5L X1INSERTHR 7 6CK= #SKI K6INSERT 4 6D4W ( 21 6DJG LDCT 0 #14 [ERROR IF^EMPTY BLOCK^ & ^EMPTY BLOCK 16 6F46 ANDX 0 AWORK1(2) [@ EOF^ BITS SET 9 6FHQ BNZ 0 ZGEOER4 4 6G3B ) 18 6GH2 LDN 5 1 [SET X5 =+1 IF FORWARD 8 6H2L LDCT 0 #40 9 6HG= ANDX 0 AWORK1(2) 9 6H_W BNZ 0 NOBAK47 18 6JFG NGN 5 1 [ =-1 IF BACKWARD 5 6J_6 NOBAK47 19 6K2C ... SETNCORE GSBS,1,FI,INSERT3 [ACTUALLY AN INSERT2 BLOCK 15 6K3N ... CALL 6 SFCA2 [X2 -> FCA 10 6K4_ ... LDX 4 FREADBLOCK(2) 21 6K6= ... BNG 5 N5 [WE'RE GOING TO INSERT A BLOCK NO IN 21 6K7H ... ADN 4 1 [THE FCB. IF WE'RE GOING BACKWARDS,US 21 6K8S ...N5 [X4->FREADBLOCK,IF FORWARD F'BLOCK +1 8 6K=5 ... PSTAC 3,2 20 6K?B ... CHAIN 1,3 [CHAIN INSERT2 INTO FILE CHAIN 16 6K#M ... CALL 7 SINSERT1 [INSERT BLOCK NO. 18 6K*Y ... NAME 2,FI,INSERT2 [RENAME BLOCK CORRECTLY. 8 6KC9 ... STOZ A1(2) 10 6KDQ ADDSKIP I516A,INSE3 17 6KYB CALL 1 SFURB [X2 -> INSERT3 BLOCK 8 6LD2 #HAL FI+INSERT3,0 14 6LXL NAME 2,FI,INSERT4 [RENAME 8 6MC= LDX 2 FX2 14 6MWW LDX 2 ACOMMUNE5(2) [-> FCA 8 6NW6 #SKI K6INSERT>99$99 12 6P*Q TRACE FREADWORD(2),INSERTHR 16 6PTB ADX 4 5 [X4 -> BLOCK NO. 7 6Q*2 PSTAC 2,2 15 6QSL BFCBX 3,2 [X3 -> FCB 16 6R#= CALL 7 SCAREFULA1 [CAREFUL UPDATING 16 6RRW NAME 2,FI,INSERT3 [RERENAME BLOCK. 8 6_MB LDX 1 FX2 15 7272 LDEX 7 AWORK1(1) [EXTRA NEEDED 9 72LL LDX 0 AWORK3(1) 17 736= ANDN 0 -1 [SIZE USED IN INSERT1 20 73KW ADX 7 0 [+AMT.USED IN INSERT1 BLOCK +A1 20 745G ADX 7 AWORK4(1) [+ AMOUNT USED IN INSERT3 BL. +A1 14 74K6 SBN 7 A1*2 [- A1*2 16 754Q STOZ 6 [DOUBLE-LENGTH 14 75JB LDN 0 3 [DIVISOR 20 7642 DVR 6 0 [X7 NOW CONTAINS AVGE. IN 3 BLOK. 8 76HL #SKI K6INSERT>99-99 9 773= TRACE 7,SMOOTH 3 17 77GW STO 7 ACOMMUNE1(1) [STORE IN ACOMMUNE1 7 782G #SKI K6INSERT 4 78G6 ( 10 78_Q BXGE 7 BSBS,ZGEOER3 9 79FB LDN 0 GSBS/3-1 9 79_2 BXGE 0 7,ZGEOER3 4 7=DL ) 4 7=Y= # 10 7?CW # USE OF ACOMMUNE WORDS. 4 7?XG # 20 7#C6 # ACOMMUNE1 :- THE IDEAL EVENTUAL AVERAGE PACKING DENSITY IN THE 12 7#WQ # THREE USAGE BLOX. 14 7*BB # ACOMMUNE2 :- POINTER TO INSERT2 BLOCK 17 7*W2 # ACOMMUNE3 :- POINTER TO INSERT1 OR INSERT3 BLOCK 21 7B*L # ACOMMUNE4 :- CUMULATIVE TOTAL OF WORDS MOVED INTO THE INSERT2 BLOC 12 7BT= # ACOMMUNE5 :- POINTER TO FCA 11 7C#W # ACOMMUNE6 :- MOSTLY UNUSED 4 7CSG # 21 7D#6 # FIRSTLY WE DECIDE WHETHER THE INSERTEE/REPLACEE IS TO GO INTO THE 20 7DRQ # INSERT1 OR INSERT2 BLOCK. IF THE LATTER,WE JUMP TO ^RECINS2^. 21 7F?B # FOR THE FIRST CASE,WE CALCULATE HOW MUCH OF THE INSERT1 BLOCK IS 21 7FR2 # TO GO INTO THE INSERT2 BLOCK,MOVE IT ACROSS.THEN WE MOVE DOWN THE 18 7G=L # REST OF THE INSERT1 BLOCK & MOVE IN THE NEW RECORD. 4 7GQ= # 16 7H9W BNG 5 SHAR3BAK [J IF BACKWARD. 14 7H*R ... LDX 2 ACOMMUNE5(1) [X2 -> FCA 9 7HFN ... CALL 1 SFFURB 17 7HKK ...#HAL FI+INSERT2,0 [X2 -> INSERT2 BLOCK 8 7HMH ... LDX 1 FX2 16 7HPG STO 2 ACOMMUNE2(1) [-> INSERT2 BLOCK 14 7J96 LDX 2 ACOMMUNE5(1) [-> FCA 16 7JNQ LDX 4 FREADWORD(2) [PRESERVE F'WORD 17 7K8B CALL 1 SFFURB [X2 -> INSERT1 BLOCK 8 7KN2 #HAL FI+INSERT1,0 8 7L7L LDX 1 FX2 18 7LM= STO 2 ACOMMUNE3(1) [ACOM3 -> INSERT1 BLOCK 16 7M6W LDX 5 4 [PRESERVE F'WORD. 8 7MLG SBN 4 A1 21 7N66 BXGE 4 7,RECINS2 [IF F'WORD IS > AVGE ALLOWED IN BLOCK 21 7NKQ [THE INSERTEE/REPLACEE GOES INTO THE 16 7P5B [INSERT2 BLOCK 20 7SGQ LDX 6 AWORK3(1) [J IF THE SIZE OF THE NEW RECORD 19 7T2B SRL 6 15 [IS GREATER THAN THE AVERAGE 10 7TG2 BXGE 6 7,VLARGEREC 7 7T_L ... LDX 0 6 21 7WF= SRA 0 1 [HALVE IT(+1 TO BE ON THE SAFE SIDE) 21 7WYW ADX 0 4 [SIMILARLY IF THE I/R.IS > AVGE. BY 18 7XDG BXL 7 0,RECINS2 [MORE THAN 1/2 ITS SIZE 6 7XY6 VLARGEREC 19 7YCQ ... ADX 4 6 [SIMILARLY IF IT DOESN'T FIT. 10 7_C2 BXGE 4 BSBS,RECINS2 8 7_WL #SKI K6INSERT>99$99 9 82B= TRACE 4,RECINS1 20 82TW LDN 0 A1-3 [TELLS US HOW MANY BACK FROM LAST 18 83*G STO 0 ACOMMUNE7(1) [BLOCK F'BLOCK WILL BE 17 83T6 ADX 2 5 [-> CURRENT RECORD 17 84#Q STO 2 6 [PRESERVE THIS IN X6 16 84SB LDX 0 AWORK1(1) [J IF NOT REPLACE 8 85#2 BPZ 0 NREP5 16 85RL LDEX 0 FRH(2) [SKIP REPLACEE 18 86?= ADX 2 0 [MOVE ON POINTER TO BLOCK 5 86QW NREP5 20 87=G BXGE 4 7,MOVEALL [J IF WHOLE OF REST OF BLOCK GOES 7 87Q6 LDN 1 0 17 889Q ZLOOP [INTO INSERT2 BLOCK 9 88PB #SKI K6INSERT>299-299 9 8992 TRACE 4,FINDMEAN 15 89NL LDEX 0 FRH(2) [NEXT RECORD 21 8=8= BZE 0 MOVENON [J IF NONE OF THIS BLOCK GOES INTO 16 8=MW [INSERT2 BLOCK 16 8?7G ADX 2 0 [UPDATE POINTER 21 8?M6 ADX 4 0 [UPDATE ^SIZE TO BE LEFT IN INSERT1 21 8#6Q BXL 4 7,ZLOOP [BLOCK^UNTIL IT EXCEEDS THE AVERAGE 21 8#LB BXL 4 BSBS,MOVESOME [IN X7,BUT DOWNDATE AGAIN IF LAST RH 18 8*62 SBX 2 0 [PUSHED TOTAL OVER 512 17 8*KL SBX 4 0 [DOWNDATE 2 TOTALS 15 8B5= MOVEALL [=MOVESOME 5 8BJW MOVESOME 9 8C4G #SKI K6INSERT>199$199 9 8CJ6 TRACE 4,RESTIN2 7 8D3Q #SKI K6INSERT 4 8DHB ( 17 8F32 LDEX 0 FRH(2) [J IF NO OVERFLOW. 9 8FGL BZE 0 ZGEOER2 4 8G2= ) 8 8GFW LDX 1 FX2 15 8G_G LDX 3 ACOMMUNE2(1) [-> INSERT2 9 8HF6 LDX 1 AWORK3(1) 8 8HYQ ANDN 1 -1 20 8JDB SBX 1 2 [SUB PTR TO START OF AREA TO BE 21 8JY2 SMO FX2 [MOVED,AND ADD PTR TO INSERT1 BLOCK. 18 8KCL ADX 1 ACOMMUNE3 [GIVES SIZE TO BE MOVED 7 8KX= #SKI K6INSERT 4 8LBW ( 10 8LWG BXGE 1 BSBS,ZGEOER6 9 8MB6 BZE 1 ZGEOER6 4 8MTQ ) 8 8N*B ADN 3 A1 9 8NT2 #SKI K6INSERT>199$199 9 8P#L TRACE 1,FROM1TO2 17 8PS= MOVE 2 1(1) [MOVE AREA ACROSS. 4 8Q?W # 20 8QRG # WE NOW MOVE DOWN THE INSERT1 BLOCK & MOVE IN THE NEW RECORD 4 8R?6 # 5 8RQQ MOVENON 19 8S=B LDX 0 2 [GIVES SIZE TO BE MOVED DOWN 7 8SQ2 SBX 0 6 8 8T9L LDX 2 FX2 14 8TP= STO 1 ACOMMUNE4(2) [STORE 20 8W8W LDX 3 6 [PTR TO START OF AREA IN INSERT1 18 8WNG LDEX 1 AWORK1(2) [SIZE OF FXTRA REQUIRED 20 8X86 BZE 0 QCHRDPT [J IF NOTHING TO BE MOVED DOWN 16 8XMQ CALL 7 MOVEDOWNB [MOVE BLOCK DOWN. 9 8Y7B BRN RDPTCH 5 8YM2 QCHRDPT 7 8_6L SMO 1 17 8_L= STOZ 0(3) [ZEROISE LAST WORD 5 925W RDPTCH 15 92KG LDX 1 ACOMMUNE3(2) [-> INSERT1 10 9356 STO 1 ACOMMUNE8(2) 17 93JQ LDX 0 AWORK1(2) [J IF REPLACE,NO NEED 18 944B BNG 0 NOCHRDPT [TO CHANGE READ POINTERS 20 94J2 ANDN 0 #777 [BOTTOM 9 BITS = SIZE OF INSERTEE 14 953L SMO ACOMMUNE5(2) [-> FCA 9 95H= ADS 0 FREADWORD 5 962W NOCHRDPT 10 96GG MHUNTW 2,FILE,FWB 8 9726 ADN 2 A1 9 97FQ LDEX 1 FRH(2) 9 97_B #SKI K6INSERT>199-199 9 98F2 TRACE 1,MOVEFWB2 17 98YL MOVE 2 0(1) [MOVE IN NEW RECORD 9 99D= #SKI K6INSERT>299-299 10 99XW TRACE 0(3),NEW REC 5 9=CG NOWIN1 4 9=X6 # 20 9?BQ # WE NOW MOVE ACROSS A CHUNK FROM THE TOP OF THE INSERT3 BLOCK 20 9?WB # INTO THE BOTTOM OF THE INSERT2 BLOCK & MOVE UP THE REST OF THE 8 9#B2 # INSERT3 BLOCK 4 9#TL # 8 9**= LDX 2 FX2 9 9*SW #SKI K6INSERT>299-299 11 9B#G TRACE AWORK4(2),TRY3TO2 14 9BS6 LDX 7 ACOMMUNE1(2) [AVERAGE 15 9C?Q LDX 2 ACOMMUNE5(2) [X2 -> FCA 16 9CRB CALL 1 SFFURB [X2 -> INSERT3 8 9D?2 #HAL FI+INSERT3,0 8 9DQL LDX 1 FX2 17 9F== STO 2 ACOMMUNE3(1) [STORE PTR TO BLOCK 8 9FPW ADN 2 A1 17 9G9G LDX 4 AWORK4(1) [AMT. USED IN INSERT3 8 9GP6 SBN 4 A1 18 9H8Q BXGE 7 4,NONEMOVE [J IF INSERT3 BLOCK OK. 20 9HNB LDX 5 ACOMMUNE4(1) [AMOUNT ALREADY IN INSERT2 BLOCK 20 9J82 BXGE 7 5,YLXP [IF NOT COMPARATIVELY LARGE JUMP 20 9JML LDX 7 5 [O/W RECALCULATE AVERAGE BETWEEN 21 9K7= ADX 7 AWORK4(1) [TWO BLOX.WE'VE DECIDED TO PUT TOO 21 9KLW SRA 7 1 [MUCH INTO THE I2 BLOCK;WE'LL HAVE TO 17 9L6G STO 7 ACOMMUNE1(1) [MAKE THE BEST OF IT. 20 9LL6 BXGE 7 4,NONEMOVE [J AGAIN IF I3 NOW ABOUT RIGHT 4 9M5Q YLXP 14 9MKB LDX 1 2 [PRESERVE 5 9N52 YLOOP 9 9NJL #SKI K6INSERT>499-499 9 9P4= TRACE 4,FINDMEAN 14 9PHW LDEX 0 FRH(1) [NEXT R.H 7 9Q3G #SKI K6INSERT 14 9QH6 BZE 0 ZGEOER11 [ENDBLOCK 21 9R2Q ADX 5 0 [ADD ON R.H.TO TOTAL INTO I2 BLOCK. 19 9RGB BXL 5 BSBS,NEXLOOP [J IF NOT YET EXCEEDED GSBS. 19 9S22 SBX 5 0 [AS WE CAN ONLY PUT 511 WORDS 9 9SFL BRN YLPEND 5 9S_= NEXLOOP 21 9TDW SBX 4 0 [DECREMENT TO BE LEFT IN BLOCK 15 9TYG ADX 1 0 [UPDATE PTR 19 9WD6 BXL 7 4,YLOOP [J BACK IF AMOUNT NOT YET ENOUGH. 5 9WXQ YLPEND 9 9XCB #SKI K6INSERT>299-299 9 9XX2 TRACE 4,TO MOVE. 8 9YBL SMO FX2 20 9YW= SBX 5 ACOMMUNE4 [AMOUNT TO BE MOVED FROM I3 TOI2 9 9_*W #SKI K6INSERT>199-199 9 9_TG TRACE 5,FROM3TO2 18 =2*6 BZE 5 NONEMOVE [J IF MOVE NONE I3->I2 20 =2SQ BXE 4 7,UNCLEVER [IF EQUAL,NO NEED TO BE CLEVER 20 =3#B BRN YCLEVER [SOMETHING INGENIOUS MAY BE DONE. 6 =3S2 SUBLASTRH 9 =4?L #SKI K6INSERT>699-699 9 =4R= TRACE 0,-LAST 21 =5=W ADX 4 0 [IF OVERFLOW CALCULATED WON'T FIT, 21 =5QG SBX 5 0 [PUT LAST RECORD BACK INTO INSERT3. 16 =6=6 BZE 5 NONEMOVE [J IF NONE LEFT 7 =6PQ SBX 1 0 9 =79B BRN UNCLEVER 5 =7P2 YCLEVER 9 =88L #SKI K6INSERT>699-699 9 =8N= TRACE 5,YCLEVER 13 =97W LDX 3 0 [SAVE 21 =9MG SRA 3 1 [TAKE 1/2 LAST R.H, & ADD TO TOTAL TO 20 ==76 ADX 3 4 [BE LEFT IN INSERT3 IF THIS IS 20 ==LQ BXGE 7 3,SUBLASTRH [NO!LESS THAN AVGE,SUB LAST R.H. 5 =?6B UNCLEVER 9 =?L2 #SKI K6INSERT>299-299 4 =#5L ( 10 =#K= TRACE 4,UNCLEVER 9 =*4W TRACE 5,ACROSS 4 =*JG ) 8 =B46 SMO FX2 15 =BHQ LDX 3 ACOMMUNE2 [-> INSERT2 8 =C3B SMO FX2 19 =CH2 ADX 3 ACOMMUNE4 [ADD AMOUNT ALREADY MOVED IN 8 =D2L ADN 3 A1 7 =DG= SMO 5 15 =D_W MOVE 2 0 [MOVE ACROSS 16 =FFG SMO 5 [AMOUNT MOVED IN 19 =F_6 STOZ 0(3) [ZEROISE LAST WORD IN BLOCK 15 =GDQ SMO 4 [AMOUNT LEFT; 20 =GYB MOVE 1 1 [MOVE UP BLOCK +1 FOR ZERO WORD 8 =HD2 SMO FX2 9 =HXL ADS 5 ACOMMUNE4 5 =JC= NONEMOVE 18 =JWW LDX 2 FX2 [RENAME INSERT2 BLOCK. 10 =KBG LDX 1 ACOMMUNE2(2) 10 =KW6 LDX 2 ACOMMUNE5(2) 10 =L*Q LDX 6 FREADBLOCK(2) 7 =LTB PSTAC 2,2 14 =M*2 BFCBX 2,2 [-> FCB 20 =MSL SBX 6 FBLMOD(2) [IF LAST BLOCK HAS BEEN A_TERED 16 =N#= SMO FX2 [DECREMEND CMOD 9 =NRW SBX 6 ACOMMUNE7 10 =P?G BNZ 6 NOTLASTALT 8 =PR6 ADN 4 A1 9 =Q=Q STO 4 CMOD(2) 20 =QQB NGS 4 CMOD(2) [UNTIL I CAN W_K OUT WHAT TO DO 6 =R=2 NOTLASTALT 8 =RPL SMO FX2 9 =S9= LDX 0 ACOMMUNE4 9 =SNW #SKI K6INSERT>199$199 9 =T8G TRACE 0,TOTALIN2 10 =TN6 BXGE 0 BSBS,ZGEOER7 9 =W7Q LDX 7 FBLMOD(2) 11 =WMB SBN 7 FBLKS-A1-FNEARLY 9 =X72 SBX 7 FSIZE(2) 8 =XLL SETREP OK 17 =Y6= BNG 7 NSETFRP [J IF NOT NEARLY FULL 9 =YKW SETREP FNEARLY 5 =_5G NSETFRP 8 =_K6 LDN 0 #77 9 ?24Q ANDX 0 FINFC(2) 16 ?2JB BZE 0 RENAMEW [J IF NOT INDEXED 9 ?342 ACROSS INDEX,3 5 ?3HL RENAMEW 8 ?43= LDX 2 FX2 10 ?4GW LDX 1 ACOMMUNE2(2) 9 ?52G NAME 1,FILE,FUWB 10 ?5G6 LDX 1 ACOMMUNE3(2) 9 ?5_Q NAME 1,FILE,FUWB 10 ?6FB LDX 1 ACOMMUNE8(2) 9 ?6_2 NAME 1,FILE,FUWB 5 ?7DL UP 4 ?7Y= # 21 ?8CW # HERE WE HAVE TO MOVE A ^SANDWICH^ ACROSS FROM THE INSERT1 TO THE 20 ?8XG # INSERT2 BLOCK.IT CONSISTS OF A SMALL AMOUNT OF OVERFLOW BEFORE 21 ?9C6 # FREADWORD;THEN THE NEW RECORD;THEN THE REST OF THE INSERT1 BLOCK. 20 ?9WQ # WE BRANCH BACK TO^NOCHRDPT^ TO DEAL WITH THE INSERT3 BLOCK. 5 ?=BB RECINS2 9 ?=W2 #SKI K6INSERT>199-199 9 ??*L TRACE 4,RECINS2 18 ??T= LDCT 0 #20 [SET RINB FOR INDEXING 9 ?##W ORS 0 AWORK1(1) 20 ?#SG LDN 0 A1-2 [TELLS US HOW MANY BACK FROM LAST 18 ?*#6 STO 0 ACOMMUNE7(1) [BLOCK F'BLOCK WILL POINT 10 ?*RQ LDX 3 ACOMMUNE2(1) 16 ?B?B ADN 3 A1 [-> INSERT2 BLOCK 9 ?BR2 LDX 0 AWORK3(1) 8 ?C=L ANDN 0 -1 21 ?CQ= BXL 0 7,POSSTOPINS [J IF POSS TO MOVE SOME FROM INSERT1 5 ?D9W NOTOPINS 10 ?DPG LDX 2 ACOMMUNE3(1) 10 ?F96 SMO ACOMMUNE5(1) 9 ?FNQ ADX 2 FREADWORD 9 ?G8B BRN NOTOPINS3 6 ?GN2 POSSTOPINS 8 ?H7L SBN 5 A1 8 ?HM= ADN 2 A1 7 ?J6W LDN 4 0 5 ?JLG VLOOP 9 ?K66 #SKI K6INSERT>499-499 9 ?KKQ TRACE 4,VLOOP 15 ?L5B LDEX 0 FRH(2) [NEXT R.H. 7 ?LK2 #SKI K6INSERT 9 ?M4L BZE 0 ZGEOER6 16 ?MJ= ADX 2 0 [UPDATE CORE PTR 21 ?N3W ADX 4 0 [UPDATE ^SIZE LEFT IN INSERT1 BLOCK^ 10 ?NHG BXE 4 5,NOTOPINS 20 ?P36 BXL 4 7,VLOOP [J BACK IF NOT YET UP TO OPTIMUM. 9 ?PGQ #SKI K6INSERT>199-199 9 ?Q2B TRACE 4,SIZEINS1 8 ?QG2 ADN 4 A1 21 ?Q_L SMO ACOMMUNE5(1) [J IF NEXT RECORD IS THE REPLACEE OR 21 ?RF= SBX 4 FREADWORD [POST-INSERTEE.(NO TOP TO ^SANDWICH^ 9 ?RYW BZE 4 QREPL1 21 ?SDG BPZ 4 NOTOPINS2 [BEING MOVED INTO THE INSERT2 BLOCK) 7 ?SY6 NGX 4 4 7 ?TCQ SMO 4 15 ?TXB MOVE 2 0 [MOVE TOP IN 9 ?WC2 #SKI K6INSERT>199$199 9 ?WWL TRACE 4,TOPINS1 19 ?XB= SMO 4 [PICK UP R.H.OF NEXT RECORD 9 ?XTW LDEX 6 FRH(2) 7 ?Y*G STOZ 0(2) 15 ?YT6 ADX 3 4 [UPDATE PTR 9 ?_#Q BRN YTOPINS2 6 ?_SB NOTOPINS2 17 #2#2 SBX 2 0 [DECREMENT POINTER 6 #2RL NOTOPINS3 7 #3?= LDN 4 0 5 #3QW QREPL1 20 #4=G LDEX 6 FRH(2) [R.H.OF REPLACEE OR POST-INSERTEE 5 #4Q6 YTOPINS2 9 #59Q #SKI K6INSERT>199$199 9 #5PB TRACE 4,TOP1->2 14 #692 STO 4 ACOMMUNE4(1) [STORE 15 #6NL MHUNTW 2,FILE,FWB [NEW RECORD 8 #78= ADN 2 A1 9 #7MW SMO FRH(2) 14 #87G MOVE 2 0 [MOVE IT IN 9 #8M6 SMO FRH(2) 15 #96Q STOZ 0(3) [ZERO WORD 9 #9LB LDEX 4 FRH(2) 21 #=62 ADS 4 ACOMMUNE4(1) [UPDATE^AREA MOVED INTO INSERT2 BLOCK 15 #=KL LDX 2 ACOMMUNE3(1) [-> INSERT1 14 #?5= STO 2 ACOMMUNE8(1) [FOR END 14 #?JW SMO ACOMMUNE5(1) [-> FCA 15 ##4G ADX 2 FREADWORD [-> RECORD 16 ##J6 LDX 0 AWORK1(1) [MARKER WORD 15 #*3Q BPZ 0 NREP6 [J IF INSERT 21 #*HB STOZ 0(2) [ZEROISE LAST WOID IN INSERT1 BLOCK 16 #B32 ADX 2 6 [J OWER RECORD 7 #BGL LDX 0 3 18 #C2= SBX 0 ACOMMUNE2(1) [PTR TO INSERT2 BLOCK. 14 #CFW SMO ACOMMUNE5(1) [-> FCA 16 #C_G STO 0 FREADWORD [NEW FREADWORD 8 #DF6 BRN YREP4 5 #DYQ NREP6 18 #FDB LDX 0 ACOMMUNE4(1) [AMOUNT IN INSERT2 BLOCK 13 #FY2 ADN 0 A1 [+A1 14 #GCL SMO ACOMMUNE5(1) [->FCA 16 #GX= STO 0 FREADWORD [NEW FREADWORD 5 #HBW YREP4 18 #HWG ADX 3 4 [ZERO WD. @ END OF BLOCK 8 #JB6 STOZ 0(3) 7 #JTQ LDN 0 1 14 #K*B SMO ACOMMUNE5(1) [->FCA 16 #KT2 ADS 0 FREADBLOCK [+1 TO F'BLOCK 19 #L#L LDX 0 AWORK3(1) [AMOUNT USED IN INSERT1 BLOCK 8 #LS= ANDN 0 -1 21 #M?W SBX 0 2 [PTR TO START OF AREA TO BE MOVED AC/ 21 #MRG ADX 0 ACOMMUNE3(1) [ROSS AS BOTTOM OF SANDWICH,+ PTR TO 19 #N?6 [INSERT1 BL. TO ABSOLUTIZE. 21 #NQQ BZE 0 NOBOTINS2 [X0 CONTAINS SIZE OF BOTTOM OF ^SAND/ 17 #P=B [WICH^.J IF NOUGHT. 16 #PQ2 SMO 0 [MOVE IT ACROSS 15 #Q9L MOVE 2 1 [+ZERO WORD 9 #QP= #SKI K6INSERT>199$199 9 #R8W TRACE 0,BOTINS1 21 #RNG ADS 0 ACOMMUNE4(1) [UPDATE ^SIZE MOVED INTO INSERT2 BL.^ 6 #S86 NOBOTINS2 15 #SMQ STOZ 0(2) [END OF BLOCK 19 #T7B BRN NOWIN1 [GO TO DO INSERT3 -> INSERT2 5 #TM2 SHAR3BAK 9 #W6L BRN ZGEOER1 4 #WL= [ 14 #X5W MENDAREA K6INSERT/5<100>30,K99INSERTHR 4 #XKG #END 8 ____ ...15744606000700000000