Home » Personal collection » Acorn hard disk » unzip_tools » !Infozip » SHeap/SHeap

SHeap/SHeap

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn hard disk » unzip_tools » !Infozip
Filename: SHeap/SHeap
Read OK:
File size: 1EA7 bytes
Load address: 0000
Exec address: 0000
File contents
    1REM Sliding_Heap Library
    2REM requires SlidingHeap 2.00
    3REM module and PROCs
    4REM LEN Steven Haslam 1992
    5REM updated LEN Harriet Bazley 19th November 2002
    6
    7ERROR 255,"This is a library;  do not attempt to run it directly!"
    8
    9DEF PROCinitheaps(heapsize%,slidingblocks%)
   10REM Call this procedure to create the empty heap before you do anything else
   11REM heapsize% defines the initial size of the fixed heap
   12REM slidingblocks% defines the maximum possible number of sliding blocks
   13
   14REM the fixed heap should be used only for blocks which will never change size
   15REM and which the programmer wishes to ensure will never slide
   16sh_fixedheapsize%=heapsize%
   17sh_heap_trigger%=FN_heap_pageup(HIMEM+sh_fixedheapsize%+20+20*slidingblocks%-&8000)
   18PROCsetslotsize(sh_heap_trigger%)
   19IF FN_heap_slotsize<sh_heap_trigger% THEN ERROR 130,"Unable to initialise heap"
   20sh_fixedheapbase%=HIMEM
   21sh_slidingheapbase%=HIMEM+sh_fixedheapsize%
   22SYS "OS_Heap",0,sh_fixedheapbase%,,sh_fixedheapsize%
   23SYS "SlidingHeap_Create",sh_slidingheapbase%,2,slidingblocks%
   24SYS "SlidingHeap_VerifyHeap",sh_slidingheapbase%
   25ENDPROC
   26:
   27DEF FNcreate_anchor(name$)
   28REM Every sliding block must have an anchor.   The block gets moved around
   29REM in memory, but its current address can always be found at !anchor%
   30REM This function creates an anchor and returns its address for future reference
   31REM The name you supply will be used in error messages and heap info reports
   32LOCAL space%
   33DIM space% 4+LEN name$+1
   34!space%=0
   35$(space%+4)=name$
   36=space%
   37:
   38DEF PROCcreate_named_sliding_block(anchor%,size%)
   39REM This is the function which actually creates a heap block.
   40REM First you must have created an anchor for the block.
   41LOCAL trysize%
   42size%=FN_heap_wordup(size%)
   43trysize%=FN_heap_pageup(FN_heap_nextfree+size%-&7FF4)
   44IF trysize%>sh_heap_trigger% THEN
   45  PROCsetslotsize(trysize%)
   46  IF FN_heap_slotsize<trysize% THEN
   47    PROCsetslotsize(sh_heap_trigger%)
   48    ERROR 131,"Not enough room to create block """+$(anchor%+4)+""""
   49    ELSE
   50    sh_heap_trigger%=trysize%
   51  ENDIF
   52ENDIF
   53SYS "SlidingHeap_NewBlock",sh_slidingheapbase%,anchor%,size%,anchor%+4
   54SYS "SlidingHeap_VerifyHeap",sh_slidingheapbase%
   55ENDPROC
   56:
   57DEF PROCextend_named_sliding_block(anchor%,newsize%)
   58REM This function increases (or decreases - the name is misleading) the size
   59REM of a heap block.  Other blocks may slide around as the block size changes.
   60REM If the block did not previously exist, it will be created - so there's not
   61REM really a lot of point using PROCcreate_named_sliding_block, I suppose...
   62REM Note that newsize% is the TOTAL size of the resulting block, not the
   63REM increase/decrease in size - i.e. you need to keep track of the current size.
   64LOCAL trysize%,oldsize%,larger%
   65IF !anchor%=0 THEN PROCcreate_named_sliding_block(anchor%,newsize%):ENDPROC
   66IF !anchor%>FN_heap_nextfree THEN ERROR 129,"Block beyond heap limits"
   67newsize%=FN_heap_wordup(newsize%)
   68SYS "SlidingHeap_DescribeBlock",sh_slidingheapbase%,anchor% TO ,,oldsize%
   69larger%=newsize%>oldsize%
   70IF larger% THEN
   71  trysize%=FN_heap_pageup(FN_heap_nextfree+(newsize%-oldsize%)-&7FFC)
   72  IF trysize%>sh_heap_trigger% THEN
   73    PROCsetslotsize(trysize%)
   74    IF FN_heap_slotsize<trysize% THEN
   75      PROCsetslotsize(sh_heap_trigger%)
   76      ERROR 132,"Not enough room to extend block """+$(anchor%+4)+""""
   77      ELSE
   78      sh_heap_trigger%=trysize%
   79    ENDIF
   80  ENDIF
   81ENDIF
   82SYS "SlidingHeap_ExtendBlock",sh_slidingheapbase%,anchor%,newsize%
   83trysize%=FN_heap_pageup(FN_heap_nextfree-&7FFC)
   84IF trysize%<>sh_heap_trigger% THEN
   85   PROCsetslotsize(trysize%)
   86   sh_heap_trigger%=trysize%
   87ENDIF
   88SYS "SlidingHeap_VerifyHeap",sh_slidingheapbase%
   89ENDPROC
   90:
   91DEF PROCscrap_sliding_block(anchor%)
   92LOCAL trysize%
   93REM This function discards a sliding block, returning its memory to the heap.
   94REM Note that the anchor is NOT deleted and can be reused later.
   95REM In fact anchors cannot be deleted.
   96IF !anchor%=0 THEN ENDPROC
   97SYS "SlidingHeap_ScrapBlock",sh_slidingheapbase%,anchor%
   98trysize%=FN_heap_pageup(FN_heap_nextfree-&7FFC)
   99IF trysize%<>sh_heap_trigger% THEN
  100  PROCsetslotsize(trysize%)
  101  sh_heap_trigger%=trysize%
  102ENDIF
  103!anchor%=0
  104SYS "SlidingHeap_VerifyHeap",sh_slidingheapbase%
  105ENDPROC
  106:
  107DEF PROCdestroyheaps
  108REM This procedure destroys the entire sliding heap.
  109LOCAL ptr%,anchor%,slot%
  110ptr%=sh_slidingheapbase%+16
  111REM start of slots
  112FOR slot%=1 TO (sh_slidingheapbase%!4):REM number of slots
  113  anchor%=ptr%!4
  114  ptr%+=16
  115  IF anchor%<>0 THEN !anchor%=0:REM reset anchors in use
  116NEXT slot%
  117PROCsetslotsize(HIMEM-&8000)
  118ENDPROC
  119:
  120DEF FNsliding_block_size(anchor%)
  121REM This function returns the current size of a sliding block
  122LOCAL size%
  123SYS "SlidingHeap_DescribeBlock",sh_slidingheapbase%,anchor% TO ,,size%
  124=size%
  125:
  126DEF PROCverify_heap
  127SYS "SlidingHeap_VerifyHeap",sh_slidingheapbase%
  128ENDPROC
  129:
  130DEF FNincreaseslots(newmax%)
  131LOCAL trysize%,size%,slots%
  132SYS "SlidingHeap_IncreaseSlots",sh_slidingheapbase%,0 TO ,slots%
  133IF newmax%=0 THEN:=slots%
  134REM return current heap size
  135size%=newmax%-slots%:REM number of slots to increase by
  136size%=size%*16:REM extra space needed by these slots
  137trysize%=FN_heap_pageup(FN_heap_nextfree+size%-&7FFC)
  138IF trysize%>sh_heap_trigger% THEN
  139  PROCsetslotsize(trysize%)
  140  IF FN_heap_slotsize<trysize% THEN
  141     PROCsetslotsize(sh_heap_trigger%)
  142     ERROR 133,"Could not increase number of slots in heap"
  143   ELSE
  144     sh_heap_trigger%=trysize%
  145   ENDIF
  146ENDIF
  147SYS "SlidingHeap_IncreaseSlots",sh_slidingheapbase%,newmax% TO ,newmax%
  148SYS "SlidingHeap_VerifyHeap",sh_slidingheapbase%
  149=newmax%
  150:
  151REM Various procedures called by Sliding Heap Library procedures
  152DEF FN_heap_slotsize
  153LOCAL R0%
  154SYS "Wimp_SlotSize",-1,-1 TO R0%
  155=R0%
  156:
  157DEF FN_heap_pageup(n%)
  158LOCAL R0%
  159SYS "OS_ReadMemMapInfo" TO R0%
  160=(n%+R0%-1) AND NOT (R0%-1)
  161:
  162DEF PROCsetslotsize(newsize%)
  163SYS "Wimp_SlotSize",newsize%,-1
  164ENDPROC
  165:
  166DEF FN_heap_nextfree
  167LOCAL nextfree%
  168SYS "SlidingHeap_NextFree",sh_slidingheapbase% TO nextfree%
  169=nextfree%
  170:
  171DEF FN_heap_wordup(x%)=(x%+3) AND NOT 3
  172:
  173 REM Sliding_Heap Library
  174 
  175 DEF PROCheap_store(anchor%,RETURN size%,inc%,RETURN ptr%,L%,string$)
  176 IF string$<>"" THEN L%=LEN(string$)
  177 IF ptr%-!anchor%+L%+1>size% THEN
  178   size%+=inc%
  179   PROCextend_named_sliding_block(anchor%,size%)
  180 ENDIF
  181 IF string$<>"" THEN $ptr%=string$:ptr%+=L%:?ptr%=10
  182 ENDPROC
  183 
  184 DEF FN_heap_numtostr(d%,n%)=RIGHT$(STRING$(d%,"0")+STR$~n%,d%)
  185 DEF FN_heap_snumtostr(d%,n%)=RIGHT$(STRING$(d%," ")+STR$ n%,d%)
  186 :
  187 DEF PROCheapsinfo(block%)
  188 LOCAL bigbloc%,totfree%
  189 SYS "OS_Heap",1,sh_fixedheapbase% TO ,,bigbloc%,totfree%
  190 PRINT "Fixed heap"
  191 PRINT "----- ----"
  192 PRINT "Heap base    : &";FN_heap_numtostr(8,sh_fixedheapbase%)
  193 PRINT "Heap size    : ";FN_heap_bytes2(sh_fixedheapsize%)
  194 PRINT "Largest free : ";FN_heap_bytes2(bigbloc%)
  195 PRINT "Total free   : ";FN_heap_bytes2(totfree%)
  196 PRINT
  197 PRINT "Sliding heap"
  198 PRINT "------- ----"
  199 SYS "SlidingHeap_HeapInfo",sh_slidingheapbase%
  200 ENDPROC
  201 :
  202 DEF FN_heap_bytes(b%)
  203 LOCAL end%
  204 SYS "OS_ConvertFixedFileSize",b%,block%,block%+&100 TO ,end%
  205 ?end%=13
  206 =$block%
  207 :
  208 DEF FN_heap_bytes2(b%)
  209 LOCAL end%
  210 SYS "OS_ConvertFileSize",b%,block%,block%+&100 TO ,end%
  211 ?end%=13
  212 =$block%
  213 :
  214 DEF FNcreate_fixed_block(size%)
  215 LOCAL pointer%,flag%
  216 SYS "XOS_Heap",2,sh_fixedheapbase%,,size% TO ,,pointer%;flag%
  217 WHILE flag% AND 1
  218 PROCextendfixedheap
  219 SYS "XOS_Heap",2,sh_fixedheapbase%,,size% TO ,,pointer%;flag%
  220 ENDWHILE
  221 =pointer%
  222 :
  223 DEF PROCextendfixedheap
  224 LOCAL nshb%,extend%,trysize%
  225 SYS "OS_ReadMemMapInfo" TO extend%
  226 trysize%=FN_heap_slotsize+extend%
  227 PROCsetslotsize(trysize%)
  228 IF FN_heap_slotsize<trysize% THEN ERROR 255,"No room to extend fixed heap"
  229 nshb%=sh_slidingheapbase%+extend%
  230 SYS "SlidingHeap_ShiftHeap",sh_slidingheapbase%,nshb%
  231 SYS "OS_Heap",5,sh_fixedheapbase%,,extend%
  232 sh_fixedheapsize%+=extend%
  233 sh_slidingheapbase%=nshb%
  234 SYS "SlidingHeap_VerifyHeap",sh_slidingheapbase%
  235 ENDPROC
  236 :
� Sliding_Heap Library
� requires SlidingHeap 2.00
� module and PROCs
� � Steven Haslam 1992
1� updated � Harriet Bazley 19th November 2002

B� 255,"This is a library;  do not attempt to run it directly!"

	*� �initheaps(heapsize%,slidingblocks%)

N� Call this procedure to create the empty heap before you do anything else
:� heapsize% defines the initial size of the fixed heap
J� slidingblocks% defines the maximum possible number of sliding blocks


P� the fixed heap should be used only for blocks which will never change size
@� and which the programmer wishes to ensure will never slide
sh_fixedheapsize%=heapsize%
Rsh_heap_trigger%=�_heap_pageup(�+sh_fixedheapsize%+20+20*slidingblocks%-&8000)
"�setslotsize(sh_heap_trigger%)
J� �_heap_slotsize<sh_heap_trigger% � � 130,"Unable to initialise heap"
sh_fixedheapbase%=�
+sh_slidingheapbase%=�+sh_fixedheapsize%
7ș "OS_Heap",0,sh_fixedheapbase%,,sh_fixedheapsize%
@ș "SlidingHeap_Create",sh_slidingheapbase%,2,slidingblocks%
3ș "SlidingHeap_VerifyHeap",sh_slidingheapbase%
�
:
� �create_anchor(name$)
L� Every sliding block must have an anchor.   The block gets moved around
H� in memory, but its current address can always be found at !anchor%
R� This function creates an anchor and returns its address for future reference
N� The name you supply will be used in error messages and heap info reports
 � space%
!� space% 4+� name$+1
"
!space%=0
#$(space%+4)=name$
$=space%
%:
&0� �create_named_sliding_block(anchor%,size%)
'?� This is the function which actually creates a heap block.
(:� First you must have created an anchor for the block.
)� trysize%
*size%=�_heap_wordup(size%)
+7trysize%=�_heap_pageup(�_heap_nextfree+size%-&7FF4)
,!� trysize%>sh_heap_trigger% �
-  �setslotsize(trysize%)
."  � �_heap_slotsize<trysize% �
/&    �setslotsize(sh_heap_trigger%)
0D    � 131,"Not enough room to create block """+$(anchor%+4)+""""
1	    �
2!    sh_heap_trigger%=trysize%
3  �
4�
5Iș "SlidingHeap_NewBlock",sh_slidingheapbase%,anchor%,size%,anchor%+4
63ș "SlidingHeap_VerifyHeap",sh_slidingheapbase%
7�
8:
93� �extend_named_sliding_block(anchor%,newsize%)
:N� This function increases (or decreases - the name is misleading) the size
;P� of a heap block.  Other blocks may slide around as the block size changes.
<P� If the block did not previously exist, it will be created - so there's not
=N� really a lot of point using PROCcreate_named_sliding_block, I suppose...
>J� Note that newsize% is the TOTAL size of the resulting block, not the
?R� increase/decrease in size - i.e. you need to keep track of the current size.
@� trysize%,oldsize%,larger%
AB� !anchor%=0 � �create_named_sliding_block(anchor%,newsize%):�
BA� !anchor%>�_heap_nextfree � � 129,"Block beyond heap limits"
C$newsize%=�_heap_wordup(newsize%)
DKș "SlidingHeap_DescribeBlock",sh_slidingheapbase%,anchor% � ,,oldsize%
Elarger%=newsize%>oldsize%
F� larger% �
GG  trysize%=�_heap_pageup(�_heap_nextfree+(newsize%-oldsize%)-&7FFC)
H#  � trysize%>sh_heap_trigger% �
I    �setslotsize(trysize%)
J$    � �_heap_slotsize<trysize% �
K(      �setslotsize(sh_heap_trigger%)
LF      � 132,"Not enough room to extend block """+$(anchor%+4)+""""
M      �
N#      sh_heap_trigger%=trysize%
O	    �
P  �
Q�
REș "SlidingHeap_ExtendBlock",sh_slidingheapbase%,anchor%,newsize%
S1trysize%=�_heap_pageup(�_heap_nextfree-&7FFC)
T"� trysize%<>sh_heap_trigger% �
U   �setslotsize(trysize%)
V    sh_heap_trigger%=trysize%
W�
X3ș "SlidingHeap_VerifyHeap",sh_slidingheapbase%
Y�
Z:
[#� �scrap_sliding_block(anchor%)
\� trysize%
]O� This function discards a sliding block, returning its memory to the heap.
^B� Note that the anchor is NOT deleted and can be reused later.
_(� In fact anchors cannot be deleted.
`� !anchor%=0 � �
a;ș "SlidingHeap_ScrapBlock",sh_slidingheapbase%,anchor%
b1trysize%=�_heap_pageup(�_heap_nextfree-&7FFC)
c"� trysize%<>sh_heap_trigger% �
d  �setslotsize(trysize%)
e  sh_heap_trigger%=trysize%
f�
g!anchor%=0
h3ș "SlidingHeap_VerifyHeap",sh_slidingheapbase%
i�
j:
k� �destroyheaps
l6� This procedure destroys the entire sliding heap.
m� ptr%,anchor%,slot%
nptr%=sh_slidingheapbase%+16
o� start of slots
p9� slot%=1 � (sh_slidingheapbase%!4):� number of slots
q  anchor%=ptr%!4
r  ptr%+=16
s6  � anchor%<>0 � !anchor%=0:� reset anchors in use
t� slot%
u�setslotsize(�-&8000)
v�
w:
x"� �sliding_block_size(anchor%)
y?� This function returns the current size of a sliding block
z� size%
{Hș "SlidingHeap_DescribeBlock",sh_slidingheapbase%,anchor% � ,,size%
|
=size%
}:
~� �verify_heap
3ș "SlidingHeap_VerifyHeap",sh_slidingheapbase%
��
�:
�� �increaseslots(newmax%)
�� trysize%,size%,slots%
�Bș "SlidingHeap_IncreaseSlots",sh_slidingheapbase%,0 � ,slots%
�� newmax%=0 �:=slots%
�� return current heap size
�9size%=newmax%-slots%:� number of slots to increase by
�6size%=size%*16:� extra space needed by these slots
�7trysize%=�_heap_pageup(�_heap_nextfree+size%-&7FFC)
�!� trysize%>sh_heap_trigger% �
�  �setslotsize(trysize%)
�"  � �_heap_slotsize<trysize% �
�'     �setslotsize(sh_heap_trigger%)
�;     � 133,"Could not increase number of slots in heap"
�   �
�"     sh_heap_trigger%=trysize%
�   �
��
�Iș "SlidingHeap_IncreaseSlots",sh_slidingheapbase%,newmax% � ,newmax%
�3ș "SlidingHeap_VerifyHeap",sh_slidingheapbase%
�=newmax%
�:
�B� Various procedures called by Sliding Heap Library procedures
�� �_heap_slotsize
�	� R0%
�"ș "Wimp_SlotSize",-1,-1 � R0%
�=R0%
�:
�� �_heap_pageup(n%)
�	� R0%
� ș "OS_ReadMemMapInfo" � R0%
�=(n%+R0%-1) � � (R0%-1)
�:
�� �setslotsize(newsize%)
�"ș "Wimp_SlotSize",newsize%,-1
��
�:
�� �_heap_nextfree
�� nextfree%
�=ș "SlidingHeap_NextFree",sh_slidingheapbase% � nextfree%
�=nextfree%
�:
�$� �_heap_wordup(x%)=(x%+3) � � 3
�:
� � Sliding_Heap Library
� 
�: � �heap_store(anchor%,� size%,inc%,� ptr%,L%,string$)
�" � string$<>"" � L%=�(string$)
�! � ptr%-!anchor%+L%+1>size% �
�   size%+=inc%
�1   �extend_named_sliding_block(anchor%,size%)
� �
�4 � string$<>"" � $ptr%=string$:ptr%+=L%:?ptr%=10
� �
� 
�0 � �_heap_numtostr(d%,n%)=��d%,"0")+�~n%,d%)
�1 � �_heap_snumtostr(d%,n%)=��d%," ")+� n%,d%)
� :
� � �heapsinfo(block%)
� � bigbloc%,totfree%
�; ș "OS_Heap",1,sh_fixedheapbase% � ,,bigbloc%,totfree%
� � "Fixed heap"
� � "----- ----"
�> � "Heap base    : &";�_heap_numtostr(8,sh_fixedheapbase%)
�9 � "Heap size    : ";�_heap_bytes2(sh_fixedheapsize%)
�0 � "Largest free : ";�_heap_bytes2(bigbloc%)
�0 � "Total free   : ";�_heap_bytes2(totfree%)
� �
� � "Sliding heap"
� � "------- ----"
�2 ș "SlidingHeap_HeapInfo",sh_slidingheapbase%
� �
� :
� � �_heap_bytes(b%)
� � end%
�? ș "OS_ConvertFixedFileSize",b%,block%,block%+&100 � ,end%
�
 ?end%=13
�
 =$block%
� :
� � �_heap_bytes2(b%)
� � end%
�: ș "OS_ConvertFileSize",b%,block%,block%+&100 � ,end%
�
 ?end%=13
�
 =$block%
� :
�! � �create_fixed_block(size%)
� � pointer%,flag%
�@ ș "XOS_Heap",2,sh_fixedheapbase%,,size% � ,,pointer%;flag%
� ȕ flag% � 1
� �extendfixedheap
�@ ș "XOS_Heap",2,sh_fixedheapbase%,,size% � ,,pointer%;flag%
� �
� =pointer%
� :
� � �extendfixedheap
� � nshb%,extend%,trysize%
�% ș "OS_ReadMemMapInfo" � extend%
�% trysize%=�_heap_slotsize+extend%
� �setslotsize(trysize%)
�F � �_heap_slotsize<trysize% � � 255,"No room to extend fixed heap"
�& nshb%=sh_slidingheapbase%+extend%
�9 ș "SlidingHeap_ShiftHeap",sh_slidingheapbase%,nshb%
�. ș "OS_Heap",5,sh_fixedheapbase%,,extend%
� sh_fixedheapsize%+=extend%
� sh_slidingheapbase%=nshb%
�4 ș "SlidingHeap_VerifyHeap",sh_slidingheapbase%
� �
� :
�
00000000  0d 00 01 1a f4 20 53 6c  69 64 69 6e 67 5f 48 65  |..... Sliding_He|
00000010  61 70 20 4c 69 62 72 61  72 79 0d 00 02 1f f4 20  |ap Library..... |
00000020  72 65 71 75 69 72 65 73  20 53 6c 69 64 69 6e 67  |requires Sliding|
00000030  48 65 61 70 20 32 2e 30  30 0d 00 03 16 f4 20 6d  |Heap 2.00..... m|
00000040  6f 64 75 6c 65 20 61 6e  64 20 50 52 4f 43 73 0d  |odule and PROCs.|
00000050  00 04 1a f4 20 a9 20 53  74 65 76 65 6e 20 48 61  |.... . Steven Ha|
00000060  73 6c 61 6d 20 31 39 39  32 0d 00 05 31 f4 20 75  |slam 1992...1. u|
00000070  70 64 61 74 65 64 20 a9  20 48 61 72 72 69 65 74  |pdated . Harriet|
00000080  20 42 61 7a 6c 65 79 20  31 39 74 68 20 4e 6f 76  | Bazley 19th Nov|
00000090  65 6d 62 65 72 20 32 30  30 32 0d 00 06 04 0d 00  |ember 2002......|
000000a0  07 42 85 20 32 35 35 2c  22 54 68 69 73 20 69 73  |.B. 255,"This is|
000000b0  20 61 20 6c 69 62 72 61  72 79 3b 20 20 64 6f 20  | a library;  do |
000000c0  6e 6f 74 20 61 74 74 65  6d 70 74 20 74 6f 20 72  |not attempt to r|
000000d0  75 6e 20 69 74 20 64 69  72 65 63 74 6c 79 21 22  |un it directly!"|
000000e0  0d 00 08 04 0d 00 09 2a  dd 20 f2 69 6e 69 74 68  |.......*. .inith|
000000f0  65 61 70 73 28 68 65 61  70 73 69 7a 65 25 2c 73  |eaps(heapsize%,s|
00000100  6c 69 64 69 6e 67 62 6c  6f 63 6b 73 25 29 0d 00  |lidingblocks%)..|
00000110  0a 4e f4 20 43 61 6c 6c  20 74 68 69 73 20 70 72  |.N. Call this pr|
00000120  6f 63 65 64 75 72 65 20  74 6f 20 63 72 65 61 74  |ocedure to creat|
00000130  65 20 74 68 65 20 65 6d  70 74 79 20 68 65 61 70  |e the empty heap|
00000140  20 62 65 66 6f 72 65 20  79 6f 75 20 64 6f 20 61  | before you do a|
00000150  6e 79 74 68 69 6e 67 20  65 6c 73 65 0d 00 0b 3a  |nything else...:|
00000160  f4 20 68 65 61 70 73 69  7a 65 25 20 64 65 66 69  |. heapsize% defi|
00000170  6e 65 73 20 74 68 65 20  69 6e 69 74 69 61 6c 20  |nes the initial |
00000180  73 69 7a 65 20 6f 66 20  74 68 65 20 66 69 78 65  |size of the fixe|
00000190  64 20 68 65 61 70 0d 00  0c 4a f4 20 73 6c 69 64  |d heap...J. slid|
000001a0  69 6e 67 62 6c 6f 63 6b  73 25 20 64 65 66 69 6e  |ingblocks% defin|
000001b0  65 73 20 74 68 65 20 6d  61 78 69 6d 75 6d 20 70  |es the maximum p|
000001c0  6f 73 73 69 62 6c 65 20  6e 75 6d 62 65 72 20 6f  |ossible number o|
000001d0  66 20 73 6c 69 64 69 6e  67 20 62 6c 6f 63 6b 73  |f sliding blocks|
000001e0  0d 00 0d 04 0d 00 0e 50  f4 20 74 68 65 20 66 69  |.......P. the fi|
000001f0  78 65 64 20 68 65 61 70  20 73 68 6f 75 6c 64 20  |xed heap should |
00000200  62 65 20 75 73 65 64 20  6f 6e 6c 79 20 66 6f 72  |be used only for|
00000210  20 62 6c 6f 63 6b 73 20  77 68 69 63 68 20 77 69  | blocks which wi|
00000220  6c 6c 20 6e 65 76 65 72  20 63 68 61 6e 67 65 20  |ll never change |
00000230  73 69 7a 65 0d 00 0f 40  f4 20 61 6e 64 20 77 68  |size...@. and wh|
00000240  69 63 68 20 74 68 65 20  70 72 6f 67 72 61 6d 6d  |ich the programm|
00000250  65 72 20 77 69 73 68 65  73 20 74 6f 20 65 6e 73  |er wishes to ens|
00000260  75 72 65 20 77 69 6c 6c  20 6e 65 76 65 72 20 73  |ure will never s|
00000270  6c 69 64 65 0d 00 10 1f  73 68 5f 66 69 78 65 64  |lide....sh_fixed|
00000280  68 65 61 70 73 69 7a 65  25 3d 68 65 61 70 73 69  |heapsize%=heapsi|
00000290  7a 65 25 0d 00 11 52 73  68 5f 68 65 61 70 5f 74  |ze%...Rsh_heap_t|
000002a0  72 69 67 67 65 72 25 3d  a4 5f 68 65 61 70 5f 70  |rigger%=._heap_p|
000002b0  61 67 65 75 70 28 93 2b  73 68 5f 66 69 78 65 64  |ageup(.+sh_fixed|
000002c0  68 65 61 70 73 69 7a 65  25 2b 32 30 2b 32 30 2a  |heapsize%+20+20*|
000002d0  73 6c 69 64 69 6e 67 62  6c 6f 63 6b 73 25 2d 26  |slidingblocks%-&|
000002e0  38 30 30 30 29 0d 00 12  22 f2 73 65 74 73 6c 6f  |8000)...".setslo|
000002f0  74 73 69 7a 65 28 73 68  5f 68 65 61 70 5f 74 72  |tsize(sh_heap_tr|
00000300  69 67 67 65 72 25 29 0d  00 13 4a e7 20 a4 5f 68  |igger%)...J. ._h|
00000310  65 61 70 5f 73 6c 6f 74  73 69 7a 65 3c 73 68 5f  |eap_slotsize<sh_|
00000320  68 65 61 70 5f 74 72 69  67 67 65 72 25 20 8c 20  |heap_trigger% . |
00000330  85 20 31 33 30 2c 22 55  6e 61 62 6c 65 20 74 6f  |. 130,"Unable to|
00000340  20 69 6e 69 74 69 61 6c  69 73 65 20 68 65 61 70  | initialise heap|
00000350  22 0d 00 14 17 73 68 5f  66 69 78 65 64 68 65 61  |"....sh_fixedhea|
00000360  70 62 61 73 65 25 3d 93  0d 00 15 2b 73 68 5f 73  |pbase%=....+sh_s|
00000370  6c 69 64 69 6e 67 68 65  61 70 62 61 73 65 25 3d  |lidingheapbase%=|
00000380  93 2b 73 68 5f 66 69 78  65 64 68 65 61 70 73 69  |.+sh_fixedheapsi|
00000390  7a 65 25 0d 00 16 37 c8  99 20 22 4f 53 5f 48 65  |ze%...7.. "OS_He|
000003a0  61 70 22 2c 30 2c 73 68  5f 66 69 78 65 64 68 65  |ap",0,sh_fixedhe|
000003b0  61 70 62 61 73 65 25 2c  2c 73 68 5f 66 69 78 65  |apbase%,,sh_fixe|
000003c0  64 68 65 61 70 73 69 7a  65 25 0d 00 17 40 c8 99  |dheapsize%...@..|
000003d0  20 22 53 6c 69 64 69 6e  67 48 65 61 70 5f 43 72  | "SlidingHeap_Cr|
000003e0  65 61 74 65 22 2c 73 68  5f 73 6c 69 64 69 6e 67  |eate",sh_sliding|
000003f0  68 65 61 70 62 61 73 65  25 2c 32 2c 73 6c 69 64  |heapbase%,2,slid|
00000400  69 6e 67 62 6c 6f 63 6b  73 25 0d 00 18 33 c8 99  |ingblocks%...3..|
00000410  20 22 53 6c 69 64 69 6e  67 48 65 61 70 5f 56 65  | "SlidingHeap_Ve|
00000420  72 69 66 79 48 65 61 70  22 2c 73 68 5f 73 6c 69  |rifyHeap",sh_sli|
00000430  64 69 6e 67 68 65 61 70  62 61 73 65 25 0d 00 19  |dingheapbase%...|
00000440  05 e1 0d 00 1a 05 3a 0d  00 1b 1b dd 20 a4 63 72  |......:..... .cr|
00000450  65 61 74 65 5f 61 6e 63  68 6f 72 28 6e 61 6d 65  |eate_anchor(name|
00000460  24 29 0d 00 1c 4c f4 20  45 76 65 72 79 20 73 6c  |$)...L. Every sl|
00000470  69 64 69 6e 67 20 62 6c  6f 63 6b 20 6d 75 73 74  |iding block must|
00000480  20 68 61 76 65 20 61 6e  20 61 6e 63 68 6f 72 2e  | have an anchor.|
00000490  20 20 20 54 68 65 20 62  6c 6f 63 6b 20 67 65 74  |   The block get|
000004a0  73 20 6d 6f 76 65 64 20  61 72 6f 75 6e 64 0d 00  |s moved around..|
000004b0  1d 48 f4 20 69 6e 20 6d  65 6d 6f 72 79 2c 20 62  |.H. in memory, b|
000004c0  75 74 20 69 74 73 20 63  75 72 72 65 6e 74 20 61  |ut its current a|
000004d0  64 64 72 65 73 73 20 63  61 6e 20 61 6c 77 61 79  |ddress can alway|
000004e0  73 20 62 65 20 66 6f 75  6e 64 20 61 74 20 21 61  |s be found at !a|
000004f0  6e 63 68 6f 72 25 0d 00  1e 52 f4 20 54 68 69 73  |nchor%...R. This|
00000500  20 66 75 6e 63 74 69 6f  6e 20 63 72 65 61 74 65  | function create|
00000510  73 20 61 6e 20 61 6e 63  68 6f 72 20 61 6e 64 20  |s an anchor and |
00000520  72 65 74 75 72 6e 73 20  69 74 73 20 61 64 64 72  |returns its addr|
00000530  65 73 73 20 66 6f 72 20  66 75 74 75 72 65 20 72  |ess for future r|
00000540  65 66 65 72 65 6e 63 65  0d 00 1f 4e f4 20 54 68  |eference...N. Th|
00000550  65 20 6e 61 6d 65 20 79  6f 75 20 73 75 70 70 6c  |e name you suppl|
00000560  79 20 77 69 6c 6c 20 62  65 20 75 73 65 64 20 69  |y will be used i|
00000570  6e 20 65 72 72 6f 72 20  6d 65 73 73 61 67 65 73  |n error messages|
00000580  20 61 6e 64 20 68 65 61  70 20 69 6e 66 6f 20 72  | and heap info r|
00000590  65 70 6f 72 74 73 0d 00  20 0c ea 20 73 70 61 63  |eports.. .. spac|
000005a0  65 25 0d 00 21 18 de 20  73 70 61 63 65 25 20 34  |e%..!.. space% 4|
000005b0  2b a9 20 6e 61 6d 65 24  2b 31 0d 00 22 0d 21 73  |+. name$+1..".!s|
000005c0  70 61 63 65 25 3d 30 0d  00 23 15 24 28 73 70 61  |pace%=0..#.$(spa|
000005d0  63 65 25 2b 34 29 3d 6e  61 6d 65 24 0d 00 24 0b  |ce%+4)=name$..$.|
000005e0  3d 73 70 61 63 65 25 0d  00 25 05 3a 0d 00 26 30  |=space%..%.:..&0|
000005f0  dd 20 f2 63 72 65 61 74  65 5f 6e 61 6d 65 64 5f  |. .create_named_|
00000600  73 6c 69 64 69 6e 67 5f  62 6c 6f 63 6b 28 61 6e  |sliding_block(an|
00000610  63 68 6f 72 25 2c 73 69  7a 65 25 29 0d 00 27 3f  |chor%,size%)..'?|
00000620  f4 20 54 68 69 73 20 69  73 20 74 68 65 20 66 75  |. This is the fu|
00000630  6e 63 74 69 6f 6e 20 77  68 69 63 68 20 61 63 74  |nction which act|
00000640  75 61 6c 6c 79 20 63 72  65 61 74 65 73 20 61 20  |ually creates a |
00000650  68 65 61 70 20 62 6c 6f  63 6b 2e 0d 00 28 3a f4  |heap block...(:.|
00000660  20 46 69 72 73 74 20 79  6f 75 20 6d 75 73 74 20  | First you must |
00000670  68 61 76 65 20 63 72 65  61 74 65 64 20 61 6e 20  |have created an |
00000680  61 6e 63 68 6f 72 20 66  6f 72 20 74 68 65 20 62  |anchor for the b|
00000690  6c 6f 63 6b 2e 0d 00 29  0e ea 20 74 72 79 73 69  |lock...).. trysi|
000006a0  7a 65 25 0d 00 2a 1e 73  69 7a 65 25 3d a4 5f 68  |ze%..*.size%=._h|
000006b0  65 61 70 5f 77 6f 72 64  75 70 28 73 69 7a 65 25  |eap_wordup(size%|
000006c0  29 0d 00 2b 37 74 72 79  73 69 7a 65 25 3d a4 5f  |)..+7trysize%=._|
000006d0  68 65 61 70 5f 70 61 67  65 75 70 28 a4 5f 68 65  |heap_pageup(._he|
000006e0  61 70 5f 6e 65 78 74 66  72 65 65 2b 73 69 7a 65  |ap_nextfree+size|
000006f0  25 2d 26 37 46 46 34 29  0d 00 2c 21 e7 20 74 72  |%-&7FF4)..,!. tr|
00000700  79 73 69 7a 65 25 3e 73  68 5f 68 65 61 70 5f 74  |ysize%>sh_heap_t|
00000710  72 69 67 67 65 72 25 20  8c 0d 00 2d 1c 20 20 f2  |rigger% ...-.  .|
00000720  73 65 74 73 6c 6f 74 73  69 7a 65 28 74 72 79 73  |setslotsize(trys|
00000730  69 7a 65 25 29 0d 00 2e  22 20 20 e7 20 a4 5f 68  |ize%)..."  . ._h|
00000740  65 61 70 5f 73 6c 6f 74  73 69 7a 65 3c 74 72 79  |eap_slotsize<try|
00000750  73 69 7a 65 25 20 8c 0d  00 2f 26 20 20 20 20 f2  |size% .../&    .|
00000760  73 65 74 73 6c 6f 74 73  69 7a 65 28 73 68 5f 68  |setslotsize(sh_h|
00000770  65 61 70 5f 74 72 69 67  67 65 72 25 29 0d 00 30  |eap_trigger%)..0|
00000780  44 20 20 20 20 85 20 31  33 31 2c 22 4e 6f 74 20  |D    . 131,"Not |
00000790  65 6e 6f 75 67 68 20 72  6f 6f 6d 20 74 6f 20 63  |enough room to c|
000007a0  72 65 61 74 65 20 62 6c  6f 63 6b 20 22 22 22 2b  |reate block """+|
000007b0  24 28 61 6e 63 68 6f 72  25 2b 34 29 2b 22 22 22  |$(anchor%+4)+"""|
000007c0  22 0d 00 31 09 20 20 20  20 cc 0d 00 32 21 20 20  |"..1.    ...2!  |
000007d0  20 20 73 68 5f 68 65 61  70 5f 74 72 69 67 67 65  |  sh_heap_trigge|
000007e0  72 25 3d 74 72 79 73 69  7a 65 25 0d 00 33 07 20  |r%=trysize%..3. |
000007f0  20 cd 0d 00 34 05 cd 0d  00 35 49 c8 99 20 22 53  | ...4....5I.. "S|
00000800  6c 69 64 69 6e 67 48 65  61 70 5f 4e 65 77 42 6c  |lidingHeap_NewBl|
00000810  6f 63 6b 22 2c 73 68 5f  73 6c 69 64 69 6e 67 68  |ock",sh_slidingh|
00000820  65 61 70 62 61 73 65 25  2c 61 6e 63 68 6f 72 25  |eapbase%,anchor%|
00000830  2c 73 69 7a 65 25 2c 61  6e 63 68 6f 72 25 2b 34  |,size%,anchor%+4|
00000840  0d 00 36 33 c8 99 20 22  53 6c 69 64 69 6e 67 48  |..63.. "SlidingH|
00000850  65 61 70 5f 56 65 72 69  66 79 48 65 61 70 22 2c  |eap_VerifyHeap",|
00000860  73 68 5f 73 6c 69 64 69  6e 67 68 65 61 70 62 61  |sh_slidingheapba|
00000870  73 65 25 0d 00 37 05 e1  0d 00 38 05 3a 0d 00 39  |se%..7....8.:..9|
00000880  33 dd 20 f2 65 78 74 65  6e 64 5f 6e 61 6d 65 64  |3. .extend_named|
00000890  5f 73 6c 69 64 69 6e 67  5f 62 6c 6f 63 6b 28 61  |_sliding_block(a|
000008a0  6e 63 68 6f 72 25 2c 6e  65 77 73 69 7a 65 25 29  |nchor%,newsize%)|
000008b0  0d 00 3a 4e f4 20 54 68  69 73 20 66 75 6e 63 74  |..:N. This funct|
000008c0  69 6f 6e 20 69 6e 63 72  65 61 73 65 73 20 28 6f  |ion increases (o|
000008d0  72 20 64 65 63 72 65 61  73 65 73 20 2d 20 74 68  |r decreases - th|
000008e0  65 20 6e 61 6d 65 20 69  73 20 6d 69 73 6c 65 61  |e name is mislea|
000008f0  64 69 6e 67 29 20 74 68  65 20 73 69 7a 65 0d 00  |ding) the size..|
00000900  3b 50 f4 20 6f 66 20 61  20 68 65 61 70 20 62 6c  |;P. of a heap bl|
00000910  6f 63 6b 2e 20 20 4f 74  68 65 72 20 62 6c 6f 63  |ock.  Other bloc|
00000920  6b 73 20 6d 61 79 20 73  6c 69 64 65 20 61 72 6f  |ks may slide aro|
00000930  75 6e 64 20 61 73 20 74  68 65 20 62 6c 6f 63 6b  |und as the block|
00000940  20 73 69 7a 65 20 63 68  61 6e 67 65 73 2e 0d 00  | size changes...|
00000950  3c 50 f4 20 49 66 20 74  68 65 20 62 6c 6f 63 6b  |<P. If the block|
00000960  20 64 69 64 20 6e 6f 74  20 70 72 65 76 69 6f 75  | did not previou|
00000970  73 6c 79 20 65 78 69 73  74 2c 20 69 74 20 77 69  |sly exist, it wi|
00000980  6c 6c 20 62 65 20 63 72  65 61 74 65 64 20 2d 20  |ll be created - |
00000990  73 6f 20 74 68 65 72 65  27 73 20 6e 6f 74 0d 00  |so there's not..|
000009a0  3d 4e f4 20 72 65 61 6c  6c 79 20 61 20 6c 6f 74  |=N. really a lot|
000009b0  20 6f 66 20 70 6f 69 6e  74 20 75 73 69 6e 67 20  | of point using |
000009c0  50 52 4f 43 63 72 65 61  74 65 5f 6e 61 6d 65 64  |PROCcreate_named|
000009d0  5f 73 6c 69 64 69 6e 67  5f 62 6c 6f 63 6b 2c 20  |_sliding_block, |
000009e0  49 20 73 75 70 70 6f 73  65 2e 2e 2e 0d 00 3e 4a  |I suppose.....>J|
000009f0  f4 20 4e 6f 74 65 20 74  68 61 74 20 6e 65 77 73  |. Note that news|
00000a00  69 7a 65 25 20 69 73 20  74 68 65 20 54 4f 54 41  |ize% is the TOTA|
00000a10  4c 20 73 69 7a 65 20 6f  66 20 74 68 65 20 72 65  |L size of the re|
00000a20  73 75 6c 74 69 6e 67 20  62 6c 6f 63 6b 2c 20 6e  |sulting block, n|
00000a30  6f 74 20 74 68 65 0d 00  3f 52 f4 20 69 6e 63 72  |ot the..?R. incr|
00000a40  65 61 73 65 2f 64 65 63  72 65 61 73 65 20 69 6e  |ease/decrease in|
00000a50  20 73 69 7a 65 20 2d 20  69 2e 65 2e 20 79 6f 75  | size - i.e. you|
00000a60  20 6e 65 65 64 20 74 6f  20 6b 65 65 70 20 74 72  | need to keep tr|
00000a70  61 63 6b 20 6f 66 20 74  68 65 20 63 75 72 72 65  |ack of the curre|
00000a80  6e 74 20 73 69 7a 65 2e  0d 00 40 1f ea 20 74 72  |nt size...@.. tr|
00000a90  79 73 69 7a 65 25 2c 6f  6c 64 73 69 7a 65 25 2c  |ysize%,oldsize%,|
00000aa0  6c 61 72 67 65 72 25 0d  00 41 42 e7 20 21 61 6e  |larger%..AB. !an|
00000ab0  63 68 6f 72 25 3d 30 20  8c 20 f2 63 72 65 61 74  |chor%=0 . .creat|
00000ac0  65 5f 6e 61 6d 65 64 5f  73 6c 69 64 69 6e 67 5f  |e_named_sliding_|
00000ad0  62 6c 6f 63 6b 28 61 6e  63 68 6f 72 25 2c 6e 65  |block(anchor%,ne|
00000ae0  77 73 69 7a 65 25 29 3a  e1 0d 00 42 41 e7 20 21  |wsize%):...BA. !|
00000af0  61 6e 63 68 6f 72 25 3e  a4 5f 68 65 61 70 5f 6e  |anchor%>._heap_n|
00000b00  65 78 74 66 72 65 65 20  8c 20 85 20 31 32 39 2c  |extfree . . 129,|
00000b10  22 42 6c 6f 63 6b 20 62  65 79 6f 6e 64 20 68 65  |"Block beyond he|
00000b20  61 70 20 6c 69 6d 69 74  73 22 0d 00 43 24 6e 65  |ap limits"..C$ne|
00000b30  77 73 69 7a 65 25 3d a4  5f 68 65 61 70 5f 77 6f  |wsize%=._heap_wo|
00000b40  72 64 75 70 28 6e 65 77  73 69 7a 65 25 29 0d 00  |rdup(newsize%)..|
00000b50  44 4b c8 99 20 22 53 6c  69 64 69 6e 67 48 65 61  |DK.. "SlidingHea|
00000b60  70 5f 44 65 73 63 72 69  62 65 42 6c 6f 63 6b 22  |p_DescribeBlock"|
00000b70  2c 73 68 5f 73 6c 69 64  69 6e 67 68 65 61 70 62  |,sh_slidingheapb|
00000b80  61 73 65 25 2c 61 6e 63  68 6f 72 25 20 b8 20 2c  |ase%,anchor% . ,|
00000b90  2c 6f 6c 64 73 69 7a 65  25 0d 00 45 1d 6c 61 72  |,oldsize%..E.lar|
00000ba0  67 65 72 25 3d 6e 65 77  73 69 7a 65 25 3e 6f 6c  |ger%=newsize%>ol|
00000bb0  64 73 69 7a 65 25 0d 00  46 0f e7 20 6c 61 72 67  |dsize%..F.. larg|
00000bc0  65 72 25 20 8c 0d 00 47  47 20 20 74 72 79 73 69  |er% ...GG  trysi|
00000bd0  7a 65 25 3d a4 5f 68 65  61 70 5f 70 61 67 65 75  |ze%=._heap_pageu|
00000be0  70 28 a4 5f 68 65 61 70  5f 6e 65 78 74 66 72 65  |p(._heap_nextfre|
00000bf0  65 2b 28 6e 65 77 73 69  7a 65 25 2d 6f 6c 64 73  |e+(newsize%-olds|
00000c00  69 7a 65 25 29 2d 26 37  46 46 43 29 0d 00 48 23  |ize%)-&7FFC)..H#|
00000c10  20 20 e7 20 74 72 79 73  69 7a 65 25 3e 73 68 5f  |  . trysize%>sh_|
00000c20  68 65 61 70 5f 74 72 69  67 67 65 72 25 20 8c 0d  |heap_trigger% ..|
00000c30  00 49 1e 20 20 20 20 f2  73 65 74 73 6c 6f 74 73  |.I.    .setslots|
00000c40  69 7a 65 28 74 72 79 73  69 7a 65 25 29 0d 00 4a  |ize(trysize%)..J|
00000c50  24 20 20 20 20 e7 20 a4  5f 68 65 61 70 5f 73 6c  |$    . ._heap_sl|
00000c60  6f 74 73 69 7a 65 3c 74  72 79 73 69 7a 65 25 20  |otsize<trysize% |
00000c70  8c 0d 00 4b 28 20 20 20  20 20 20 f2 73 65 74 73  |...K(      .sets|
00000c80  6c 6f 74 73 69 7a 65 28  73 68 5f 68 65 61 70 5f  |lotsize(sh_heap_|
00000c90  74 72 69 67 67 65 72 25  29 0d 00 4c 46 20 20 20  |trigger%)..LF   |
00000ca0  20 20 20 85 20 31 33 32  2c 22 4e 6f 74 20 65 6e  |   . 132,"Not en|
00000cb0  6f 75 67 68 20 72 6f 6f  6d 20 74 6f 20 65 78 74  |ough room to ext|
00000cc0  65 6e 64 20 62 6c 6f 63  6b 20 22 22 22 2b 24 28  |end block """+$(|
00000cd0  61 6e 63 68 6f 72 25 2b  34 29 2b 22 22 22 22 0d  |anchor%+4)+"""".|
00000ce0  00 4d 0b 20 20 20 20 20  20 cc 0d 00 4e 23 20 20  |.M.      ...N#  |
00000cf0  20 20 20 20 73 68 5f 68  65 61 70 5f 74 72 69 67  |    sh_heap_trig|
00000d00  67 65 72 25 3d 74 72 79  73 69 7a 65 25 0d 00 4f  |ger%=trysize%..O|
00000d10  09 20 20 20 20 cd 0d 00  50 07 20 20 cd 0d 00 51  |.    ...P.  ...Q|
00000d20  05 cd 0d 00 52 45 c8 99  20 22 53 6c 69 64 69 6e  |....RE.. "Slidin|
00000d30  67 48 65 61 70 5f 45 78  74 65 6e 64 42 6c 6f 63  |gHeap_ExtendBloc|
00000d40  6b 22 2c 73 68 5f 73 6c  69 64 69 6e 67 68 65 61  |k",sh_slidinghea|
00000d50  70 62 61 73 65 25 2c 61  6e 63 68 6f 72 25 2c 6e  |pbase%,anchor%,n|
00000d60  65 77 73 69 7a 65 25 0d  00 53 31 74 72 79 73 69  |ewsize%..S1trysi|
00000d70  7a 65 25 3d a4 5f 68 65  61 70 5f 70 61 67 65 75  |ze%=._heap_pageu|
00000d80  70 28 a4 5f 68 65 61 70  5f 6e 65 78 74 66 72 65  |p(._heap_nextfre|
00000d90  65 2d 26 37 46 46 43 29  0d 00 54 22 e7 20 74 72  |e-&7FFC)..T". tr|
00000da0  79 73 69 7a 65 25 3c 3e  73 68 5f 68 65 61 70 5f  |ysize%<>sh_heap_|
00000db0  74 72 69 67 67 65 72 25  20 8c 0d 00 55 1d 20 20  |trigger% ...U.  |
00000dc0  20 f2 73 65 74 73 6c 6f  74 73 69 7a 65 28 74 72  | .setslotsize(tr|
00000dd0  79 73 69 7a 65 25 29 0d  00 56 20 20 20 20 73 68  |ysize%)..V    sh|
00000de0  5f 68 65 61 70 5f 74 72  69 67 67 65 72 25 3d 74  |_heap_trigger%=t|
00000df0  72 79 73 69 7a 65 25 0d  00 57 05 cd 0d 00 58 33  |rysize%..W....X3|
00000e00  c8 99 20 22 53 6c 69 64  69 6e 67 48 65 61 70 5f  |.. "SlidingHeap_|
00000e10  56 65 72 69 66 79 48 65  61 70 22 2c 73 68 5f 73  |VerifyHeap",sh_s|
00000e20  6c 69 64 69 6e 67 68 65  61 70 62 61 73 65 25 0d  |lidingheapbase%.|
00000e30  00 59 05 e1 0d 00 5a 05  3a 0d 00 5b 23 dd 20 f2  |.Y....Z.:..[#. .|
00000e40  73 63 72 61 70 5f 73 6c  69 64 69 6e 67 5f 62 6c  |scrap_sliding_bl|
00000e50  6f 63 6b 28 61 6e 63 68  6f 72 25 29 0d 00 5c 0e  |ock(anchor%)..\.|
00000e60  ea 20 74 72 79 73 69 7a  65 25 0d 00 5d 4f f4 20  |. trysize%..]O. |
00000e70  54 68 69 73 20 66 75 6e  63 74 69 6f 6e 20 64 69  |This function di|
00000e80  73 63 61 72 64 73 20 61  20 73 6c 69 64 69 6e 67  |scards a sliding|
00000e90  20 62 6c 6f 63 6b 2c 20  72 65 74 75 72 6e 69 6e  | block, returnin|
00000ea0  67 20 69 74 73 20 6d 65  6d 6f 72 79 20 74 6f 20  |g its memory to |
00000eb0  74 68 65 20 68 65 61 70  2e 0d 00 5e 42 f4 20 4e  |the heap...^B. N|
00000ec0  6f 74 65 20 74 68 61 74  20 74 68 65 20 61 6e 63  |ote that the anc|
00000ed0  68 6f 72 20 69 73 20 4e  4f 54 20 64 65 6c 65 74  |hor is NOT delet|
00000ee0  65 64 20 61 6e 64 20 63  61 6e 20 62 65 20 72 65  |ed and can be re|
00000ef0  75 73 65 64 20 6c 61 74  65 72 2e 0d 00 5f 28 f4  |used later..._(.|
00000f00  20 49 6e 20 66 61 63 74  20 61 6e 63 68 6f 72 73  | In fact anchors|
00000f10  20 63 61 6e 6e 6f 74 20  62 65 20 64 65 6c 65 74  | cannot be delet|
00000f20  65 64 2e 0d 00 60 14 e7  20 21 61 6e 63 68 6f 72  |ed...`.. !anchor|
00000f30  25 3d 30 20 8c 20 e1 0d  00 61 3b c8 99 20 22 53  |%=0 . ...a;.. "S|
00000f40  6c 69 64 69 6e 67 48 65  61 70 5f 53 63 72 61 70  |lidingHeap_Scrap|
00000f50  42 6c 6f 63 6b 22 2c 73  68 5f 73 6c 69 64 69 6e  |Block",sh_slidin|
00000f60  67 68 65 61 70 62 61 73  65 25 2c 61 6e 63 68 6f  |gheapbase%,ancho|
00000f70  72 25 0d 00 62 31 74 72  79 73 69 7a 65 25 3d a4  |r%..b1trysize%=.|
00000f80  5f 68 65 61 70 5f 70 61  67 65 75 70 28 a4 5f 68  |_heap_pageup(._h|
00000f90  65 61 70 5f 6e 65 78 74  66 72 65 65 2d 26 37 46  |eap_nextfree-&7F|
00000fa0  46 43 29 0d 00 63 22 e7  20 74 72 79 73 69 7a 65  |FC)..c". trysize|
00000fb0  25 3c 3e 73 68 5f 68 65  61 70 5f 74 72 69 67 67  |%<>sh_heap_trigg|
00000fc0  65 72 25 20 8c 0d 00 64  1c 20 20 f2 73 65 74 73  |er% ...d.  .sets|
00000fd0  6c 6f 74 73 69 7a 65 28  74 72 79 73 69 7a 65 25  |lotsize(trysize%|
00000fe0  29 0d 00 65 1f 20 20 73  68 5f 68 65 61 70 5f 74  |)..e.  sh_heap_t|
00000ff0  72 69 67 67 65 72 25 3d  74 72 79 73 69 7a 65 25  |rigger%=trysize%|
00001000  0d 00 66 05 cd 0d 00 67  0e 21 61 6e 63 68 6f 72  |..f....g.!anchor|
00001010  25 3d 30 0d 00 68 33 c8  99 20 22 53 6c 69 64 69  |%=0..h3.. "Slidi|
00001020  6e 67 48 65 61 70 5f 56  65 72 69 66 79 48 65 61  |ngHeap_VerifyHea|
00001030  70 22 2c 73 68 5f 73 6c  69 64 69 6e 67 68 65 61  |p",sh_slidinghea|
00001040  70 62 61 73 65 25 0d 00  69 05 e1 0d 00 6a 05 3a  |pbase%..i....j.:|
00001050  0d 00 6b 13 dd 20 f2 64  65 73 74 72 6f 79 68 65  |..k.. .destroyhe|
00001060  61 70 73 0d 00 6c 36 f4  20 54 68 69 73 20 70 72  |aps..l6. This pr|
00001070  6f 63 65 64 75 72 65 20  64 65 73 74 72 6f 79 73  |ocedure destroys|
00001080  20 74 68 65 20 65 6e 74  69 72 65 20 73 6c 69 64  | the entire slid|
00001090  69 6e 67 20 68 65 61 70  2e 0d 00 6d 18 ea 20 70  |ing heap...m.. p|
000010a0  74 72 25 2c 61 6e 63 68  6f 72 25 2c 73 6c 6f 74  |tr%,anchor%,slot|
000010b0  25 0d 00 6e 1f 70 74 72  25 3d 73 68 5f 73 6c 69  |%..n.ptr%=sh_sli|
000010c0  64 69 6e 67 68 65 61 70  62 61 73 65 25 2b 31 36  |dingheapbase%+16|
000010d0  0d 00 6f 14 f4 20 73 74  61 72 74 20 6f 66 20 73  |..o.. start of s|
000010e0  6c 6f 74 73 0d 00 70 39  e3 20 73 6c 6f 74 25 3d  |lots..p9. slot%=|
000010f0  31 20 b8 20 28 73 68 5f  73 6c 69 64 69 6e 67 68  |1 . (sh_slidingh|
00001100  65 61 70 62 61 73 65 25  21 34 29 3a f4 20 6e 75  |eapbase%!4):. nu|
00001110  6d 62 65 72 20 6f 66 20  73 6c 6f 74 73 0d 00 71  |mber of slots..q|
00001120  14 20 20 61 6e 63 68 6f  72 25 3d 70 74 72 25 21  |.  anchor%=ptr%!|
00001130  34 0d 00 72 0e 20 20 70  74 72 25 2b 3d 31 36 0d  |4..r.  ptr%+=16.|
00001140  00 73 36 20 20 e7 20 61  6e 63 68 6f 72 25 3c 3e  |.s6  . anchor%<>|
00001150  30 20 8c 20 21 61 6e 63  68 6f 72 25 3d 30 3a f4  |0 . !anchor%=0:.|
00001160  20 72 65 73 65 74 20 61  6e 63 68 6f 72 73 20 69  | reset anchors i|
00001170  6e 20 75 73 65 0d 00 74  0b ed 20 73 6c 6f 74 25  |n use..t.. slot%|
00001180  0d 00 75 19 f2 73 65 74  73 6c 6f 74 73 69 7a 65  |..u..setslotsize|
00001190  28 93 2d 26 38 30 30 30  29 0d 00 76 05 e1 0d 00  |(.-&8000)..v....|
000011a0  77 05 3a 0d 00 78 22 dd  20 a4 73 6c 69 64 69 6e  |w.:..x". .slidin|
000011b0  67 5f 62 6c 6f 63 6b 5f  73 69 7a 65 28 61 6e 63  |g_block_size(anc|
000011c0  68 6f 72 25 29 0d 00 79  3f f4 20 54 68 69 73 20  |hor%)..y?. This |
000011d0  66 75 6e 63 74 69 6f 6e  20 72 65 74 75 72 6e 73  |function returns|
000011e0  20 74 68 65 20 63 75 72  72 65 6e 74 20 73 69 7a  | the current siz|
000011f0  65 20 6f 66 20 61 20 73  6c 69 64 69 6e 67 20 62  |e of a sliding b|
00001200  6c 6f 63 6b 0d 00 7a 0b  ea 20 73 69 7a 65 25 0d  |lock..z.. size%.|
00001210  00 7b 48 c8 99 20 22 53  6c 69 64 69 6e 67 48 65  |.{H.. "SlidingHe|
00001220  61 70 5f 44 65 73 63 72  69 62 65 42 6c 6f 63 6b  |ap_DescribeBlock|
00001230  22 2c 73 68 5f 73 6c 69  64 69 6e 67 68 65 61 70  |",sh_slidingheap|
00001240  62 61 73 65 25 2c 61 6e  63 68 6f 72 25 20 b8 20  |base%,anchor% . |
00001250  2c 2c 73 69 7a 65 25 0d  00 7c 0a 3d 73 69 7a 65  |,,size%..|.=size|
00001260  25 0d 00 7d 05 3a 0d 00  7e 12 dd 20 f2 76 65 72  |%..}.:..~.. .ver|
00001270  69 66 79 5f 68 65 61 70  0d 00 7f 33 c8 99 20 22  |ify_heap...3.. "|
00001280  53 6c 69 64 69 6e 67 48  65 61 70 5f 56 65 72 69  |SlidingHeap_Veri|
00001290  66 79 48 65 61 70 22 2c  73 68 5f 73 6c 69 64 69  |fyHeap",sh_slidi|
000012a0  6e 67 68 65 61 70 62 61  73 65 25 0d 00 80 05 e1  |ngheapbase%.....|
000012b0  0d 00 81 05 3a 0d 00 82  1d dd 20 a4 69 6e 63 72  |....:..... .incr|
000012c0  65 61 73 65 73 6c 6f 74  73 28 6e 65 77 6d 61 78  |easeslots(newmax|
000012d0  25 29 0d 00 83 1b ea 20  74 72 79 73 69 7a 65 25  |%)..... trysize%|
000012e0  2c 73 69 7a 65 25 2c 73  6c 6f 74 73 25 0d 00 84  |,size%,slots%...|
000012f0  42 c8 99 20 22 53 6c 69  64 69 6e 67 48 65 61 70  |B.. "SlidingHeap|
00001300  5f 49 6e 63 72 65 61 73  65 53 6c 6f 74 73 22 2c  |_IncreaseSlots",|
00001310  73 68 5f 73 6c 69 64 69  6e 67 68 65 61 70 62 61  |sh_slidingheapba|
00001320  73 65 25 2c 30 20 b8 20  2c 73 6c 6f 74 73 25 0d  |se%,0 . ,slots%.|
00001330  00 85 19 e7 20 6e 65 77  6d 61 78 25 3d 30 20 8c  |.... newmax%=0 .|
00001340  3a 3d 73 6c 6f 74 73 25  0d 00 86 1e f4 20 72 65  |:=slots%..... re|
00001350  74 75 72 6e 20 63 75 72  72 65 6e 74 20 68 65 61  |turn current hea|
00001360  70 20 73 69 7a 65 0d 00  87 39 73 69 7a 65 25 3d  |p size...9size%=|
00001370  6e 65 77 6d 61 78 25 2d  73 6c 6f 74 73 25 3a f4  |newmax%-slots%:.|
00001380  20 6e 75 6d 62 65 72 20  6f 66 20 73 6c 6f 74 73  | number of slots|
00001390  20 74 6f 20 69 6e 63 72  65 61 73 65 20 62 79 0d  | to increase by.|
000013a0  00 88 36 73 69 7a 65 25  3d 73 69 7a 65 25 2a 31  |..6size%=size%*1|
000013b0  36 3a f4 20 65 78 74 72  61 20 73 70 61 63 65 20  |6:. extra space |
000013c0  6e 65 65 64 65 64 20 62  79 20 74 68 65 73 65 20  |needed by these |
000013d0  73 6c 6f 74 73 0d 00 89  37 74 72 79 73 69 7a 65  |slots...7trysize|
000013e0  25 3d a4 5f 68 65 61 70  5f 70 61 67 65 75 70 28  |%=._heap_pageup(|
000013f0  a4 5f 68 65 61 70 5f 6e  65 78 74 66 72 65 65 2b  |._heap_nextfree+|
00001400  73 69 7a 65 25 2d 26 37  46 46 43 29 0d 00 8a 21  |size%-&7FFC)...!|
00001410  e7 20 74 72 79 73 69 7a  65 25 3e 73 68 5f 68 65  |. trysize%>sh_he|
00001420  61 70 5f 74 72 69 67 67  65 72 25 20 8c 0d 00 8b  |ap_trigger% ....|
00001430  1c 20 20 f2 73 65 74 73  6c 6f 74 73 69 7a 65 28  |.  .setslotsize(|
00001440  74 72 79 73 69 7a 65 25  29 0d 00 8c 22 20 20 e7  |trysize%)..."  .|
00001450  20 a4 5f 68 65 61 70 5f  73 6c 6f 74 73 69 7a 65  | ._heap_slotsize|
00001460  3c 74 72 79 73 69 7a 65  25 20 8c 0d 00 8d 27 20  |<trysize% ....' |
00001470  20 20 20 20 f2 73 65 74  73 6c 6f 74 73 69 7a 65  |    .setslotsize|
00001480  28 73 68 5f 68 65 61 70  5f 74 72 69 67 67 65 72  |(sh_heap_trigger|
00001490  25 29 0d 00 8e 3b 20 20  20 20 20 85 20 31 33 33  |%)...;     . 133|
000014a0  2c 22 43 6f 75 6c 64 20  6e 6f 74 20 69 6e 63 72  |,"Could not incr|
000014b0  65 61 73 65 20 6e 75 6d  62 65 72 20 6f 66 20 73  |ease number of s|
000014c0  6c 6f 74 73 20 69 6e 20  68 65 61 70 22 0d 00 8f  |lots in heap"...|
000014d0  08 20 20 20 cc 0d 00 90  22 20 20 20 20 20 73 68  |.   ...."     sh|
000014e0  5f 68 65 61 70 5f 74 72  69 67 67 65 72 25 3d 74  |_heap_trigger%=t|
000014f0  72 79 73 69 7a 65 25 0d  00 91 08 20 20 20 cd 0d  |rysize%....   ..|
00001500  00 92 05 cd 0d 00 93 49  c8 99 20 22 53 6c 69 64  |.......I.. "Slid|
00001510  69 6e 67 48 65 61 70 5f  49 6e 63 72 65 61 73 65  |ingHeap_Increase|
00001520  53 6c 6f 74 73 22 2c 73  68 5f 73 6c 69 64 69 6e  |Slots",sh_slidin|
00001530  67 68 65 61 70 62 61 73  65 25 2c 6e 65 77 6d 61  |gheapbase%,newma|
00001540  78 25 20 b8 20 2c 6e 65  77 6d 61 78 25 0d 00 94  |x% . ,newmax%...|
00001550  33 c8 99 20 22 53 6c 69  64 69 6e 67 48 65 61 70  |3.. "SlidingHeap|
00001560  5f 56 65 72 69 66 79 48  65 61 70 22 2c 73 68 5f  |_VerifyHeap",sh_|
00001570  73 6c 69 64 69 6e 67 68  65 61 70 62 61 73 65 25  |slidingheapbase%|
00001580  0d 00 95 0c 3d 6e 65 77  6d 61 78 25 0d 00 96 05  |....=newmax%....|
00001590  3a 0d 00 97 42 f4 20 56  61 72 69 6f 75 73 20 70  |:...B. Various p|
000015a0  72 6f 63 65 64 75 72 65  73 20 63 61 6c 6c 65 64  |rocedures called|
000015b0  20 62 79 20 53 6c 69 64  69 6e 67 20 48 65 61 70  | by Sliding Heap|
000015c0  20 4c 69 62 72 61 72 79  20 70 72 6f 63 65 64 75  | Library procedu|
000015d0  72 65 73 0d 00 98 15 dd  20 a4 5f 68 65 61 70 5f  |res..... ._heap_|
000015e0  73 6c 6f 74 73 69 7a 65  0d 00 99 09 ea 20 52 30  |slotsize..... R0|
000015f0  25 0d 00 9a 22 c8 99 20  22 57 69 6d 70 5f 53 6c  |%...".. "Wimp_Sl|
00001600  6f 74 53 69 7a 65 22 2c  2d 31 2c 2d 31 20 b8 20  |otSize",-1,-1 . |
00001610  52 30 25 0d 00 9b 08 3d  52 30 25 0d 00 9c 05 3a  |R0%....=R0%....:|
00001620  0d 00 9d 17 dd 20 a4 5f  68 65 61 70 5f 70 61 67  |..... ._heap_pag|
00001630  65 75 70 28 6e 25 29 0d  00 9e 09 ea 20 52 30 25  |eup(n%)..... R0%|
00001640  0d 00 9f 20 c8 99 20 22  4f 53 5f 52 65 61 64 4d  |... .. "OS_ReadM|
00001650  65 6d 4d 61 70 49 6e 66  6f 22 20 b8 20 52 30 25  |emMapInfo" . R0%|
00001660  0d 00 a0 1b 3d 28 6e 25  2b 52 30 25 2d 31 29 20  |....=(n%+R0%-1) |
00001670  80 20 ac 20 28 52 30 25  2d 31 29 0d 00 a1 05 3a  |. . (R0%-1)....:|
00001680  0d 00 a2 1c dd 20 f2 73  65 74 73 6c 6f 74 73 69  |..... .setslotsi|
00001690  7a 65 28 6e 65 77 73 69  7a 65 25 29 0d 00 a3 22  |ze(newsize%)..."|
000016a0  c8 99 20 22 57 69 6d 70  5f 53 6c 6f 74 53 69 7a  |.. "Wimp_SlotSiz|
000016b0  65 22 2c 6e 65 77 73 69  7a 65 25 2c 2d 31 0d 00  |e",newsize%,-1..|
000016c0  a4 05 e1 0d 00 a5 05 3a  0d 00 a6 15 dd 20 a4 5f  |.......:..... ._|
000016d0  68 65 61 70 5f 6e 65 78  74 66 72 65 65 0d 00 a7  |heap_nextfree...|
000016e0  0f ea 20 6e 65 78 74 66  72 65 65 25 0d 00 a8 3d  |.. nextfree%...=|
000016f0  c8 99 20 22 53 6c 69 64  69 6e 67 48 65 61 70 5f  |.. "SlidingHeap_|
00001700  4e 65 78 74 46 72 65 65  22 2c 73 68 5f 73 6c 69  |NextFree",sh_sli|
00001710  64 69 6e 67 68 65 61 70  62 61 73 65 25 20 b8 20  |dingheapbase% . |
00001720  6e 65 78 74 66 72 65 65  25 0d 00 a9 0e 3d 6e 65  |nextfree%....=ne|
00001730  78 74 66 72 65 65 25 0d  00 aa 05 3a 0d 00 ab 24  |xtfree%....:...$|
00001740  dd 20 a4 5f 68 65 61 70  5f 77 6f 72 64 75 70 28  |. ._heap_wordup(|
00001750  78 25 29 3d 28 78 25 2b  33 29 20 80 20 ac 20 33  |x%)=(x%+3) . . 3|
00001760  0d 00 ac 05 3a 0d 00 ad  1b 20 f4 20 53 6c 69 64  |....:.... . Slid|
00001770  69 6e 67 5f 48 65 61 70  20 4c 69 62 72 61 72 79  |ing_Heap Library|
00001780  0d 00 ae 05 20 0d 00 af  3a 20 dd 20 f2 68 65 61  |.... ...: . .hea|
00001790  70 5f 73 74 6f 72 65 28  61 6e 63 68 6f 72 25 2c  |p_store(anchor%,|
000017a0  f8 20 73 69 7a 65 25 2c  69 6e 63 25 2c f8 20 70  |. size%,inc%,. p|
000017b0  74 72 25 2c 4c 25 2c 73  74 72 69 6e 67 24 29 0d  |tr%,L%,string$).|
000017c0  00 b0 22 20 e7 20 73 74  72 69 6e 67 24 3c 3e 22  |.." . string$<>"|
000017d0  22 20 8c 20 4c 25 3d a9  28 73 74 72 69 6e 67 24  |" . L%=.(string$|
000017e0  29 0d 00 b1 21 20 e7 20  70 74 72 25 2d 21 61 6e  |)...! . ptr%-!an|
000017f0  63 68 6f 72 25 2b 4c 25  2b 31 3e 73 69 7a 65 25  |chor%+L%+1>size%|
00001800  20 8c 0d 00 b2 12 20 20  20 73 69 7a 65 25 2b 3d  | .....   size%+=|
00001810  69 6e 63 25 0d 00 b3 31  20 20 20 f2 65 78 74 65  |inc%...1   .exte|
00001820  6e 64 5f 6e 61 6d 65 64  5f 73 6c 69 64 69 6e 67  |nd_named_sliding|
00001830  5f 62 6c 6f 63 6b 28 61  6e 63 68 6f 72 25 2c 73  |_block(anchor%,s|
00001840  69 7a 65 25 29 0d 00 b4  06 20 cd 0d 00 b5 34 20  |ize%).... ....4 |
00001850  e7 20 73 74 72 69 6e 67  24 3c 3e 22 22 20 8c 20  |. string$<>"" . |
00001860  24 70 74 72 25 3d 73 74  72 69 6e 67 24 3a 70 74  |$ptr%=string$:pt|
00001870  72 25 2b 3d 4c 25 3a 3f  70 74 72 25 3d 31 30 0d  |r%+=L%:?ptr%=10.|
00001880  00 b6 06 20 e1 0d 00 b7  05 20 0d 00 b8 30 20 dd  |... ..... ...0 .|
00001890  20 a4 5f 68 65 61 70 5f  6e 75 6d 74 6f 73 74 72  | ._heap_numtostr|
000018a0  28 64 25 2c 6e 25 29 3d  c2 c4 64 25 2c 22 30 22  |(d%,n%)=..d%,"0"|
000018b0  29 2b c3 7e 6e 25 2c 64  25 29 0d 00 b9 31 20 dd  |)+.~n%,d%)...1 .|
000018c0  20 a4 5f 68 65 61 70 5f  73 6e 75 6d 74 6f 73 74  | ._heap_snumtost|
000018d0  72 28 64 25 2c 6e 25 29  3d c2 c4 64 25 2c 22 20  |r(d%,n%)=..d%," |
000018e0  22 29 2b c3 20 6e 25 2c  64 25 29 0d 00 ba 06 20  |")+. n%,d%).... |
000018f0  3a 0d 00 bb 19 20 dd 20  f2 68 65 61 70 73 69 6e  |:.... . .heapsin|
00001900  66 6f 28 62 6c 6f 63 6b  25 29 0d 00 bc 18 20 ea  |fo(block%).... .|
00001910  20 62 69 67 62 6c 6f 63  25 2c 74 6f 74 66 72 65  | bigbloc%,totfre|
00001920  65 25 0d 00 bd 3b 20 c8  99 20 22 4f 53 5f 48 65  |e%...; .. "OS_He|
00001930  61 70 22 2c 31 2c 73 68  5f 66 69 78 65 64 68 65  |ap",1,sh_fixedhe|
00001940  61 70 62 61 73 65 25 20  b8 20 2c 2c 62 69 67 62  |apbase% . ,,bigb|
00001950  6c 6f 63 25 2c 74 6f 74  66 72 65 65 25 0d 00 be  |loc%,totfree%...|
00001960  13 20 f1 20 22 46 69 78  65 64 20 68 65 61 70 22  |. . "Fixed heap"|
00001970  0d 00 bf 13 20 f1 20 22  2d 2d 2d 2d 2d 20 2d 2d  |.... . "----- --|
00001980  2d 2d 22 0d 00 c0 3e 20  f1 20 22 48 65 61 70 20  |--"...> . "Heap |
00001990  62 61 73 65 20 20 20 20  3a 20 26 22 3b a4 5f 68  |base    : &";._h|
000019a0  65 61 70 5f 6e 75 6d 74  6f 73 74 72 28 38 2c 73  |eap_numtostr(8,s|
000019b0  68 5f 66 69 78 65 64 68  65 61 70 62 61 73 65 25  |h_fixedheapbase%|
000019c0  29 0d 00 c1 39 20 f1 20  22 48 65 61 70 20 73 69  |)...9 . "Heap si|
000019d0  7a 65 20 20 20 20 3a 20  22 3b a4 5f 68 65 61 70  |ze    : ";._heap|
000019e0  5f 62 79 74 65 73 32 28  73 68 5f 66 69 78 65 64  |_bytes2(sh_fixed|
000019f0  68 65 61 70 73 69 7a 65  25 29 0d 00 c2 30 20 f1  |heapsize%)...0 .|
00001a00  20 22 4c 61 72 67 65 73  74 20 66 72 65 65 20 3a  | "Largest free :|
00001a10  20 22 3b a4 5f 68 65 61  70 5f 62 79 74 65 73 32  | ";._heap_bytes2|
00001a20  28 62 69 67 62 6c 6f 63  25 29 0d 00 c3 30 20 f1  |(bigbloc%)...0 .|
00001a30  20 22 54 6f 74 61 6c 20  66 72 65 65 20 20 20 3a  | "Total free   :|
00001a40  20 22 3b a4 5f 68 65 61  70 5f 62 79 74 65 73 32  | ";._heap_bytes2|
00001a50  28 74 6f 74 66 72 65 65  25 29 0d 00 c4 06 20 f1  |(totfree%).... .|
00001a60  0d 00 c5 15 20 f1 20 22  53 6c 69 64 69 6e 67 20  |.... . "Sliding |
00001a70  68 65 61 70 22 0d 00 c6  15 20 f1 20 22 2d 2d 2d  |heap".... . "---|
00001a80  2d 2d 2d 2d 20 2d 2d 2d  2d 22 0d 00 c7 32 20 c8  |---- ----"...2 .|
00001a90  99 20 22 53 6c 69 64 69  6e 67 48 65 61 70 5f 48  |. "SlidingHeap_H|
00001aa0  65 61 70 49 6e 66 6f 22  2c 73 68 5f 73 6c 69 64  |eapInfo",sh_slid|
00001ab0  69 6e 67 68 65 61 70 62  61 73 65 25 0d 00 c8 06  |ingheapbase%....|
00001ac0  20 e1 0d 00 c9 06 20 3a  0d 00 ca 17 20 dd 20 a4  | ..... :.... . .|
00001ad0  5f 68 65 61 70 5f 62 79  74 65 73 28 62 25 29 0d  |_heap_bytes(b%).|
00001ae0  00 cb 0b 20 ea 20 65 6e  64 25 0d 00 cc 3f 20 c8  |... . end%...? .|
00001af0  99 20 22 4f 53 5f 43 6f  6e 76 65 72 74 46 69 78  |. "OS_ConvertFix|
00001b00  65 64 46 69 6c 65 53 69  7a 65 22 2c 62 25 2c 62  |edFileSize",b%,b|
00001b10  6c 6f 63 6b 25 2c 62 6c  6f 63 6b 25 2b 26 31 30  |lock%,block%+&10|
00001b20  30 20 b8 20 2c 65 6e 64  25 0d 00 cd 0d 20 3f 65  |0 . ,end%.... ?e|
00001b30  6e 64 25 3d 31 33 0d 00  ce 0d 20 3d 24 62 6c 6f  |nd%=13.... =$blo|
00001b40  63 6b 25 0d 00 cf 06 20  3a 0d 00 d0 18 20 dd 20  |ck%.... :.... . |
00001b50  a4 5f 68 65 61 70 5f 62  79 74 65 73 32 28 62 25  |._heap_bytes2(b%|
00001b60  29 0d 00 d1 0b 20 ea 20  65 6e 64 25 0d 00 d2 3a  |).... . end%...:|
00001b70  20 c8 99 20 22 4f 53 5f  43 6f 6e 76 65 72 74 46  | .. "OS_ConvertF|
00001b80  69 6c 65 53 69 7a 65 22  2c 62 25 2c 62 6c 6f 63  |ileSize",b%,bloc|
00001b90  6b 25 2c 62 6c 6f 63 6b  25 2b 26 31 30 30 20 b8  |k%,block%+&100 .|
00001ba0  20 2c 65 6e 64 25 0d 00  d3 0d 20 3f 65 6e 64 25  | ,end%.... ?end%|
00001bb0  3d 31 33 0d 00 d4 0d 20  3d 24 62 6c 6f 63 6b 25  |=13.... =$block%|
00001bc0  0d 00 d5 06 20 3a 0d 00  d6 21 20 dd 20 a4 63 72  |.... :...! . .cr|
00001bd0  65 61 74 65 5f 66 69 78  65 64 5f 62 6c 6f 63 6b  |eate_fixed_block|
00001be0  28 73 69 7a 65 25 29 0d  00 d7 15 20 ea 20 70 6f  |(size%).... . po|
00001bf0  69 6e 74 65 72 25 2c 66  6c 61 67 25 0d 00 d8 40  |inter%,flag%...@|
00001c00  20 c8 99 20 22 58 4f 53  5f 48 65 61 70 22 2c 32  | .. "XOS_Heap",2|
00001c10  2c 73 68 5f 66 69 78 65  64 68 65 61 70 62 61 73  |,sh_fixedheapbas|
00001c20  65 25 2c 2c 73 69 7a 65  25 20 b8 20 2c 2c 70 6f  |e%,,size% . ,,po|
00001c30  69 6e 74 65 72 25 3b 66  6c 61 67 25 0d 00 d9 11  |inter%;flag%....|
00001c40  20 c8 95 20 66 6c 61 67  25 20 80 20 31 0d 00 da  | .. flag% . 1...|
00001c50  15 20 f2 65 78 74 65 6e  64 66 69 78 65 64 68 65  |. .extendfixedhe|
00001c60  61 70 0d 00 db 40 20 c8  99 20 22 58 4f 53 5f 48  |ap...@ .. "XOS_H|
00001c70  65 61 70 22 2c 32 2c 73  68 5f 66 69 78 65 64 68  |eap",2,sh_fixedh|
00001c80  65 61 70 62 61 73 65 25  2c 2c 73 69 7a 65 25 20  |eapbase%,,size% |
00001c90  b8 20 2c 2c 70 6f 69 6e  74 65 72 25 3b 66 6c 61  |. ,,pointer%;fla|
00001ca0  67 25 0d 00 dc 06 20 ce  0d 00 dd 0e 20 3d 70 6f  |g%.... ..... =po|
00001cb0  69 6e 74 65 72 25 0d 00  de 06 20 3a 0d 00 df 17  |inter%.... :....|
00001cc0  20 dd 20 f2 65 78 74 65  6e 64 66 69 78 65 64 68  | . .extendfixedh|
00001cd0  65 61 70 0d 00 e0 1d 20  ea 20 6e 73 68 62 25 2c  |eap.... . nshb%,|
00001ce0  65 78 74 65 6e 64 25 2c  74 72 79 73 69 7a 65 25  |extend%,trysize%|
00001cf0  0d 00 e1 25 20 c8 99 20  22 4f 53 5f 52 65 61 64  |...% .. "OS_Read|
00001d00  4d 65 6d 4d 61 70 49 6e  66 6f 22 20 b8 20 65 78  |MemMapInfo" . ex|
00001d10  74 65 6e 64 25 0d 00 e2  25 20 74 72 79 73 69 7a  |tend%...% trysiz|
00001d20  65 25 3d a4 5f 68 65 61  70 5f 73 6c 6f 74 73 69  |e%=._heap_slotsi|
00001d30  7a 65 2b 65 78 74 65 6e  64 25 0d 00 e3 1b 20 f2  |ze+extend%.... .|
00001d40  73 65 74 73 6c 6f 74 73  69 7a 65 28 74 72 79 73  |setslotsize(trys|
00001d50  69 7a 65 25 29 0d 00 e4  46 20 e7 20 a4 5f 68 65  |ize%)...F . ._he|
00001d60  61 70 5f 73 6c 6f 74 73  69 7a 65 3c 74 72 79 73  |ap_slotsize<trys|
00001d70  69 7a 65 25 20 8c 20 85  20 32 35 35 2c 22 4e 6f  |ize% . . 255,"No|
00001d80  20 72 6f 6f 6d 20 74 6f  20 65 78 74 65 6e 64 20  | room to extend |
00001d90  66 69 78 65 64 20 68 65  61 70 22 0d 00 e5 26 20  |fixed heap"...& |
00001da0  6e 73 68 62 25 3d 73 68  5f 73 6c 69 64 69 6e 67  |nshb%=sh_sliding|
00001db0  68 65 61 70 62 61 73 65  25 2b 65 78 74 65 6e 64  |heapbase%+extend|
00001dc0  25 0d 00 e6 39 20 c8 99  20 22 53 6c 69 64 69 6e  |%...9 .. "Slidin|
00001dd0  67 48 65 61 70 5f 53 68  69 66 74 48 65 61 70 22  |gHeap_ShiftHeap"|
00001de0  2c 73 68 5f 73 6c 69 64  69 6e 67 68 65 61 70 62  |,sh_slidingheapb|
00001df0  61 73 65 25 2c 6e 73 68  62 25 0d 00 e7 2e 20 c8  |ase%,nshb%.... .|
00001e00  99 20 22 4f 53 5f 48 65  61 70 22 2c 35 2c 73 68  |. "OS_Heap",5,sh|
00001e10  5f 66 69 78 65 64 68 65  61 70 62 61 73 65 25 2c  |_fixedheapbase%,|
00001e20  2c 65 78 74 65 6e 64 25  0d 00 e8 1f 20 73 68 5f  |,extend%.... sh_|
00001e30  66 69 78 65 64 68 65 61  70 73 69 7a 65 25 2b 3d  |fixedheapsize%+=|
00001e40  65 78 74 65 6e 64 25 0d  00 e9 1e 20 73 68 5f 73  |extend%.... sh_s|
00001e50  6c 69 64 69 6e 67 68 65  61 70 62 61 73 65 25 3d  |lidingheapbase%=|
00001e60  6e 73 68 62 25 0d 00 ea  34 20 c8 99 20 22 53 6c  |nshb%...4 .. "Sl|
00001e70  69 64 69 6e 67 48 65 61  70 5f 56 65 72 69 66 79  |idingHeap_Verify|
00001e80  48 65 61 70 22 2c 73 68  5f 73 6c 69 64 69 6e 67  |Heap",sh_sliding|
00001e90  68 65 61 70 62 61 73 65  25 0d 00 eb 06 20 e1 0d  |heapbase%.... ..|
00001ea0  00 ec 06 20 3a 0d ff                              |... :..|
00001ea7