Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Regulars2 » StarInfo/Fletcher/!Setup/Files/Disc1/Program/NetGame/!NetGame/BasicLib/DynMenu

StarInfo/Fletcher/!Setup/Files/Disc1/Program/NetGame/!NetGame/BasicLib/DynMenu

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 » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Regulars2
Filename: StarInfo/Fletcher/!Setup/Files/Disc1/Program/NetGame/!NetGame/BasicLib/DynMenu
Read OK:
File size: 0D84 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >DynMenuLib
   20REM Dynamic menu handling
   30REM This REQUIRES the HeapLibrary so you must LIBRARY it
   40REM Version 1.01 (20 May 1997)
   50END
   60:
   70REM Initialise the dynamic menu handler
   80DEFPROCinit_dynmenu
   90dynm_start=0:REM start of dynamic menu chain
  100dynm_top=0:REM topmost menu pointer
  110dynm_menu=0:REM The menu we are currently defining
  120dynm_stack=0:REM Stack of menus we are defining
  130ENDPROC
  140:
  150REM Create a dynamic menu
  160DEFPROCdynmenu_menu(title$)
  170PROCdynmenu_destroy:REM Destroy the current menu chain
  180PROCdynmenu_submenu(title$)
  190ENDPROC
  200:
  210REM Destroy the current dynamic menu
  220DEFPROCdynmenu_destroy
  230LOCAL next%
  240WHILE dynm_start<>0
  250 next%=!dynm_start:PROCrelease(dynm_start):dynm_start=next%
  260ENDWHILE
  270WHILE dynm_stack<>0
  280 next%=!dynm_stack:PROCrelease(dynm_stack):dynm_stack=next%
  290ENDWHILE
  300dynm_top=0:dynm_menu=0:REM No top menu, no current menu
  310ENDPROC
  320:
  330REM Create a submenu definition
  340DEFPROCdynmenu_submenu(title$)
  350LOCAL last%
  360last%=FNclaim(8):!last%=dynm_stack
  370last%!4=dynm_menu:dynm_stack=last%:REM Link the stack, set menu
  380dynm_menu=FNclaim(-36)+8:REM For the menu header
  390dynm_menu!-4=28:REM No entries yet
  400$dynm_menu=LEFT$(title$,11):dynm_menu!12=&70207
  410dynm_menu!16=LEN(LEFT$(title$,11))*16+16:REM Width of menu
  420dynm_menu!20=&2C:dynm_menu!24=0:REM Height, and gap of menus
  430ENDPROC
  440:
  450DEFFNdynmenu_end
  460LOCAL thismenu%,last%
  470IF dynm_menu!-4=28 THEN
  480 dynm_menu=FNextend(dynm_menu-8,24)+8
  490 dynm_menu!28=0:REM item flags
  500 dynm_menu!32=-1:REM No sub-menu
  510 dynm_menu!36=&7400021:REM Shaded entry
  520 $(dynm_menu+40)="None":REM No entry
  530 dynm_menu!-4=(dynm_menu!-4)+24
  540ENDIF
  550dynm_menu!((dynm_menu!-4)-24)=dynm_menu!((dynm_menu!-4)-24) OR 128
  560dynm_menu!-8=dynm_start:REM Link ourselves to the release chain
  570dynm_start=dynm_menu-8:REM And place us at the head
  580thismenu%=dynm_menu:dynm_menu=dynm_stack!4
  590last%=!dynm_stack:PROCrelease(dynm_stack)
  600dynm_stack=last%:IF last%=0 THENdynm_top=thismenu%
  610=thismenu%
  620:
  630DEFFNdynm_strdup(item$)
  640LOCAL mem%:mem%=FNclaim(LEN(item$)+5):$(mem%+4)=item$
  650!mem%=dynm_start:dynm_start=mem%
  660=mem%+4
  670:
  680REM Add an item to the menu
  690REM b0 = ticked
  700REM b1 = dotted
  710REM b2 = writable
  720REM b3 = message when over
  730REM b4 = grayed out
  740DEFPROCdynmenu_add(item$,sprite$,flags%)
  750LOCAL item%
  760dynm_menu=FNextend(dynm_menu-8,24)+8:item%=dynm_menu!-4
  770dynm_menu!(item%)=flags% AND 15:REM item flags
  780dynm_menu!(item%+4)=-1:REM No sub-menu
  790dynm_menu!(item%+8)=&7000121:REM Shaded entry
  800IF (flags% AND 16)=16 THENdynm_menu!(item%+8)=dynm_menu!(item%+8) OR (1<<22)
  810dynm_menu!(item%+12)=FNdynm_strdup(item$):REM the text
  820dynm_menu!(item%+20)=LEN(item$)+1
  830IF sprite$<>"" THEN
  840 dynm_menu!(item%+16)=FNdynm_strdup("S"+sprite$)
  850 dynm_menu!(item%+8)=dynm_menu!(item%+8) OR &32
  860ELSE
  870 dynm_menu!(item%+16)=0
  880ENDIF
  890IF LEN(item$)+1>(dynm_menu!16)/16 THEN
  900 dynm_menu!16=LEN(item$)*16+16:REM Extend width of menu
  910ENDIF
  920dynm_menu!-4=(dynm_menu!-4)+24
  930ENDPROC
  940:
  950REM Attach a menu/window to this entry
  960DEFPROCdynmenu_attach(submenu%)
  970dynm_menu!((dynm_menu!-4)-20)=submenu%
  980ENDPROC
  990:
 1000REM Preserve the current state for later restoration
 1010DEFFNdynmenu_preserve
 1020LOCAL handle%:handle%=FNclaim(16)
 1030!handle%=dynm_menu:handle%!4=dynm_top
 1040handle%!8=dynm_stack:handle%!12=dynm_start
 1050dynm_start=0:dynm_top=0:dynm_menu=0:dynm_stack=0
 1060=handle%
 1070:
 1080REM Restore the state of the menus
 1090DEFPROCdynmenu_restore(handle%)
 1100IF handle%<>0 THEN
 1110 dynm_menu=!handle%:dynm_top=handle%!4
 1120 dynm_stack=handle%!8:dynm_start=handle%!12
 1130 PROCrelease(handle%)
 1140ENDIF
 1150ENDPROC

� >DynMenuLib
� Dynamic menu handling
:� This REQUIRES the HeapLibrary so you must LIBRARY it
( � Version 1.01 (20 May 1997)
2�
<:
F)� Initialise the dynamic menu handler
P��init_dynmenu
Z.dynm_start=0:� start of dynamic menu chain
d%dynm_top=0:� topmost menu pointer
n4dynm_menu=0:� The menu we are currently defining
x1dynm_stack=0:� Stack of menus we are defining
��
�:
�� Create a dynamic menu
���dynmenu_menu(title$)
�5�dynmenu_destroy:� Destroy the current menu chain
��dynmenu_submenu(title$)
��
�:
�&� Destroy the current dynamic menu
���dynmenu_destroy
�� next%
�ȕ dynm_start<>0
�< next%=!dynm_start:�release(dynm_start):dynm_start=next%
�
ȕ dynm_stack<>0
< next%=!dynm_stack:�release(dynm_stack):dynm_stack=next%
"�
,9dynm_top=0:dynm_menu=0:� No top menu, no current menu
6�
@:
J!� Create a submenu definition
T��dynmenu_submenu(title$)
^� last%
h%last%=�claim(8):!last%=dynm_stack
rAlast%!4=dynm_menu:dynm_stack=last%:� Link the stack, set menu
|1dynm_menu=�claim(-36)+8:� For the menu header
�$dynm_menu!-4=28:� No entries yet
�.$dynm_menu=�title$,11):dynm_menu!12=&70207
�5dynm_menu!16=�(�title$,11))*16+16:� Width of menu
�>dynm_menu!20=&2C:dynm_menu!24=0:� Height, and gap of menus
��
�:
�ݤdynmenu_end
�� thismenu%,last%
�� dynm_menu!-4=28 �
�( dynm_menu=�extend(dynm_menu-8,24)+8
�  dynm_menu!28=0:� item flags
�" dynm_menu!32=-1:� No sub-menu
�) dynm_menu!36=&7400021:� Shaded entry
& $(dynm_menu+40)="None":� No entry
# dynm_menu!-4=(dynm_menu!-4)+24
�
&Edynm_menu!((dynm_menu!-4)-24)=dynm_menu!((dynm_menu!-4)-24) � 128
0Adynm_menu!-8=dynm_start:� Link ourselves to the release chain
:5dynm_start=dynm_menu-8:� And place us at the head
D.thismenu%=dynm_menu:dynm_menu=dynm_stack!4
N*last%=!dynm_stack:�release(dynm_stack)
X2dynm_stack=last%:� last%=0 �dynm_top=thismenu%
b=thismenu%
l:
vݤdynm_strdup(item$)
�2� mem%:mem%=�claim(�(item$)+5):$(mem%+4)=item$
�$!mem%=dynm_start:dynm_start=mem%
�=mem%+4
�:
�� Add an item to the menu
�� b0 = ticked
�� b1 = dotted
�� b2 = writable
�� b3 = message when over
�� b4 = grayed out
�'��dynmenu_add(item$,sprite$,flags%)
�� item%
�:dynm_menu=�extend(dynm_menu-8,24)+8:item%=dynm_menu!-4
.dynm_menu!(item%)=flags% � 15:� item flags
(dynm_menu!(item%+4)=-1:� No sub-menu
/dynm_menu!(item%+8)=&7000121:� Shaded entry
 I� (flags% � 16)=16 �dynm_menu!(item%+8)=dynm_menu!(item%+8) � (1<<22)
*7dynm_menu!(item%+12)=�dynm_strdup(item$):� the text
4#dynm_menu!(item%+20)=�(item$)+1
>� sprite$<>"" �
H3 dynm_menu!(item%+16)=�dynm_strdup("S"+sprite$)
R2 dynm_menu!(item%+8)=dynm_menu!(item%+8) � &32
\�
f dynm_menu!(item%+16)=0
p�
z$� �(item$)+1>(dynm_menu!16)/16 �
�7 dynm_menu!16=�(item$)*16+16:� Extend width of menu
��
�"dynm_menu!-4=(dynm_menu!-4)+24
��
�:
�(� Attach a menu/window to this entry
���dynmenu_attach(submenu%)
�*dynm_menu!((dynm_menu!-4)-20)=submenu%
��
�:
�6� Preserve the current state for later restoration
�ݤdynmenu_preserve
� � handle%:handle%=�claim(16)
)!handle%=dynm_menu:handle%!4=dynm_top
.handle%!8=dynm_stack:handle%!12=dynm_start
4dynm_start=0:dynm_top=0:dynm_menu=0:dynm_stack=0
$=handle%
.:
8$� Restore the state of the menus
B��dynmenu_restore(handle%)
L� handle%<>0 �
V* dynm_menu=!handle%:dynm_top=handle%!4
`/ dynm_stack=handle%!8:dynm_start=handle%!12
j �release(handle%)
t�
~�
�
00000000  0d 00 0a 11 f4 20 3e 44  79 6e 4d 65 6e 75 4c 69  |..... >DynMenuLi|
00000010  62 0d 00 14 1b f4 20 44  79 6e 61 6d 69 63 20 6d  |b..... Dynamic m|
00000020  65 6e 75 20 68 61 6e 64  6c 69 6e 67 0d 00 1e 3a  |enu handling...:|
00000030  f4 20 54 68 69 73 20 52  45 51 55 49 52 45 53 20  |. This REQUIRES |
00000040  74 68 65 20 48 65 61 70  4c 69 62 72 61 72 79 20  |the HeapLibrary |
00000050  73 6f 20 79 6f 75 20 6d  75 73 74 20 4c 49 42 52  |so you must LIBR|
00000060  41 52 59 20 69 74 0d 00  28 20 f4 20 56 65 72 73  |ARY it..( . Vers|
00000070  69 6f 6e 20 31 2e 30 31  20 28 32 30 20 4d 61 79  |ion 1.01 (20 May|
00000080  20 31 39 39 37 29 0d 00  32 05 e0 0d 00 3c 05 3a  | 1997)..2....<.:|
00000090  0d 00 46 29 f4 20 49 6e  69 74 69 61 6c 69 73 65  |..F). Initialise|
000000a0  20 74 68 65 20 64 79 6e  61 6d 69 63 20 6d 65 6e  | the dynamic men|
000000b0  75 20 68 61 6e 64 6c 65  72 0d 00 50 12 dd f2 69  |u handler..P...i|
000000c0  6e 69 74 5f 64 79 6e 6d  65 6e 75 0d 00 5a 2e 64  |nit_dynmenu..Z.d|
000000d0  79 6e 6d 5f 73 74 61 72  74 3d 30 3a f4 20 73 74  |ynm_start=0:. st|
000000e0  61 72 74 20 6f 66 20 64  79 6e 61 6d 69 63 20 6d  |art of dynamic m|
000000f0  65 6e 75 20 63 68 61 69  6e 0d 00 64 25 64 79 6e  |enu chain..d%dyn|
00000100  6d 5f 74 6f 70 3d 30 3a  f4 20 74 6f 70 6d 6f 73  |m_top=0:. topmos|
00000110  74 20 6d 65 6e 75 20 70  6f 69 6e 74 65 72 0d 00  |t menu pointer..|
00000120  6e 34 64 79 6e 6d 5f 6d  65 6e 75 3d 30 3a f4 20  |n4dynm_menu=0:. |
00000130  54 68 65 20 6d 65 6e 75  20 77 65 20 61 72 65 20  |The menu we are |
00000140  63 75 72 72 65 6e 74 6c  79 20 64 65 66 69 6e 69  |currently defini|
00000150  6e 67 0d 00 78 31 64 79  6e 6d 5f 73 74 61 63 6b  |ng..x1dynm_stack|
00000160  3d 30 3a f4 20 53 74 61  63 6b 20 6f 66 20 6d 65  |=0:. Stack of me|
00000170  6e 75 73 20 77 65 20 61  72 65 20 64 65 66 69 6e  |nus we are defin|
00000180  69 6e 67 0d 00 82 05 e1  0d 00 8c 05 3a 0d 00 96  |ing.........:...|
00000190  1b f4 20 43 72 65 61 74  65 20 61 20 64 79 6e 61  |.. Create a dyna|
000001a0  6d 69 63 20 6d 65 6e 75  0d 00 a0 1a dd f2 64 79  |mic menu......dy|
000001b0  6e 6d 65 6e 75 5f 6d 65  6e 75 28 74 69 74 6c 65  |nmenu_menu(title|
000001c0  24 29 0d 00 aa 35 f2 64  79 6e 6d 65 6e 75 5f 64  |$)...5.dynmenu_d|
000001d0  65 73 74 72 6f 79 3a f4  20 44 65 73 74 72 6f 79  |estroy:. Destroy|
000001e0  20 74 68 65 20 63 75 72  72 65 6e 74 20 6d 65 6e  | the current men|
000001f0  75 20 63 68 61 69 6e 0d  00 b4 1c f2 64 79 6e 6d  |u chain.....dynm|
00000200  65 6e 75 5f 73 75 62 6d  65 6e 75 28 74 69 74 6c  |enu_submenu(titl|
00000210  65 24 29 0d 00 be 05 e1  0d 00 c8 05 3a 0d 00 d2  |e$).........:...|
00000220  26 f4 20 44 65 73 74 72  6f 79 20 74 68 65 20 63  |&. Destroy the c|
00000230  75 72 72 65 6e 74 20 64  79 6e 61 6d 69 63 20 6d  |urrent dynamic m|
00000240  65 6e 75 0d 00 dc 15 dd  f2 64 79 6e 6d 65 6e 75  |enu......dynmenu|
00000250  5f 64 65 73 74 72 6f 79  0d 00 e6 0b ea 20 6e 65  |_destroy..... ne|
00000260  78 74 25 0d 00 f0 14 c8  95 20 64 79 6e 6d 5f 73  |xt%...... dynm_s|
00000270  74 61 72 74 3c 3e 30 0d  00 fa 3c 20 6e 65 78 74  |tart<>0...< next|
00000280  25 3d 21 64 79 6e 6d 5f  73 74 61 72 74 3a f2 72  |%=!dynm_start:.r|
00000290  65 6c 65 61 73 65 28 64  79 6e 6d 5f 73 74 61 72  |elease(dynm_star|
000002a0  74 29 3a 64 79 6e 6d 5f  73 74 61 72 74 3d 6e 65  |t):dynm_start=ne|
000002b0  78 74 25 0d 01 04 05 ce  0d 01 0e 14 c8 95 20 64  |xt%........... d|
000002c0  79 6e 6d 5f 73 74 61 63  6b 3c 3e 30 0d 01 18 3c  |ynm_stack<>0...<|
000002d0  20 6e 65 78 74 25 3d 21  64 79 6e 6d 5f 73 74 61  | next%=!dynm_sta|
000002e0  63 6b 3a f2 72 65 6c 65  61 73 65 28 64 79 6e 6d  |ck:.release(dynm|
000002f0  5f 73 74 61 63 6b 29 3a  64 79 6e 6d 5f 73 74 61  |_stack):dynm_sta|
00000300  63 6b 3d 6e 65 78 74 25  0d 01 22 05 ce 0d 01 2c  |ck=next%.."....,|
00000310  39 64 79 6e 6d 5f 74 6f  70 3d 30 3a 64 79 6e 6d  |9dynm_top=0:dynm|
00000320  5f 6d 65 6e 75 3d 30 3a  f4 20 4e 6f 20 74 6f 70  |_menu=0:. No top|
00000330  20 6d 65 6e 75 2c 20 6e  6f 20 63 75 72 72 65 6e  | menu, no curren|
00000340  74 20 6d 65 6e 75 0d 01  36 05 e1 0d 01 40 05 3a  |t menu..6....@.:|
00000350  0d 01 4a 21 f4 20 43 72  65 61 74 65 20 61 20 73  |..J!. Create a s|
00000360  75 62 6d 65 6e 75 20 64  65 66 69 6e 69 74 69 6f  |ubmenu definitio|
00000370  6e 0d 01 54 1d dd f2 64  79 6e 6d 65 6e 75 5f 73  |n..T...dynmenu_s|
00000380  75 62 6d 65 6e 75 28 74  69 74 6c 65 24 29 0d 01  |ubmenu(title$)..|
00000390  5e 0b ea 20 6c 61 73 74  25 0d 01 68 25 6c 61 73  |^.. last%..h%las|
000003a0  74 25 3d a4 63 6c 61 69  6d 28 38 29 3a 21 6c 61  |t%=.claim(8):!la|
000003b0  73 74 25 3d 64 79 6e 6d  5f 73 74 61 63 6b 0d 01  |st%=dynm_stack..|
000003c0  72 41 6c 61 73 74 25 21  34 3d 64 79 6e 6d 5f 6d  |rAlast%!4=dynm_m|
000003d0  65 6e 75 3a 64 79 6e 6d  5f 73 74 61 63 6b 3d 6c  |enu:dynm_stack=l|
000003e0  61 73 74 25 3a f4 20 4c  69 6e 6b 20 74 68 65 20  |ast%:. Link the |
000003f0  73 74 61 63 6b 2c 20 73  65 74 20 6d 65 6e 75 0d  |stack, set menu.|
00000400  01 7c 31 64 79 6e 6d 5f  6d 65 6e 75 3d a4 63 6c  |.|1dynm_menu=.cl|
00000410  61 69 6d 28 2d 33 36 29  2b 38 3a f4 20 46 6f 72  |aim(-36)+8:. For|
00000420  20 74 68 65 20 6d 65 6e  75 20 68 65 61 64 65 72  | the menu header|
00000430  0d 01 86 24 64 79 6e 6d  5f 6d 65 6e 75 21 2d 34  |...$dynm_menu!-4|
00000440  3d 32 38 3a f4 20 4e 6f  20 65 6e 74 72 69 65 73  |=28:. No entries|
00000450  20 79 65 74 0d 01 90 2e  24 64 79 6e 6d 5f 6d 65  | yet....$dynm_me|
00000460  6e 75 3d c0 74 69 74 6c  65 24 2c 31 31 29 3a 64  |nu=.title$,11):d|
00000470  79 6e 6d 5f 6d 65 6e 75  21 31 32 3d 26 37 30 32  |ynm_menu!12=&702|
00000480  30 37 0d 01 9a 35 64 79  6e 6d 5f 6d 65 6e 75 21  |07...5dynm_menu!|
00000490  31 36 3d a9 28 c0 74 69  74 6c 65 24 2c 31 31 29  |16=.(.title$,11)|
000004a0  29 2a 31 36 2b 31 36 3a  f4 20 57 69 64 74 68 20  |)*16+16:. Width |
000004b0  6f 66 20 6d 65 6e 75 0d  01 a4 3e 64 79 6e 6d 5f  |of menu...>dynm_|
000004c0  6d 65 6e 75 21 32 30 3d  26 32 43 3a 64 79 6e 6d  |menu!20=&2C:dynm|
000004d0  5f 6d 65 6e 75 21 32 34  3d 30 3a f4 20 48 65 69  |_menu!24=0:. Hei|
000004e0  67 68 74 2c 20 61 6e 64  20 67 61 70 20 6f 66 20  |ght, and gap of |
000004f0  6d 65 6e 75 73 0d 01 ae  05 e1 0d 01 b8 05 3a 0d  |menus.........:.|
00000500  01 c2 11 dd a4 64 79 6e  6d 65 6e 75 5f 65 6e 64  |.....dynmenu_end|
00000510  0d 01 cc 15 ea 20 74 68  69 73 6d 65 6e 75 25 2c  |..... thismenu%,|
00000520  6c 61 73 74 25 0d 01 d6  17 e7 20 64 79 6e 6d 5f  |last%..... dynm_|
00000530  6d 65 6e 75 21 2d 34 3d  32 38 20 8c 0d 01 e0 28  |menu!-4=28 ....(|
00000540  20 64 79 6e 6d 5f 6d 65  6e 75 3d a4 65 78 74 65  | dynm_menu=.exte|
00000550  6e 64 28 64 79 6e 6d 5f  6d 65 6e 75 2d 38 2c 32  |nd(dynm_menu-8,2|
00000560  34 29 2b 38 0d 01 ea 20  20 64 79 6e 6d 5f 6d 65  |4)+8...  dynm_me|
00000570  6e 75 21 32 38 3d 30 3a  f4 20 69 74 65 6d 20 66  |nu!28=0:. item f|
00000580  6c 61 67 73 0d 01 f4 22  20 64 79 6e 6d 5f 6d 65  |lags..." dynm_me|
00000590  6e 75 21 33 32 3d 2d 31  3a f4 20 4e 6f 20 73 75  |nu!32=-1:. No su|
000005a0  62 2d 6d 65 6e 75 0d 01  fe 29 20 64 79 6e 6d 5f  |b-menu...) dynm_|
000005b0  6d 65 6e 75 21 33 36 3d  26 37 34 30 30 30 32 31  |menu!36=&7400021|
000005c0  3a f4 20 53 68 61 64 65  64 20 65 6e 74 72 79 0d  |:. Shaded entry.|
000005d0  02 08 26 20 24 28 64 79  6e 6d 5f 6d 65 6e 75 2b  |..& $(dynm_menu+|
000005e0  34 30 29 3d 22 4e 6f 6e  65 22 3a f4 20 4e 6f 20  |40)="None":. No |
000005f0  65 6e 74 72 79 0d 02 12  23 20 64 79 6e 6d 5f 6d  |entry...# dynm_m|
00000600  65 6e 75 21 2d 34 3d 28  64 79 6e 6d 5f 6d 65 6e  |enu!-4=(dynm_men|
00000610  75 21 2d 34 29 2b 32 34  0d 02 1c 05 cd 0d 02 26  |u!-4)+24.......&|
00000620  45 64 79 6e 6d 5f 6d 65  6e 75 21 28 28 64 79 6e  |Edynm_menu!((dyn|
00000630  6d 5f 6d 65 6e 75 21 2d  34 29 2d 32 34 29 3d 64  |m_menu!-4)-24)=d|
00000640  79 6e 6d 5f 6d 65 6e 75  21 28 28 64 79 6e 6d 5f  |ynm_menu!((dynm_|
00000650  6d 65 6e 75 21 2d 34 29  2d 32 34 29 20 84 20 31  |menu!-4)-24) . 1|
00000660  32 38 0d 02 30 41 64 79  6e 6d 5f 6d 65 6e 75 21  |28..0Adynm_menu!|
00000670  2d 38 3d 64 79 6e 6d 5f  73 74 61 72 74 3a f4 20  |-8=dynm_start:. |
00000680  4c 69 6e 6b 20 6f 75 72  73 65 6c 76 65 73 20 74  |Link ourselves t|
00000690  6f 20 74 68 65 20 72 65  6c 65 61 73 65 20 63 68  |o the release ch|
000006a0  61 69 6e 0d 02 3a 35 64  79 6e 6d 5f 73 74 61 72  |ain..:5dynm_star|
000006b0  74 3d 64 79 6e 6d 5f 6d  65 6e 75 2d 38 3a f4 20  |t=dynm_menu-8:. |
000006c0  41 6e 64 20 70 6c 61 63  65 20 75 73 20 61 74 20  |And place us at |
000006d0  74 68 65 20 68 65 61 64  0d 02 44 2e 74 68 69 73  |the head..D.this|
000006e0  6d 65 6e 75 25 3d 64 79  6e 6d 5f 6d 65 6e 75 3a  |menu%=dynm_menu:|
000006f0  64 79 6e 6d 5f 6d 65 6e  75 3d 64 79 6e 6d 5f 73  |dynm_menu=dynm_s|
00000700  74 61 63 6b 21 34 0d 02  4e 2a 6c 61 73 74 25 3d  |tack!4..N*last%=|
00000710  21 64 79 6e 6d 5f 73 74  61 63 6b 3a f2 72 65 6c  |!dynm_stack:.rel|
00000720  65 61 73 65 28 64 79 6e  6d 5f 73 74 61 63 6b 29  |ease(dynm_stack)|
00000730  0d 02 58 32 64 79 6e 6d  5f 73 74 61 63 6b 3d 6c  |..X2dynm_stack=l|
00000740  61 73 74 25 3a e7 20 6c  61 73 74 25 3d 30 20 8c  |ast%:. last%=0 .|
00000750  64 79 6e 6d 5f 74 6f 70  3d 74 68 69 73 6d 65 6e  |dynm_top=thismen|
00000760  75 25 0d 02 62 0e 3d 74  68 69 73 6d 65 6e 75 25  |u%..b.=thismenu%|
00000770  0d 02 6c 05 3a 0d 02 76  18 dd a4 64 79 6e 6d 5f  |..l.:..v...dynm_|
00000780  73 74 72 64 75 70 28 69  74 65 6d 24 29 0d 02 80  |strdup(item$)...|
00000790  32 ea 20 6d 65 6d 25 3a  6d 65 6d 25 3d a4 63 6c  |2. mem%:mem%=.cl|
000007a0  61 69 6d 28 a9 28 69 74  65 6d 24 29 2b 35 29 3a  |aim(.(item$)+5):|
000007b0  24 28 6d 65 6d 25 2b 34  29 3d 69 74 65 6d 24 0d  |$(mem%+4)=item$.|
000007c0  02 8a 24 21 6d 65 6d 25  3d 64 79 6e 6d 5f 73 74  |..$!mem%=dynm_st|
000007d0  61 72 74 3a 64 79 6e 6d  5f 73 74 61 72 74 3d 6d  |art:dynm_start=m|
000007e0  65 6d 25 0d 02 94 0b 3d  6d 65 6d 25 2b 34 0d 02  |em%....=mem%+4..|
000007f0  9e 05 3a 0d 02 a8 1d f4  20 41 64 64 20 61 6e 20  |..:..... Add an |
00000800  69 74 65 6d 20 74 6f 20  74 68 65 20 6d 65 6e 75  |item to the menu|
00000810  0d 02 b2 11 f4 20 62 30  20 3d 20 74 69 63 6b 65  |..... b0 = ticke|
00000820  64 0d 02 bc 11 f4 20 62  31 20 3d 20 64 6f 74 74  |d..... b1 = dott|
00000830  65 64 0d 02 c6 13 f4 20  62 32 20 3d 20 77 72 69  |ed..... b2 = wri|
00000840  74 61 62 6c 65 0d 02 d0  1c f4 20 62 33 20 3d 20  |table..... b3 = |
00000850  6d 65 73 73 61 67 65 20  77 68 65 6e 20 6f 76 65  |message when ove|
00000860  72 0d 02 da 15 f4 20 62  34 20 3d 20 67 72 61 79  |r..... b4 = gray|
00000870  65 64 20 6f 75 74 0d 02  e4 27 dd f2 64 79 6e 6d  |ed out...'..dynm|
00000880  65 6e 75 5f 61 64 64 28  69 74 65 6d 24 2c 73 70  |enu_add(item$,sp|
00000890  72 69 74 65 24 2c 66 6c  61 67 73 25 29 0d 02 ee  |rite$,flags%)...|
000008a0  0b ea 20 69 74 65 6d 25  0d 02 f8 3a 64 79 6e 6d  |.. item%...:dynm|
000008b0  5f 6d 65 6e 75 3d a4 65  78 74 65 6e 64 28 64 79  |_menu=.extend(dy|
000008c0  6e 6d 5f 6d 65 6e 75 2d  38 2c 32 34 29 2b 38 3a  |nm_menu-8,24)+8:|
000008d0  69 74 65 6d 25 3d 64 79  6e 6d 5f 6d 65 6e 75 21  |item%=dynm_menu!|
000008e0  2d 34 0d 03 02 2e 64 79  6e 6d 5f 6d 65 6e 75 21  |-4....dynm_menu!|
000008f0  28 69 74 65 6d 25 29 3d  66 6c 61 67 73 25 20 80  |(item%)=flags% .|
00000900  20 31 35 3a f4 20 69 74  65 6d 20 66 6c 61 67 73  | 15:. item flags|
00000910  0d 03 0c 28 64 79 6e 6d  5f 6d 65 6e 75 21 28 69  |...(dynm_menu!(i|
00000920  74 65 6d 25 2b 34 29 3d  2d 31 3a f4 20 4e 6f 20  |tem%+4)=-1:. No |
00000930  73 75 62 2d 6d 65 6e 75  0d 03 16 2f 64 79 6e 6d  |sub-menu.../dynm|
00000940  5f 6d 65 6e 75 21 28 69  74 65 6d 25 2b 38 29 3d  |_menu!(item%+8)=|
00000950  26 37 30 30 30 31 32 31  3a f4 20 53 68 61 64 65  |&7000121:. Shade|
00000960  64 20 65 6e 74 72 79 0d  03 20 49 e7 20 28 66 6c  |d entry.. I. (fl|
00000970  61 67 73 25 20 80 20 31  36 29 3d 31 36 20 8c 64  |ags% . 16)=16 .d|
00000980  79 6e 6d 5f 6d 65 6e 75  21 28 69 74 65 6d 25 2b  |ynm_menu!(item%+|
00000990  38 29 3d 64 79 6e 6d 5f  6d 65 6e 75 21 28 69 74  |8)=dynm_menu!(it|
000009a0  65 6d 25 2b 38 29 20 84  20 28 31 3c 3c 32 32 29  |em%+8) . (1<<22)|
000009b0  0d 03 2a 37 64 79 6e 6d  5f 6d 65 6e 75 21 28 69  |..*7dynm_menu!(i|
000009c0  74 65 6d 25 2b 31 32 29  3d a4 64 79 6e 6d 5f 73  |tem%+12)=.dynm_s|
000009d0  74 72 64 75 70 28 69 74  65 6d 24 29 3a f4 20 74  |trdup(item$):. t|
000009e0  68 65 20 74 65 78 74 0d  03 34 23 64 79 6e 6d 5f  |he text..4#dynm_|
000009f0  6d 65 6e 75 21 28 69 74  65 6d 25 2b 32 30 29 3d  |menu!(item%+20)=|
00000a00  a9 28 69 74 65 6d 24 29  2b 31 0d 03 3e 13 e7 20  |.(item$)+1..>.. |
00000a10  73 70 72 69 74 65 24 3c  3e 22 22 20 8c 0d 03 48  |sprite$<>"" ...H|
00000a20  33 20 64 79 6e 6d 5f 6d  65 6e 75 21 28 69 74 65  |3 dynm_menu!(ite|
00000a30  6d 25 2b 31 36 29 3d a4  64 79 6e 6d 5f 73 74 72  |m%+16)=.dynm_str|
00000a40  64 75 70 28 22 53 22 2b  73 70 72 69 74 65 24 29  |dup("S"+sprite$)|
00000a50  0d 03 52 32 20 64 79 6e  6d 5f 6d 65 6e 75 21 28  |..R2 dynm_menu!(|
00000a60  69 74 65 6d 25 2b 38 29  3d 64 79 6e 6d 5f 6d 65  |item%+8)=dynm_me|
00000a70  6e 75 21 28 69 74 65 6d  25 2b 38 29 20 84 20 26  |nu!(item%+8) . &|
00000a80  33 32 0d 03 5c 05 cc 0d  03 66 1b 20 64 79 6e 6d  |32..\....f. dynm|
00000a90  5f 6d 65 6e 75 21 28 69  74 65 6d 25 2b 31 36 29  |_menu!(item%+16)|
00000aa0  3d 30 0d 03 70 05 cd 0d  03 7a 24 e7 20 a9 28 69  |=0..p....z$. .(i|
00000ab0  74 65 6d 24 29 2b 31 3e  28 64 79 6e 6d 5f 6d 65  |tem$)+1>(dynm_me|
00000ac0  6e 75 21 31 36 29 2f 31  36 20 8c 0d 03 84 37 20  |nu!16)/16 ....7 |
00000ad0  64 79 6e 6d 5f 6d 65 6e  75 21 31 36 3d a9 28 69  |dynm_menu!16=.(i|
00000ae0  74 65 6d 24 29 2a 31 36  2b 31 36 3a f4 20 45 78  |tem$)*16+16:. Ex|
00000af0  74 65 6e 64 20 77 69 64  74 68 20 6f 66 20 6d 65  |tend width of me|
00000b00  6e 75 0d 03 8e 05 cd 0d  03 98 22 64 79 6e 6d 5f  |nu........"dynm_|
00000b10  6d 65 6e 75 21 2d 34 3d  28 64 79 6e 6d 5f 6d 65  |menu!-4=(dynm_me|
00000b20  6e 75 21 2d 34 29 2b 32  34 0d 03 a2 05 e1 0d 03  |nu!-4)+24.......|
00000b30  ac 05 3a 0d 03 b6 28 f4  20 41 74 74 61 63 68 20  |..:...(. Attach |
00000b40  61 20 6d 65 6e 75 2f 77  69 6e 64 6f 77 20 74 6f  |a menu/window to|
00000b50  20 74 68 69 73 20 65 6e  74 72 79 0d 03 c0 1e dd  | this entry.....|
00000b60  f2 64 79 6e 6d 65 6e 75  5f 61 74 74 61 63 68 28  |.dynmenu_attach(|
00000b70  73 75 62 6d 65 6e 75 25  29 0d 03 ca 2a 64 79 6e  |submenu%)...*dyn|
00000b80  6d 5f 6d 65 6e 75 21 28  28 64 79 6e 6d 5f 6d 65  |m_menu!((dynm_me|
00000b90  6e 75 21 2d 34 29 2d 32  30 29 3d 73 75 62 6d 65  |nu!-4)-20)=subme|
00000ba0  6e 75 25 0d 03 d4 05 e1  0d 03 de 05 3a 0d 03 e8  |nu%.........:...|
00000bb0  36 f4 20 50 72 65 73 65  72 76 65 20 74 68 65 20  |6. Preserve the |
00000bc0  63 75 72 72 65 6e 74 20  73 74 61 74 65 20 66 6f  |current state fo|
00000bd0  72 20 6c 61 74 65 72 20  72 65 73 74 6f 72 61 74  |r later restorat|
00000be0  69 6f 6e 0d 03 f2 16 dd  a4 64 79 6e 6d 65 6e 75  |ion......dynmenu|
00000bf0  5f 70 72 65 73 65 72 76  65 0d 03 fc 20 ea 20 68  |_preserve... . h|
00000c00  61 6e 64 6c 65 25 3a 68  61 6e 64 6c 65 25 3d a4  |andle%:handle%=.|
00000c10  63 6c 61 69 6d 28 31 36  29 0d 04 06 29 21 68 61  |claim(16)...)!ha|
00000c20  6e 64 6c 65 25 3d 64 79  6e 6d 5f 6d 65 6e 75 3a  |ndle%=dynm_menu:|
00000c30  68 61 6e 64 6c 65 25 21  34 3d 64 79 6e 6d 5f 74  |handle%!4=dynm_t|
00000c40  6f 70 0d 04 10 2e 68 61  6e 64 6c 65 25 21 38 3d  |op....handle%!8=|
00000c50  64 79 6e 6d 5f 73 74 61  63 6b 3a 68 61 6e 64 6c  |dynm_stack:handl|
00000c60  65 25 21 31 32 3d 64 79  6e 6d 5f 73 74 61 72 74  |e%!12=dynm_start|
00000c70  0d 04 1a 34 64 79 6e 6d  5f 73 74 61 72 74 3d 30  |...4dynm_start=0|
00000c80  3a 64 79 6e 6d 5f 74 6f  70 3d 30 3a 64 79 6e 6d  |:dynm_top=0:dynm|
00000c90  5f 6d 65 6e 75 3d 30 3a  64 79 6e 6d 5f 73 74 61  |_menu=0:dynm_sta|
00000ca0  63 6b 3d 30 0d 04 24 0c  3d 68 61 6e 64 6c 65 25  |ck=0..$.=handle%|
00000cb0  0d 04 2e 05 3a 0d 04 38  24 f4 20 52 65 73 74 6f  |....:..8$. Resto|
00000cc0  72 65 20 74 68 65 20 73  74 61 74 65 20 6f 66 20  |re the state of |
00000cd0  74 68 65 20 6d 65 6e 75  73 0d 04 42 1e dd f2 64  |the menus..B...d|
00000ce0  79 6e 6d 65 6e 75 5f 72  65 73 74 6f 72 65 28 68  |ynmenu_restore(h|
00000cf0  61 6e 64 6c 65 25 29 0d  04 4c 12 e7 20 68 61 6e  |andle%)..L.. han|
00000d00  64 6c 65 25 3c 3e 30 20  8c 0d 04 56 2a 20 64 79  |dle%<>0 ...V* dy|
00000d10  6e 6d 5f 6d 65 6e 75 3d  21 68 61 6e 64 6c 65 25  |nm_menu=!handle%|
00000d20  3a 64 79 6e 6d 5f 74 6f  70 3d 68 61 6e 64 6c 65  |:dynm_top=handle|
00000d30  25 21 34 0d 04 60 2f 20  64 79 6e 6d 5f 73 74 61  |%!4..`/ dynm_sta|
00000d40  63 6b 3d 68 61 6e 64 6c  65 25 21 38 3a 64 79 6e  |ck=handle%!8:dyn|
00000d50  6d 5f 73 74 61 72 74 3d  68 61 6e 64 6c 65 25 21  |m_start=handle%!|
00000d60  31 32 0d 04 6a 16 20 f2  72 65 6c 65 61 73 65 28  |12..j. .release(|
00000d70  68 61 6e 64 6c 65 25 29  0d 04 74 05 cd 0d 04 7e  |handle%)..t....~|
00000d80  05 e1 0d ff                                       |....|
00000d84