Home » Archimedes archive » Acorn Computing » 1993 09 Mega Disk.adf » 93_09 » Miscellany/!AutoRun/!RunImage

Miscellany/!AutoRun/!RunImage

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 » Archimedes archive » Acorn Computing » 1993 09 Mega Disk.adf » 93_09
Filename: Miscellany/!AutoRun/!RunImage
Read OK:
File size: 541D bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >AutoRunII/III - converted and updated for the Archimedes
   20REM  ALL the contents of this program was written and created
   30REM  by Stephen Harrison
   40REM LEN 1992/3 Stephen Harrison
   50 :
   60ON ERROR PRINT REPORT$;" at line ";ERL:END
   70 :
   80PROCinit("AutoRun")
   90 :
  100WHILE NOT quit%
  110PROCwimp_poll
  120ENDWHILE
  130IF loaded% THEN PROCrelease_mem(code%)
  140SYS "Wimp_CloseDown"
  150END
  160:
  170:
  180DEFPROCinit(title$)
  190block_len%=888
  200 :
  210DIM block% block_len%
  220DIM pw% 28+24*1                     : REM 28+24*number of items in menu
  230DIM enc% 28+24*2                    : REM 28+24*number of items in menu
  240DIM iconbarmenu% 28+24*4            : REM 28+24*number of items in menu
  250DIM password% 13
  260DIM pwvalid% 4
  270 :
  280risc_ver%=2
  290application$=title$
  300quit%=FALSE
  310dopass%=FALSE
  320menusave%=FALSE
  330loaded%=FALSE
  340 :
  350SYS "Wimp_Initialise",risc_ver%*100,&4B534154,application$
  360ON ERROR PROCan_error:END
  370 :
  380PROCsetup_templates(10)
  390savetext%=FNfindtextaddr(save_window%,1)
  400 :
  410iconbaricon%=FNcreate_icon(-1,0,0,68,68,&3002,"!autorun",0,0,0)
  420 :
  430temp=FNcreatemenu(pw%,"  Password  ,1,&80,-1,")
  440PROCwriteable(pw%,0)
  450$pwvalid%="D*"
  460PROCindirect(pw%,0,"",password%,pwvalid%,13)
  470 :
  480temp=FNcreatemenu(enc%,"Encryption,2,0,-1,None,&80,pw%,Password")
  490PROCtick_on(enc%,0)
  500ibmenu_len%=FNcreatemenu(iconbarmenu%,"AutoRun,4,0,infobox%,Info,0,enc%,Encryption,0,save_window%,Save,&80,-1,Quit")
  510PROCshade_on(iconbarmenu%,2)
  520 :
  530ENDPROC
  540:
  550:
  560DEFPROCwimp_poll
  570SYS "Wimp_Poll",0,block% TO reason%
  580CASE reason% OF
  590WHEN 1 : PROCredraw(!block%)             : REM redarw window request
  600WHEN 2 : SYS "Wimp_OpenWindow",,block%   : REM re-open window request
  610WHEN 3 : PROCclosewindow(!block%)        : REM close window request
  620WHEN 6 : PROCclick(block%!12)            : REM mouse click
  630WHEN 7 : PROCstartsave                   : REM user drag box
  640WHEN 8 : PROCkeypress(block%!24,!block%) : REM key pressed
  650WHEN 9 : PROCmenuselect                  : REM menu selection
  660WHEN 17,18 : PROCreceive          : REM user message / user message recorded
  670WHEN 19 : REM user message acknowledged
  680ENDCASE
  690ENDPROC
  700:
  710:
  720DEF PROCerror(error$)
  730click%=FNerrorbox(error$,1)
  740ENDPROC
  750:
  760:
  770DEF FNerrorbox(message$,flag%)
  780err_title$=application$
  790IF flag% AND 16 THEN err_title$="Message from "+err_title$
  800!block%=255
  810$(block%+4)=message$+CHR$0
  820SYS "Wimp_ReportError",block%,flag%,err_title$ TO ,err_click%
  830=err_click%
  840:
  850:
  860DEF PROCan_error
  870ON ERROR PRINT REPORT$;" at line ";ERL:END
  880PROCerror(REPORT$+" at line "+STR$ERL)
  890IF loaded% THEN PROCrelease_mem(code%)
  900SYS "Wimp_CloseDown"
  910ENDPROC
  920:
  930:
  940DEF FNcreate_icon(whand%,icon_x%,icon_y%,icon_w%,icon_h%,flag%,text$,ptr1%,ptr2%,ptr3%)
  950!block%=whand%
  960block%!4=icon_x%
  970block%!8=icon_y%
  980block%!12=icon_w%+icon_x%
  990block%!16=icon_h%+icon_y%
 1000block%!20=flag%
 1010IF ptr1%=0 THEN
 1020$(block%+24)=text$
 1030ELSE
 1040block%!24=ptr1%
 1050block%!28=ptr2%
 1060block%!32=ptr3%
 1070ENDIF
 1080SYS "Wimp_CreateIcon",,block% TO ihandle%
 1090=ihandle%
 1100:
 1110:
 1120DEF PROCredraw(window%)
 1130CASE window% OF
 1140ENDCASE
 1150ENDPROC
 1160:
 1170:
 1180DEF PROCkeypress(key%,window%)
 1190CASE window% OF
 1200 WHEN save_window% : IF key%=13 PROCquicksave:PROCclosemenus
 1210OTHERWISE:SYS "Wimp_ProcessKey",key%
 1220ENDCASE
 1230ENDPROC
 1240:
 1250:
 1260DEF PROCclick(wind%)
 1270icon%=block%!16
 1280buttons%=block%!8
 1290CASE wind% OF
 1300 WHEN -2           : PROCiconbar(buttons%)
 1310 WHEN save_window% : CASE icon% OF
 1320  WHEN 0 : IF buttons%=(4<<4) OR buttons%=(1<<4) THEN PROCdragbox :REM 4<<4=drag button if shifted left 4 places
 1330  WHEN 2 : IF buttons%=4 OR buttons%=1 THEN PROCquicksave:IF buttons%<>1 PROCclosemenus
 1340 ENDCASE
 1350ENDCASE
 1360ENDPROC
 1370:
 1380:
 1390DEF PROCdragbox
 1400!block%=save_window%              :REM window
 1410SYS "Wimp_GetWindowState",,block% :REM get info on window
 1420ox%=block%!4-block%!20            :REM window x pos
 1430oy%=block%!16-block%!24           :REM window y pos
 1440block%!4=0                        :REM icon 0
 1450SYS "Wimp_GetIconState",,block%   :REM get icon info
 1460block%!4=5                        :REM drag type 5
 1470block%!08=ox%+block%!08           :REM x screen co-ord of icon
 1480block%!12=oy%+block%!12           :REM y screen co-ord of icon
 1490block%!16=ox%+block%!16           :REM right x pos
 1500block%!20=oy%+block%!20           :REM top y pos
 1510block%!24=0:block%!28=0           :REM screen co-ords of bot x,y bouncy box
 1520block%!32=&7FFFFFFF               :REM farest x,y co-ords of bouncy box
 1530block%!36=&7FFFFFFF
 1540SYS "Wimp_DragBox",,block%        :REM start draging
 1550ENDPROC
 1560:
 1570:
 1580DEF PROCiconbar(button%)
 1590CASE button% OF
 1600 WHEN 2 : PROCshowmenu(iconbarmenu%,!block%-64,96+ibmenu_len%)
 1610ENDCASE
 1620ENDPROC
 1630:
 1640:
 1650DEF PROCclosemenus
 1660SYS "Wimp_CreateMenu",,-1,0,0
 1670ENDPROC
 1680:
 1690:
 1700DEF PROCshowmenu(menu%,menu_x%,menu_y%)
 1710menuopen%=menu%
 1720SYS "Wimp_CreateMenu",,menu%,menu_x%,menu_y%
 1730ENDPROC
 1740:
 1750:
 1760DEF FNcreatemenu(menu%,contents$)
 1770LOCAL counter%,ptr%,tempwidth%
 1780contents$=contents$+CHR$0
 1790counter%=0
 1800PROCreadstr(contents$,counter%,title$,counter%)
 1810PROCreadnum(contents$,counter%,num_of_items%,counter%)
 1820$menu%=title$
 1830maxwidth%=(LEN(title$)-2)*16
 1840menu%!12=&00070207            :REM colours
 1850menu%!20=44                   :REM height
 1860menu%!24=0                    :REM gap
 1870ptr%=menu%+28
 1880menu_len%=0
 1890FOR items%=1 TO num_of_items%
 1900PROCreadnum(contents$,counter%,menu_flags%,counter%)
 1910PROCreadnum(contents$,counter%,subptr%,counter%)
 1920PROCreadstr(contents$,counter%,item$,counter%)
 1930!ptr%=menu_flags%
 1940ptr%!4=subptr%
 1950ptr%!8=&7000021
 1960$(ptr%+12)=item$
 1970tempwidth%=(LEN(item$)+1)*16
 1980IF tempwidth%>maxwidth% THEN maxwidth%=tempwidth%
 1990ptr%+=24
 2000menu_len%+=44
 2010NEXT
 2020menu%!16=maxwidth%
 2030=menu_len%
 2040:
 2050:
 2060DEFPROCreadstr(search$,pos%,RETURN search$,RETURN pos%)
 2070LOCAL oldpos%
 2080oldpos%=pos%+1
 2090REPEAT
 2100pos%+=1
 2110UNTIL MID$(search$,pos%,1)="," OR MID$(search$,pos%,1)=CHR$0
 2120search$=MID$(search$,oldpos%,(pos%-oldpos%))
 2130ENDPROC
 2140:
 2150:
 2160DEFPROCreadnum(search$,pos%,RETURN found%,RETURN pos%)
 2170LOCAL oldpos%
 2180oldpos%=pos%+1
 2190REPEAT
 2200pos%+=1
 2210UNTIL MID$(search$,pos%,1)="," OR MID$(search$,pos%,1)=CHR$0
 2220search$=MID$(search$,oldpos%,(pos%-oldpos%))
 2230found%=EVAL(search$)
 2240ENDPROC
 2250:
 2260:
 2270DEF PROCmenuselect
 2280sel1%=!block%:sel2%=block%!4
 2290sel3%=block%!8:sel4%=block%!12
 2300 :
 2310SYS "Wimp_GetPointerInfo",,block%
 2320button%=block%!8
 2330 :
 2340CASE menuopen% OF
 2350 WHEN iconbarmenu% : CASE sel1% OF
 2360  WHEN 0 :
 2370  WHEN 1 : CASE sel2% OF
 2380   WHEN 0 : dopass%=FALSE:PROCtick_on(enc%,0):PROCtick_off(enc%,1):$password%="":PROCunload
 2390   WHEN 1 : IF $password%<>"" THEN dopass%=TRUE:PROCtick_on(enc%,1):PROCtick_off(enc%,0):PROCunload
 2400  ENDCASE
 2410  WHEN 2 : menusave%=TRUE:PROCquicksave
 2420  WHEN 3 : quit%=TRUE
 2430 ENDCASE
 2440ENDCASE
 2450 :
 2460IF button%=1 THEN PROCshowmenu(menuopen%,0,0)
 2470ENDPROC
 2480:
 2490:
 2500DEF PROCindirect(menu%,item%,text$,indpos%,valid%,length%)
 2510$indpos%=text$
 2520ptr%=menu%+28
 2530ptr%=ptr%+24*item%
 2540ptr%?9=ptr%?9 OR %1 :REM indirected (bit 8)
 2550ptr%!12=indpos%
 2560ptr%!16=valid%
 2570ptr%!20=length%
 2580ENDPROC
 2590:
 2600:
 2610DEF PROCwriteable(menu%,item%)
 2620ptr%=menu%+28
 2630ptr%=ptr%+24*item%
 2640?ptr%=?ptr% OR %100
 2650ENDPROC
 2660:
 2670:
 2680DEF PROCtick_on(menu%,item%)
 2690ptr%=menu%+28
 2700ptr%=ptr%+24*item%
 2710?ptr%=?ptr% OR 1
 2720ENDPROC
 2730:
 2740:
 2750DEF PROCtick_off(menu%,item%)
 2760ptr%=menu%+28
 2770ptr%=ptr%+24*item%
 2780?ptr%=?ptr% AND %11111110
 2790ENDPROC
 2800:
 2810:
 2820DEF PROCshade_on(menu%,item%)
 2830ptr%=menu%+28
 2840ptr%=ptr%+24*item%
 2850ptr%+=10
 2860?ptr%=?ptr% OR %01000000
 2870ENDPROC
 2880:
 2890:
 2900DEF PROCshade_off(menu%,item%)
 2910ptr%=menu%+28
 2920ptr%=ptr%+24*item%
 2930ptr%+=10
 2940?ptr%=?ptr% AND %10111111
 2950ENDPROC
 2960:
 2970:
 2980DEF PROCclosewindow(window%)
 2990CASE window% OF
 3000ENDCASE
 3010 :
 3020!block%=window%
 3030SYS "Wimp_CloseWindow",,block%
 3040ENDPROC
 3050:
 3060:
 3070DEF PROCopenwindow(window%,x,y)
 3080CASE window% OF
 3090ENDCASE
 3100 :
 3110!block%=window%
 3120SYS "Wimp_GetWindowState",,block%
 3130block%!28=-1                       :REM open window at the front
 3140wd%=block%!12-block%!4
 3150hi%=block%!16-block%!8
 3160block%!4=x:block%!8=y
 3170block%!12=x+wd%
 3180block%!16=y+hi%
 3190SYS "Wimp_OpenWindow",,block%
 3200ENDPROC
 3210:
 3220:
 3230DEF PROCreceive
 3240CASE block%!16 OF
 3250 WHEN 0 : quit%=TRUE
 3260 WHEN 2 : PROCdatasave
 3270 WHEN 3 : PROCdataload(block%!40)
 3280ENDCASE
 3290ENDPROC
 3300:
 3310:
 3320DEF PROCdataload(type%)
 3330pathname$=FNgetstr(block%+44)
 3340CASE type% OF
 3350 WHEN &FFB : PROCgetworking(pathname$)
 3360ENDCASE
 3370ENDPROC
 3380:
 3390:
 3400DEF FNgetstr(store%)
 3410LOCAL get$
 3420REPEAT
 3430get$+=CHR$(?store%)
 3440store%+=1
 3450UNTIL?store%=0
 3460=get$
 3470:
 3480:
 3490DEFPROCsetup_templates(num_icons%)
 3500LOCAL id%,ind_len%,info_len%,save_len%
 3510 :
 3520info_len%=178
 3530save_len%=256
 3540 :
 3550ind_len%=info_len%+save_len%
 3560IF block_len%<88+32*num_icons%+save_len% ERROR 255,"'block%' too small"
 3570DIM ind% ind_len%
 3580DIM id% 12
 3590 :
 3600SYS "Wimp_OpenTemplate",,"<Obey$Dir>.Templates"
 3610$id%="xfer_send"
 3620SYS "Wimp_LoadTemplate",,block%,ind%,ind%+ind_len%,-1,id%,0 TO ,,remain%,,,,next%
 3630 :
 3640SYS "Wimp_CreateWindow",,block% TO save_window%
 3650$id%="progInfo"
 3660SYS "Wimp_LoadTemplate",,block%,remain%,ind%+ind_len%,-1,id%,next% TO ,,remain%,,,,next%
 3670SYS "Wimp_CreateWindow",,block% TO infobox%
 3680SYS "Wimp_CloseTemplate"
 3690ENDPROC
 3700:
 3710:
 3720DEF PROCstartsave                      :REM starting the save messages
 3730SYS "Wimp_GetPointerInfo",,block%      :REM get info on window+icon of dest.
 3740block%!20=block%!12                    :REM task handle or window of dest.
 3750block%!24=block%!16                    :REM icon handle
 3760block%!28=!block%                      :REM dest. x co-ord
 3770block%!32=block%!4                     :REM dest. y co-ord
 3780block%!36=proglen%                     :REM est. size of data
 3790!block%=64                             :REM len of block
 3800block%!12=0                            :REM your_ref (0 for start)
 3810block%!16=1                            :REM message action
 3820block%!40=&FF8                         :REM file type
 3830$(block%+44)=FNgetfilename($savetext%) :REM filename
 3840SYS "Wimp_SendMessage",18,block%,block%!20,block%!24
 3850ENDPROC
 3860:
 3870:
 3880DEF FNgetfilename(path$)
 3890WHILE INSTR(path$,".")                :REM while there is still a '.' in the
 3900 path$=MID$(path$,INSTR(path$,".")+1) :REM name, shorten it, starting from
 3910ENDWHILE                              :REM that '.'
 3920=path$+CHR$0
 3930:
 3940:
 3950DEF PROCdatasave :REM OK to save now, then send message to confirm OK save
 3960$savetext%=FNgetstr(block%+44) :REM put full pathname in save window text
 3970PROCdothesave                  :REM do the save
 3980block%!12=block%!8             :REM put his ref. in 'your ref.' section
 3990block%!16=3:!block%=256        :REM message code 3, max. name len - 256
 4000SYS "Wimp_SendMessage",18,block%,block%!20,block%!24  :REM send DataLoadAck
 4010IF buttons%=(1<<4) THEN
 4020 SYS "Wimp_ForceRedraw",save_window%,10,-156,184,-120 :REM update pathname
 4030ELSE
 4040 PROCclosemenus
 4050ENDIF
 4060ENDPROC
 4070:
 4080:
 4090DEF PROCquicksave
 4100IF INSTR($savetext%,".") THEN
 4110 PROCdothesave  :REM if name has a '.' then it is prob a pathname, so save it
 4120ELSE
 4130 IF menusave% THEN
 4140  SYS "Wimp_GetPointerInfo",,block%
 4150  PROCshowmenu(save_window%,!block%-50,block%!4+50)
 4160 ELSE
 4170  click%=FNerrorbox("To save, drag the icon to a directory display",17)
 4180 ENDIF
 4190ENDIF
 4200menusave%=FALSE
 4210ENDPROC
 4220:
 4230:
 4240DEF PROCdothesave
 4250OSCLI"Save "+$savetext%+" "+STR$~code%+" "+STR$~O%
 4260OSCLI"Settype "+$savetext%+" Absolute"
 4270ENDPROC
 4280:
 4290:
 4300DEF FNfindtextaddr(window%,icon%)
 4310!block%=window%
 4320block%!4=icon%
 4330SYS "Wimp_GetIconState",,block%
 4340=block%!28
 4350:
 4360:
 4370DEFPROCgetworking(file$)
 4380SYS "Hourglass_On"
 4390IF loaded% THEN PROCrelease_mem(code%)
 4400x=OPENIN(pathname$)
 4410proglen%=EXT#x
 4420CLOSE#x
 4430 :
 4440code_len%=1024+proglen%
 4450code%=FNclaim_mem(code_len%)
 4460len=proglen%
 4470IF dopass% THEN
 4480 PROCpw_assm
 4490 OSCLI"Load "+file$+" "+STR$~(file+code%)
 4500 FOR store=1 TO LEN($password%)
 4510  ?(pass+code%+store-1)=ASC(MID$($password%,store,1))
 4520 NEXT
 4530 PROCpw_encode
 4540ELSE
 4550 PROCnop_assm
 4560 OSCLI"Load "+file$+" "+STR$~(file+code%)
 4570ENDIF
 4580loaded%=TRUE
 4590PROCshade_off(iconbarmenu%,2)
 4600 :
 4610SYS "Wimp_GetPointerInfo",,block%
 4620PROCshowmenu(save_window%,!block%-50,block%!4+50)
 4630SYS "Hourglass_Off"
 4640ENDPROC
 4650:
 4660:
 4670DEF PROCunload
 4680IF loaded% THEN PROCrelease_mem(code%)
 4690loaded%=FALSE
 4700PROCshade_on(iconbarmenu%,2)
 4710ENDPROC
 4720:
 4730:
 4740DEF PROCalterbaricon : REM ********* This PROC is currently not used!!!
 4750!block%=-1           : REM it also requires the ibar icon to be indirected
 4760block%!4=iconbaricon%
 4770SYS "Wimp_GetIconState",,block%
 4780IF processing% THEN $(block%!28)="processing" ELSE $(block%!28)="!autorun"
 4790SYS "Wimp_ForceRedraw",-2,block%!8,block%!12,block%!16,block%!20
 4800ENDPROC
 4810:
 4820:
 4830DEF FNclaim_mem(size%)
 4840SYS "OS_Module",6,,,size% TO ,,ptr%
 4850=ptr%
 4860:
 4870:
 4880DEF PROCrelease_mem(ptr%)
 4890SYS "OS_Module",7,,ptr%
 4900ENDPROC
 4910:
 4920REM Hello hacker! Please note, it is impossible (well, very hard) to crack
 4930REM a passworded program - look at the following assembler bit, to see....
 4940:
 4950REM Phoenix of QUANTUM (me) says hello to Ben Carter, Gary D,
 4960REM Leon H, Tim, and everyone out there in Q U A N T U M - see ya!
 4970:
 4980REM >AutoRunPS (AutoRunII & III) v3.11
 4990REM Machine code shell + password for a Baisc program
 5000REM Now creates 'Absolute' M/C files for output files (at last!!!)
 5010REM Only adds 174 (+/- 4) bytes to orignal file for no password!!!
 5020REM or 548 (+/- 4) bytes if you use a password...
 5030REM LEN 1992/3 Stephen Harrison
 5040:
 5050:
 5060DEF PROCnop_save
 5070OSCLI"Save "+mfn$+" "+STR$~code%+" "+STR$~O%
 5080OSCLI"Settype "+mfn$+" Absolute"
 5090ENDPROC
 5100:
 5110DEF PROCnop_assm
 5120stack_size%=4           :REM only storing r14!!!
 5130FOR I=12 TO 14 STEP2
 5140O%=code%:P%=0:L%=code%+code_len%
 5150:
 5160[OPT I
 5170.start
 5180LDR R2,endpos     ;r2=offset to end of prog
 5190ADR R3,start      ;r3=start
 5200ADD R0,R2,R3      ;r0=real end of prog
 5210ADD R1,R0,#&F00   ;r1=shift all the code forward by &F00 (room for BASIC)
 5220.moveit
 5230LDR R3,[R0],#-4   ;load r3 with word (& then take 4 from r0)
 5240STR R3,[R1],#-4   ;store r3 at r1 (& then take 4 from r1)
 5250SUBS R2,R2,#4     ;take 4 from r2
 5260BNE moveit        ;if r2 not 0 then repeat
 5270ADR R12,start     ;get r12=start (for future reference)
 5280B continue+&F00   ;everything is now &F00 forward!!!
 5290:
 5300.endpos           ;end of file
 5310EQUD end
 5320:
 5330.file             ;Basic file goes here
 5340]
 5350P%+=len:O%+=len
 5360[OPTI
 5370ALIGN             ;and here is... THE STACK
 5380]
 5390P%+=stack_size%:O%+=stack_size%
 5400[OPTI
 5410.stack            ;stacking backwards... (I hope!!!)
 5420:
 5430.filepos
 5440EQUD file+&F00    ;position of file (now &f00 forward)
 5450:
 5460.continue
 5470LDR R1,filepos    ;file offset from 0
 5480ADD R1,R1,R12     ;r12=start of prog, so r1=file position
 5490STR R1,filepos    ;store file pos
 5500ADR R13,stack     ;r13=our stack
 5510STMFD R13!,{R14}  ;store r14
 5520LDR R0,filepos    ;file position
 5530ADR R1,position   ;position in output string
 5540MOV R2,#9         ;buffer size
 5550SWI "OS_ConvertHex8"   ;insert the position of the Basic file
 5560LDR R0,filelen    ;len of file
 5570LDR R1,filepos    ;file position
 5580ADD R0,R0,R1      ;now = end of file position
 5590ADR R1,length     ;position in string
 5600MOV R2,#9         ;buffer size
 5610SWI "OS_ConvertHex8"   ;insert the end position of the Basic file
 5620MOV R0,#ASC","    ;put the comma
 5630STRB R0,comma     ;in the string
 5640ADR R0,basic      ;addr of full command
 5650SWI "OS_CLI"      ;call it
 5660LDMFD R13!,{PC}   ;exit
 5670:
 5680.filelen          ;length of basic prog
 5690EQUD len
 5700:
 5710.basic            ;the string
 5720EQUS "*Basic -quit  @"
 5730.position
 5740EQUD 0
 5750EQUD 0
 5760.comma
 5770EQUB 0
 5780.length
 5790EQUD 0
 5800EQUD 0
 5810EQUD 0
 5820:
 5830.end              ;the end (!!!)
 5840]
 5850NEXT
 5860ENDPROC
 5870:
 5880:
 5890DEF PROCpw_encode
 5900!(sample+code%+0)=!(file+code%)   :REM !sample(0-8) holds the first three
 5910!(sample+code%+4)=!(file+code%+4) :REM words of the Basic file, uncoded,
 5920!(sample+code%+8)=!(file+code%+8) :REM so that the decoder can check that
 5930                                  :REM it has decoded the prog. correctly
 5940                                  :REM - without storing the password...
 5950first=!(pass+code%+0)    :REM 1st, 2nd and 3rd - are used to encode the prog.
 5960second=!(pass+code%+4)
 5970third=!(pass+code%+8)
 5980FOR coder=0 TO len STEP 12                            :REM get encoding...
 5990!(file+code%+coder)=!(file+code%+coder) EOR first
 6000!(file+code%+coder+4)=!(file+code%+coder+4) EOR second
 6010!(file+code%+coder+8)=!(file+code%+coder+8) EOR third
 6020NEXT
 6030!(pass+code%+0)=&12345678 :REM ramdom data - to blank the password store
 6040!(pass+code%+4)=&87654321
 6050!(pass+code%+8)=&18273645
 6060ENDPROC
 6070:
 6080DEF PROCpw_assm
 6090stack_size%=4           :REM only storing r14!!!
 6100FOR I=12 TO 14 STEP2
 6110O%=code%:P%=0:L%=code%+code_len%
 6120:
 6130[OPT I
 6140.start
 6150SWI "OS_GetEnv"   ;r0=ptr to entry string
 6160MOV R11,R0        ;r11=ptr to entry string (for future use)
 6170LDR R2,endpos     ;r2=offset to end of prog
 6180ADR R3,start      ;r3=start
 6190ADD R0,R2,R3      ;r0=real end of prog
 6200ADD R1,R0,#&F00   ;r1=shift all the code forward by &F00 (room for BASIC)
 6210.moveit
 6220LDR R3,[R0],#-4   ;load r3 with word (& then take 4 from r0)
 6230STR R3,[R1],#-4   ;store r3 at r1 (& then take 4 from r1)
 6240SUBS R2,R2,#4     ;take 4 from r2
 6250BNE moveit        ;if r2 not 0 then repeat
 6260ADR R12,start     ;get r12=start (for future reference)
 6270B continue+&F00   ;everything is now &F00 forward!!!
 6280:
 6290.endpos           ;end of file
 6300EQUD end
 6310:
 6320.file             ;Basic file goes here
 6330]
 6340P%+=len+12:O%+=len+12 :REM leave a gap incase of decoder overflow
 6350[OPTI
 6360ALIGN             ;and here is... THE STACK
 6370]
 6380P%+=stack_size%:O%+=stack_size%
 6390[OPTI
 6400.stack            ;stacking backwards... (I hope!!!)
 6410:
 6420.filepos
 6430EQUD file+&F00    ;position of file (now &f00 forward)
 6440:
 6450.continue
 6460LDR R1,filepos    ;file offset from 0
 6470ADD R1,R1,R12     ;r12=start of prog, so r1=file position
 6480STR R1,filepos    ;store file pos
 6490ADR R13,stack     ;r13=our stack
 6500STMFD R13!,{R14}  ;store r14
 6510MOV R0,R11        ;r0=entry string ptr
 6520MOV R1,#0         ;r1=counter
 6530.findspace
 6540LDRB R2,[R0,R1]   ;r2=?str+count
 6550ADD R1,R1,#1      ;count+=1
 6560CMP R2,#32        ;is it > 32?
 6570BGT findspace     ;look for space     - *** no '+&F00' needed now, because
 6580ADDEQ R1,R1,R0    ;if 32, get addr          everything is now running from
 6590BEQ foundpass     ;and goto foundpw         &F00 forward!!!
 6600:
 6610ADR R0,enterpass ;no pw, so input
 6620SWI "OS_Write0"  ;print it
 6630:
 6640ADR R1,pass      ;addr of pw store
 6650MOV R2,#0        ;counter
 6660.readloop
 6670SWI "OS_ReadC"   ;input char
 6680CMP R0,#127      ;is it delete?
 6690BNE nodelete     ;if not, go
 6700CMP R2,#0        ;is count 0?
 6710SUBNE R2,R2,#1   ;no, then take 1
 6720SWINE 0          ;print the delete
 6730B readloop       ;read next char
 6740:
 6750.nodelete
 6760CMP R0,#32        ;is char space?
 6770STRGEB R0,[R1,R2] ;if > = then store
 6780SWIGE 256+ASC"*"  ;and print '*'
 6790ADDGE R2,R2,#1    ;and add 1 to count
 6800BLT foundpass     ;if less than, then found it
 6810CMP R2,#12        ;is count 12?
 6820BLT readloop      ;if less, then read next char
 6830:
 6840.foundpass        ;found pass!!!
 6850ADR R0,pass       ;r0=pass store
 6860CMP R1,R0         ;r1=password pos  r0=password store
 6870BEQ alreadythere  ;is pw in pw store?
 6880MOV R2,#0         ;counter
 6890.moveloop         ;move pw to store
 6900LDRB R3,[R1,R2]   ;r3 = char
 6910CMP R3,#32        ;is it 32?
 6920BLE alreadythere  ;if less, then go
 6930STRB R3,[R0,R2]   ;store char in store
 6940ADD R2,R2,#1      ;add 1 to count
 6950CMP R2,#12        ;is it 12?
 6960BLT moveloop      ;if less, get next
 6970:
 6980.alreadythere     ;now ready
 6990ADR R0,pass       ;r0=pw store
 7000LDR R1,filepos    ;r0=pass  r1=filepos
 7010MOV R2,#0         ;counter
 7020LDR R3,[R0]       ;r3=1st pw bit
 7030LDR R4,[R0,#4]    ;r4=2nd pw bit
 7040LDR R5,[R0,#8]    ;r5=3rd pw bit
 7050LDR R6,filelen    ;r6=file len
 7060.decode
 7070LDR R0,[R1,R2]    ;load word
 7080EOR R0,R0,R3      ;decode with r3
 7090STR R0,[R1,R2]    ;store word
 7100ADD R2,R2,#4      ;add 4 to count
 7110LDR R0,[R1,R2]    ;load next word
 7120EOR R0,R0,R4      ;decode with r4
 7130STR R0,[R1,R2]    ;store word
 7140ADD R2,R2,#4      ;add 4 to count
 7150LDR R0,[R1,R2]    ;load next word
 7160EOR R0,R0,R5      ;decode with r5
 7170STR R0,[R1,R2]    ;store word
 7180CMP R2,R6         ;is count at end?
 7190ADDLT R2,R2,#4    ;if less, add 4
 7200BLT decode        ;and decode next
 7210:
 7220ADR R0,sample     ;r0=test data
 7230LDR R1,filepos    ;file position
 7240LDR R2,[R0]       ;load test word 1
 7250LDR R3,[R1]       ;load real word 1
 7260CMP R2,R3         ;compare
 7270BNE wrong         ;if bad, then wrong
 7280LDR R2,[R0,#4]    ;load test word 2
 7290LDR R3,[R1,#4]    ;load real word 2
 7300CMP R2,R3         ;compare
 7310BNE wrong         ;if bad, then wrong
 7320LDR R2,[R0,#8]    ;load test word 3
 7330LDR R3,[R1,#8]    ;load real word 3
 7340CMP R2,R3         ;compare
 7350BEQ correct       ;if good, then all correct
 7360:
 7370.wrong            ;bad pw
 7380ADR R0,wrongword
 7390SWI "OS_Write0"   ;print 'bad pw'
 7400LDMFD R13!,{PC}   ;exit
 7410:
 7420.correct          ;correct pw!!!
 7430LDR R0,filepos    ;file position
 7440ADR R1,position   ;position in output string
 7450MOV R2,#9         ;buffer size
 7460SWI "OS_ConvertHex8"   ;insert the possition of the Basic file
 7470LDR R0,filelen    ;len of file
 7480LDR R1,filepos    ;file position
 7490ADD R0,R0,R1      ;now = end of file position
 7500ADR R1,length     ;position in string
 7510MOV R2,#9         ;buffer size
 7520SWI "OS_ConvertHex8"   ;insert the end possition of the Basic file
 7530MOV R0,#ASC","    ;put the comma
 7540STRB R0,comma     ;in the string
 7550ADR R0,basic      ;addr of full command
 7560SWI "OS_CLI"      ;call it
 7570LDMFD R13!,{PC}   ;exit
 7580:
 7590.enterpass              ;password string
 7600EQUS "Password: "+CHR$0
 7610:
 7620.wrongword              ;wrong pw
 7630EQUS CHR$(13)+CHR$(10)+"Wrong password"+CHR$(13)+CHR$(10)
 7640EQUB 0
 7650ALIGN
 7660:
 7670.sample           ;sample test data
 7680EQUD 0
 7690EQUD 0
 7700EQUD 0
 7710:
 7720.pass             ;password (with blank data)
 7730EQUD &12345678
 7740EQUD &87654321
 7750EQUD &18273645
 7760:
 7770.filelen          ;length of basic prog
 7780EQUD len
 7790:
 7800.basic            ;the string
 7810EQUS "*Basic -quit  @"
 7820.position
 7830EQUD 0
 7840EQUD 0
 7850.comma
 7860EQUB 0
 7870.length
 7880EQUD 0
 7890EQUD 0
 7900EQUD 0
 7910:
 7920.end              ;the end (!!!)
 7930]
 7940NEXT
 7950ENDPROC

?� >AutoRunII/III - converted and updated for the Archimedes
?�  ALL the contents of this program was written and created
�  by Stephen Harrison
(� � 1992/3 Stephen Harrison
2 :
<� � � �$;" at line ";�:�
F :
P�init("AutoRun")
Z :
dȕ � quit%
n�wimp_poll
x�
�#� loaded% � �release_mem(code%)
�ș "Wimp_CloseDown"
��
�:
�:
���init(title$)
�block_len%=888
� :
�� block% block_len%
�G� pw% 28+24*1                     : � 28+24*number of items in menu
�G� enc% 28+24*2                    : � 28+24*number of items in menu
�G� iconbarmenu% 28+24*4            : � 28+24*number of items in menu
�� password% 13
� pwvalid% 4
 :
risc_ver%=2
"application$=title$
,quit%=�
6
dopass%=�
@menusave%=�
J
loaded%=�
T :
^=ș "Wimp_Initialise",risc_ver%*100,&4B534154,application$
h� � �an_error:�
r :
|�setup_templates(10)
�+savetext%=�findtextaddr(save_window%,1)
� :
�Biconbaricon%=�create_icon(-1,0,0,68,68,&3002,"!autorun",0,0,0)
� :
�2temp=�createmenu(pw%,"  Password  ,1,&80,-1,")
��writeable(pw%,0)
�$pwvalid%="D*"
�-�indirect(pw%,0,"",password%,pwvalid%,13)
� :
�Dtemp=�createmenu(enc%,"Encryption,2,0,-1,None,&80,pw%,Password")
��tick_on(enc%,0)
�wibmenu_len%=�createmenu(iconbarmenu%,"AutoRun,4,0,infobox%,Info,0,enc%,Encryption,0,save_window%,Save,&80,-1,Quit")
��shade_on(iconbarmenu%,2)
 :
�
:
&:
0��wimp_poll
:%ș "Wimp_Poll",0,block% � reason%
DȎ reason% �
N@� 1 : �redraw(!block%)             : � redarw window request
XC� 2 : ș "Wimp_OpenWindow",,block%   : � re-open window request
b?� 3 : �closewindow(!block%)        : � close window request
l6� 6 : �click(block%!12)            : � mouse click
v8� 7 : �startsave                   : � user drag box
�6� 8 : �keypress(block%!24,!block%) : � key pressed
�9� 9 : �menuselect                  : � menu selection
�H� 17,18 : �receive          : � user message / user message recorded
�&� 19 : � user message acknowledged
��
��
�:
�:
�� �error(error$)
�click%=�errorbox(error$,1)
��
�:
�:
� �errorbox(message$,flag%)
err_title$=application$
8� flag% � 16 � err_title$="Message from "+err_title$
 !block%=255
*$(block%+4)=message$+�0
4?ș "Wimp_ReportError",block%,flag%,err_title$ � ,err_click%
>=err_click%
H:
R:
\� �an_error
f� � � �$;" at line ";�:�
p�error(�$+" at line "+Þ)
z#� loaded% � �release_mem(code%)
�ș "Wimp_CloseDown"
��
�:
�:
�X� �create_icon(whand%,icon_x%,icon_y%,icon_w%,icon_h%,flag%,text$,ptr1%,ptr2%,ptr3%)
�!block%=whand%
�block%!4=icon_x%
�block%!8=icon_y%
�block%!12=icon_w%+icon_x%
�block%!16=icon_h%+icon_y%
�block%!20=flag%
�� ptr1%=0 �
�$(block%+24)=text$
�
block%!24=ptr1%
block%!28=ptr2%
$block%!32=ptr3%
.�
8+ș "Wimp_CreateIcon",,block% � ihandle%
B
=ihandle%
L:
V:
`� �redraw(window%)
jȎ window% �
t�
~�
�:
�:
�� �keypress(key%,window%)
�Ȏ window% �
�6 � save_window% : � key%=13 �quicksave:�closemenus
�:ș "Wimp_ProcessKey",key%
��
��
�:
�:
�� �click(wind%)
�icon%=block%!16
buttons%=block%!8

Ȏ wind% �
( � -2           : �iconbar(buttons%)
  � save_window% : Ȏ icon% �
(g  � 0 : � buttons%=(4<<4) � buttons%=(1<<4) � �dragbox :� 4<<4=drag button if shifted left 4 places
2L  � 2 : � buttons%=4 � buttons%=1 � �quicksave:� buttons%<>1 �closemenus
< �
F�
P�
Z:
d:
n� �dragbox
x/!block%=save_window%              :� window
�:ș "Wimp_GetWindowState",,block% :� get info on window
�5ox%=block%!4-block%!20            :� window x pos
�5oy%=block%!16-block%!24           :� window y pos
�/block%!4=0                        :� icon 0
�5ș "Wimp_GetIconState",,block%   :� get icon info
�4block%!4=5                        :� drag type 5
�@block%!08=ox%+block%!08           :� x screen co-ord of icon
�@block%!12=oy%+block%!12           :� y screen co-ord of icon
�4block%!16=ox%+block%!16           :� right x pos
�2block%!20=oy%+block%!20           :� top y pos
�Mblock%!24=0:block%!28=0           :� screen co-ords of bot x,y bouncy box
�Iblock%!32=&7FFFFFFF               :� farest x,y co-ords of bouncy box
�block%!36=&7FFFFFFF
5ș "Wimp_DragBox",,block%        :� start draging
�
:
":
,� �iconbar(button%)
6Ȏ button% �
@< � 2 : �showmenu(iconbarmenu%,!block%-64,96+ibmenu_len%)
J�
T�
^:
h:
r� �closemenus
| ș "Wimp_CreateMenu",,-1,0,0
��
�:
�:
�&� �showmenu(menu%,menu_x%,menu_y%)
�menuopen%=menu%
�/ș "Wimp_CreateMenu",,menu%,menu_x%,menu_y%
��
�:
�:
�"� �createmenu(menu%,contents$)
�� counter%,ptr%,tempwidth%
�contents$=contents$+�0
�counter%=0
0�readstr(contents$,counter%,title$,counter%)
7�readnum(contents$,counter%,num_of_items%,counter%)
$menu%=title$
&maxwidth%=(�(title$)-2)*16
0,menu%!12=&00070207            :� colours
:+menu%!20=44                   :� height
D(menu%!24=0                    :� gap
Nptr%=menu%+28
Xmenu_len%=0
b� items%=1 � num_of_items%
l5�readnum(contents$,counter%,menu_flags%,counter%)
v1�readnum(contents$,counter%,subptr%,counter%)
�/�readstr(contents$,counter%,item$,counter%)
�!ptr%=menu_flags%
�ptr%!4=subptr%
�ptr%!8=&7000021
�$(ptr%+12)=item$
�tempwidth%=(�(item$)+1)*16
�1� tempwidth%>maxwidth% � maxwidth%=tempwidth%
�ptr%+=24
�menu_len%+=44
��
�menu%!16=maxwidth%
�=menu_len%
�:
:
,��readstr(search$,pos%,� search$,� pos%)

� oldpos%
 oldpos%=pos%+1
*�
4pos%+=1
>0� �search$,pos%,1)="," � �search$,pos%,1)=�0
H,search$=�search$,oldpos%,(pos%-oldpos%))
R�
\:
f:
p+��readnum(search$,pos%,� found%,� pos%)
z
� oldpos%
�oldpos%=pos%+1
��
�pos%+=1
�0� �search$,pos%,1)="," � �search$,pos%,1)=�0
�,search$=�search$,oldpos%,(pos%-oldpos%))
�found%=�(search$)
��
�:
�:
�� �menuselect
� sel1%=!block%:sel2%=block%!4
�"sel3%=block%!8:sel4%=block%!12
� :
	$ș "Wimp_GetPointerInfo",,block%
	button%=block%!8
	 :
	$Ȏ menuopen% �
	.  � iconbarmenu% : Ȏ sel1% �
	8  � 0 :
	B  � 1 : Ȏ sel2% �
	LO   � 0 : dopass%=�:�tick_on(enc%,0):�tick_off(enc%,1):$password%="":�unload
	VT   � 1 : � $password%<>"" � dopass%=�:�tick_on(enc%,1):�tick_off(enc%,0):�unload
	`  �
	j"  � 2 : menusave%=�:�quicksave
	t  � 3 : quit%=�
	~ �
	��
	� :
	�*� button%=1 � �showmenu(menuopen%,0,0)
	��
	�:
	�:
	�9� �indirect(menu%,item%,text$,indpos%,valid%,length%)
	�$indpos%=text$
	�ptr%=menu%+28
	�ptr%=ptr%+24*item%
	�,ptr%?9=ptr%?9 � %1 :� indirected (bit 8)
	�ptr%!12=indpos%
ptr%!16=valid%

ptr%!20=length%
�
:
(:
2� �writeable(menu%,item%)
<ptr%=menu%+28
Fptr%=ptr%+24*item%
P?ptr%=?ptr% � %100
Z�
d:
n:
x� �tick_on(menu%,item%)
�ptr%=menu%+28
�ptr%=ptr%+24*item%
�?ptr%=?ptr% � 1
��
�:
�:
�� �tick_off(menu%,item%)
�ptr%=menu%+28
�ptr%=ptr%+24*item%
�?ptr%=?ptr% � %11111110
��
�:
�:
� �shade_on(menu%,item%)
ptr%=menu%+28
ptr%=ptr%+24*item%
"ptr%+=10
,?ptr%=?ptr% � %01000000
6�
@:
J:
T� �shade_off(menu%,item%)
^ptr%=menu%+28
hptr%=ptr%+24*item%
rptr%+=10
|?ptr%=?ptr% � %10111111
��
�:
�:
�� �closewindow(window%)
�Ȏ window% �
��
� :
�!block%=window%
�!ș "Wimp_CloseWindow",,block%
��
�:
�:
�� �openwindow(window%,x,y)
Ȏ window% �
�
 :
&!block%=window%
0$ș "Wimp_GetWindowState",,block%
:Bblock%!28=-1                       :� open window at the front
Dwd%=block%!12-block%!4
Nhi%=block%!16-block%!8
Xblock%!4=x:block%!8=y
bblock%!12=x+wd%
lblock%!16=y+hi%
v ș "Wimp_OpenWindow",,block%
��
�:
�:
�� �receive
�Ȏ block%!16 �
� � 0 : quit%=�
� � 2 : �datasave
� � 3 : �dataload(block%!40)
��
��
�:
�:
�� �dataload(type%)

 pathname$=�getstr(block%+44)

Ȏ type% �

$ � &FFB : �getworking(pathname$)

 �

*�

4:

>:

H� �getstr(store%)

R
� get$

\�

fget$+=�(?store%)

p
store%+=1

z�?store%=0

�	=get$

�:

�:

�!��setup_templates(num_icons%)

�&� id%,ind_len%,info_len%,save_len%

� :

�info_len%=178

�save_len%=256

� :

� ind_len%=info_len%+save_len%

�F� block_len%<88+32*num_icons%+save_len% � 255,"'block%' too small"

�� ind% ind_len%

�� id% 12
 :
2ș "Wimp_OpenTemplate",,"<Obey$Dir>.Templates"
$id%="xfer_send"
$Sș "Wimp_LoadTemplate",,block%,ind%,ind%+ind_len%,-1,id%,0 � ,,remain%,,,,next%
. :
81ș "Wimp_CreateWindow",,block% � save_window%
B$id%="progInfo"
LZș "Wimp_LoadTemplate",,block%,remain%,ind%+ind_len%,-1,id%,next% � ,,remain%,,,,next%
V-ș "Wimp_CreateWindow",,block% � infobox%
`ș "Wimp_CloseTemplate"
j�
t:
~:
�C� �startsave                      :� starting the save messages
�Mș "Wimp_GetPointerInfo",,block%      :� get info on window+icon of dest.
�Lblock%!20=block%!12                    :� task handle or window of dest.
�9block%!24=block%!16                    :� icon handle
�<block%!28=!block%                      :� dest. x co-ord
�<block%!32=block%!4                     :� dest. y co-ord
�?block%!36=proglen%                     :� est. size of data
�:!block%=64                             :� len of block
�Dblock%!12=0                            :� your_ref (0 for start)
�<block%!16=1                            :� message action
�7block%!40=&FF8                         :� file type
�5$(block%+44)=�getfilename($savetext%) :� filename
7ș "Wimp_SendMessage",18,block%,block%!20,block%!24

�
:
:
(� �getfilename(path$)
2Fȕ �path$,".")                :� while there is still a '.' in the
<C path$=�path$,�path$,".")+1) :� name, shorten it, starting from
F.�                              :� that '.'
P
=path$+�0
Z:
d:
nG� �datasave :� OK to save now, then send message to confirm OK save
xJ$savetext%=�getstr(block%+44) :� put full pathname in save window text
�.�dothesave                  :� do the save
�Iblock%!12=block%!8             :� put his ref. in 'your ref.' section
�Iblock%!16=3:!block%=256        :� message code 3, max. name len - 256
�Lș "Wimp_SendMessage",18,block%,block%!20,block%!24  :� send DataLoadAck
�� buttons%=(1<<4) �
�K ș "Wimp_ForceRedraw",save_window%,10,-156,184,-120 :� update pathname
��
� �closemenus
��
��
�:
�:
�� �quicksave
� �$savetext%,".") �
L �dothesave  :� if name has a '.' then it is prob a pathname, so save it
�
" � menusave% �
,&  ș "Wimp_GetPointerInfo",,block%
64  �showmenu(save_window%,!block%-50,block%!4+50)
@ �
JJ  click%=�errorbox("To save, drag the icon to a directory display",17)
T �
^�
hmenusave%=�
r�
|:
�:
�� �dothesave
�,�"Save "+$savetext%+" "+�~code%+" "+�~O%
�&�"Settype "+$savetext%+" Absolute"
��
�:
�:
�"� �findtextaddr(window%,icon%)
�!block%=window%
�block%!4=icon%
�"ș "Wimp_GetIconState",,block%
�=block%!28
�:
:
��getworking(file$)
ș "Hourglass_On"
&#� loaded% � �release_mem(code%)
0x=�(pathname$)
:proglen%=�#x
D�#x
N :
Xcode_len%=1024+proglen%
bcode%=�claim_mem(code_len%)
llen=proglen%
v� dopass% �
�
 �pw_assm
�& �"Load "+file$+" "+�~(file+code%)
� � store=1 � �($password%)
�3  ?(pass+code%+store-1)=�(�$password%,store,1))
� �
� �pw_encode
��
� �nop_assm
�& �"Load "+file$+" "+�~(file+code%)
��
�
loaded%=�
��shade_off(iconbarmenu%,2)
� :
$ș "Wimp_GetPointerInfo",,block%
2�showmenu(save_window%,!block%-50,block%!4+50)
ș "Hourglass_Off"
 �
*:
4:
>
� �unload
H#� loaded% � �release_mem(code%)
R
loaded%=�
\�shade_on(iconbarmenu%,2)
f�
p:
z:
�D� �alterbaricon : � ********* This PROC is currently not used!!!
�L!block%=-1           : � it also requires the ibar icon to be indirected
�block%!4=iconbaricon%
�"ș "Wimp_GetIconState",,block%
�G� processing% � $(block%!28)="processing" � $(block%!28)="!autorun"
�Cș "Wimp_ForceRedraw",-2,block%!8,block%!12,block%!16,block%!20
��
�:
�:
�� �claim_mem(size%)
�%ș "OS_Module",6,,,size% � ,,ptr%
�	=ptr%
�:
:
� �release_mem(ptr%)
ș "OS_Module",7,,ptr%
$�
.:
8L� Hello hacker! Please note, it is impossible (well, very hard) to crack
BL� a passworded program - look at the following assembler bit, to see....
L:
V?� Phoenix of QUANTUM (me) says hello to Ben Carter, Gary D,
`D� Leon H, Tim, and everyone out there in Q U A N T U M - see ya!
j:
t(� >AutoRunPS (AutoRunII & III) v3.11
~7� Machine code shell + password for a Baisc program
�D� Now creates 'Absolute' M/C files for output files (at last!!!)
�D� Only adds 174 (+/- 4) bytes to orignal file for no password!!!
�3� or 548 (+/- 4) bytes if you use a password...
�� � 1992/3 Stephen Harrison
�:
�:
�� �nop_save
�&�"Save "+mfn$+" "+�~code%+" "+�~O%
� �"Settype "+mfn$+" Absolute"
��
�:
�� �nop_assm
2stack_size%=4           :� only storing r14!!!

� I=12 � 14 �2
$O%=code%:P%=0:L%=code%+code_len%
:
(
[OPT I
2
.start
</LDR R2,endpos     ;r2=offset to end of prog
FADR R3,start      ;r3=start
P*ADD R0,R2,R3      ;r0=real end of prog
ZMADD R1,R0,#&F00   ;r1=shift all the code forward by &F00 (room for BASIC)
d.moveit
n@LDR R3,[R0],#-4   ;load r3 with word (& then take 4 from r0)
x=STR R3,[R1],#-4   ;store r3 at r1 (& then take 4 from r1)
�%SUBS R2,R2,#4     ;take 4 from r2
�.BNE moveit        ;if r2 not 0 then repeat
�;ADR R12,start     ;get r12=start (for future reference)
�8B continue+&F00   ;everything is now &F00 forward!!!
�:
�".endpos           ;end of file
�EQUD end
�:
�+.file             ;Basic file goes here
�]
�P%+=len:O%+=len
�	[OPTI
�/ALIGN             ;and here is... THE STACK
]
#P%+=stack_size%:O%+=stack_size%
	[OPTI
"8.stack            ;stacking backwards... (I hope!!!)
,:
6.filepos
@:EQUD file+&F00    ;position of file (now &f00 forward)
J:
T
.continue
^)LDR R1,filepos    ;file offset from 0
h=ADD R1,R1,R12     ;r12=start of prog, so r1=file position
r%STR R1,filepos    ;store file pos
|$ADR R13,stack     ;r13=our stack
� STMFD R13!,{R14}  ;store r14
�$LDR R0,filepos    ;file position
�0ADR R1,position   ;position in output string
�"MOV R2,#9         ;buffer size
�ASWI "OS_ConvertHex8"   ;insert the position of the Basic file
�"LDR R0,filelen    ;len of file
�$LDR R1,filepos    ;file position
�1ADD R0,R0,R1      ;now = end of file position
�)ADR R1,length     ;position in string
�"MOV R2,#9         ;buffer size
�ESWI "OS_ConvertHex8"   ;insert the end position of the Basic file
�"MOV R0,#�","    ;put the comma
�$STRB R0,comma     ;in the string
+ADR R0,basic      ;addr of full command
SWI "OS_CLI"      ;call it
LDMFD R13!,{PC}   ;exit
&:
0+.filelen          ;length of basic prog
:EQUD len
D:
N!.basic            ;the string
XEQUS "*Basic -quit  @"
b
.position
l
EQUD 0
v
EQUD 0
�
.comma
�
EQUB 0
�.length
�
EQUD 0
�
EQUD 0
�
EQUD 0
�:
�$.end              ;the end (!!!)
�]
��
��
�:
�:
� �pw_encode
K!(sample+code%+0)=!(file+code%)   :� !sample(0-8) holds the first three
J!(sample+code%+4)=!(file+code%+4) :� words of the Basic file, uncoded,
 K!(sample+code%+8)=!(file+code%+8) :� so that the decoder can check that
*K                                  :� it has decoded the prog. correctly
4J                                  :� - without storing the password...
>Ofirst=!(pass+code%+0)    :� 1st, 2nd and 3rd - are used to encode the prog.
Hsecond=!(pass+code%+4)
Rthird=!(pass+code%+8)
\F� coder=0 � len � 12                            :� get encoding...
f3!(file+code%+coder)=!(file+code%+coder) � first
p8!(file+code%+coder+4)=!(file+code%+coder+4) � second
z7!(file+code%+coder+8)=!(file+code%+coder+8) � third
��
�J!(pass+code%+0)=&12345678 :� ramdom data - to blank the password store
�!(pass+code%+4)=&87654321
�!(pass+code%+8)=&18273645
��
�:
�� �pw_assm
�2stack_size%=4           :� only storing r14!!!
�� I=12 � 14 �2
�$O%=code%:P%=0:L%=code%+code_len%
�:
�
[OPT I
�
.start
-SWI "OS_GetEnv"   ;r0=ptr to entry string
?MOV R11,R0        ;r11=ptr to entry string (for future use)
/LDR R2,endpos     ;r2=offset to end of prog
$ADR R3,start      ;r3=start
.*ADD R0,R2,R3      ;r0=real end of prog
8MADD R1,R0,#&F00   ;r1=shift all the code forward by &F00 (room for BASIC)
B.moveit
L@LDR R3,[R0],#-4   ;load r3 with word (& then take 4 from r0)
V=STR R3,[R1],#-4   ;store r3 at r1 (& then take 4 from r1)
`%SUBS R2,R2,#4     ;take 4 from r2
j.BNE moveit        ;if r2 not 0 then repeat
t;ADR R12,start     ;get r12=start (for future reference)
~8B continue+&F00   ;everything is now &F00 forward!!!
�:
�".endpos           ;end of file
�EQUD end
�:
�+.file             ;Basic file goes here
�]
�CP%+=len+12:O%+=len+12 :� leave a gap incase of decoder overflow
�	[OPTI
�/ALIGN             ;and here is... THE STACK
�]
�#P%+=stack_size%:O%+=stack_size%
�	[OPTI
8.stack            ;stacking backwards... (I hope!!!)

:
.filepos
:EQUD file+&F00    ;position of file (now &f00 forward)
(:
2
.continue
<)LDR R1,filepos    ;file offset from 0
F=ADD R1,R1,R12     ;r12=start of prog, so r1=file position
P%STR R1,filepos    ;store file pos
Z$ADR R13,stack     ;r13=our stack
d STMFD R13!,{R14}  ;store r14
n*MOV R0,R11        ;r0=entry string ptr
x!MOV R1,#0         ;r1=counter
�.findspace
�$LDRB R2,[R0,R1]   ;r2=?str+count
�ADD R1,R1,#1      ;count+=1
�"CMP R2,#32        ;is it > 32?
�NBGT findspace     ;look for space     - *** no '+&F00' needed now, because
�NADDEQ R1,R1,R0    ;if 32, get addr          everything is now running from
�?BEQ foundpass     ;and goto foundpw         &F00 forward!!!
�:
�%ADR R0,enterpass ;no pw, so input
�SWI "OS_Write0"  ;print it
�:
�&ADR R1,pass      ;addr of pw store
�MOV R2,#0        ;counter

.readloop
 SWI "OS_ReadC"   ;input char
#CMP R0,#127      ;is it delete?
" BNE nodelete     ;if not, go
,!CMP R2,#0        ;is count 0?
6%SUBNE R2,R2,#1   ;no, then take 1
@&SWINE 0          ;print the delete
J$B readloop       ;read next char
T:
^
.nodelete
h%CMP R0,#32        ;is char space?
r(STRGEB R0,[R1,R2] ;if > = then store
|"SWIGE 256+�"*"  ;and print '*'
�)ADDGE R2,R2,#1    ;and add 1 to count
�2BLT foundpass     ;if less than, then found it
�#CMP R2,#12        ;is count 12?
�3BLT readloop      ;if less, then read next char
�:
�$.foundpass        ;found pass!!!
�$ADR R0,pass       ;r0=pass store
�9CMP R1,R0         ;r1=password pos  r0=password store
�)BEQ alreadythere  ;is pw in pw store?
�MOV R2,#0         ;counter
�'.moveloop         ;move pw to store
� LDRB R3,[R1,R2]   ;r3 = char
� CMP R3,#32        ;is it 32?
'BLE alreadythere  ;if less, then go
*STRB R3,[R0,R2]   ;store char in store
%ADD R2,R2,#1      ;add 1 to count
& CMP R2,#12        ;is it 12?
0(BLT moveloop      ;if less, get next
::
D .alreadythere     ;now ready
N"ADR R0,pass       ;r0=pw store
X*LDR R1,filepos    ;r0=pass  r1=filepos
bMOV R2,#0         ;counter
l$LDR R3,[R0]       ;r3=1st pw bit
v$LDR R4,[R0,#4]    ;r4=2nd pw bit
�$LDR R5,[R0,#8]    ;r5=3rd pw bit
�"LDR R6,filelen    ;r6=file len
�.decode
� LDR R0,[R1,R2]    ;load word
�#� R0,R0,R3      ;decode with r3
�!STR R0,[R1,R2]    ;store word
�%ADD R2,R2,#4      ;add 4 to count
�%LDR R0,[R1,R2]    ;load next word
�#� R0,R0,R4      ;decode with r4
�!STR R0,[R1,R2]    ;store word
�%ADD R2,R2,#4      ;add 4 to count
�%LDR R0,[R1,R2]    ;load next word
�#� R0,R0,R5      ;decode with r5
!STR R0,[R1,R2]    ;store word
'CMP R2,R6         ;is count at end?
%ADDLT R2,R2,#4    ;if less, add 4
 &BLT decode        ;and decode next
*:
4#ADR R0,sample     ;r0=test data
>$LDR R1,filepos    ;file position
H'LDR R2,[R0]       ;load test word 1
R'LDR R3,[R1]       ;load real word 1
\CMP R2,R3         ;compare
f)BNE wrong         ;if bad, then wrong
p'LDR R2,[R0,#4]    ;load test word 2
z'LDR R3,[R1,#4]    ;load real word 2
�CMP R2,R3         ;compare
�)BNE wrong         ;if bad, then wrong
�'LDR R2,[R0,#8]    ;load test word 3
�'LDR R3,[R1,#8]    ;load real word 3
�CMP R2,R3         ;compare
�0BEQ correct       ;if good, then all correct
�:
�.wrong            ;bad pw
�ADR R0,wrongword
�%SWI "OS_Write0"   ;print 'bad pw'
�LDMFD R13!,{PC}   ;exit
�:
�$.correct          ;correct pw!!!
$LDR R0,filepos    ;file position
0ADR R1,position   ;position in output string
"MOV R2,#9         ;buffer size
$BSWI "OS_ConvertHex8"   ;insert the possition of the Basic file
."LDR R0,filelen    ;len of file
8$LDR R1,filepos    ;file position
B1ADD R0,R0,R1      ;now = end of file position
L)ADR R1,length     ;position in string
V"MOV R2,#9         ;buffer size
`FSWI "OS_ConvertHex8"   ;insert the end possition of the Basic file
j"MOV R0,#�","    ;put the comma
t$STRB R0,comma     ;in the string
~+ADR R0,basic      ;addr of full command
�SWI "OS_CLI"      ;call it
�LDMFD R13!,{PC}   ;exit
�:
�,.enterpass              ;password string
�EQUS "Password: "+�0
�:
�%.wrongword              ;wrong pw
�1EQUS �(13)+�(10)+"Wrong password"+�(13)+�(10)
�
EQUB 0
�	ALIGN
�:
�'.sample           ;sample test data

EQUD 0


EQUD 0

EQUD 0
:
(1.pass             ;password (with blank data)
2EQUD &12345678
<EQUD &87654321
FEQUD &18273645
P:
Z+.filelen          ;length of basic prog
dEQUD len
n:
x!.basic            ;the string
�EQUS "*Basic -quit  @"
�
.position
�
EQUD 0
�
EQUD 0
�
.comma
�
EQUB 0
�.length
�
EQUD 0
�
EQUD 0
�
EQUD 0
�:
�$.end              ;the end (!!!)
�]
�
�
�
00000000  0d 00 0a 3f f4 20 3e 41  75 74 6f 52 75 6e 49 49  |...?. >AutoRunII|
00000010  2f 49 49 49 20 2d 20 63  6f 6e 76 65 72 74 65 64  |/III - converted|
00000020  20 61 6e 64 20 75 70 64  61 74 65 64 20 66 6f 72  | and updated for|
00000030  20 74 68 65 20 41 72 63  68 69 6d 65 64 65 73 0d  | the Archimedes.|
00000040  00 14 3f f4 20 20 41 4c  4c 20 74 68 65 20 63 6f  |..?.  ALL the co|
00000050  6e 74 65 6e 74 73 20 6f  66 20 74 68 69 73 20 70  |ntents of this p|
00000060  72 6f 67 72 61 6d 20 77  61 73 20 77 72 69 74 74  |rogram was writt|
00000070  65 6e 20 61 6e 64 20 63  72 65 61 74 65 64 0d 00  |en and created..|
00000080  1e 1a f4 20 20 62 79 20  53 74 65 70 68 65 6e 20  |...  by Stephen |
00000090  48 61 72 72 69 73 6f 6e  0d 00 28 1f f4 20 a9 20  |Harrison..(.. . |
000000a0  31 39 39 32 2f 33 20 53  74 65 70 68 65 6e 20 48  |1992/3 Stephen H|
000000b0  61 72 72 69 73 6f 6e 0d  00 32 06 20 3a 0d 00 3c  |arrison..2. :..<|
000000c0  1c ee 20 85 20 f1 20 f6  24 3b 22 20 61 74 20 6c  |.. . . .$;" at l|
000000d0  69 6e 65 20 22 3b 9e 3a  e0 0d 00 46 06 20 3a 0d  |ine ";.:...F. :.|
000000e0  00 50 14 f2 69 6e 69 74  28 22 41 75 74 6f 52 75  |.P..init("AutoRu|
000000f0  6e 22 29 0d 00 5a 06 20  3a 0d 00 64 0e c8 95 20  |n")..Z. :..d... |
00000100  ac 20 71 75 69 74 25 0d  00 6e 0e f2 77 69 6d 70  |. quit%..n..wimp|
00000110  5f 70 6f 6c 6c 0d 00 78  05 ce 0d 00 82 23 e7 20  |_poll..x.....#. |
00000120  6c 6f 61 64 65 64 25 20  8c 20 f2 72 65 6c 65 61  |loaded% . .relea|
00000130  73 65 5f 6d 65 6d 28 63  6f 64 65 25 29 0d 00 8c  |se_mem(code%)...|
00000140  17 c8 99 20 22 57 69 6d  70 5f 43 6c 6f 73 65 44  |... "Wimp_CloseD|
00000150  6f 77 6e 22 0d 00 96 05  e0 0d 00 a0 05 3a 0d 00  |own".........:..|
00000160  aa 05 3a 0d 00 b4 12 dd  f2 69 6e 69 74 28 74 69  |..:......init(ti|
00000170  74 6c 65 24 29 0d 00 be  12 62 6c 6f 63 6b 5f 6c  |tle$)....block_l|
00000180  65 6e 25 3d 38 38 38 0d  00 c8 06 20 3a 0d 00 d2  |en%=888.... :...|
00000190  17 de 20 62 6c 6f 63 6b  25 20 62 6c 6f 63 6b 5f  |.. block% block_|
000001a0  6c 65 6e 25 0d 00 dc 47  de 20 70 77 25 20 32 38  |len%...G. pw% 28|
000001b0  2b 32 34 2a 31 20 20 20  20 20 20 20 20 20 20 20  |+24*1           |
000001c0  20 20 20 20 20 20 20 20  20 20 3a 20 f4 20 32 38  |          : . 28|
000001d0  2b 32 34 2a 6e 75 6d 62  65 72 20 6f 66 20 69 74  |+24*number of it|
000001e0  65 6d 73 20 69 6e 20 6d  65 6e 75 0d 00 e6 47 de  |ems in menu...G.|
000001f0  20 65 6e 63 25 20 32 38  2b 32 34 2a 32 20 20 20  | enc% 28+24*2   |
00000200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000210  20 3a 20 f4 20 32 38 2b  32 34 2a 6e 75 6d 62 65  | : . 28+24*numbe|
00000220  72 20 6f 66 20 69 74 65  6d 73 20 69 6e 20 6d 65  |r of items in me|
00000230  6e 75 0d 00 f0 47 de 20  69 63 6f 6e 62 61 72 6d  |nu...G. iconbarm|
00000240  65 6e 75 25 20 32 38 2b  32 34 2a 34 20 20 20 20  |enu% 28+24*4    |
00000250  20 20 20 20 20 20 20 20  3a 20 f4 20 32 38 2b 32  |        : . 28+2|
00000260  34 2a 6e 75 6d 62 65 72  20 6f 66 20 69 74 65 6d  |4*number of item|
00000270  73 20 69 6e 20 6d 65 6e  75 0d 00 fa 12 de 20 70  |s in menu..... p|
00000280  61 73 73 77 6f 72 64 25  20 31 33 0d 01 04 10 de  |assword% 13.....|
00000290  20 70 77 76 61 6c 69 64  25 20 34 0d 01 0e 06 20  | pwvalid% 4.... |
000002a0  3a 0d 01 18 0f 72 69 73  63 5f 76 65 72 25 3d 32  |:....risc_ver%=2|
000002b0  0d 01 22 17 61 70 70 6c  69 63 61 74 69 6f 6e 24  |..".application$|
000002c0  3d 74 69 74 6c 65 24 0d  01 2c 0b 71 75 69 74 25  |=title$..,.quit%|
000002d0  3d a3 0d 01 36 0d 64 6f  70 61 73 73 25 3d a3 0d  |=...6.dopass%=..|
000002e0  01 40 0f 6d 65 6e 75 73  61 76 65 25 3d a3 0d 01  |.@.menusave%=...|
000002f0  4a 0d 6c 6f 61 64 65 64  25 3d a3 0d 01 54 06 20  |J.loaded%=...T. |
00000300  3a 0d 01 5e 3d c8 99 20  22 57 69 6d 70 5f 49 6e  |:..^=.. "Wimp_In|
00000310  69 74 69 61 6c 69 73 65  22 2c 72 69 73 63 5f 76  |itialise",risc_v|
00000320  65 72 25 2a 31 30 30 2c  26 34 42 35 33 34 31 35  |er%*100,&4B53415|
00000330  34 2c 61 70 70 6c 69 63  61 74 69 6f 6e 24 0d 01  |4,application$..|
00000340  68 13 ee 20 85 20 f2 61  6e 5f 65 72 72 6f 72 3a  |h.. . .an_error:|
00000350  e0 0d 01 72 06 20 3a 0d  01 7c 18 f2 73 65 74 75  |...r. :..|..setu|
00000360  70 5f 74 65 6d 70 6c 61  74 65 73 28 31 30 29 0d  |p_templates(10).|
00000370  01 86 2b 73 61 76 65 74  65 78 74 25 3d a4 66 69  |..+savetext%=.fi|
00000380  6e 64 74 65 78 74 61 64  64 72 28 73 61 76 65 5f  |ndtextaddr(save_|
00000390  77 69 6e 64 6f 77 25 2c  31 29 0d 01 90 06 20 3a  |window%,1).... :|
000003a0  0d 01 9a 42 69 63 6f 6e  62 61 72 69 63 6f 6e 25  |...Biconbaricon%|
000003b0  3d a4 63 72 65 61 74 65  5f 69 63 6f 6e 28 2d 31  |=.create_icon(-1|
000003c0  2c 30 2c 30 2c 36 38 2c  36 38 2c 26 33 30 30 32  |,0,0,68,68,&3002|
000003d0  2c 22 21 61 75 74 6f 72  75 6e 22 2c 30 2c 30 2c  |,"!autorun",0,0,|
000003e0  30 29 0d 01 a4 06 20 3a  0d 01 ae 32 74 65 6d 70  |0).... :...2temp|
000003f0  3d a4 63 72 65 61 74 65  6d 65 6e 75 28 70 77 25  |=.createmenu(pw%|
00000400  2c 22 20 20 50 61 73 73  77 6f 72 64 20 20 2c 31  |,"  Password  ,1|
00000410  2c 26 38 30 2c 2d 31 2c  22 29 0d 01 b8 15 f2 77  |,&80,-1,").....w|
00000420  72 69 74 65 61 62 6c 65  28 70 77 25 2c 30 29 0d  |riteable(pw%,0).|
00000430  01 c2 12 24 70 77 76 61  6c 69 64 25 3d 22 44 2a  |...$pwvalid%="D*|
00000440  22 0d 01 cc 2d f2 69 6e  64 69 72 65 63 74 28 70  |"...-.indirect(p|
00000450  77 25 2c 30 2c 22 22 2c  70 61 73 73 77 6f 72 64  |w%,0,"",password|
00000460  25 2c 70 77 76 61 6c 69  64 25 2c 31 33 29 0d 01  |%,pwvalid%,13)..|
00000470  d6 06 20 3a 0d 01 e0 44  74 65 6d 70 3d a4 63 72  |.. :...Dtemp=.cr|
00000480  65 61 74 65 6d 65 6e 75  28 65 6e 63 25 2c 22 45  |eatemenu(enc%,"E|
00000490  6e 63 72 79 70 74 69 6f  6e 2c 32 2c 30 2c 2d 31  |ncryption,2,0,-1|
000004a0  2c 4e 6f 6e 65 2c 26 38  30 2c 70 77 25 2c 50 61  |,None,&80,pw%,Pa|
000004b0  73 73 77 6f 72 64 22 29  0d 01 ea 14 f2 74 69 63  |ssword").....tic|
000004c0  6b 5f 6f 6e 28 65 6e 63  25 2c 30 29 0d 01 f4 77  |k_on(enc%,0)...w|
000004d0  69 62 6d 65 6e 75 5f 6c  65 6e 25 3d a4 63 72 65  |ibmenu_len%=.cre|
000004e0  61 74 65 6d 65 6e 75 28  69 63 6f 6e 62 61 72 6d  |atemenu(iconbarm|
000004f0  65 6e 75 25 2c 22 41 75  74 6f 52 75 6e 2c 34 2c  |enu%,"AutoRun,4,|
00000500  30 2c 69 6e 66 6f 62 6f  78 25 2c 49 6e 66 6f 2c  |0,infobox%,Info,|
00000510  30 2c 65 6e 63 25 2c 45  6e 63 72 79 70 74 69 6f  |0,enc%,Encryptio|
00000520  6e 2c 30 2c 73 61 76 65  5f 77 69 6e 64 6f 77 25  |n,0,save_window%|
00000530  2c 53 61 76 65 2c 26 38  30 2c 2d 31 2c 51 75 69  |,Save,&80,-1,Qui|
00000540  74 22 29 0d 01 fe 1d f2  73 68 61 64 65 5f 6f 6e  |t").....shade_on|
00000550  28 69 63 6f 6e 62 61 72  6d 65 6e 75 25 2c 32 29  |(iconbarmenu%,2)|
00000560  0d 02 08 06 20 3a 0d 02  12 05 e1 0d 02 1c 05 3a  |.... :.........:|
00000570  0d 02 26 05 3a 0d 02 30  0f dd f2 77 69 6d 70 5f  |..&.:..0...wimp_|
00000580  70 6f 6c 6c 0d 02 3a 25  c8 99 20 22 57 69 6d 70  |poll..:%.. "Wimp|
00000590  5f 50 6f 6c 6c 22 2c 30  2c 62 6c 6f 63 6b 25 20  |_Poll",0,block% |
000005a0  b8 20 72 65 61 73 6f 6e  25 0d 02 44 10 c8 8e 20  |. reason%..D... |
000005b0  72 65 61 73 6f 6e 25 20  ca 0d 02 4e 40 c9 20 31  |reason% ...N@. 1|
000005c0  20 3a 20 f2 72 65 64 72  61 77 28 21 62 6c 6f 63  | : .redraw(!bloc|
000005d0  6b 25 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |k%)             |
000005e0  3a 20 f4 20 72 65 64 61  72 77 20 77 69 6e 64 6f  |: . redarw windo|
000005f0  77 20 72 65 71 75 65 73  74 0d 02 58 43 c9 20 32  |w request..XC. 2|
00000600  20 3a 20 c8 99 20 22 57  69 6d 70 5f 4f 70 65 6e  | : .. "Wimp_Open|
00000610  57 69 6e 64 6f 77 22 2c  2c 62 6c 6f 63 6b 25 20  |Window",,block% |
00000620  20 20 3a 20 f4 20 72 65  2d 6f 70 65 6e 20 77 69  |  : . re-open wi|
00000630  6e 64 6f 77 20 72 65 71  75 65 73 74 0d 02 62 3f  |ndow request..b?|
00000640  c9 20 33 20 3a 20 f2 63  6c 6f 73 65 77 69 6e 64  |. 3 : .closewind|
00000650  6f 77 28 21 62 6c 6f 63  6b 25 29 20 20 20 20 20  |ow(!block%)     |
00000660  20 20 20 3a 20 f4 20 63  6c 6f 73 65 20 77 69 6e  |   : . close win|
00000670  64 6f 77 20 72 65 71 75  65 73 74 0d 02 6c 36 c9  |dow request..l6.|
00000680  20 36 20 3a 20 f2 63 6c  69 63 6b 28 62 6c 6f 63  | 6 : .click(bloc|
00000690  6b 25 21 31 32 29 20 20  20 20 20 20 20 20 20 20  |k%!12)          |
000006a0  20 20 3a 20 f4 20 6d 6f  75 73 65 20 63 6c 69 63  |  : . mouse clic|
000006b0  6b 0d 02 76 38 c9 20 37  20 3a 20 f2 73 74 61 72  |k..v8. 7 : .star|
000006c0  74 73 61 76 65 20 20 20  20 20 20 20 20 20 20 20  |tsave           |
000006d0  20 20 20 20 20 20 20 20  3a 20 f4 20 75 73 65 72  |        : . user|
000006e0  20 64 72 61 67 20 62 6f  78 0d 02 80 36 c9 20 38  | drag box...6. 8|
000006f0  20 3a 20 f2 6b 65 79 70  72 65 73 73 28 62 6c 6f  | : .keypress(blo|
00000700  63 6b 25 21 32 34 2c 21  62 6c 6f 63 6b 25 29 20  |ck%!24,!block%) |
00000710  3a 20 f4 20 6b 65 79 20  70 72 65 73 73 65 64 0d  |: . key pressed.|
00000720  02 8a 39 c9 20 39 20 3a  20 f2 6d 65 6e 75 73 65  |..9. 9 : .menuse|
00000730  6c 65 63 74 20 20 20 20  20 20 20 20 20 20 20 20  |lect            |
00000740  20 20 20 20 20 20 3a 20  f4 20 6d 65 6e 75 20 73  |      : . menu s|
00000750  65 6c 65 63 74 69 6f 6e  0d 02 94 48 c9 20 31 37  |election...H. 17|
00000760  2c 31 38 20 3a 20 f2 72  65 63 65 69 76 65 20 20  |,18 : .receive  |
00000770  20 20 20 20 20 20 20 20  3a 20 f4 20 75 73 65 72  |        : . user|
00000780  20 6d 65 73 73 61 67 65  20 2f 20 75 73 65 72 20  | message / user |
00000790  6d 65 73 73 61 67 65 20  72 65 63 6f 72 64 65 64  |message recorded|
000007a0  0d 02 9e 26 c9 20 31 39  20 3a 20 f4 20 75 73 65  |...&. 19 : . use|
000007b0  72 20 6d 65 73 73 61 67  65 20 61 63 6b 6e 6f 77  |r message acknow|
000007c0  6c 65 64 67 65 64 0d 02  a8 05 cb 0d 02 b2 05 e1  |ledged..........|
000007d0  0d 02 bc 05 3a 0d 02 c6  05 3a 0d 02 d0 14 dd 20  |....:....:..... |
000007e0  f2 65 72 72 6f 72 28 65  72 72 6f 72 24 29 0d 02  |.error(error$)..|
000007f0  da 1e 63 6c 69 63 6b 25  3d a4 65 72 72 6f 72 62  |..click%=.errorb|
00000800  6f 78 28 65 72 72 6f 72  24 2c 31 29 0d 02 e4 05  |ox(error$,1)....|
00000810  e1 0d 02 ee 05 3a 0d 02  f8 05 3a 0d 03 02 1f dd  |.....:....:.....|
00000820  20 a4 65 72 72 6f 72 62  6f 78 28 6d 65 73 73 61  | .errorbox(messa|
00000830  67 65 24 2c 66 6c 61 67  25 29 0d 03 0c 1b 65 72  |ge$,flag%)....er|
00000840  72 5f 74 69 74 6c 65 24  3d 61 70 70 6c 69 63 61  |r_title$=applica|
00000850  74 69 6f 6e 24 0d 03 16  38 e7 20 66 6c 61 67 25  |tion$...8. flag%|
00000860  20 80 20 31 36 20 8c 20  65 72 72 5f 74 69 74 6c  | . 16 . err_titl|
00000870  65 24 3d 22 4d 65 73 73  61 67 65 20 66 72 6f 6d  |e$="Message from|
00000880  20 22 2b 65 72 72 5f 74  69 74 6c 65 24 0d 03 20  | "+err_title$.. |
00000890  0f 21 62 6c 6f 63 6b 25  3d 32 35 35 0d 03 2a 1b  |.!block%=255..*.|
000008a0  24 28 62 6c 6f 63 6b 25  2b 34 29 3d 6d 65 73 73  |$(block%+4)=mess|
000008b0  61 67 65 24 2b bd 30 0d  03 34 3f c8 99 20 22 57  |age$+.0..4?.. "W|
000008c0  69 6d 70 5f 52 65 70 6f  72 74 45 72 72 6f 72 22  |imp_ReportError"|
000008d0  2c 62 6c 6f 63 6b 25 2c  66 6c 61 67 25 2c 65 72  |,block%,flag%,er|
000008e0  72 5f 74 69 74 6c 65 24  20 b8 20 2c 65 72 72 5f  |r_title$ . ,err_|
000008f0  63 6c 69 63 6b 25 0d 03  3e 0f 3d 65 72 72 5f 63  |click%..>.=err_c|
00000900  6c 69 63 6b 25 0d 03 48  05 3a 0d 03 52 05 3a 0d  |lick%..H.:..R.:.|
00000910  03 5c 0f dd 20 f2 61 6e  5f 65 72 72 6f 72 0d 03  |.\.. .an_error..|
00000920  66 1c ee 20 85 20 f1 20  f6 24 3b 22 20 61 74 20  |f.. . . .$;" at |
00000930  6c 69 6e 65 20 22 3b 9e  3a e0 0d 03 70 1d f2 65  |line ";.:...p..e|
00000940  72 72 6f 72 28 f6 24 2b  22 20 61 74 20 6c 69 6e  |rror(.$+" at lin|
00000950  65 20 22 2b c3 9e 29 0d  03 7a 23 e7 20 6c 6f 61  |e "+..)..z#. loa|
00000960  64 65 64 25 20 8c 20 f2  72 65 6c 65 61 73 65 5f  |ded% . .release_|
00000970  6d 65 6d 28 63 6f 64 65  25 29 0d 03 84 17 c8 99  |mem(code%)......|
00000980  20 22 57 69 6d 70 5f 43  6c 6f 73 65 44 6f 77 6e  | "Wimp_CloseDown|
00000990  22 0d 03 8e 05 e1 0d 03  98 05 3a 0d 03 a2 05 3a  |".........:....:|
000009a0  0d 03 ac 58 dd 20 a4 63  72 65 61 74 65 5f 69 63  |...X. .create_ic|
000009b0  6f 6e 28 77 68 61 6e 64  25 2c 69 63 6f 6e 5f 78  |on(whand%,icon_x|
000009c0  25 2c 69 63 6f 6e 5f 79  25 2c 69 63 6f 6e 5f 77  |%,icon_y%,icon_w|
000009d0  25 2c 69 63 6f 6e 5f 68  25 2c 66 6c 61 67 25 2c  |%,icon_h%,flag%,|
000009e0  74 65 78 74 24 2c 70 74  72 31 25 2c 70 74 72 32  |text$,ptr1%,ptr2|
000009f0  25 2c 70 74 72 33 25 29  0d 03 b6 12 21 62 6c 6f  |%,ptr3%)....!blo|
00000a00  63 6b 25 3d 77 68 61 6e  64 25 0d 03 c0 14 62 6c  |ck%=whand%....bl|
00000a10  6f 63 6b 25 21 34 3d 69  63 6f 6e 5f 78 25 0d 03  |ock%!4=icon_x%..|
00000a20  ca 14 62 6c 6f 63 6b 25  21 38 3d 69 63 6f 6e 5f  |..block%!8=icon_|
00000a30  79 25 0d 03 d4 1d 62 6c  6f 63 6b 25 21 31 32 3d  |y%....block%!12=|
00000a40  69 63 6f 6e 5f 77 25 2b  69 63 6f 6e 5f 78 25 0d  |icon_w%+icon_x%.|
00000a50  03 de 1d 62 6c 6f 63 6b  25 21 31 36 3d 69 63 6f  |...block%!16=ico|
00000a60  6e 5f 68 25 2b 69 63 6f  6e 5f 79 25 0d 03 e8 13  |n_h%+icon_y%....|
00000a70  62 6c 6f 63 6b 25 21 32  30 3d 66 6c 61 67 25 0d  |block%!20=flag%.|
00000a80  03 f2 0f e7 20 70 74 72  31 25 3d 30 20 8c 0d 03  |.... ptr1%=0 ...|
00000a90  fc 16 24 28 62 6c 6f 63  6b 25 2b 32 34 29 3d 74  |..$(block%+24)=t|
00000aa0  65 78 74 24 0d 04 06 05  cc 0d 04 10 13 62 6c 6f  |ext$.........blo|
00000ab0  63 6b 25 21 32 34 3d 70  74 72 31 25 0d 04 1a 13  |ck%!24=ptr1%....|
00000ac0  62 6c 6f 63 6b 25 21 32  38 3d 70 74 72 32 25 0d  |block%!28=ptr2%.|
00000ad0  04 24 13 62 6c 6f 63 6b  25 21 33 32 3d 70 74 72  |.$.block%!32=ptr|
00000ae0  33 25 0d 04 2e 05 cd 0d  04 38 2b c8 99 20 22 57  |3%.......8+.. "W|
00000af0  69 6d 70 5f 43 72 65 61  74 65 49 63 6f 6e 22 2c  |imp_CreateIcon",|
00000b00  2c 62 6c 6f 63 6b 25 20  b8 20 69 68 61 6e 64 6c  |,block% . ihandl|
00000b10  65 25 0d 04 42 0d 3d 69  68 61 6e 64 6c 65 25 0d  |e%..B.=ihandle%.|
00000b20  04 4c 05 3a 0d 04 56 05  3a 0d 04 60 16 dd 20 f2  |.L.:..V.:..`.. .|
00000b30  72 65 64 72 61 77 28 77  69 6e 64 6f 77 25 29 0d  |redraw(window%).|
00000b40  04 6a 10 c8 8e 20 77 69  6e 64 6f 77 25 20 ca 0d  |.j... window% ..|
00000b50  04 74 05 cb 0d 04 7e 05  e1 0d 04 88 05 3a 0d 04  |.t....~......:..|
00000b60  92 05 3a 0d 04 9c 1d dd  20 f2 6b 65 79 70 72 65  |..:..... .keypre|
00000b70  73 73 28 6b 65 79 25 2c  77 69 6e 64 6f 77 25 29  |ss(key%,window%)|
00000b80  0d 04 a6 10 c8 8e 20 77  69 6e 64 6f 77 25 20 ca  |...... window% .|
00000b90  0d 04 b0 36 20 c9 20 73  61 76 65 5f 77 69 6e 64  |...6 . save_wind|
00000ba0  6f 77 25 20 3a 20 e7 20  6b 65 79 25 3d 31 33 20  |ow% : . key%=13 |
00000bb0  f2 71 75 69 63 6b 73 61  76 65 3a f2 63 6c 6f 73  |.quicksave:.clos|
00000bc0  65 6d 65 6e 75 73 0d 04  ba 1f 7f 3a c8 99 20 22  |emenus.....:.. "|
00000bd0  57 69 6d 70 5f 50 72 6f  63 65 73 73 4b 65 79 22  |Wimp_ProcessKey"|
00000be0  2c 6b 65 79 25 0d 04 c4  05 cb 0d 04 ce 05 e1 0d  |,key%...........|
00000bf0  04 d8 05 3a 0d 04 e2 05  3a 0d 04 ec 13 dd 20 f2  |...:....:..... .|
00000c00  63 6c 69 63 6b 28 77 69  6e 64 25 29 0d 04 f6 13  |click(wind%)....|
00000c10  69 63 6f 6e 25 3d 62 6c  6f 63 6b 25 21 31 36 0d  |icon%=block%!16.|
00000c20  05 00 15 62 75 74 74 6f  6e 73 25 3d 62 6c 6f 63  |...buttons%=bloc|
00000c30  6b 25 21 38 0d 05 0a 0e  c8 8e 20 77 69 6e 64 25  |k%!8...... wind%|
00000c40  20 ca 0d 05 14 28 20 c9  20 2d 32 20 20 20 20 20  | ....( . -2     |
00000c50  20 20 20 20 20 20 3a 20  f2 69 63 6f 6e 62 61 72  |      : .iconbar|
00000c60  28 62 75 74 74 6f 6e 73  25 29 0d 05 1e 20 20 c9  |(buttons%)...  .|
00000c70  20 73 61 76 65 5f 77 69  6e 64 6f 77 25 20 3a 20  | save_window% : |
00000c80  c8 8e 20 69 63 6f 6e 25  20 ca 0d 05 28 67 20 20  |.. icon% ...(g  |
00000c90  c9 20 30 20 3a 20 e7 20  62 75 74 74 6f 6e 73 25  |. 0 : . buttons%|
00000ca0  3d 28 34 3c 3c 34 29 20  84 20 62 75 74 74 6f 6e  |=(4<<4) . button|
00000cb0  73 25 3d 28 31 3c 3c 34  29 20 8c 20 f2 64 72 61  |s%=(1<<4) . .dra|
00000cc0  67 62 6f 78 20 3a f4 20  34 3c 3c 34 3d 64 72 61  |gbox :. 4<<4=dra|
00000cd0  67 20 62 75 74 74 6f 6e  20 69 66 20 73 68 69 66  |g button if shif|
00000ce0  74 65 64 20 6c 65 66 74  20 34 20 70 6c 61 63 65  |ted left 4 place|
00000cf0  73 0d 05 32 4c 20 20 c9  20 32 20 3a 20 e7 20 62  |s..2L  . 2 : . b|
00000d00  75 74 74 6f 6e 73 25 3d  34 20 84 20 62 75 74 74  |uttons%=4 . butt|
00000d10  6f 6e 73 25 3d 31 20 8c  20 f2 71 75 69 63 6b 73  |ons%=1 . .quicks|
00000d20  61 76 65 3a e7 20 62 75  74 74 6f 6e 73 25 3c 3e  |ave:. buttons%<>|
00000d30  31 20 f2 63 6c 6f 73 65  6d 65 6e 75 73 0d 05 3c  |1 .closemenus..<|
00000d40  06 20 cb 0d 05 46 05 cb  0d 05 50 05 e1 0d 05 5a  |. ...F....P....Z|
00000d50  05 3a 0d 05 64 05 3a 0d  05 6e 0e dd 20 f2 64 72  |.:..d.:..n.. .dr|
00000d60  61 67 62 6f 78 0d 05 78  2f 21 62 6c 6f 63 6b 25  |agbox..x/!block%|
00000d70  3d 73 61 76 65 5f 77 69  6e 64 6f 77 25 20 20 20  |=save_window%   |
00000d80  20 20 20 20 20 20 20 20  20 20 20 3a f4 20 77 69  |           :. wi|
00000d90  6e 64 6f 77 0d 05 82 3a  c8 99 20 22 57 69 6d 70  |ndow...:.. "Wimp|
00000da0  5f 47 65 74 57 69 6e 64  6f 77 53 74 61 74 65 22  |_GetWindowState"|
00000db0  2c 2c 62 6c 6f 63 6b 25  20 3a f4 20 67 65 74 20  |,,block% :. get |
00000dc0  69 6e 66 6f 20 6f 6e 20  77 69 6e 64 6f 77 0d 05  |info on window..|
00000dd0  8c 35 6f 78 25 3d 62 6c  6f 63 6b 25 21 34 2d 62  |.5ox%=block%!4-b|
00000de0  6c 6f 63 6b 25 21 32 30  20 20 20 20 20 20 20 20  |lock%!20        |
00000df0  20 20 20 20 3a f4 20 77  69 6e 64 6f 77 20 78 20  |    :. window x |
00000e00  70 6f 73 0d 05 96 35 6f  79 25 3d 62 6c 6f 63 6b  |pos...5oy%=block|
00000e10  25 21 31 36 2d 62 6c 6f  63 6b 25 21 32 34 20 20  |%!16-block%!24  |
00000e20  20 20 20 20 20 20 20 20  20 3a f4 20 77 69 6e 64  |         :. wind|
00000e30  6f 77 20 79 20 70 6f 73  0d 05 a0 2f 62 6c 6f 63  |ow y pos.../bloc|
00000e40  6b 25 21 34 3d 30 20 20  20 20 20 20 20 20 20 20  |k%!4=0          |
00000e50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3a f4  |              :.|
00000e60  20 69 63 6f 6e 20 30 0d  05 aa 35 c8 99 20 22 57  | icon 0...5.. "W|
00000e70  69 6d 70 5f 47 65 74 49  63 6f 6e 53 74 61 74 65  |imp_GetIconState|
00000e80  22 2c 2c 62 6c 6f 63 6b  25 20 20 20 3a f4 20 67  |",,block%   :. g|
00000e90  65 74 20 69 63 6f 6e 20  69 6e 66 6f 0d 05 b4 34  |et icon info...4|
00000ea0  62 6c 6f 63 6b 25 21 34  3d 35 20 20 20 20 20 20  |block%!4=5      |
00000eb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ec0  20 20 3a f4 20 64 72 61  67 20 74 79 70 65 20 35  |  :. drag type 5|
00000ed0  0d 05 be 40 62 6c 6f 63  6b 25 21 30 38 3d 6f 78  |...@block%!08=ox|
00000ee0  25 2b 62 6c 6f 63 6b 25  21 30 38 20 20 20 20 20  |%+block%!08     |
00000ef0  20 20 20 20 20 20 3a f4  20 78 20 73 63 72 65 65  |      :. x scree|
00000f00  6e 20 63 6f 2d 6f 72 64  20 6f 66 20 69 63 6f 6e  |n co-ord of icon|
00000f10  0d 05 c8 40 62 6c 6f 63  6b 25 21 31 32 3d 6f 79  |...@block%!12=oy|
00000f20  25 2b 62 6c 6f 63 6b 25  21 31 32 20 20 20 20 20  |%+block%!12     |
00000f30  20 20 20 20 20 20 3a f4  20 79 20 73 63 72 65 65  |      :. y scree|
00000f40  6e 20 63 6f 2d 6f 72 64  20 6f 66 20 69 63 6f 6e  |n co-ord of icon|
00000f50  0d 05 d2 34 62 6c 6f 63  6b 25 21 31 36 3d 6f 78  |...4block%!16=ox|
00000f60  25 2b 62 6c 6f 63 6b 25  21 31 36 20 20 20 20 20  |%+block%!16     |
00000f70  20 20 20 20 20 20 3a f4  20 72 69 67 68 74 20 78  |      :. right x|
00000f80  20 70 6f 73 0d 05 dc 32  62 6c 6f 63 6b 25 21 32  | pos...2block%!2|
00000f90  30 3d 6f 79 25 2b 62 6c  6f 63 6b 25 21 32 30 20  |0=oy%+block%!20 |
00000fa0  20 20 20 20 20 20 20 20  20 20 3a f4 20 74 6f 70  |          :. top|
00000fb0  20 79 20 70 6f 73 0d 05  e6 4d 62 6c 6f 63 6b 25  | y pos...Mblock%|
00000fc0  21 32 34 3d 30 3a 62 6c  6f 63 6b 25 21 32 38 3d  |!24=0:block%!28=|
00000fd0  30 20 20 20 20 20 20 20  20 20 20 20 3a f4 20 73  |0           :. s|
00000fe0  63 72 65 65 6e 20 63 6f  2d 6f 72 64 73 20 6f 66  |creen co-ords of|
00000ff0  20 62 6f 74 20 78 2c 79  20 62 6f 75 6e 63 79 20  | bot x,y bouncy |
00001000  62 6f 78 0d 05 f0 49 62  6c 6f 63 6b 25 21 33 32  |box...Iblock%!32|
00001010  3d 26 37 46 46 46 46 46  46 46 20 20 20 20 20 20  |=&7FFFFFFF      |
00001020  20 20 20 20 20 20 20 20  20 3a f4 20 66 61 72 65  |         :. fare|
00001030  73 74 20 78 2c 79 20 63  6f 2d 6f 72 64 73 20 6f  |st x,y co-ords o|
00001040  66 20 62 6f 75 6e 63 79  20 62 6f 78 0d 05 fa 17  |f bouncy box....|
00001050  62 6c 6f 63 6b 25 21 33  36 3d 26 37 46 46 46 46  |block%!36=&7FFFF|
00001060  46 46 46 0d 06 04 35 c8  99 20 22 57 69 6d 70 5f  |FFF...5.. "Wimp_|
00001070  44 72 61 67 42 6f 78 22  2c 2c 62 6c 6f 63 6b 25  |DragBox",,block%|
00001080  20 20 20 20 20 20 20 20  3a f4 20 73 74 61 72 74  |        :. start|
00001090  20 64 72 61 67 69 6e 67  0d 06 0e 05 e1 0d 06 18  | draging........|
000010a0  05 3a 0d 06 22 05 3a 0d  06 2c 17 dd 20 f2 69 63  |.:..".:..,.. .ic|
000010b0  6f 6e 62 61 72 28 62 75  74 74 6f 6e 25 29 0d 06  |onbar(button%)..|
000010c0  36 10 c8 8e 20 62 75 74  74 6f 6e 25 20 ca 0d 06  |6... button% ...|
000010d0  40 3c 20 c9 20 32 20 3a  20 f2 73 68 6f 77 6d 65  |@< . 2 : .showme|
000010e0  6e 75 28 69 63 6f 6e 62  61 72 6d 65 6e 75 25 2c  |nu(iconbarmenu%,|
000010f0  21 62 6c 6f 63 6b 25 2d  36 34 2c 39 36 2b 69 62  |!block%-64,96+ib|
00001100  6d 65 6e 75 5f 6c 65 6e  25 29 0d 06 4a 05 cb 0d  |menu_len%)..J...|
00001110  06 54 05 e1 0d 06 5e 05  3a 0d 06 68 05 3a 0d 06  |.T....^.:..h.:..|
00001120  72 11 dd 20 f2 63 6c 6f  73 65 6d 65 6e 75 73 0d  |r.. .closemenus.|
00001130  06 7c 20 c8 99 20 22 57  69 6d 70 5f 43 72 65 61  |.| .. "Wimp_Crea|
00001140  74 65 4d 65 6e 75 22 2c  2c 2d 31 2c 30 2c 30 0d  |teMenu",,-1,0,0.|
00001150  06 86 05 e1 0d 06 90 05  3a 0d 06 9a 05 3a 0d 06  |........:....:..|
00001160  a4 26 dd 20 f2 73 68 6f  77 6d 65 6e 75 28 6d 65  |.&. .showmenu(me|
00001170  6e 75 25 2c 6d 65 6e 75  5f 78 25 2c 6d 65 6e 75  |nu%,menu_x%,menu|
00001180  5f 79 25 29 0d 06 ae 13  6d 65 6e 75 6f 70 65 6e  |_y%)....menuopen|
00001190  25 3d 6d 65 6e 75 25 0d  06 b8 2f c8 99 20 22 57  |%=menu%.../.. "W|
000011a0  69 6d 70 5f 43 72 65 61  74 65 4d 65 6e 75 22 2c  |imp_CreateMenu",|
000011b0  2c 6d 65 6e 75 25 2c 6d  65 6e 75 5f 78 25 2c 6d  |,menu%,menu_x%,m|
000011c0  65 6e 75 5f 79 25 0d 06  c2 05 e1 0d 06 cc 05 3a  |enu_y%.........:|
000011d0  0d 06 d6 05 3a 0d 06 e0  22 dd 20 a4 63 72 65 61  |....:...". .crea|
000011e0  74 65 6d 65 6e 75 28 6d  65 6e 75 25 2c 63 6f 6e  |temenu(menu%,con|
000011f0  74 65 6e 74 73 24 29 0d  06 ea 1e ea 20 63 6f 75  |tents$)..... cou|
00001200  6e 74 65 72 25 2c 70 74  72 25 2c 74 65 6d 70 77  |nter%,ptr%,tempw|
00001210  69 64 74 68 25 0d 06 f4  1a 63 6f 6e 74 65 6e 74  |idth%....content|
00001220  73 24 3d 63 6f 6e 74 65  6e 74 73 24 2b bd 30 0d  |s$=contents$+.0.|
00001230  06 fe 0e 63 6f 75 6e 74  65 72 25 3d 30 0d 07 08  |...counter%=0...|
00001240  30 f2 72 65 61 64 73 74  72 28 63 6f 6e 74 65 6e  |0.readstr(conten|
00001250  74 73 24 2c 63 6f 75 6e  74 65 72 25 2c 74 69 74  |ts$,counter%,tit|
00001260  6c 65 24 2c 63 6f 75 6e  74 65 72 25 29 0d 07 12  |le$,counter%)...|
00001270  37 f2 72 65 61 64 6e 75  6d 28 63 6f 6e 74 65 6e  |7.readnum(conten|
00001280  74 73 24 2c 63 6f 75 6e  74 65 72 25 2c 6e 75 6d  |ts$,counter%,num|
00001290  5f 6f 66 5f 69 74 65 6d  73 25 2c 63 6f 75 6e 74  |_of_items%,count|
000012a0  65 72 25 29 0d 07 1c 11  24 6d 65 6e 75 25 3d 74  |er%)....$menu%=t|
000012b0  69 74 6c 65 24 0d 07 26  1e 6d 61 78 77 69 64 74  |itle$..&.maxwidt|
000012c0  68 25 3d 28 a9 28 74 69  74 6c 65 24 29 2d 32 29  |h%=(.(title$)-2)|
000012d0  2a 31 36 0d 07 30 2c 6d  65 6e 75 25 21 31 32 3d  |*16..0,menu%!12=|
000012e0  26 30 30 30 37 30 32 30  37 20 20 20 20 20 20 20  |&00070207       |
000012f0  20 20 20 20 20 3a f4 20  63 6f 6c 6f 75 72 73 0d  |     :. colours.|
00001300  07 3a 2b 6d 65 6e 75 25  21 32 30 3d 34 34 20 20  |.:+menu%!20=44  |
00001310  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001320  20 3a f4 20 68 65 69 67  68 74 0d 07 44 28 6d 65  | :. height..D(me|
00001330  6e 75 25 21 32 34 3d 30  20 20 20 20 20 20 20 20  |nu%!24=0        |
00001340  20 20 20 20 20 20 20 20  20 20 20 20 3a f4 20 67  |            :. g|
00001350  61 70 0d 07 4e 11 70 74  72 25 3d 6d 65 6e 75 25  |ap..N.ptr%=menu%|
00001360  2b 32 38 0d 07 58 0f 6d  65 6e 75 5f 6c 65 6e 25  |+28..X.menu_len%|
00001370  3d 30 0d 07 62 1e e3 20  69 74 65 6d 73 25 3d 31  |=0..b.. items%=1|
00001380  20 b8 20 6e 75 6d 5f 6f  66 5f 69 74 65 6d 73 25  | . num_of_items%|
00001390  0d 07 6c 35 f2 72 65 61  64 6e 75 6d 28 63 6f 6e  |..l5.readnum(con|
000013a0  74 65 6e 74 73 24 2c 63  6f 75 6e 74 65 72 25 2c  |tents$,counter%,|
000013b0  6d 65 6e 75 5f 66 6c 61  67 73 25 2c 63 6f 75 6e  |menu_flags%,coun|
000013c0  74 65 72 25 29 0d 07 76  31 f2 72 65 61 64 6e 75  |ter%)..v1.readnu|
000013d0  6d 28 63 6f 6e 74 65 6e  74 73 24 2c 63 6f 75 6e  |m(contents$,coun|
000013e0  74 65 72 25 2c 73 75 62  70 74 72 25 2c 63 6f 75  |ter%,subptr%,cou|
000013f0  6e 74 65 72 25 29 0d 07  80 2f f2 72 65 61 64 73  |nter%).../.reads|
00001400  74 72 28 63 6f 6e 74 65  6e 74 73 24 2c 63 6f 75  |tr(contents$,cou|
00001410  6e 74 65 72 25 2c 69 74  65 6d 24 2c 63 6f 75 6e  |nter%,item$,coun|
00001420  74 65 72 25 29 0d 07 8a  15 21 70 74 72 25 3d 6d  |ter%)....!ptr%=m|
00001430  65 6e 75 5f 66 6c 61 67  73 25 0d 07 94 12 70 74  |enu_flags%....pt|
00001440  72 25 21 34 3d 73 75 62  70 74 72 25 0d 07 9e 13  |r%!4=subptr%....|
00001450  70 74 72 25 21 38 3d 26  37 30 30 30 30 32 31 0d  |ptr%!8=&7000021.|
00001460  07 a8 14 24 28 70 74 72  25 2b 31 32 29 3d 69 74  |...$(ptr%+12)=it|
00001470  65 6d 24 0d 07 b2 1e 74  65 6d 70 77 69 64 74 68  |em$....tempwidth|
00001480  25 3d 28 a9 28 69 74 65  6d 24 29 2b 31 29 2a 31  |%=(.(item$)+1)*1|
00001490  36 0d 07 bc 31 e7 20 74  65 6d 70 77 69 64 74 68  |6...1. tempwidth|
000014a0  25 3e 6d 61 78 77 69 64  74 68 25 20 8c 20 6d 61  |%>maxwidth% . ma|
000014b0  78 77 69 64 74 68 25 3d  74 65 6d 70 77 69 64 74  |xwidth%=tempwidt|
000014c0  68 25 0d 07 c6 0c 70 74  72 25 2b 3d 32 34 0d 07  |h%....ptr%+=24..|
000014d0  d0 11 6d 65 6e 75 5f 6c  65 6e 25 2b 3d 34 34 0d  |..menu_len%+=44.|
000014e0  07 da 05 ed 0d 07 e4 16  6d 65 6e 75 25 21 31 36  |........menu%!16|
000014f0  3d 6d 61 78 77 69 64 74  68 25 0d 07 ee 0e 3d 6d  |=maxwidth%....=m|
00001500  65 6e 75 5f 6c 65 6e 25  0d 07 f8 05 3a 0d 08 02  |enu_len%....:...|
00001510  05 3a 0d 08 0c 2c dd f2  72 65 61 64 73 74 72 28  |.:...,..readstr(|
00001520  73 65 61 72 63 68 24 2c  70 6f 73 25 2c f8 20 73  |search$,pos%,. s|
00001530  65 61 72 63 68 24 2c f8  20 70 6f 73 25 29 0d 08  |earch$,. pos%)..|
00001540  16 0d ea 20 6f 6c 64 70  6f 73 25 0d 08 20 12 6f  |... oldpos%.. .o|
00001550  6c 64 70 6f 73 25 3d 70  6f 73 25 2b 31 0d 08 2a  |ldpos%=pos%+1..*|
00001560  05 f5 0d 08 34 0b 70 6f  73 25 2b 3d 31 0d 08 3e  |....4.pos%+=1..>|
00001570  30 fd 20 c1 73 65 61 72  63 68 24 2c 70 6f 73 25  |0. .search$,pos%|
00001580  2c 31 29 3d 22 2c 22 20  84 20 c1 73 65 61 72 63  |,1)="," . .searc|
00001590  68 24 2c 70 6f 73 25 2c  31 29 3d bd 30 0d 08 48  |h$,pos%,1)=.0..H|
000015a0  2c 73 65 61 72 63 68 24  3d c1 73 65 61 72 63 68  |,search$=.search|
000015b0  24 2c 6f 6c 64 70 6f 73  25 2c 28 70 6f 73 25 2d  |$,oldpos%,(pos%-|
000015c0  6f 6c 64 70 6f 73 25 29  29 0d 08 52 05 e1 0d 08  |oldpos%))..R....|
000015d0  5c 05 3a 0d 08 66 05 3a  0d 08 70 2b dd f2 72 65  |\.:..f.:..p+..re|
000015e0  61 64 6e 75 6d 28 73 65  61 72 63 68 24 2c 70 6f  |adnum(search$,po|
000015f0  73 25 2c f8 20 66 6f 75  6e 64 25 2c f8 20 70 6f  |s%,. found%,. po|
00001600  73 25 29 0d 08 7a 0d ea  20 6f 6c 64 70 6f 73 25  |s%)..z.. oldpos%|
00001610  0d 08 84 12 6f 6c 64 70  6f 73 25 3d 70 6f 73 25  |....oldpos%=pos%|
00001620  2b 31 0d 08 8e 05 f5 0d  08 98 0b 70 6f 73 25 2b  |+1.........pos%+|
00001630  3d 31 0d 08 a2 30 fd 20  c1 73 65 61 72 63 68 24  |=1...0. .search$|
00001640  2c 70 6f 73 25 2c 31 29  3d 22 2c 22 20 84 20 c1  |,pos%,1)="," . .|
00001650  73 65 61 72 63 68 24 2c  70 6f 73 25 2c 31 29 3d  |search$,pos%,1)=|
00001660  bd 30 0d 08 ac 2c 73 65  61 72 63 68 24 3d c1 73  |.0...,search$=.s|
00001670  65 61 72 63 68 24 2c 6f  6c 64 70 6f 73 25 2c 28  |earch$,oldpos%,(|
00001680  70 6f 73 25 2d 6f 6c 64  70 6f 73 25 29 29 0d 08  |pos%-oldpos%))..|
00001690  b6 15 66 6f 75 6e 64 25  3d a0 28 73 65 61 72 63  |..found%=.(searc|
000016a0  68 24 29 0d 08 c0 05 e1  0d 08 ca 05 3a 0d 08 d4  |h$).........:...|
000016b0  05 3a 0d 08 de 11 dd 20  f2 6d 65 6e 75 73 65 6c  |.:..... .menusel|
000016c0  65 63 74 0d 08 e8 20 73  65 6c 31 25 3d 21 62 6c  |ect... sel1%=!bl|
000016d0  6f 63 6b 25 3a 73 65 6c  32 25 3d 62 6c 6f 63 6b  |ock%:sel2%=block|
000016e0  25 21 34 0d 08 f2 22 73  65 6c 33 25 3d 62 6c 6f  |%!4..."sel3%=blo|
000016f0  63 6b 25 21 38 3a 73 65  6c 34 25 3d 62 6c 6f 63  |ck%!8:sel4%=bloc|
00001700  6b 25 21 31 32 0d 08 fc  06 20 3a 0d 09 06 24 c8  |k%!12.... :...$.|
00001710  99 20 22 57 69 6d 70 5f  47 65 74 50 6f 69 6e 74  |. "Wimp_GetPoint|
00001720  65 72 49 6e 66 6f 22 2c  2c 62 6c 6f 63 6b 25 0d  |erInfo",,block%.|
00001730  09 10 14 62 75 74 74 6f  6e 25 3d 62 6c 6f 63 6b  |...button%=block|
00001740  25 21 38 0d 09 1a 06 20  3a 0d 09 24 12 c8 8e 20  |%!8.... :..$... |
00001750  6d 65 6e 75 6f 70 65 6e  25 20 ca 0d 09 2e 20 20  |menuopen% ....  |
00001760  c9 20 69 63 6f 6e 62 61  72 6d 65 6e 75 25 20 3a  |. iconbarmenu% :|
00001770  20 c8 8e 20 73 65 6c 31  25 20 ca 0d 09 38 0b 20  | .. sel1% ...8. |
00001780  20 c9 20 30 20 3a 0d 09  42 16 20 20 c9 20 31 20  | . 0 :..B.  . 1 |
00001790  3a 20 c8 8e 20 73 65 6c  32 25 20 ca 0d 09 4c 4f  |: .. sel2% ...LO|
000017a0  20 20 20 c9 20 30 20 3a  20 64 6f 70 61 73 73 25  |   . 0 : dopass%|
000017b0  3d a3 3a f2 74 69 63 6b  5f 6f 6e 28 65 6e 63 25  |=.:.tick_on(enc%|
000017c0  2c 30 29 3a f2 74 69 63  6b 5f 6f 66 66 28 65 6e  |,0):.tick_off(en|
000017d0  63 25 2c 31 29 3a 24 70  61 73 73 77 6f 72 64 25  |c%,1):$password%|
000017e0  3d 22 22 3a f2 75 6e 6c  6f 61 64 0d 09 56 54 20  |="":.unload..VT |
000017f0  20 20 c9 20 31 20 3a 20  e7 20 24 70 61 73 73 77  |  . 1 : . $passw|
00001800  6f 72 64 25 3c 3e 22 22  20 8c 20 64 6f 70 61 73  |ord%<>"" . dopas|
00001810  73 25 3d b9 3a f2 74 69  63 6b 5f 6f 6e 28 65 6e  |s%=.:.tick_on(en|
00001820  63 25 2c 31 29 3a f2 74  69 63 6b 5f 6f 66 66 28  |c%,1):.tick_off(|
00001830  65 6e 63 25 2c 30 29 3a  f2 75 6e 6c 6f 61 64 0d  |enc%,0):.unload.|
00001840  09 60 07 20 20 cb 0d 09  6a 22 20 20 c9 20 32 20  |.`.  ...j"  . 2 |
00001850  3a 20 6d 65 6e 75 73 61  76 65 25 3d b9 3a f2 71  |: menusave%=.:.q|
00001860  75 69 63 6b 73 61 76 65  0d 09 74 13 20 20 c9 20  |uicksave..t.  . |
00001870  33 20 3a 20 71 75 69 74  25 3d b9 0d 09 7e 06 20  |3 : quit%=...~. |
00001880  cb 0d 09 88 05 cb 0d 09  92 06 20 3a 0d 09 9c 2a  |.......... :...*|
00001890  e7 20 62 75 74 74 6f 6e  25 3d 31 20 8c 20 f2 73  |. button%=1 . .s|
000018a0  68 6f 77 6d 65 6e 75 28  6d 65 6e 75 6f 70 65 6e  |howmenu(menuopen|
000018b0  25 2c 30 2c 30 29 0d 09  a6 05 e1 0d 09 b0 05 3a  |%,0,0).........:|
000018c0  0d 09 ba 05 3a 0d 09 c4  39 dd 20 f2 69 6e 64 69  |....:...9. .indi|
000018d0  72 65 63 74 28 6d 65 6e  75 25 2c 69 74 65 6d 25  |rect(menu%,item%|
000018e0  2c 74 65 78 74 24 2c 69  6e 64 70 6f 73 25 2c 76  |,text$,indpos%,v|
000018f0  61 6c 69 64 25 2c 6c 65  6e 67 74 68 25 29 0d 09  |alid%,length%)..|
00001900  ce 12 24 69 6e 64 70 6f  73 25 3d 74 65 78 74 24  |..$indpos%=text$|
00001910  0d 09 d8 11 70 74 72 25  3d 6d 65 6e 75 25 2b 32  |....ptr%=menu%+2|
00001920  38 0d 09 e2 16 70 74 72  25 3d 70 74 72 25 2b 32  |8....ptr%=ptr%+2|
00001930  34 2a 69 74 65 6d 25 0d  09 ec 2c 70 74 72 25 3f  |4*item%...,ptr%?|
00001940  39 3d 70 74 72 25 3f 39  20 84 20 25 31 20 3a f4  |9=ptr%?9 . %1 :.|
00001950  20 69 6e 64 69 72 65 63  74 65 64 20 28 62 69 74  | indirected (bit|
00001960  20 38 29 0d 09 f6 13 70  74 72 25 21 31 32 3d 69  | 8)....ptr%!12=i|
00001970  6e 64 70 6f 73 25 0d 0a  00 12 70 74 72 25 21 31  |ndpos%....ptr%!1|
00001980  36 3d 76 61 6c 69 64 25  0d 0a 0a 13 70 74 72 25  |6=valid%....ptr%|
00001990  21 32 30 3d 6c 65 6e 67  74 68 25 0d 0a 14 05 e1  |!20=length%.....|
000019a0  0d 0a 1e 05 3a 0d 0a 28  05 3a 0d 0a 32 1d dd 20  |....:..(.:..2.. |
000019b0  f2 77 72 69 74 65 61 62  6c 65 28 6d 65 6e 75 25  |.writeable(menu%|
000019c0  2c 69 74 65 6d 25 29 0d  0a 3c 11 70 74 72 25 3d  |,item%)..<.ptr%=|
000019d0  6d 65 6e 75 25 2b 32 38  0d 0a 46 16 70 74 72 25  |menu%+28..F.ptr%|
000019e0  3d 70 74 72 25 2b 32 34  2a 69 74 65 6d 25 0d 0a  |=ptr%+24*item%..|
000019f0  50 16 3f 70 74 72 25 3d  3f 70 74 72 25 20 84 20  |P.?ptr%=?ptr% . |
00001a00  25 31 30 30 0d 0a 5a 05  e1 0d 0a 64 05 3a 0d 0a  |%100..Z....d.:..|
00001a10  6e 05 3a 0d 0a 78 1b dd  20 f2 74 69 63 6b 5f 6f  |n.:..x.. .tick_o|
00001a20  6e 28 6d 65 6e 75 25 2c  69 74 65 6d 25 29 0d 0a  |n(menu%,item%)..|
00001a30  82 11 70 74 72 25 3d 6d  65 6e 75 25 2b 32 38 0d  |..ptr%=menu%+28.|
00001a40  0a 8c 16 70 74 72 25 3d  70 74 72 25 2b 32 34 2a  |...ptr%=ptr%+24*|
00001a50  69 74 65 6d 25 0d 0a 96  13 3f 70 74 72 25 3d 3f  |item%....?ptr%=?|
00001a60  70 74 72 25 20 84 20 31  0d 0a a0 05 e1 0d 0a aa  |ptr% . 1........|
00001a70  05 3a 0d 0a b4 05 3a 0d  0a be 1c dd 20 f2 74 69  |.:....:..... .ti|
00001a80  63 6b 5f 6f 66 66 28 6d  65 6e 75 25 2c 69 74 65  |ck_off(menu%,ite|
00001a90  6d 25 29 0d 0a c8 11 70  74 72 25 3d 6d 65 6e 75  |m%)....ptr%=menu|
00001aa0  25 2b 32 38 0d 0a d2 16  70 74 72 25 3d 70 74 72  |%+28....ptr%=ptr|
00001ab0  25 2b 32 34 2a 69 74 65  6d 25 0d 0a dc 1b 3f 70  |%+24*item%....?p|
00001ac0  74 72 25 3d 3f 70 74 72  25 20 80 20 25 31 31 31  |tr%=?ptr% . %111|
00001ad0  31 31 31 31 30 0d 0a e6  05 e1 0d 0a f0 05 3a 0d  |11110.........:.|
00001ae0  0a fa 05 3a 0d 0b 04 1c  dd 20 f2 73 68 61 64 65  |...:..... .shade|
00001af0  5f 6f 6e 28 6d 65 6e 75  25 2c 69 74 65 6d 25 29  |_on(menu%,item%)|
00001b00  0d 0b 0e 11 70 74 72 25  3d 6d 65 6e 75 25 2b 32  |....ptr%=menu%+2|
00001b10  38 0d 0b 18 16 70 74 72  25 3d 70 74 72 25 2b 32  |8....ptr%=ptr%+2|
00001b20  34 2a 69 74 65 6d 25 0d  0b 22 0c 70 74 72 25 2b  |4*item%..".ptr%+|
00001b30  3d 31 30 0d 0b 2c 1b 3f  70 74 72 25 3d 3f 70 74  |=10..,.?ptr%=?pt|
00001b40  72 25 20 84 20 25 30 31  30 30 30 30 30 30 0d 0b  |r% . %01000000..|
00001b50  36 05 e1 0d 0b 40 05 3a  0d 0b 4a 05 3a 0d 0b 54  |6....@.:..J.:..T|
00001b60  1d dd 20 f2 73 68 61 64  65 5f 6f 66 66 28 6d 65  |.. .shade_off(me|
00001b70  6e 75 25 2c 69 74 65 6d  25 29 0d 0b 5e 11 70 74  |nu%,item%)..^.pt|
00001b80  72 25 3d 6d 65 6e 75 25  2b 32 38 0d 0b 68 16 70  |r%=menu%+28..h.p|
00001b90  74 72 25 3d 70 74 72 25  2b 32 34 2a 69 74 65 6d  |tr%=ptr%+24*item|
00001ba0  25 0d 0b 72 0c 70 74 72  25 2b 3d 31 30 0d 0b 7c  |%..r.ptr%+=10..||
00001bb0  1b 3f 70 74 72 25 3d 3f  70 74 72 25 20 80 20 25  |.?ptr%=?ptr% . %|
00001bc0  31 30 31 31 31 31 31 31  0d 0b 86 05 e1 0d 0b 90  |10111111........|
00001bd0  05 3a 0d 0b 9a 05 3a 0d  0b a4 1b dd 20 f2 63 6c  |.:....:..... .cl|
00001be0  6f 73 65 77 69 6e 64 6f  77 28 77 69 6e 64 6f 77  |osewindow(window|
00001bf0  25 29 0d 0b ae 10 c8 8e  20 77 69 6e 64 6f 77 25  |%)...... window%|
00001c00  20 ca 0d 0b b8 05 cb 0d  0b c2 06 20 3a 0d 0b cc  | .......... :...|
00001c10  13 21 62 6c 6f 63 6b 25  3d 77 69 6e 64 6f 77 25  |.!block%=window%|
00001c20  0d 0b d6 21 c8 99 20 22  57 69 6d 70 5f 43 6c 6f  |...!.. "Wimp_Clo|
00001c30  73 65 57 69 6e 64 6f 77  22 2c 2c 62 6c 6f 63 6b  |seWindow",,block|
00001c40  25 0d 0b e0 05 e1 0d 0b  ea 05 3a 0d 0b f4 05 3a  |%.........:....:|
00001c50  0d 0b fe 1e dd 20 f2 6f  70 65 6e 77 69 6e 64 6f  |..... .openwindo|
00001c60  77 28 77 69 6e 64 6f 77  25 2c 78 2c 79 29 0d 0c  |w(window%,x,y)..|
00001c70  08 10 c8 8e 20 77 69 6e  64 6f 77 25 20 ca 0d 0c  |.... window% ...|
00001c80  12 05 cb 0d 0c 1c 06 20  3a 0d 0c 26 13 21 62 6c  |....... :..&.!bl|
00001c90  6f 63 6b 25 3d 77 69 6e  64 6f 77 25 0d 0c 30 24  |ock%=window%..0$|
00001ca0  c8 99 20 22 57 69 6d 70  5f 47 65 74 57 69 6e 64  |.. "Wimp_GetWind|
00001cb0  6f 77 53 74 61 74 65 22  2c 2c 62 6c 6f 63 6b 25  |owState",,block%|
00001cc0  0d 0c 3a 42 62 6c 6f 63  6b 25 21 32 38 3d 2d 31  |..:Bblock%!28=-1|
00001cd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001ce0  20 20 20 20 20 20 20 3a  f4 20 6f 70 65 6e 20 77  |       :. open w|
00001cf0  69 6e 64 6f 77 20 61 74  20 74 68 65 20 66 72 6f  |indow at the fro|
00001d00  6e 74 0d 0c 44 1a 77 64  25 3d 62 6c 6f 63 6b 25  |nt..D.wd%=block%|
00001d10  21 31 32 2d 62 6c 6f 63  6b 25 21 34 0d 0c 4e 1a  |!12-block%!4..N.|
00001d20  68 69 25 3d 62 6c 6f 63  6b 25 21 31 36 2d 62 6c  |hi%=block%!16-bl|
00001d30  6f 63 6b 25 21 38 0d 0c  58 19 62 6c 6f 63 6b 25  |ock%!8..X.block%|
00001d40  21 34 3d 78 3a 62 6c 6f  63 6b 25 21 38 3d 79 0d  |!4=x:block%!8=y.|
00001d50  0c 62 13 62 6c 6f 63 6b  25 21 31 32 3d 78 2b 77  |.b.block%!12=x+w|
00001d60  64 25 0d 0c 6c 13 62 6c  6f 63 6b 25 21 31 36 3d  |d%..l.block%!16=|
00001d70  79 2b 68 69 25 0d 0c 76  20 c8 99 20 22 57 69 6d  |y+hi%..v .. "Wim|
00001d80  70 5f 4f 70 65 6e 57 69  6e 64 6f 77 22 2c 2c 62  |p_OpenWindow",,b|
00001d90  6c 6f 63 6b 25 0d 0c 80  05 e1 0d 0c 8a 05 3a 0d  |lock%.........:.|
00001da0  0c 94 05 3a 0d 0c 9e 0e  dd 20 f2 72 65 63 65 69  |...:..... .recei|
00001db0  76 65 0d 0c a8 12 c8 8e  20 62 6c 6f 63 6b 25 21  |ve...... block%!|
00001dc0  31 36 20 ca 0d 0c b2 12  20 c9 20 30 20 3a 20 71  |16 ..... . 0 : q|
00001dd0  75 69 74 25 3d b9 0d 0c  bc 14 20 c9 20 32 20 3a  |uit%=..... . 2 :|
00001de0  20 f2 64 61 74 61 73 61  76 65 0d 0c c6 1f 20 c9  | .datasave.... .|
00001df0  20 33 20 3a 20 f2 64 61  74 61 6c 6f 61 64 28 62  | 3 : .dataload(b|
00001e00  6c 6f 63 6b 25 21 34 30  29 0d 0c d0 05 cb 0d 0c  |lock%!40).......|
00001e10  da 05 e1 0d 0c e4 05 3a  0d 0c ee 05 3a 0d 0c f8  |.......:....:...|
00001e20  16 dd 20 f2 64 61 74 61  6c 6f 61 64 28 74 79 70  |.. .dataload(typ|
00001e30  65 25 29 0d 0d 02 20 70  61 74 68 6e 61 6d 65 24  |e%)... pathname$|
00001e40  3d a4 67 65 74 73 74 72  28 62 6c 6f 63 6b 25 2b  |=.getstr(block%+|
00001e50  34 34 29 0d 0d 0c 0e c8  8e 20 74 79 70 65 25 20  |44)...... type% |
00001e60  ca 0d 0d 16 24 20 c9 20  26 46 46 42 20 3a 20 f2  |....$ . &FFB : .|
00001e70  67 65 74 77 6f 72 6b 69  6e 67 28 70 61 74 68 6e  |getworking(pathn|
00001e80  61 6d 65 24 29 0d 0d 20  05 cb 0d 0d 2a 05 e1 0d  |ame$).. ....*...|
00001e90  0d 34 05 3a 0d 0d 3e 05  3a 0d 0d 48 15 dd 20 a4  |.4.:..>.:..H.. .|
00001ea0  67 65 74 73 74 72 28 73  74 6f 72 65 25 29 0d 0d  |getstr(store%)..|
00001eb0  52 0a ea 20 67 65 74 24  0d 0d 5c 05 f5 0d 0d 66  |R.. get$..\....f|
00001ec0  14 67 65 74 24 2b 3d bd  28 3f 73 74 6f 72 65 25  |.get$+=.(?store%|
00001ed0  29 0d 0d 70 0d 73 74 6f  72 65 25 2b 3d 31 0d 0d  |)..p.store%+=1..|
00001ee0  7a 0e fd 3f 73 74 6f 72  65 25 3d 30 0d 0d 84 09  |z..?store%=0....|
00001ef0  3d 67 65 74 24 0d 0d 8e  05 3a 0d 0d 98 05 3a 0d  |=get$....:....:.|
00001f00  0d a2 21 dd f2 73 65 74  75 70 5f 74 65 6d 70 6c  |..!..setup_templ|
00001f10  61 74 65 73 28 6e 75 6d  5f 69 63 6f 6e 73 25 29  |ates(num_icons%)|
00001f20  0d 0d ac 26 ea 20 69 64  25 2c 69 6e 64 5f 6c 65  |...&. id%,ind_le|
00001f30  6e 25 2c 69 6e 66 6f 5f  6c 65 6e 25 2c 73 61 76  |n%,info_len%,sav|
00001f40  65 5f 6c 65 6e 25 0d 0d  b6 06 20 3a 0d 0d c0 11  |e_len%.... :....|
00001f50  69 6e 66 6f 5f 6c 65 6e  25 3d 31 37 38 0d 0d ca  |info_len%=178...|
00001f60  11 73 61 76 65 5f 6c 65  6e 25 3d 32 35 36 0d 0d  |.save_len%=256..|
00001f70  d4 06 20 3a 0d 0d de 20  69 6e 64 5f 6c 65 6e 25  |.. :... ind_len%|
00001f80  3d 69 6e 66 6f 5f 6c 65  6e 25 2b 73 61 76 65 5f  |=info_len%+save_|
00001f90  6c 65 6e 25 0d 0d e8 46  e7 20 62 6c 6f 63 6b 5f  |len%...F. block_|
00001fa0  6c 65 6e 25 3c 38 38 2b  33 32 2a 6e 75 6d 5f 69  |len%<88+32*num_i|
00001fb0  63 6f 6e 73 25 2b 73 61  76 65 5f 6c 65 6e 25 20  |cons%+save_len% |
00001fc0  85 20 32 35 35 2c 22 27  62 6c 6f 63 6b 25 27 20  |. 255,"'block%' |
00001fd0  74 6f 6f 20 73 6d 61 6c  6c 22 0d 0d f2 13 de 20  |too small"..... |
00001fe0  69 6e 64 25 20 69 6e 64  5f 6c 65 6e 25 0d 0d fc  |ind% ind_len%...|
00001ff0  0c de 20 69 64 25 20 31  32 0d 0e 06 06 20 3a 0d  |.. id% 12.... :.|
00002000  0e 10 32 c8 99 20 22 57  69 6d 70 5f 4f 70 65 6e  |..2.. "Wimp_Open|
00002010  54 65 6d 70 6c 61 74 65  22 2c 2c 22 3c 4f 62 65  |Template",,"<Obe|
00002020  79 24 44 69 72 3e 2e 54  65 6d 70 6c 61 74 65 73  |y$Dir>.Templates|
00002030  22 0d 0e 1a 14 24 69 64  25 3d 22 78 66 65 72 5f  |"....$id%="xfer_|
00002040  73 65 6e 64 22 0d 0e 24  53 c8 99 20 22 57 69 6d  |send"..$S.. "Wim|
00002050  70 5f 4c 6f 61 64 54 65  6d 70 6c 61 74 65 22 2c  |p_LoadTemplate",|
00002060  2c 62 6c 6f 63 6b 25 2c  69 6e 64 25 2c 69 6e 64  |,block%,ind%,ind|
00002070  25 2b 69 6e 64 5f 6c 65  6e 25 2c 2d 31 2c 69 64  |%+ind_len%,-1,id|
00002080  25 2c 30 20 b8 20 2c 2c  72 65 6d 61 69 6e 25 2c  |%,0 . ,,remain%,|
00002090  2c 2c 2c 6e 65 78 74 25  0d 0e 2e 06 20 3a 0d 0e  |,,,next%.... :..|
000020a0  38 31 c8 99 20 22 57 69  6d 70 5f 43 72 65 61 74  |81.. "Wimp_Creat|
000020b0  65 57 69 6e 64 6f 77 22  2c 2c 62 6c 6f 63 6b 25  |eWindow",,block%|
000020c0  20 b8 20 73 61 76 65 5f  77 69 6e 64 6f 77 25 0d  | . save_window%.|
000020d0  0e 42 13 24 69 64 25 3d  22 70 72 6f 67 49 6e 66  |.B.$id%="progInf|
000020e0  6f 22 0d 0e 4c 5a c8 99  20 22 57 69 6d 70 5f 4c  |o"..LZ.. "Wimp_L|
000020f0  6f 61 64 54 65 6d 70 6c  61 74 65 22 2c 2c 62 6c  |oadTemplate",,bl|
00002100  6f 63 6b 25 2c 72 65 6d  61 69 6e 25 2c 69 6e 64  |ock%,remain%,ind|
00002110  25 2b 69 6e 64 5f 6c 65  6e 25 2c 2d 31 2c 69 64  |%+ind_len%,-1,id|
00002120  25 2c 6e 65 78 74 25 20  b8 20 2c 2c 72 65 6d 61  |%,next% . ,,rema|
00002130  69 6e 25 2c 2c 2c 2c 6e  65 78 74 25 0d 0e 56 2d  |in%,,,,next%..V-|
00002140  c8 99 20 22 57 69 6d 70  5f 43 72 65 61 74 65 57  |.. "Wimp_CreateW|
00002150  69 6e 64 6f 77 22 2c 2c  62 6c 6f 63 6b 25 20 b8  |indow",,block% .|
00002160  20 69 6e 66 6f 62 6f 78  25 0d 0e 60 1b c8 99 20  | infobox%..`... |
00002170  22 57 69 6d 70 5f 43 6c  6f 73 65 54 65 6d 70 6c  |"Wimp_CloseTempl|
00002180  61 74 65 22 0d 0e 6a 05  e1 0d 0e 74 05 3a 0d 0e  |ate"..j....t.:..|
00002190  7e 05 3a 0d 0e 88 43 dd  20 f2 73 74 61 72 74 73  |~.:...C. .starts|
000021a0  61 76 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ave             |
000021b0  20 20 20 20 20 20 20 20  20 3a f4 20 73 74 61 72  |         :. star|
000021c0  74 69 6e 67 20 74 68 65  20 73 61 76 65 20 6d 65  |ting the save me|
000021d0  73 73 61 67 65 73 0d 0e  92 4d c8 99 20 22 57 69  |ssages...M.. "Wi|
000021e0  6d 70 5f 47 65 74 50 6f  69 6e 74 65 72 49 6e 66  |mp_GetPointerInf|
000021f0  6f 22 2c 2c 62 6c 6f 63  6b 25 20 20 20 20 20 20  |o",,block%      |
00002200  3a f4 20 67 65 74 20 69  6e 66 6f 20 6f 6e 20 77  |:. get info on w|
00002210  69 6e 64 6f 77 2b 69 63  6f 6e 20 6f 66 20 64 65  |indow+icon of de|
00002220  73 74 2e 0d 0e 9c 4c 62  6c 6f 63 6b 25 21 32 30  |st....Lblock%!20|
00002230  3d 62 6c 6f 63 6b 25 21  31 32 20 20 20 20 20 20  |=block%!12      |
00002240  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3a f4  |              :.|
00002250  20 74 61 73 6b 20 68 61  6e 64 6c 65 20 6f 72 20  | task handle or |
00002260  77 69 6e 64 6f 77 20 6f  66 20 64 65 73 74 2e 0d  |window of dest..|
00002270  0e a6 39 62 6c 6f 63 6b  25 21 32 34 3d 62 6c 6f  |..9block%!24=blo|
00002280  63 6b 25 21 31 36 20 20  20 20 20 20 20 20 20 20  |ck%!16          |
00002290  20 20 20 20 20 20 20 20  20 20 3a f4 20 69 63 6f  |          :. ico|
000022a0  6e 20 68 61 6e 64 6c 65  0d 0e b0 3c 62 6c 6f 63  |n handle...<bloc|
000022b0  6b 25 21 32 38 3d 21 62  6c 6f 63 6b 25 20 20 20  |k%!28=!block%   |
000022c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000022d0  20 20 20 3a f4 20 64 65  73 74 2e 20 78 20 63 6f  |   :. dest. x co|
000022e0  2d 6f 72 64 0d 0e ba 3c  62 6c 6f 63 6b 25 21 33  |-ord...<block%!3|
000022f0  32 3d 62 6c 6f 63 6b 25  21 34 20 20 20 20 20 20  |2=block%!4      |
00002300  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3a  |               :|
00002310  f4 20 64 65 73 74 2e 20  79 20 63 6f 2d 6f 72 64  |. dest. y co-ord|
00002320  0d 0e c4 3f 62 6c 6f 63  6b 25 21 33 36 3d 70 72  |...?block%!36=pr|
00002330  6f 67 6c 65 6e 25 20 20  20 20 20 20 20 20 20 20  |oglen%          |
00002340  20 20 20 20 20 20 20 20  20 20 20 3a f4 20 65 73  |           :. es|
00002350  74 2e 20 73 69 7a 65 20  6f 66 20 64 61 74 61 0d  |t. size of data.|
00002360  0e ce 3a 21 62 6c 6f 63  6b 25 3d 36 34 20 20 20  |..:!block%=64   |
00002370  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002380  20 20 20 20 20 20 20 20  20 20 3a f4 20 6c 65 6e  |          :. len|
00002390  20 6f 66 20 62 6c 6f 63  6b 0d 0e d8 44 62 6c 6f  | of block...Dblo|
000023a0  63 6b 25 21 31 32 3d 30  20 20 20 20 20 20 20 20  |ck%!12=0        |
000023b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000023c0  20 20 20 20 3a f4 20 79  6f 75 72 5f 72 65 66 20  |    :. your_ref |
000023d0  28 30 20 66 6f 72 20 73  74 61 72 74 29 0d 0e e2  |(0 for start)...|
000023e0  3c 62 6c 6f 63 6b 25 21  31 36 3d 31 20 20 20 20  |<block%!16=1    |
000023f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002400  20 20 20 20 20 20 20 20  3a f4 20 6d 65 73 73 61  |        :. messa|
00002410  67 65 20 61 63 74 69 6f  6e 0d 0e ec 37 62 6c 6f  |ge action...7blo|
00002420  63 6b 25 21 34 30 3d 26  46 46 38 20 20 20 20 20  |ck%!40=&FF8     |
00002430  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002440  20 20 20 20 3a f4 20 66  69 6c 65 20 74 79 70 65  |    :. file type|
00002450  0d 0e f6 35 24 28 62 6c  6f 63 6b 25 2b 34 34 29  |...5$(block%+44)|
00002460  3d a4 67 65 74 66 69 6c  65 6e 61 6d 65 28 24 73  |=.getfilename($s|
00002470  61 76 65 74 65 78 74 25  29 20 3a f4 20 66 69 6c  |avetext%) :. fil|
00002480  65 6e 61 6d 65 0d 0f 00  37 c8 99 20 22 57 69 6d  |ename...7.. "Wim|
00002490  70 5f 53 65 6e 64 4d 65  73 73 61 67 65 22 2c 31  |p_SendMessage",1|
000024a0  38 2c 62 6c 6f 63 6b 25  2c 62 6c 6f 63 6b 25 21  |8,block%,block%!|
000024b0  32 30 2c 62 6c 6f 63 6b  25 21 32 34 0d 0f 0a 05  |20,block%!24....|
000024c0  e1 0d 0f 14 05 3a 0d 0f  1e 05 3a 0d 0f 28 19 dd  |.....:....:..(..|
000024d0  20 a4 67 65 74 66 69 6c  65 6e 61 6d 65 28 70 61  | .getfilename(pa|
000024e0  74 68 24 29 0d 0f 32 46  c8 95 20 a7 70 61 74 68  |th$)..2F.. .path|
000024f0  24 2c 22 2e 22 29 20 20  20 20 20 20 20 20 20 20  |$,".")          |
00002500  20 20 20 20 20 20 3a f4  20 77 68 69 6c 65 20 74  |      :. while t|
00002510  68 65 72 65 20 69 73 20  73 74 69 6c 6c 20 61 20  |here is still a |
00002520  27 2e 27 20 69 6e 20 74  68 65 0d 0f 3c 43 20 70  |'.' in the..<C p|
00002530  61 74 68 24 3d c1 70 61  74 68 24 2c a7 70 61 74  |ath$=.path$,.pat|
00002540  68 24 2c 22 2e 22 29 2b  31 29 20 3a f4 20 6e 61  |h$,".")+1) :. na|
00002550  6d 65 2c 20 73 68 6f 72  74 65 6e 20 69 74 2c 20  |me, shorten it, |
00002560  73 74 61 72 74 69 6e 67  20 66 72 6f 6d 0d 0f 46  |starting from..F|
00002570  2e ce 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
00002580  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002590  3a f4 20 74 68 61 74 20  27 2e 27 0d 0f 50 0d 3d  |:. that '.'..P.=|
000025a0  70 61 74 68 24 2b bd 30  0d 0f 5a 05 3a 0d 0f 64  |path$+.0..Z.:..d|
000025b0  05 3a 0d 0f 6e 47 dd 20  f2 64 61 74 61 73 61 76  |.:..nG. .datasav|
000025c0  65 20 3a f4 20 4f 4b 20  74 6f 20 73 61 76 65 20  |e :. OK to save |
000025d0  6e 6f 77 2c 20 74 68 65  6e 20 73 65 6e 64 20 6d  |now, then send m|
000025e0  65 73 73 61 67 65 20 74  6f 20 63 6f 6e 66 69 72  |essage to confir|
000025f0  6d 20 4f 4b 20 73 61 76  65 0d 0f 78 4a 24 73 61  |m OK save..xJ$sa|
00002600  76 65 74 65 78 74 25 3d  a4 67 65 74 73 74 72 28  |vetext%=.getstr(|
00002610  62 6c 6f 63 6b 25 2b 34  34 29 20 3a f4 20 70 75  |block%+44) :. pu|
00002620  74 20 66 75 6c 6c 20 70  61 74 68 6e 61 6d 65 20  |t full pathname |
00002630  69 6e 20 73 61 76 65 20  77 69 6e 64 6f 77 20 74  |in save window t|
00002640  65 78 74 0d 0f 82 2e f2  64 6f 74 68 65 73 61 76  |ext.....dothesav|
00002650  65 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e               |
00002660  20 20 20 3a f4 20 64 6f  20 74 68 65 20 73 61 76  |   :. do the sav|
00002670  65 0d 0f 8c 49 62 6c 6f  63 6b 25 21 31 32 3d 62  |e...Iblock%!12=b|
00002680  6c 6f 63 6b 25 21 38 20  20 20 20 20 20 20 20 20  |lock%!8         |
00002690  20 20 20 20 3a f4 20 70  75 74 20 68 69 73 20 72  |    :. put his r|
000026a0  65 66 2e 20 69 6e 20 27  79 6f 75 72 20 72 65 66  |ef. in 'your ref|
000026b0  2e 27 20 73 65 63 74 69  6f 6e 0d 0f 96 49 62 6c  |.' section...Ibl|
000026c0  6f 63 6b 25 21 31 36 3d  33 3a 21 62 6c 6f 63 6b  |ock%!16=3:!block|
000026d0  25 3d 32 35 36 20 20 20  20 20 20 20 20 3a f4 20  |%=256        :. |
000026e0  6d 65 73 73 61 67 65 20  63 6f 64 65 20 33 2c 20  |message code 3, |
000026f0  6d 61 78 2e 20 6e 61 6d  65 20 6c 65 6e 20 2d 20  |max. name len - |
00002700  32 35 36 0d 0f a0 4c c8  99 20 22 57 69 6d 70 5f  |256...L.. "Wimp_|
00002710  53 65 6e 64 4d 65 73 73  61 67 65 22 2c 31 38 2c  |SendMessage",18,|
00002720  62 6c 6f 63 6b 25 2c 62  6c 6f 63 6b 25 21 32 30  |block%,block%!20|
00002730  2c 62 6c 6f 63 6b 25 21  32 34 20 20 3a f4 20 73  |,block%!24  :. s|
00002740  65 6e 64 20 44 61 74 61  4c 6f 61 64 41 63 6b 0d  |end DataLoadAck.|
00002750  0f aa 17 e7 20 62 75 74  74 6f 6e 73 25 3d 28 31  |.... buttons%=(1|
00002760  3c 3c 34 29 20 8c 0d 0f  b4 4b 20 c8 99 20 22 57  |<<4) ....K .. "W|
00002770  69 6d 70 5f 46 6f 72 63  65 52 65 64 72 61 77 22  |imp_ForceRedraw"|
00002780  2c 73 61 76 65 5f 77 69  6e 64 6f 77 25 2c 31 30  |,save_window%,10|
00002790  2c 2d 31 35 36 2c 31 38  34 2c 2d 31 32 30 20 3a  |,-156,184,-120 :|
000027a0  f4 20 75 70 64 61 74 65  20 70 61 74 68 6e 61 6d  |. update pathnam|
000027b0  65 0d 0f be 05 cc 0d 0f  c8 10 20 f2 63 6c 6f 73  |e......... .clos|
000027c0  65 6d 65 6e 75 73 0d 0f  d2 05 cd 0d 0f dc 05 e1  |emenus..........|
000027d0  0d 0f e6 05 3a 0d 0f f0  05 3a 0d 0f fa 10 dd 20  |....:....:..... |
000027e0  f2 71 75 69 63 6b 73 61  76 65 0d 10 04 18 e7 20  |.quicksave..... |
000027f0  a7 24 73 61 76 65 74 65  78 74 25 2c 22 2e 22 29  |.$savetext%,".")|
00002800  20 8c 0d 10 0e 4c 20 f2  64 6f 74 68 65 73 61 76  | ....L .dothesav|
00002810  65 20 20 3a f4 20 69 66  20 6e 61 6d 65 20 68 61  |e  :. if name ha|
00002820  73 20 61 20 27 2e 27 20  74 68 65 6e 20 69 74 20  |s a '.' then it |
00002830  69 73 20 70 72 6f 62 20  61 20 70 61 74 68 6e 61  |is prob a pathna|
00002840  6d 65 2c 20 73 6f 20 73  61 76 65 20 69 74 0d 10  |me, so save it..|
00002850  18 05 cc 0d 10 22 12 20  e7 20 6d 65 6e 75 73 61  |.....". . menusa|
00002860  76 65 25 20 8c 0d 10 2c  26 20 20 c8 99 20 22 57  |ve% ...,&  .. "W|
00002870  69 6d 70 5f 47 65 74 50  6f 69 6e 74 65 72 49 6e  |imp_GetPointerIn|
00002880  66 6f 22 2c 2c 62 6c 6f  63 6b 25 0d 10 36 34 20  |fo",,block%..64 |
00002890  20 f2 73 68 6f 77 6d 65  6e 75 28 73 61 76 65 5f  | .showmenu(save_|
000028a0  77 69 6e 64 6f 77 25 2c  21 62 6c 6f 63 6b 25 2d  |window%,!block%-|
000028b0  35 30 2c 62 6c 6f 63 6b  25 21 34 2b 35 30 29 0d  |50,block%!4+50).|
000028c0  10 40 06 20 cc 0d 10 4a  4a 20 20 63 6c 69 63 6b  |.@. ...JJ  click|
000028d0  25 3d a4 65 72 72 6f 72  62 6f 78 28 22 54 6f 20  |%=.errorbox("To |
000028e0  73 61 76 65 2c 20 64 72  61 67 20 74 68 65 20 69  |save, drag the i|
000028f0  63 6f 6e 20 74 6f 20 61  20 64 69 72 65 63 74 6f  |con to a directo|
00002900  72 79 20 64 69 73 70 6c  61 79 22 2c 31 37 29 0d  |ry display",17).|
00002910  10 54 06 20 cd 0d 10 5e  05 cd 0d 10 68 0f 6d 65  |.T. ...^....h.me|
00002920  6e 75 73 61 76 65 25 3d  a3 0d 10 72 05 e1 0d 10  |nusave%=...r....|
00002930  7c 05 3a 0d 10 86 05 3a  0d 10 90 10 dd 20 f2 64  ||.:....:..... .d|
00002940  6f 74 68 65 73 61 76 65  0d 10 9a 2c ff 22 53 61  |othesave...,."Sa|
00002950  76 65 20 22 2b 24 73 61  76 65 74 65 78 74 25 2b  |ve "+$savetext%+|
00002960  22 20 22 2b c3 7e 63 6f  64 65 25 2b 22 20 22 2b  |" "+.~code%+" "+|
00002970  c3 7e 4f 25 0d 10 a4 26  ff 22 53 65 74 74 79 70  |.~O%...&."Settyp|
00002980  65 20 22 2b 24 73 61 76  65 74 65 78 74 25 2b 22  |e "+$savetext%+"|
00002990  20 41 62 73 6f 6c 75 74  65 22 0d 10 ae 05 e1 0d  | Absolute"......|
000029a0  10 b8 05 3a 0d 10 c2 05  3a 0d 10 cc 22 dd 20 a4  |...:....:...". .|
000029b0  66 69 6e 64 74 65 78 74  61 64 64 72 28 77 69 6e  |findtextaddr(win|
000029c0  64 6f 77 25 2c 69 63 6f  6e 25 29 0d 10 d6 13 21  |dow%,icon%)....!|
000029d0  62 6c 6f 63 6b 25 3d 77  69 6e 64 6f 77 25 0d 10  |block%=window%..|
000029e0  e0 12 62 6c 6f 63 6b 25  21 34 3d 69 63 6f 6e 25  |..block%!4=icon%|
000029f0  0d 10 ea 22 c8 99 20 22  57 69 6d 70 5f 47 65 74  |...".. "Wimp_Get|
00002a00  49 63 6f 6e 53 74 61 74  65 22 2c 2c 62 6c 6f 63  |IconState",,bloc|
00002a10  6b 25 0d 10 f4 0e 3d 62  6c 6f 63 6b 25 21 32 38  |k%....=block%!28|
00002a20  0d 10 fe 05 3a 0d 11 08  05 3a 0d 11 12 17 dd f2  |....:....:......|
00002a30  67 65 74 77 6f 72 6b 69  6e 67 28 66 69 6c 65 24  |getworking(file$|
00002a40  29 0d 11 1c 15 c8 99 20  22 48 6f 75 72 67 6c 61  |)...... "Hourgla|
00002a50  73 73 5f 4f 6e 22 0d 11  26 23 e7 20 6c 6f 61 64  |ss_On"..&#. load|
00002a60  65 64 25 20 8c 20 f2 72  65 6c 65 61 73 65 5f 6d  |ed% . .release_m|
00002a70  65 6d 28 63 6f 64 65 25  29 0d 11 30 12 78 3d 8e  |em(code%)..0.x=.|
00002a80  28 70 61 74 68 6e 61 6d  65 24 29 0d 11 3a 10 70  |(pathname$)..:.p|
00002a90  72 6f 67 6c 65 6e 25 3d  a2 23 78 0d 11 44 07 d9  |roglen%=.#x..D..|
00002aa0  23 78 0d 11 4e 06 20 3a  0d 11 58 1b 63 6f 64 65  |#x..N. :..X.code|
00002ab0  5f 6c 65 6e 25 3d 31 30  32 34 2b 70 72 6f 67 6c  |_len%=1024+progl|
00002ac0  65 6e 25 0d 11 62 1f 63  6f 64 65 25 3d a4 63 6c  |en%..b.code%=.cl|
00002ad0  61 69 6d 5f 6d 65 6d 28  63 6f 64 65 5f 6c 65 6e  |aim_mem(code_len|
00002ae0  25 29 0d 11 6c 10 6c 65  6e 3d 70 72 6f 67 6c 65  |%)..l.len=progle|
00002af0  6e 25 0d 11 76 0f e7 20  64 6f 70 61 73 73 25 20  |n%..v.. dopass% |
00002b00  8c 0d 11 80 0d 20 f2 70  77 5f 61 73 73 6d 0d 11  |..... .pw_assm..|
00002b10  8a 26 20 ff 22 4c 6f 61  64 20 22 2b 66 69 6c 65  |.& ."Load "+file|
00002b20  24 2b 22 20 22 2b c3 7e  28 66 69 6c 65 2b 63 6f  |$+" "+.~(file+co|
00002b30  64 65 25 29 0d 11 94 1e  20 e3 20 73 74 6f 72 65  |de%).... . store|
00002b40  3d 31 20 b8 20 a9 28 24  70 61 73 73 77 6f 72 64  |=1 . .($password|
00002b50  25 29 0d 11 9e 33 20 20  3f 28 70 61 73 73 2b 63  |%)...3  ?(pass+c|
00002b60  6f 64 65 25 2b 73 74 6f  72 65 2d 31 29 3d 97 28  |ode%+store-1)=.(|
00002b70  c1 24 70 61 73 73 77 6f  72 64 25 2c 73 74 6f 72  |.$password%,stor|
00002b80  65 2c 31 29 29 0d 11 a8  06 20 ed 0d 11 b2 0f 20  |e,1)).... ..... |
00002b90  f2 70 77 5f 65 6e 63 6f  64 65 0d 11 bc 05 cc 0d  |.pw_encode......|
00002ba0  11 c6 0e 20 f2 6e 6f 70  5f 61 73 73 6d 0d 11 d0  |... .nop_assm...|
00002bb0  26 20 ff 22 4c 6f 61 64  20 22 2b 66 69 6c 65 24  |& ."Load "+file$|
00002bc0  2b 22 20 22 2b c3 7e 28  66 69 6c 65 2b 63 6f 64  |+" "+.~(file+cod|
00002bd0  65 25 29 0d 11 da 05 cd  0d 11 e4 0d 6c 6f 61 64  |e%).........load|
00002be0  65 64 25 3d b9 0d 11 ee  1e f2 73 68 61 64 65 5f  |ed%=......shade_|
00002bf0  6f 66 66 28 69 63 6f 6e  62 61 72 6d 65 6e 75 25  |off(iconbarmenu%|
00002c00  2c 32 29 0d 11 f8 06 20  3a 0d 12 02 24 c8 99 20  |,2).... :...$.. |
00002c10  22 57 69 6d 70 5f 47 65  74 50 6f 69 6e 74 65 72  |"Wimp_GetPointer|
00002c20  49 6e 66 6f 22 2c 2c 62  6c 6f 63 6b 25 0d 12 0c  |Info",,block%...|
00002c30  32 f2 73 68 6f 77 6d 65  6e 75 28 73 61 76 65 5f  |2.showmenu(save_|
00002c40  77 69 6e 64 6f 77 25 2c  21 62 6c 6f 63 6b 25 2d  |window%,!block%-|
00002c50  35 30 2c 62 6c 6f 63 6b  25 21 34 2b 35 30 29 0d  |50,block%!4+50).|
00002c60  12 16 16 c8 99 20 22 48  6f 75 72 67 6c 61 73 73  |..... "Hourglass|
00002c70  5f 4f 66 66 22 0d 12 20  05 e1 0d 12 2a 05 3a 0d  |_Off".. ....*.:.|
00002c80  12 34 05 3a 0d 12 3e 0d  dd 20 f2 75 6e 6c 6f 61  |.4.:..>.. .unloa|
00002c90  64 0d 12 48 23 e7 20 6c  6f 61 64 65 64 25 20 8c  |d..H#. loaded% .|
00002ca0  20 f2 72 65 6c 65 61 73  65 5f 6d 65 6d 28 63 6f  | .release_mem(co|
00002cb0  64 65 25 29 0d 12 52 0d  6c 6f 61 64 65 64 25 3d  |de%)..R.loaded%=|
00002cc0  a3 0d 12 5c 1d f2 73 68  61 64 65 5f 6f 6e 28 69  |...\..shade_on(i|
00002cd0  63 6f 6e 62 61 72 6d 65  6e 75 25 2c 32 29 0d 12  |conbarmenu%,2)..|
00002ce0  66 05 e1 0d 12 70 05 3a  0d 12 7a 05 3a 0d 12 84  |f....p.:..z.:...|
00002cf0  44 dd 20 f2 61 6c 74 65  72 62 61 72 69 63 6f 6e  |D. .alterbaricon|
00002d00  20 3a 20 f4 20 2a 2a 2a  2a 2a 2a 2a 2a 2a 20 54  | : . ********* T|
00002d10  68 69 73 20 50 52 4f 43  20 69 73 20 63 75 72 72  |his PROC is curr|
00002d20  65 6e 74 6c 79 20 6e 6f  74 20 75 73 65 64 21 21  |ently not used!!|
00002d30  21 0d 12 8e 4c 21 62 6c  6f 63 6b 25 3d 2d 31 20  |!...L!block%=-1 |
00002d40  20 20 20 20 20 20 20 20  20 20 3a 20 f4 20 69 74  |          : . it|
00002d50  20 61 6c 73 6f 20 72 65  71 75 69 72 65 73 20 74  | also requires t|
00002d60  68 65 20 69 62 61 72 20  69 63 6f 6e 20 74 6f 20  |he ibar icon to |
00002d70  62 65 20 69 6e 64 69 72  65 63 74 65 64 0d 12 98  |be indirected...|
00002d80  19 62 6c 6f 63 6b 25 21  34 3d 69 63 6f 6e 62 61  |.block%!4=iconba|
00002d90  72 69 63 6f 6e 25 0d 12  a2 22 c8 99 20 22 57 69  |ricon%...".. "Wi|
00002da0  6d 70 5f 47 65 74 49 63  6f 6e 53 74 61 74 65 22  |mp_GetIconState"|
00002db0  2c 2c 62 6c 6f 63 6b 25  0d 12 ac 47 e7 20 70 72  |,,block%...G. pr|
00002dc0  6f 63 65 73 73 69 6e 67  25 20 8c 20 24 28 62 6c  |ocessing% . $(bl|
00002dd0  6f 63 6b 25 21 32 38 29  3d 22 70 72 6f 63 65 73  |ock%!28)="proces|
00002de0  73 69 6e 67 22 20 8b 20  24 28 62 6c 6f 63 6b 25  |sing" . $(block%|
00002df0  21 32 38 29 3d 22 21 61  75 74 6f 72 75 6e 22 0d  |!28)="!autorun".|
00002e00  12 b6 43 c8 99 20 22 57  69 6d 70 5f 46 6f 72 63  |..C.. "Wimp_Forc|
00002e10  65 52 65 64 72 61 77 22  2c 2d 32 2c 62 6c 6f 63  |eRedraw",-2,bloc|
00002e20  6b 25 21 38 2c 62 6c 6f  63 6b 25 21 31 32 2c 62  |k%!8,block%!12,b|
00002e30  6c 6f 63 6b 25 21 31 36  2c 62 6c 6f 63 6b 25 21  |lock%!16,block%!|
00002e40  32 30 0d 12 c0 05 e1 0d  12 ca 05 3a 0d 12 d4 05  |20.........:....|
00002e50  3a 0d 12 de 17 dd 20 a4  63 6c 61 69 6d 5f 6d 65  |:..... .claim_me|
00002e60  6d 28 73 69 7a 65 25 29  0d 12 e8 25 c8 99 20 22  |m(size%)...%.. "|
00002e70  4f 53 5f 4d 6f 64 75 6c  65 22 2c 36 2c 2c 2c 73  |OS_Module",6,,,s|
00002e80  69 7a 65 25 20 b8 20 2c  2c 70 74 72 25 0d 12 f2  |ize% . ,,ptr%...|
00002e90  09 3d 70 74 72 25 0d 12  fc 05 3a 0d 13 06 05 3a  |.=ptr%....:....:|
00002ea0  0d 13 10 18 dd 20 f2 72  65 6c 65 61 73 65 5f 6d  |..... .release_m|
00002eb0  65 6d 28 70 74 72 25 29  0d 13 1a 1a c8 99 20 22  |em(ptr%)...... "|
00002ec0  4f 53 5f 4d 6f 64 75 6c  65 22 2c 37 2c 2c 70 74  |OS_Module",7,,pt|
00002ed0  72 25 0d 13 24 05 e1 0d  13 2e 05 3a 0d 13 38 4c  |r%..$......:..8L|
00002ee0  f4 20 48 65 6c 6c 6f 20  68 61 63 6b 65 72 21 20  |. Hello hacker! |
00002ef0  50 6c 65 61 73 65 20 6e  6f 74 65 2c 20 69 74 20  |Please note, it |
00002f00  69 73 20 69 6d 70 6f 73  73 69 62 6c 65 20 28 77  |is impossible (w|
00002f10  65 6c 6c 2c 20 76 65 72  79 20 68 61 72 64 29 20  |ell, very hard) |
00002f20  74 6f 20 63 72 61 63 6b  0d 13 42 4c f4 20 61 20  |to crack..BL. a |
00002f30  70 61 73 73 77 6f 72 64  65 64 20 70 72 6f 67 72  |passworded progr|
00002f40  61 6d 20 2d 20 6c 6f 6f  6b 20 61 74 20 74 68 65  |am - look at the|
00002f50  20 66 6f 6c 6c 6f 77 69  6e 67 20 61 73 73 65 6d  | following assem|
00002f60  62 6c 65 72 20 62 69 74  2c 20 74 6f 20 73 65 65  |bler bit, to see|
00002f70  2e 2e 2e 2e 0d 13 4c 05  3a 0d 13 56 3f f4 20 50  |......L.:..V?. P|
00002f80  68 6f 65 6e 69 78 20 6f  66 20 51 55 41 4e 54 55  |hoenix of QUANTU|
00002f90  4d 20 28 6d 65 29 20 73  61 79 73 20 68 65 6c 6c  |M (me) says hell|
00002fa0  6f 20 74 6f 20 42 65 6e  20 43 61 72 74 65 72 2c  |o to Ben Carter,|
00002fb0  20 47 61 72 79 20 44 2c  0d 13 60 44 f4 20 4c 65  | Gary D,..`D. Le|
00002fc0  6f 6e 20 48 2c 20 54 69  6d 2c 20 61 6e 64 20 65  |on H, Tim, and e|
00002fd0  76 65 72 79 6f 6e 65 20  6f 75 74 20 74 68 65 72  |veryone out ther|
00002fe0  65 20 69 6e 20 51 20 55  20 41 20 4e 20 54 20 55  |e in Q U A N T U|
00002ff0  20 4d 20 2d 20 73 65 65  20 79 61 21 0d 13 6a 05  | M - see ya!..j.|
00003000  3a 0d 13 74 28 f4 20 3e  41 75 74 6f 52 75 6e 50  |:..t(. >AutoRunP|
00003010  53 20 28 41 75 74 6f 52  75 6e 49 49 20 26 20 49  |S (AutoRunII & I|
00003020  49 49 29 20 76 33 2e 31  31 0d 13 7e 37 f4 20 4d  |II) v3.11..~7. M|
00003030  61 63 68 69 6e 65 20 63  6f 64 65 20 73 68 65 6c  |achine code shel|
00003040  6c 20 2b 20 70 61 73 73  77 6f 72 64 20 66 6f 72  |l + password for|
00003050  20 61 20 42 61 69 73 63  20 70 72 6f 67 72 61 6d  | a Baisc program|
00003060  0d 13 88 44 f4 20 4e 6f  77 20 63 72 65 61 74 65  |...D. Now create|
00003070  73 20 27 41 62 73 6f 6c  75 74 65 27 20 4d 2f 43  |s 'Absolute' M/C|
00003080  20 66 69 6c 65 73 20 66  6f 72 20 6f 75 74 70 75  | files for outpu|
00003090  74 20 66 69 6c 65 73 20  28 61 74 20 6c 61 73 74  |t files (at last|
000030a0  21 21 21 29 0d 13 92 44  f4 20 4f 6e 6c 79 20 61  |!!!)...D. Only a|
000030b0  64 64 73 20 31 37 34 20  28 2b 2f 2d 20 34 29 20  |dds 174 (+/- 4) |
000030c0  62 79 74 65 73 20 74 6f  20 6f 72 69 67 6e 61 6c  |bytes to orignal|
000030d0  20 66 69 6c 65 20 66 6f  72 20 6e 6f 20 70 61 73  | file for no pas|
000030e0  73 77 6f 72 64 21 21 21  0d 13 9c 33 f4 20 6f 72  |sword!!!...3. or|
000030f0  20 35 34 38 20 28 2b 2f  2d 20 34 29 20 62 79 74  | 548 (+/- 4) byt|
00003100  65 73 20 69 66 20 79 6f  75 20 75 73 65 20 61 20  |es if you use a |
00003110  70 61 73 73 77 6f 72 64  2e 2e 2e 0d 13 a6 1f f4  |password........|
00003120  20 a9 20 31 39 39 32 2f  33 20 53 74 65 70 68 65  | . 1992/3 Stephe|
00003130  6e 20 48 61 72 72 69 73  6f 6e 0d 13 b0 05 3a 0d  |n Harrison....:.|
00003140  13 ba 05 3a 0d 13 c4 0f  dd 20 f2 6e 6f 70 5f 73  |...:..... .nop_s|
00003150  61 76 65 0d 13 ce 26 ff  22 53 61 76 65 20 22 2b  |ave...&."Save "+|
00003160  6d 66 6e 24 2b 22 20 22  2b c3 7e 63 6f 64 65 25  |mfn$+" "+.~code%|
00003170  2b 22 20 22 2b c3 7e 4f  25 0d 13 d8 20 ff 22 53  |+" "+.~O%... ."S|
00003180  65 74 74 79 70 65 20 22  2b 6d 66 6e 24 2b 22 20  |ettype "+mfn$+" |
00003190  41 62 73 6f 6c 75 74 65  22 0d 13 e2 05 e1 0d 13  |Absolute".......|
000031a0  ec 05 3a 0d 13 f6 0f dd  20 f2 6e 6f 70 5f 61 73  |..:..... .nop_as|
000031b0  73 6d 0d 14 00 32 73 74  61 63 6b 5f 73 69 7a 65  |sm...2stack_size|
000031c0  25 3d 34 20 20 20 20 20  20 20 20 20 20 20 3a f4  |%=4           :.|
000031d0  20 6f 6e 6c 79 20 73 74  6f 72 69 6e 67 20 72 31  | only storing r1|
000031e0  34 21 21 21 0d 14 0a 12  e3 20 49 3d 31 32 20 b8  |4!!!..... I=12 .|
000031f0  20 31 34 20 88 32 0d 14  14 24 4f 25 3d 63 6f 64  | 14 .2...$O%=cod|
00003200  65 25 3a 50 25 3d 30 3a  4c 25 3d 63 6f 64 65 25  |e%:P%=0:L%=code%|
00003210  2b 63 6f 64 65 5f 6c 65  6e 25 0d 14 1e 05 3a 0d  |+code_len%....:.|
00003220  14 28 0a 5b 4f 50 54 20  49 0d 14 32 0a 2e 73 74  |.(.[OPT I..2..st|
00003230  61 72 74 0d 14 3c 2f 4c  44 52 20 52 32 2c 65 6e  |art..</LDR R2,en|
00003240  64 70 6f 73 20 20 20 20  20 3b 72 32 3d 6f 66 66  |dpos     ;r2=off|
00003250  73 65 74 20 74 6f 20 65  6e 64 20 6f 66 20 70 72  |set to end of pr|
00003260  6f 67 0d 14 46 1f 41 44  52 20 52 33 2c 73 74 61  |og..F.ADR R3,sta|
00003270  72 74 20 20 20 20 20 20  3b 72 33 3d 73 74 61 72  |rt      ;r3=star|
00003280  74 0d 14 50 2a 41 44 44  20 52 30 2c 52 32 2c 52  |t..P*ADD R0,R2,R|
00003290  33 20 20 20 20 20 20 3b  72 30 3d 72 65 61 6c 20  |3      ;r0=real |
000032a0  65 6e 64 20 6f 66 20 70  72 6f 67 0d 14 5a 4d 41  |end of prog..ZMA|
000032b0  44 44 20 52 31 2c 52 30  2c 23 26 46 30 30 20 20  |DD R1,R0,#&F00  |
000032c0  20 3b 72 31 3d 73 68 69  66 74 20 61 6c 6c 20 74  | ;r1=shift all t|
000032d0  68 65 20 63 6f 64 65 20  66 6f 72 77 61 72 64 20  |he code forward |
000032e0  62 79 20 26 46 30 30 20  28 72 6f 6f 6d 20 66 6f  |by &F00 (room fo|
000032f0  72 20 42 41 53 49 43 29  0d 14 64 0b 2e 6d 6f 76  |r BASIC)..d..mov|
00003300  65 69 74 0d 14 6e 40 4c  44 52 20 52 33 2c 5b 52  |eit..n@LDR R3,[R|
00003310  30 5d 2c 23 2d 34 20 20  20 3b 6c 6f 61 64 20 72  |0],#-4   ;load r|
00003320  33 20 77 69 74 68 20 77  6f 72 64 20 28 26 20 74  |3 with word (& t|
00003330  68 65 6e 20 74 61 6b 65  20 34 20 66 72 6f 6d 20  |hen take 4 from |
00003340  72 30 29 0d 14 78 3d 53  54 52 20 52 33 2c 5b 52  |r0)..x=STR R3,[R|
00003350  31 5d 2c 23 2d 34 20 20  20 3b 73 74 6f 72 65 20  |1],#-4   ;store |
00003360  72 33 20 61 74 20 72 31  20 28 26 20 74 68 65 6e  |r3 at r1 (& then|
00003370  20 74 61 6b 65 20 34 20  66 72 6f 6d 20 72 31 29  | take 4 from r1)|
00003380  0d 14 82 25 53 55 42 53  20 52 32 2c 52 32 2c 23  |...%SUBS R2,R2,#|
00003390  34 20 20 20 20 20 3b 74  61 6b 65 20 34 20 66 72  |4     ;take 4 fr|
000033a0  6f 6d 20 72 32 0d 14 8c  2e 42 4e 45 20 6d 6f 76  |om r2....BNE mov|
000033b0  65 69 74 20 20 20 20 20  20 20 20 3b 69 66 20 72  |eit        ;if r|
000033c0  32 20 6e 6f 74 20 30 20  74 68 65 6e 20 72 65 70  |2 not 0 then rep|
000033d0  65 61 74 0d 14 96 3b 41  44 52 20 52 31 32 2c 73  |eat...;ADR R12,s|
000033e0  74 61 72 74 20 20 20 20  20 3b 67 65 74 20 72 31  |tart     ;get r1|
000033f0  32 3d 73 74 61 72 74 20  28 66 6f 72 20 66 75 74  |2=start (for fut|
00003400  75 72 65 20 72 65 66 65  72 65 6e 63 65 29 0d 14  |ure reference)..|
00003410  a0 38 42 20 63 6f 6e 74  69 6e 75 65 2b 26 46 30  |.8B continue+&F0|
00003420  30 20 20 20 3b 65 76 65  72 79 74 68 69 6e 67 20  |0   ;everything |
00003430  69 73 20 6e 6f 77 20 26  46 30 30 20 66 6f 72 77  |is now &F00 forw|
00003440  61 72 64 21 21 21 0d 14  aa 05 3a 0d 14 b4 22 2e  |ard!!!....:...".|
00003450  65 6e 64 70 6f 73 20 20  20 20 20 20 20 20 20 20  |endpos          |
00003460  20 3b 65 6e 64 20 6f 66  20 66 69 6c 65 0d 14 be  | ;end of file...|
00003470  0c 45 51 55 44 20 65 6e  64 0d 14 c8 05 3a 0d 14  |.EQUD end....:..|
00003480  d2 2b 2e 66 69 6c 65 20  20 20 20 20 20 20 20 20  |.+.file         |
00003490  20 20 20 20 3b 42 61 73  69 63 20 66 69 6c 65 20  |    ;Basic file |
000034a0  67 6f 65 73 20 68 65 72  65 0d 14 dc 05 5d 0d 14  |goes here....]..|
000034b0  e6 13 50 25 2b 3d 6c 65  6e 3a 4f 25 2b 3d 6c 65  |..P%+=len:O%+=le|
000034c0  6e 0d 14 f0 09 5b 4f 50  54 49 0d 14 fa 2f 41 4c  |n....[OPTI.../AL|
000034d0  49 47 4e 20 20 20 20 20  20 20 20 20 20 20 20 20  |IGN             |
000034e0  3b 61 6e 64 20 68 65 72  65 20 69 73 2e 2e 2e 20  |;and here is... |
000034f0  54 48 45 20 53 54 41 43  4b 0d 15 04 05 5d 0d 15  |THE STACK....]..|
00003500  0e 23 50 25 2b 3d 73 74  61 63 6b 5f 73 69 7a 65  |.#P%+=stack_size|
00003510  25 3a 4f 25 2b 3d 73 74  61 63 6b 5f 73 69 7a 65  |%:O%+=stack_size|
00003520  25 0d 15 18 09 5b 4f 50  54 49 0d 15 22 38 2e 73  |%....[OPTI.."8.s|
00003530  74 61 63 6b 20 20 20 20  20 20 20 20 20 20 20 20  |tack            |
00003540  3b 73 74 61 63 6b 69 6e  67 20 62 61 63 6b 77 61  |;stacking backwa|
00003550  72 64 73 2e 2e 2e 20 28  49 20 68 6f 70 65 21 21  |rds... (I hope!!|
00003560  21 29 0d 15 2c 05 3a 0d  15 36 0c 2e 66 69 6c 65  |!)..,.:..6..file|
00003570  70 6f 73 0d 15 40 3a 45  51 55 44 20 66 69 6c 65  |pos..@:EQUD file|
00003580  2b 26 46 30 30 20 20 20  20 3b 70 6f 73 69 74 69  |+&F00    ;positi|
00003590  6f 6e 20 6f 66 20 66 69  6c 65 20 28 6e 6f 77 20  |on of file (now |
000035a0  26 66 30 30 20 66 6f 72  77 61 72 64 29 0d 15 4a  |&f00 forward)..J|
000035b0  05 3a 0d 15 54 0d 2e 63  6f 6e 74 69 6e 75 65 0d  |.:..T..continue.|
000035c0  15 5e 29 4c 44 52 20 52  31 2c 66 69 6c 65 70 6f  |.^)LDR R1,filepo|
000035d0  73 20 20 20 20 3b 66 69  6c 65 20 6f 66 66 73 65  |s    ;file offse|
000035e0  74 20 66 72 6f 6d 20 30  0d 15 68 3d 41 44 44 20  |t from 0..h=ADD |
000035f0  52 31 2c 52 31 2c 52 31  32 20 20 20 20 20 3b 72  |R1,R1,R12     ;r|
00003600  31 32 3d 73 74 61 72 74  20 6f 66 20 70 72 6f 67  |12=start of prog|
00003610  2c 20 73 6f 20 72 31 3d  66 69 6c 65 20 70 6f 73  |, so r1=file pos|
00003620  69 74 69 6f 6e 0d 15 72  25 53 54 52 20 52 31 2c  |ition..r%STR R1,|
00003630  66 69 6c 65 70 6f 73 20  20 20 20 3b 73 74 6f 72  |filepos    ;stor|
00003640  65 20 66 69 6c 65 20 70  6f 73 0d 15 7c 24 41 44  |e file pos..|$AD|
00003650  52 20 52 31 33 2c 73 74  61 63 6b 20 20 20 20 20  |R R13,stack     |
00003660  3b 72 31 33 3d 6f 75 72  20 73 74 61 63 6b 0d 15  |;r13=our stack..|
00003670  86 20 53 54 4d 46 44 20  52 31 33 21 2c 7b 52 31  |. STMFD R13!,{R1|
00003680  34 7d 20 20 3b 73 74 6f  72 65 20 72 31 34 0d 15  |4}  ;store r14..|
00003690  90 24 4c 44 52 20 52 30  2c 66 69 6c 65 70 6f 73  |.$LDR R0,filepos|
000036a0  20 20 20 20 3b 66 69 6c  65 20 70 6f 73 69 74 69  |    ;file positi|
000036b0  6f 6e 0d 15 9a 30 41 44  52 20 52 31 2c 70 6f 73  |on...0ADR R1,pos|
000036c0  69 74 69 6f 6e 20 20 20  3b 70 6f 73 69 74 69 6f  |ition   ;positio|
000036d0  6e 20 69 6e 20 6f 75 74  70 75 74 20 73 74 72 69  |n in output stri|
000036e0  6e 67 0d 15 a4 22 4d 4f  56 20 52 32 2c 23 39 20  |ng..."MOV R2,#9 |
000036f0  20 20 20 20 20 20 20 20  3b 62 75 66 66 65 72 20  |        ;buffer |
00003700  73 69 7a 65 0d 15 ae 41  53 57 49 20 22 4f 53 5f  |size...ASWI "OS_|
00003710  43 6f 6e 76 65 72 74 48  65 78 38 22 20 20 20 3b  |ConvertHex8"   ;|
00003720  69 6e 73 65 72 74 20 74  68 65 20 70 6f 73 69 74  |insert the posit|
00003730  69 6f 6e 20 6f 66 20 74  68 65 20 42 61 73 69 63  |ion of the Basic|
00003740  20 66 69 6c 65 0d 15 b8  22 4c 44 52 20 52 30 2c  | file..."LDR R0,|
00003750  66 69 6c 65 6c 65 6e 20  20 20 20 3b 6c 65 6e 20  |filelen    ;len |
00003760  6f 66 20 66 69 6c 65 0d  15 c2 24 4c 44 52 20 52  |of file...$LDR R|
00003770  31 2c 66 69 6c 65 70 6f  73 20 20 20 20 3b 66 69  |1,filepos    ;fi|
00003780  6c 65 20 70 6f 73 69 74  69 6f 6e 0d 15 cc 31 41  |le position...1A|
00003790  44 44 20 52 30 2c 52 30  2c 52 31 20 20 20 20 20  |DD R0,R0,R1     |
000037a0  20 3b 6e 6f 77 20 3d 20  65 6e 64 20 6f 66 20 66  | ;now = end of f|
000037b0  69 6c 65 20 70 6f 73 69  74 69 6f 6e 0d 15 d6 29  |ile position...)|
000037c0  41 44 52 20 52 31 2c 6c  65 6e 67 74 68 20 20 20  |ADR R1,length   |
000037d0  20 20 3b 70 6f 73 69 74  69 6f 6e 20 69 6e 20 73  |  ;position in s|
000037e0  74 72 69 6e 67 0d 15 e0  22 4d 4f 56 20 52 32 2c  |tring..."MOV R2,|
000037f0  23 39 20 20 20 20 20 20  20 20 20 3b 62 75 66 66  |#9         ;buff|
00003800  65 72 20 73 69 7a 65 0d  15 ea 45 53 57 49 20 22  |er size...ESWI "|
00003810  4f 53 5f 43 6f 6e 76 65  72 74 48 65 78 38 22 20  |OS_ConvertHex8" |
00003820  20 20 3b 69 6e 73 65 72  74 20 74 68 65 20 65 6e  |  ;insert the en|
00003830  64 20 70 6f 73 69 74 69  6f 6e 20 6f 66 20 74 68  |d position of th|
00003840  65 20 42 61 73 69 63 20  66 69 6c 65 0d 15 f4 22  |e Basic file..."|
00003850  4d 4f 56 20 52 30 2c 23  97 22 2c 22 20 20 20 20  |MOV R0,#.","    |
00003860  3b 70 75 74 20 74 68 65  20 63 6f 6d 6d 61 0d 15  |;put the comma..|
00003870  fe 24 53 54 52 42 20 52  30 2c 63 6f 6d 6d 61 20  |.$STRB R0,comma |
00003880  20 20 20 20 3b 69 6e 20  74 68 65 20 73 74 72 69  |    ;in the stri|
00003890  6e 67 0d 16 08 2b 41 44  52 20 52 30 2c 62 61 73  |ng...+ADR R0,bas|
000038a0  69 63 20 20 20 20 20 20  3b 61 64 64 72 20 6f 66  |ic      ;addr of|
000038b0  20 66 75 6c 6c 20 63 6f  6d 6d 61 6e 64 0d 16 12  | full command...|
000038c0  1e 53 57 49 20 22 4f 53  5f 43 4c 49 22 20 20 20  |.SWI "OS_CLI"   |
000038d0  20 20 20 3b 63 61 6c 6c  20 69 74 0d 16 1c 1b 4c  |   ;call it....L|
000038e0  44 4d 46 44 20 52 31 33  21 2c 7b 50 43 7d 20 20  |DMFD R13!,{PC}  |
000038f0  20 3b 65 78 69 74 0d 16  26 05 3a 0d 16 30 2b 2e  | ;exit..&.:..0+.|
00003900  66 69 6c 65 6c 65 6e 20  20 20 20 20 20 20 20 20  |filelen         |
00003910  20 3b 6c 65 6e 67 74 68  20 6f 66 20 62 61 73 69  | ;length of basi|
00003920  63 20 70 72 6f 67 0d 16  3a 0c 45 51 55 44 20 6c  |c prog..:.EQUD l|
00003930  65 6e 0d 16 44 05 3a 0d  16 4e 21 2e 62 61 73 69  |en..D.:..N!.basi|
00003940  63 20 20 20 20 20 20 20  20 20 20 20 20 3b 74 68  |c            ;th|
00003950  65 20 73 74 72 69 6e 67  0d 16 58 1a 45 51 55 53  |e string..X.EQUS|
00003960  20 22 2a 42 61 73 69 63  20 2d 71 75 69 74 20 20  | "*Basic -quit  |
00003970  40 22 0d 16 62 0d 2e 70  6f 73 69 74 69 6f 6e 0d  |@"..b..position.|
00003980  16 6c 0a 45 51 55 44 20  30 0d 16 76 0a 45 51 55  |.l.EQUD 0..v.EQU|
00003990  44 20 30 0d 16 80 0a 2e  63 6f 6d 6d 61 0d 16 8a  |D 0.....comma...|
000039a0  0a 45 51 55 42 20 30 0d  16 94 0b 2e 6c 65 6e 67  |.EQUB 0.....leng|
000039b0  74 68 0d 16 9e 0a 45 51  55 44 20 30 0d 16 a8 0a  |th....EQUD 0....|
000039c0  45 51 55 44 20 30 0d 16  b2 0a 45 51 55 44 20 30  |EQUD 0....EQUD 0|
000039d0  0d 16 bc 05 3a 0d 16 c6  24 2e 65 6e 64 20 20 20  |....:...$.end   |
000039e0  20 20 20 20 20 20 20 20  20 20 20 3b 74 68 65 20  |           ;the |
000039f0  65 6e 64 20 28 21 21 21  29 0d 16 d0 05 5d 0d 16  |end (!!!)....]..|
00003a00  da 05 ed 0d 16 e4 05 e1  0d 16 ee 05 3a 0d 16 f8  |............:...|
00003a10  05 3a 0d 17 02 10 dd 20  f2 70 77 5f 65 6e 63 6f  |.:..... .pw_enco|
00003a20  64 65 0d 17 0c 4b 21 28  73 61 6d 70 6c 65 2b 63  |de...K!(sample+c|
00003a30  6f 64 65 25 2b 30 29 3d  21 28 66 69 6c 65 2b 63  |ode%+0)=!(file+c|
00003a40  6f 64 65 25 29 20 20 20  3a f4 20 21 73 61 6d 70  |ode%)   :. !samp|
00003a50  6c 65 28 30 2d 38 29 20  68 6f 6c 64 73 20 74 68  |le(0-8) holds th|
00003a60  65 20 66 69 72 73 74 20  74 68 72 65 65 0d 17 16  |e first three...|
00003a70  4a 21 28 73 61 6d 70 6c  65 2b 63 6f 64 65 25 2b  |J!(sample+code%+|
00003a80  34 29 3d 21 28 66 69 6c  65 2b 63 6f 64 65 25 2b  |4)=!(file+code%+|
00003a90  34 29 20 3a f4 20 77 6f  72 64 73 20 6f 66 20 74  |4) :. words of t|
00003aa0  68 65 20 42 61 73 69 63  20 66 69 6c 65 2c 20 75  |he Basic file, u|
00003ab0  6e 63 6f 64 65 64 2c 0d  17 20 4b 21 28 73 61 6d  |ncoded,.. K!(sam|
00003ac0  70 6c 65 2b 63 6f 64 65  25 2b 38 29 3d 21 28 66  |ple+code%+8)=!(f|
00003ad0  69 6c 65 2b 63 6f 64 65  25 2b 38 29 20 3a f4 20  |ile+code%+8) :. |
00003ae0  73 6f 20 74 68 61 74 20  74 68 65 20 64 65 63 6f  |so that the deco|
00003af0  64 65 72 20 63 61 6e 20  63 68 65 63 6b 20 74 68  |der can check th|
00003b00  61 74 0d 17 2a 4b 20 20  20 20 20 20 20 20 20 20  |at..*K          |
00003b10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003b20  20 20 20 20 20 20 20 20  3a f4 20 69 74 20 68 61  |        :. it ha|
00003b30  73 20 64 65 63 6f 64 65  64 20 74 68 65 20 70 72  |s decoded the pr|
00003b40  6f 67 2e 20 63 6f 72 72  65 63 74 6c 79 0d 17 34  |og. correctly..4|
00003b50  4a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |J               |
00003b60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003b70  20 20 20 3a f4 20 2d 20  77 69 74 68 6f 75 74 20  |   :. - without |
00003b80  73 74 6f 72 69 6e 67 20  74 68 65 20 70 61 73 73  |storing the pass|
00003b90  77 6f 72 64 2e 2e 2e 0d  17 3e 4f 66 69 72 73 74  |word.....>Ofirst|
00003ba0  3d 21 28 70 61 73 73 2b  63 6f 64 65 25 2b 30 29  |=!(pass+code%+0)|
00003bb0  20 20 20 20 3a f4 20 31  73 74 2c 20 32 6e 64 20  |    :. 1st, 2nd |
00003bc0  61 6e 64 20 33 72 64 20  2d 20 61 72 65 20 75 73  |and 3rd - are us|
00003bd0  65 64 20 74 6f 20 65 6e  63 6f 64 65 20 74 68 65  |ed to encode the|
00003be0  20 70 72 6f 67 2e 0d 17  48 1a 73 65 63 6f 6e 64  | prog...H.second|
00003bf0  3d 21 28 70 61 73 73 2b  63 6f 64 65 25 2b 34 29  |=!(pass+code%+4)|
00003c00  0d 17 52 19 74 68 69 72  64 3d 21 28 70 61 73 73  |..R.third=!(pass|
00003c10  2b 63 6f 64 65 25 2b 38  29 0d 17 5c 46 e3 20 63  |+code%+8)..\F. c|
00003c20  6f 64 65 72 3d 30 20 b8  20 6c 65 6e 20 88 20 31  |oder=0 . len . 1|
00003c30  32 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |2               |
00003c40  20 20 20 20 20 20 20 20  20 20 20 20 20 3a f4 20  |             :. |
00003c50  67 65 74 20 65 6e 63 6f  64 69 6e 67 2e 2e 2e 0d  |get encoding....|
00003c60  17 66 33 21 28 66 69 6c  65 2b 63 6f 64 65 25 2b  |.f3!(file+code%+|
00003c70  63 6f 64 65 72 29 3d 21  28 66 69 6c 65 2b 63 6f  |coder)=!(file+co|
00003c80  64 65 25 2b 63 6f 64 65  72 29 20 82 20 66 69 72  |de%+coder) . fir|
00003c90  73 74 0d 17 70 38 21 28  66 69 6c 65 2b 63 6f 64  |st..p8!(file+cod|
00003ca0  65 25 2b 63 6f 64 65 72  2b 34 29 3d 21 28 66 69  |e%+coder+4)=!(fi|
00003cb0  6c 65 2b 63 6f 64 65 25  2b 63 6f 64 65 72 2b 34  |le+code%+coder+4|
00003cc0  29 20 82 20 73 65 63 6f  6e 64 0d 17 7a 37 21 28  |) . second..z7!(|
00003cd0  66 69 6c 65 2b 63 6f 64  65 25 2b 63 6f 64 65 72  |file+code%+coder|
00003ce0  2b 38 29 3d 21 28 66 69  6c 65 2b 63 6f 64 65 25  |+8)=!(file+code%|
00003cf0  2b 63 6f 64 65 72 2b 38  29 20 82 20 74 68 69 72  |+coder+8) . thir|
00003d00  64 0d 17 84 05 ed 0d 17  8e 4a 21 28 70 61 73 73  |d........J!(pass|
00003d10  2b 63 6f 64 65 25 2b 30  29 3d 26 31 32 33 34 35  |+code%+0)=&12345|
00003d20  36 37 38 20 3a f4 20 72  61 6d 64 6f 6d 20 64 61  |678 :. ramdom da|
00003d30  74 61 20 2d 20 74 6f 20  62 6c 61 6e 6b 20 74 68  |ta - to blank th|
00003d40  65 20 70 61 73 73 77 6f  72 64 20 73 74 6f 72 65  |e password store|
00003d50  0d 17 98 1d 21 28 70 61  73 73 2b 63 6f 64 65 25  |....!(pass+code%|
00003d60  2b 34 29 3d 26 38 37 36  35 34 33 32 31 0d 17 a2  |+4)=&87654321...|
00003d70  1d 21 28 70 61 73 73 2b  63 6f 64 65 25 2b 38 29  |.!(pass+code%+8)|
00003d80  3d 26 31 38 32 37 33 36  34 35 0d 17 ac 05 e1 0d  |=&18273645......|
00003d90  17 b6 05 3a 0d 17 c0 0e  dd 20 f2 70 77 5f 61 73  |...:..... .pw_as|
00003da0  73 6d 0d 17 ca 32 73 74  61 63 6b 5f 73 69 7a 65  |sm...2stack_size|
00003db0  25 3d 34 20 20 20 20 20  20 20 20 20 20 20 3a f4  |%=4           :.|
00003dc0  20 6f 6e 6c 79 20 73 74  6f 72 69 6e 67 20 72 31  | only storing r1|
00003dd0  34 21 21 21 0d 17 d4 12  e3 20 49 3d 31 32 20 b8  |4!!!..... I=12 .|
00003de0  20 31 34 20 88 32 0d 17  de 24 4f 25 3d 63 6f 64  | 14 .2...$O%=cod|
00003df0  65 25 3a 50 25 3d 30 3a  4c 25 3d 63 6f 64 65 25  |e%:P%=0:L%=code%|
00003e00  2b 63 6f 64 65 5f 6c 65  6e 25 0d 17 e8 05 3a 0d  |+code_len%....:.|
00003e10  17 f2 0a 5b 4f 50 54 20  49 0d 17 fc 0a 2e 73 74  |...[OPT I.....st|
00003e20  61 72 74 0d 18 06 2d 53  57 49 20 22 4f 53 5f 47  |art...-SWI "OS_G|
00003e30  65 74 45 6e 76 22 20 20  20 3b 72 30 3d 70 74 72  |etEnv"   ;r0=ptr|
00003e40  20 74 6f 20 65 6e 74 72  79 20 73 74 72 69 6e 67  | to entry string|
00003e50  0d 18 10 3f 4d 4f 56 20  52 31 31 2c 52 30 20 20  |...?MOV R11,R0  |
00003e60  20 20 20 20 20 20 3b 72  31 31 3d 70 74 72 20 74  |      ;r11=ptr t|
00003e70  6f 20 65 6e 74 72 79 20  73 74 72 69 6e 67 20 28  |o entry string (|
00003e80  66 6f 72 20 66 75 74 75  72 65 20 75 73 65 29 0d  |for future use).|
00003e90  18 1a 2f 4c 44 52 20 52  32 2c 65 6e 64 70 6f 73  |../LDR R2,endpos|
00003ea0  20 20 20 20 20 3b 72 32  3d 6f 66 66 73 65 74 20  |     ;r2=offset |
00003eb0  74 6f 20 65 6e 64 20 6f  66 20 70 72 6f 67 0d 18  |to end of prog..|
00003ec0  24 1f 41 44 52 20 52 33  2c 73 74 61 72 74 20 20  |$.ADR R3,start  |
00003ed0  20 20 20 20 3b 72 33 3d  73 74 61 72 74 0d 18 2e  |    ;r3=start...|
00003ee0  2a 41 44 44 20 52 30 2c  52 32 2c 52 33 20 20 20  |*ADD R0,R2,R3   |
00003ef0  20 20 20 3b 72 30 3d 72  65 61 6c 20 65 6e 64 20  |   ;r0=real end |
00003f00  6f 66 20 70 72 6f 67 0d  18 38 4d 41 44 44 20 52  |of prog..8MADD R|
00003f10  31 2c 52 30 2c 23 26 46  30 30 20 20 20 3b 72 31  |1,R0,#&F00   ;r1|
00003f20  3d 73 68 69 66 74 20 61  6c 6c 20 74 68 65 20 63  |=shift all the c|
00003f30  6f 64 65 20 66 6f 72 77  61 72 64 20 62 79 20 26  |ode forward by &|
00003f40  46 30 30 20 28 72 6f 6f  6d 20 66 6f 72 20 42 41  |F00 (room for BA|
00003f50  53 49 43 29 0d 18 42 0b  2e 6d 6f 76 65 69 74 0d  |SIC)..B..moveit.|
00003f60  18 4c 40 4c 44 52 20 52  33 2c 5b 52 30 5d 2c 23  |.L@LDR R3,[R0],#|
00003f70  2d 34 20 20 20 3b 6c 6f  61 64 20 72 33 20 77 69  |-4   ;load r3 wi|
00003f80  74 68 20 77 6f 72 64 20  28 26 20 74 68 65 6e 20  |th word (& then |
00003f90  74 61 6b 65 20 34 20 66  72 6f 6d 20 72 30 29 0d  |take 4 from r0).|
00003fa0  18 56 3d 53 54 52 20 52  33 2c 5b 52 31 5d 2c 23  |.V=STR R3,[R1],#|
00003fb0  2d 34 20 20 20 3b 73 74  6f 72 65 20 72 33 20 61  |-4   ;store r3 a|
00003fc0  74 20 72 31 20 28 26 20  74 68 65 6e 20 74 61 6b  |t r1 (& then tak|
00003fd0  65 20 34 20 66 72 6f 6d  20 72 31 29 0d 18 60 25  |e 4 from r1)..`%|
00003fe0  53 55 42 53 20 52 32 2c  52 32 2c 23 34 20 20 20  |SUBS R2,R2,#4   |
00003ff0  20 20 3b 74 61 6b 65 20  34 20 66 72 6f 6d 20 72  |  ;take 4 from r|
00004000  32 0d 18 6a 2e 42 4e 45  20 6d 6f 76 65 69 74 20  |2..j.BNE moveit |
00004010  20 20 20 20 20 20 20 3b  69 66 20 72 32 20 6e 6f  |       ;if r2 no|
00004020  74 20 30 20 74 68 65 6e  20 72 65 70 65 61 74 0d  |t 0 then repeat.|
00004030  18 74 3b 41 44 52 20 52  31 32 2c 73 74 61 72 74  |.t;ADR R12,start|
00004040  20 20 20 20 20 3b 67 65  74 20 72 31 32 3d 73 74  |     ;get r12=st|
00004050  61 72 74 20 28 66 6f 72  20 66 75 74 75 72 65 20  |art (for future |
00004060  72 65 66 65 72 65 6e 63  65 29 0d 18 7e 38 42 20  |reference)..~8B |
00004070  63 6f 6e 74 69 6e 75 65  2b 26 46 30 30 20 20 20  |continue+&F00   |
00004080  3b 65 76 65 72 79 74 68  69 6e 67 20 69 73 20 6e  |;everything is n|
00004090  6f 77 20 26 46 30 30 20  66 6f 72 77 61 72 64 21  |ow &F00 forward!|
000040a0  21 21 0d 18 88 05 3a 0d  18 92 22 2e 65 6e 64 70  |!!....:...".endp|
000040b0  6f 73 20 20 20 20 20 20  20 20 20 20 20 3b 65 6e  |os           ;en|
000040c0  64 20 6f 66 20 66 69 6c  65 0d 18 9c 0c 45 51 55  |d of file....EQU|
000040d0  44 20 65 6e 64 0d 18 a6  05 3a 0d 18 b0 2b 2e 66  |D end....:...+.f|
000040e0  69 6c 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ile             |
000040f0  3b 42 61 73 69 63 20 66  69 6c 65 20 67 6f 65 73  |;Basic file goes|
00004100  20 68 65 72 65 0d 18 ba  05 5d 0d 18 c4 43 50 25  | here....]...CP%|
00004110  2b 3d 6c 65 6e 2b 31 32  3a 4f 25 2b 3d 6c 65 6e  |+=len+12:O%+=len|
00004120  2b 31 32 20 3a f4 20 6c  65 61 76 65 20 61 20 67  |+12 :. leave a g|
00004130  61 70 20 69 6e 63 61 73  65 20 6f 66 20 64 65 63  |ap incase of dec|
00004140  6f 64 65 72 20 6f 76 65  72 66 6c 6f 77 0d 18 ce  |oder overflow...|
00004150  09 5b 4f 50 54 49 0d 18  d8 2f 41 4c 49 47 4e 20  |.[OPTI.../ALIGN |
00004160  20 20 20 20 20 20 20 20  20 20 20 20 3b 61 6e 64  |            ;and|
00004170  20 68 65 72 65 20 69 73  2e 2e 2e 20 54 48 45 20  | here is... THE |
00004180  53 54 41 43 4b 0d 18 e2  05 5d 0d 18 ec 23 50 25  |STACK....]...#P%|
00004190  2b 3d 73 74 61 63 6b 5f  73 69 7a 65 25 3a 4f 25  |+=stack_size%:O%|
000041a0  2b 3d 73 74 61 63 6b 5f  73 69 7a 65 25 0d 18 f6  |+=stack_size%...|
000041b0  09 5b 4f 50 54 49 0d 19  00 38 2e 73 74 61 63 6b  |.[OPTI...8.stack|
000041c0  20 20 20 20 20 20 20 20  20 20 20 20 3b 73 74 61  |            ;sta|
000041d0  63 6b 69 6e 67 20 62 61  63 6b 77 61 72 64 73 2e  |cking backwards.|
000041e0  2e 2e 20 28 49 20 68 6f  70 65 21 21 21 29 0d 19  |.. (I hope!!!)..|
000041f0  0a 05 3a 0d 19 14 0c 2e  66 69 6c 65 70 6f 73 0d  |..:.....filepos.|
00004200  19 1e 3a 45 51 55 44 20  66 69 6c 65 2b 26 46 30  |..:EQUD file+&F0|
00004210  30 20 20 20 20 3b 70 6f  73 69 74 69 6f 6e 20 6f  |0    ;position o|
00004220  66 20 66 69 6c 65 20 28  6e 6f 77 20 26 66 30 30  |f file (now &f00|
00004230  20 66 6f 72 77 61 72 64  29 0d 19 28 05 3a 0d 19  | forward)..(.:..|
00004240  32 0d 2e 63 6f 6e 74 69  6e 75 65 0d 19 3c 29 4c  |2..continue..<)L|
00004250  44 52 20 52 31 2c 66 69  6c 65 70 6f 73 20 20 20  |DR R1,filepos   |
00004260  20 3b 66 69 6c 65 20 6f  66 66 73 65 74 20 66 72  | ;file offset fr|
00004270  6f 6d 20 30 0d 19 46 3d  41 44 44 20 52 31 2c 52  |om 0..F=ADD R1,R|
00004280  31 2c 52 31 32 20 20 20  20 20 3b 72 31 32 3d 73  |1,R12     ;r12=s|
00004290  74 61 72 74 20 6f 66 20  70 72 6f 67 2c 20 73 6f  |tart of prog, so|
000042a0  20 72 31 3d 66 69 6c 65  20 70 6f 73 69 74 69 6f  | r1=file positio|
000042b0  6e 0d 19 50 25 53 54 52  20 52 31 2c 66 69 6c 65  |n..P%STR R1,file|
000042c0  70 6f 73 20 20 20 20 3b  73 74 6f 72 65 20 66 69  |pos    ;store fi|
000042d0  6c 65 20 70 6f 73 0d 19  5a 24 41 44 52 20 52 31  |le pos..Z$ADR R1|
000042e0  33 2c 73 74 61 63 6b 20  20 20 20 20 3b 72 31 33  |3,stack     ;r13|
000042f0  3d 6f 75 72 20 73 74 61  63 6b 0d 19 64 20 53 54  |=our stack..d ST|
00004300  4d 46 44 20 52 31 33 21  2c 7b 52 31 34 7d 20 20  |MFD R13!,{R14}  |
00004310  3b 73 74 6f 72 65 20 72  31 34 0d 19 6e 2a 4d 4f  |;store r14..n*MO|
00004320  56 20 52 30 2c 52 31 31  20 20 20 20 20 20 20 20  |V R0,R11        |
00004330  3b 72 30 3d 65 6e 74 72  79 20 73 74 72 69 6e 67  |;r0=entry string|
00004340  20 70 74 72 0d 19 78 21  4d 4f 56 20 52 31 2c 23  | ptr..x!MOV R1,#|
00004350  30 20 20 20 20 20 20 20  20 20 3b 72 31 3d 63 6f  |0         ;r1=co|
00004360  75 6e 74 65 72 0d 19 82  0e 2e 66 69 6e 64 73 70  |unter.....findsp|
00004370  61 63 65 0d 19 8c 24 4c  44 52 42 20 52 32 2c 5b  |ace...$LDRB R2,[|
00004380  52 30 2c 52 31 5d 20 20  20 3b 72 32 3d 3f 73 74  |R0,R1]   ;r2=?st|
00004390  72 2b 63 6f 75 6e 74 0d  19 96 1f 41 44 44 20 52  |r+count....ADD R|
000043a0  31 2c 52 31 2c 23 31 20  20 20 20 20 20 3b 63 6f  |1,R1,#1      ;co|
000043b0  75 6e 74 2b 3d 31 0d 19  a0 22 43 4d 50 20 52 32  |unt+=1..."CMP R2|
000043c0  2c 23 33 32 20 20 20 20  20 20 20 20 3b 69 73 20  |,#32        ;is |
000043d0  69 74 20 3e 20 33 32 3f  0d 19 aa 4e 42 47 54 20  |it > 32?...NBGT |
000043e0  66 69 6e 64 73 70 61 63  65 20 20 20 20 20 3b 6c  |findspace     ;l|
000043f0  6f 6f 6b 20 66 6f 72 20  73 70 61 63 65 20 20 20  |ook for space   |
00004400  20 20 2d 20 2a 2a 2a 20  6e 6f 20 27 2b 26 46 30  |  - *** no '+&F0|
00004410  30 27 20 6e 65 65 64 65  64 20 6e 6f 77 2c 20 62  |0' needed now, b|
00004420  65 63 61 75 73 65 0d 19  b4 4e 41 44 44 45 51 20  |ecause...NADDEQ |
00004430  52 31 2c 52 31 2c 52 30  20 20 20 20 3b 69 66 20  |R1,R1,R0    ;if |
00004440  33 32 2c 20 67 65 74 20  61 64 64 72 20 20 20 20  |32, get addr    |
00004450  20 20 20 20 20 20 65 76  65 72 79 74 68 69 6e 67  |      everything|
00004460  20 69 73 20 6e 6f 77 20  72 75 6e 6e 69 6e 67 20  | is now running |
00004470  66 72 6f 6d 0d 19 be 3f  42 45 51 20 66 6f 75 6e  |from...?BEQ foun|
00004480  64 70 61 73 73 20 20 20  20 20 3b 61 6e 64 20 67  |dpass     ;and g|
00004490  6f 74 6f 20 66 6f 75 6e  64 70 77 20 20 20 20 20  |oto foundpw     |
000044a0  20 20 20 20 26 46 30 30  20 66 6f 72 77 61 72 64  |    &F00 forward|
000044b0  21 21 21 0d 19 c8 05 3a  0d 19 d2 25 41 44 52 20  |!!!....:...%ADR |
000044c0  52 30 2c 65 6e 74 65 72  70 61 73 73 20 3b 6e 6f  |R0,enterpass ;no|
000044d0  20 70 77 2c 20 73 6f 20  69 6e 70 75 74 0d 19 dc  | pw, so input...|
000044e0  1e 53 57 49 20 22 4f 53  5f 57 72 69 74 65 30 22  |.SWI "OS_Write0"|
000044f0  20 20 3b 70 72 69 6e 74  20 69 74 0d 19 e6 05 3a  |  ;print it....:|
00004500  0d 19 f0 26 41 44 52 20  52 31 2c 70 61 73 73 20  |...&ADR R1,pass |
00004510  20 20 20 20 20 3b 61 64  64 72 20 6f 66 20 70 77  |     ;addr of pw|
00004520  20 73 74 6f 72 65 0d 19  fa 1d 4d 4f 56 20 52 32  | store....MOV R2|
00004530  2c 23 30 20 20 20 20 20  20 20 20 3b 63 6f 75 6e  |,#0        ;coun|
00004540  74 65 72 0d 1a 04 0d 2e  72 65 61 64 6c 6f 6f 70  |ter.....readloop|
00004550  0d 1a 0e 20 53 57 49 20  22 4f 53 5f 52 65 61 64  |... SWI "OS_Read|
00004560  43 22 20 20 20 3b 69 6e  70 75 74 20 63 68 61 72  |C"   ;input char|
00004570  0d 1a 18 23 43 4d 50 20  52 30 2c 23 31 32 37 20  |...#CMP R0,#127 |
00004580  20 20 20 20 20 3b 69 73  20 69 74 20 64 65 6c 65  |     ;is it dele|
00004590  74 65 3f 0d 1a 22 20 42  4e 45 20 6e 6f 64 65 6c  |te?.." BNE nodel|
000045a0  65 74 65 20 20 20 20 20  3b 69 66 20 6e 6f 74 2c  |ete     ;if not,|
000045b0  20 67 6f 0d 1a 2c 21 43  4d 50 20 52 32 2c 23 30  | go..,!CMP R2,#0|
000045c0  20 20 20 20 20 20 20 20  3b 69 73 20 63 6f 75 6e  |        ;is coun|
000045d0  74 20 30 3f 0d 1a 36 25  53 55 42 4e 45 20 52 32  |t 0?..6%SUBNE R2|
000045e0  2c 52 32 2c 23 31 20 20  20 3b 6e 6f 2c 20 74 68  |,R2,#1   ;no, th|
000045f0  65 6e 20 74 61 6b 65 20  31 0d 1a 40 26 53 57 49  |en take 1..@&SWI|
00004600  4e 45 20 30 20 20 20 20  20 20 20 20 20 20 3b 70  |NE 0          ;p|
00004610  72 69 6e 74 20 74 68 65  20 64 65 6c 65 74 65 0d  |rint the delete.|
00004620  1a 4a 24 42 20 72 65 61  64 6c 6f 6f 70 20 20 20  |.J$B readloop   |
00004630  20 20 20 20 3b 72 65 61  64 20 6e 65 78 74 20 63  |    ;read next c|
00004640  68 61 72 0d 1a 54 05 3a  0d 1a 5e 0d 2e 6e 6f 64  |har..T.:..^..nod|
00004650  65 6c 65 74 65 0d 1a 68  25 43 4d 50 20 52 30 2c  |elete..h%CMP R0,|
00004660  23 33 32 20 20 20 20 20  20 20 20 3b 69 73 20 63  |#32        ;is c|
00004670  68 61 72 20 73 70 61 63  65 3f 0d 1a 72 28 53 54  |har space?..r(ST|
00004680  52 47 45 42 20 52 30 2c  5b 52 31 2c 52 32 5d 20  |RGEB R0,[R1,R2] |
00004690  3b 69 66 20 3e 20 3d 20  74 68 65 6e 20 73 74 6f  |;if > = then sto|
000046a0  72 65 0d 1a 7c 22 53 57  49 47 45 20 32 35 36 2b  |re..|"SWIGE 256+|
000046b0  97 22 2a 22 20 20 3b 61  6e 64 20 70 72 69 6e 74  |."*"  ;and print|
000046c0  20 27 2a 27 0d 1a 86 29  41 44 44 47 45 20 52 32  | '*'...)ADDGE R2|
000046d0  2c 52 32 2c 23 31 20 20  20 20 3b 61 6e 64 20 61  |,R2,#1    ;and a|
000046e0  64 64 20 31 20 74 6f 20  63 6f 75 6e 74 0d 1a 90  |dd 1 to count...|
000046f0  32 42 4c 54 20 66 6f 75  6e 64 70 61 73 73 20 20  |2BLT foundpass  |
00004700  20 20 20 3b 69 66 20 6c  65 73 73 20 74 68 61 6e  |   ;if less than|
00004710  2c 20 74 68 65 6e 20 66  6f 75 6e 64 20 69 74 0d  |, then found it.|
00004720  1a 9a 23 43 4d 50 20 52  32 2c 23 31 32 20 20 20  |..#CMP R2,#12   |
00004730  20 20 20 20 20 3b 69 73  20 63 6f 75 6e 74 20 31  |     ;is count 1|
00004740  32 3f 0d 1a a4 33 42 4c  54 20 72 65 61 64 6c 6f  |2?...3BLT readlo|
00004750  6f 70 20 20 20 20 20 20  3b 69 66 20 6c 65 73 73  |op      ;if less|
00004760  2c 20 74 68 65 6e 20 72  65 61 64 20 6e 65 78 74  |, then read next|
00004770  20 63 68 61 72 0d 1a ae  05 3a 0d 1a b8 24 2e 66  | char....:...$.f|
00004780  6f 75 6e 64 70 61 73 73  20 20 20 20 20 20 20 20  |oundpass        |
00004790  3b 66 6f 75 6e 64 20 70  61 73 73 21 21 21 0d 1a  |;found pass!!!..|
000047a0  c2 24 41 44 52 20 52 30  2c 70 61 73 73 20 20 20  |.$ADR R0,pass   |
000047b0  20 20 20 20 3b 72 30 3d  70 61 73 73 20 73 74 6f  |    ;r0=pass sto|
000047c0  72 65 0d 1a cc 39 43 4d  50 20 52 31 2c 52 30 20  |re...9CMP R1,R0 |
000047d0  20 20 20 20 20 20 20 20  3b 72 31 3d 70 61 73 73  |        ;r1=pass|
000047e0  77 6f 72 64 20 70 6f 73  20 20 72 30 3d 70 61 73  |word pos  r0=pas|
000047f0  73 77 6f 72 64 20 73 74  6f 72 65 0d 1a d6 29 42  |sword store...)B|
00004800  45 51 20 61 6c 72 65 61  64 79 74 68 65 72 65 20  |EQ alreadythere |
00004810  20 3b 69 73 20 70 77 20  69 6e 20 70 77 20 73 74  | ;is pw in pw st|
00004820  6f 72 65 3f 0d 1a e0 1e  4d 4f 56 20 52 32 2c 23  |ore?....MOV R2,#|
00004830  30 20 20 20 20 20 20 20  20 20 3b 63 6f 75 6e 74  |0         ;count|
00004840  65 72 0d 1a ea 27 2e 6d  6f 76 65 6c 6f 6f 70 20  |er...'.moveloop |
00004850  20 20 20 20 20 20 20 20  3b 6d 6f 76 65 20 70 77  |        ;move pw|
00004860  20 74 6f 20 73 74 6f 72  65 0d 1a f4 20 4c 44 52  | to store... LDR|
00004870  42 20 52 33 2c 5b 52 31  2c 52 32 5d 20 20 20 3b  |B R3,[R1,R2]   ;|
00004880  72 33 20 3d 20 63 68 61  72 0d 1a fe 20 43 4d 50  |r3 = char... CMP|
00004890  20 52 33 2c 23 33 32 20  20 20 20 20 20 20 20 3b  | R3,#32        ;|
000048a0  69 73 20 69 74 20 33 32  3f 0d 1b 08 27 42 4c 45  |is it 32?...'BLE|
000048b0  20 61 6c 72 65 61 64 79  74 68 65 72 65 20 20 3b  | alreadythere  ;|
000048c0  69 66 20 6c 65 73 73 2c  20 74 68 65 6e 20 67 6f  |if less, then go|
000048d0  0d 1b 12 2a 53 54 52 42  20 52 33 2c 5b 52 30 2c  |...*STRB R3,[R0,|
000048e0  52 32 5d 20 20 20 3b 73  74 6f 72 65 20 63 68 61  |R2]   ;store cha|
000048f0  72 20 69 6e 20 73 74 6f  72 65 0d 1b 1c 25 41 44  |r in store...%AD|
00004900  44 20 52 32 2c 52 32 2c  23 31 20 20 20 20 20 20  |D R2,R2,#1      |
00004910  3b 61 64 64 20 31 20 74  6f 20 63 6f 75 6e 74 0d  |;add 1 to count.|
00004920  1b 26 20 43 4d 50 20 52  32 2c 23 31 32 20 20 20  |.& CMP R2,#12   |
00004930  20 20 20 20 20 3b 69 73  20 69 74 20 31 32 3f 0d  |     ;is it 12?.|
00004940  1b 30 28 42 4c 54 20 6d  6f 76 65 6c 6f 6f 70 20  |.0(BLT moveloop |
00004950  20 20 20 20 20 3b 69 66  20 6c 65 73 73 2c 20 67  |     ;if less, g|
00004960  65 74 20 6e 65 78 74 0d  1b 3a 05 3a 0d 1b 44 20  |et next..:.:..D |
00004970  2e 61 6c 72 65 61 64 79  74 68 65 72 65 20 20 20  |.alreadythere   |
00004980  20 20 3b 6e 6f 77 20 72  65 61 64 79 0d 1b 4e 22  |  ;now ready..N"|
00004990  41 44 52 20 52 30 2c 70  61 73 73 20 20 20 20 20  |ADR R0,pass     |
000049a0  20 20 3b 72 30 3d 70 77  20 73 74 6f 72 65 0d 1b  |  ;r0=pw store..|
000049b0  58 2a 4c 44 52 20 52 31  2c 66 69 6c 65 70 6f 73  |X*LDR R1,filepos|
000049c0  20 20 20 20 3b 72 30 3d  70 61 73 73 20 20 72 31  |    ;r0=pass  r1|
000049d0  3d 66 69 6c 65 70 6f 73  0d 1b 62 1e 4d 4f 56 20  |=filepos..b.MOV |
000049e0  52 32 2c 23 30 20 20 20  20 20 20 20 20 20 3b 63  |R2,#0         ;c|
000049f0  6f 75 6e 74 65 72 0d 1b  6c 24 4c 44 52 20 52 33  |ounter..l$LDR R3|
00004a00  2c 5b 52 30 5d 20 20 20  20 20 20 20 3b 72 33 3d  |,[R0]       ;r3=|
00004a10  31 73 74 20 70 77 20 62  69 74 0d 1b 76 24 4c 44  |1st pw bit..v$LD|
00004a20  52 20 52 34 2c 5b 52 30  2c 23 34 5d 20 20 20 20  |R R4,[R0,#4]    |
00004a30  3b 72 34 3d 32 6e 64 20  70 77 20 62 69 74 0d 1b  |;r4=2nd pw bit..|
00004a40  80 24 4c 44 52 20 52 35  2c 5b 52 30 2c 23 38 5d  |.$LDR R5,[R0,#8]|
00004a50  20 20 20 20 3b 72 35 3d  33 72 64 20 70 77 20 62  |    ;r5=3rd pw b|
00004a60  69 74 0d 1b 8a 22 4c 44  52 20 52 36 2c 66 69 6c  |it..."LDR R6,fil|
00004a70  65 6c 65 6e 20 20 20 20  3b 72 36 3d 66 69 6c 65  |elen    ;r6=file|
00004a80  20 6c 65 6e 0d 1b 94 0b  2e 64 65 63 6f 64 65 0d  | len.....decode.|
00004a90  1b 9e 20 4c 44 52 20 52  30 2c 5b 52 31 2c 52 32  |.. LDR R0,[R1,R2|
00004aa0  5d 20 20 20 20 3b 6c 6f  61 64 20 77 6f 72 64 0d  |]    ;load word.|
00004ab0  1b a8 23 82 20 52 30 2c  52 30 2c 52 33 20 20 20  |..#. R0,R0,R3   |
00004ac0  20 20 20 3b 64 65 63 6f  64 65 20 77 69 74 68 20  |   ;decode with |
00004ad0  72 33 0d 1b b2 21 53 54  52 20 52 30 2c 5b 52 31  |r3...!STR R0,[R1|
00004ae0  2c 52 32 5d 20 20 20 20  3b 73 74 6f 72 65 20 77  |,R2]    ;store w|
00004af0  6f 72 64 0d 1b bc 25 41  44 44 20 52 32 2c 52 32  |ord...%ADD R2,R2|
00004b00  2c 23 34 20 20 20 20 20  20 3b 61 64 64 20 34 20  |,#4      ;add 4 |
00004b10  74 6f 20 63 6f 75 6e 74  0d 1b c6 25 4c 44 52 20  |to count...%LDR |
00004b20  52 30 2c 5b 52 31 2c 52  32 5d 20 20 20 20 3b 6c  |R0,[R1,R2]    ;l|
00004b30  6f 61 64 20 6e 65 78 74  20 77 6f 72 64 0d 1b d0  |oad next word...|
00004b40  23 82 20 52 30 2c 52 30  2c 52 34 20 20 20 20 20  |#. R0,R0,R4     |
00004b50  20 3b 64 65 63 6f 64 65  20 77 69 74 68 20 72 34  | ;decode with r4|
00004b60  0d 1b da 21 53 54 52 20  52 30 2c 5b 52 31 2c 52  |...!STR R0,[R1,R|
00004b70  32 5d 20 20 20 20 3b 73  74 6f 72 65 20 77 6f 72  |2]    ;store wor|
00004b80  64 0d 1b e4 25 41 44 44  20 52 32 2c 52 32 2c 23  |d...%ADD R2,R2,#|
00004b90  34 20 20 20 20 20 20 3b  61 64 64 20 34 20 74 6f  |4      ;add 4 to|
00004ba0  20 63 6f 75 6e 74 0d 1b  ee 25 4c 44 52 20 52 30  | count...%LDR R0|
00004bb0  2c 5b 52 31 2c 52 32 5d  20 20 20 20 3b 6c 6f 61  |,[R1,R2]    ;loa|
00004bc0  64 20 6e 65 78 74 20 77  6f 72 64 0d 1b f8 23 82  |d next word...#.|
00004bd0  20 52 30 2c 52 30 2c 52  35 20 20 20 20 20 20 3b  | R0,R0,R5      ;|
00004be0  64 65 63 6f 64 65 20 77  69 74 68 20 72 35 0d 1c  |decode with r5..|
00004bf0  02 21 53 54 52 20 52 30  2c 5b 52 31 2c 52 32 5d  |.!STR R0,[R1,R2]|
00004c00  20 20 20 20 3b 73 74 6f  72 65 20 77 6f 72 64 0d  |    ;store word.|
00004c10  1c 0c 27 43 4d 50 20 52  32 2c 52 36 20 20 20 20  |..'CMP R2,R6    |
00004c20  20 20 20 20 20 3b 69 73  20 63 6f 75 6e 74 20 61  |     ;is count a|
00004c30  74 20 65 6e 64 3f 0d 1c  16 25 41 44 44 4c 54 20  |t end?...%ADDLT |
00004c40  52 32 2c 52 32 2c 23 34  20 20 20 20 3b 69 66 20  |R2,R2,#4    ;if |
00004c50  6c 65 73 73 2c 20 61 64  64 20 34 0d 1c 20 26 42  |less, add 4.. &B|
00004c60  4c 54 20 64 65 63 6f 64  65 20 20 20 20 20 20 20  |LT decode       |
00004c70  20 3b 61 6e 64 20 64 65  63 6f 64 65 20 6e 65 78  | ;and decode nex|
00004c80  74 0d 1c 2a 05 3a 0d 1c  34 23 41 44 52 20 52 30  |t..*.:..4#ADR R0|
00004c90  2c 73 61 6d 70 6c 65 20  20 20 20 20 3b 72 30 3d  |,sample     ;r0=|
00004ca0  74 65 73 74 20 64 61 74  61 0d 1c 3e 24 4c 44 52  |test data..>$LDR|
00004cb0  20 52 31 2c 66 69 6c 65  70 6f 73 20 20 20 20 3b  | R1,filepos    ;|
00004cc0  66 69 6c 65 20 70 6f 73  69 74 69 6f 6e 0d 1c 48  |file position..H|
00004cd0  27 4c 44 52 20 52 32 2c  5b 52 30 5d 20 20 20 20  |'LDR R2,[R0]    |
00004ce0  20 20 20 3b 6c 6f 61 64  20 74 65 73 74 20 77 6f  |   ;load test wo|
00004cf0  72 64 20 31 0d 1c 52 27  4c 44 52 20 52 33 2c 5b  |rd 1..R'LDR R3,[|
00004d00  52 31 5d 20 20 20 20 20  20 20 3b 6c 6f 61 64 20  |R1]       ;load |
00004d10  72 65 61 6c 20 77 6f 72  64 20 31 0d 1c 5c 1e 43  |real word 1..\.C|
00004d20  4d 50 20 52 32 2c 52 33  20 20 20 20 20 20 20 20  |MP R2,R3        |
00004d30  20 3b 63 6f 6d 70 61 72  65 0d 1c 66 29 42 4e 45  | ;compare..f)BNE|
00004d40  20 77 72 6f 6e 67 20 20  20 20 20 20 20 20 20 3b  | wrong         ;|
00004d50  69 66 20 62 61 64 2c 20  74 68 65 6e 20 77 72 6f  |if bad, then wro|
00004d60  6e 67 0d 1c 70 27 4c 44  52 20 52 32 2c 5b 52 30  |ng..p'LDR R2,[R0|
00004d70  2c 23 34 5d 20 20 20 20  3b 6c 6f 61 64 20 74 65  |,#4]    ;load te|
00004d80  73 74 20 77 6f 72 64 20  32 0d 1c 7a 27 4c 44 52  |st word 2..z'LDR|
00004d90  20 52 33 2c 5b 52 31 2c  23 34 5d 20 20 20 20 3b  | R3,[R1,#4]    ;|
00004da0  6c 6f 61 64 20 72 65 61  6c 20 77 6f 72 64 20 32  |load real word 2|
00004db0  0d 1c 84 1e 43 4d 50 20  52 32 2c 52 33 20 20 20  |....CMP R2,R3   |
00004dc0  20 20 20 20 20 20 3b 63  6f 6d 70 61 72 65 0d 1c  |      ;compare..|
00004dd0  8e 29 42 4e 45 20 77 72  6f 6e 67 20 20 20 20 20  |.)BNE wrong     |
00004de0  20 20 20 20 3b 69 66 20  62 61 64 2c 20 74 68 65  |    ;if bad, the|
00004df0  6e 20 77 72 6f 6e 67 0d  1c 98 27 4c 44 52 20 52  |n wrong...'LDR R|
00004e00  32 2c 5b 52 30 2c 23 38  5d 20 20 20 20 3b 6c 6f  |2,[R0,#8]    ;lo|
00004e10  61 64 20 74 65 73 74 20  77 6f 72 64 20 33 0d 1c  |ad test word 3..|
00004e20  a2 27 4c 44 52 20 52 33  2c 5b 52 31 2c 23 38 5d  |.'LDR R3,[R1,#8]|
00004e30  20 20 20 20 3b 6c 6f 61  64 20 72 65 61 6c 20 77  |    ;load real w|
00004e40  6f 72 64 20 33 0d 1c ac  1e 43 4d 50 20 52 32 2c  |ord 3....CMP R2,|
00004e50  52 33 20 20 20 20 20 20  20 20 20 3b 63 6f 6d 70  |R3         ;comp|
00004e60  61 72 65 0d 1c b6 30 42  45 51 20 63 6f 72 72 65  |are...0BEQ corre|
00004e70  63 74 20 20 20 20 20 20  20 3b 69 66 20 67 6f 6f  |ct       ;if goo|
00004e80  64 2c 20 74 68 65 6e 20  61 6c 6c 20 63 6f 72 72  |d, then all corr|
00004e90  65 63 74 0d 1c c0 05 3a  0d 1c ca 1d 2e 77 72 6f  |ect....:.....wro|
00004ea0  6e 67 20 20 20 20 20 20  20 20 20 20 20 20 3b 62  |ng            ;b|
00004eb0  61 64 20 70 77 0d 1c d4  14 41 44 52 20 52 30 2c  |ad pw....ADR R0,|
00004ec0  77 72 6f 6e 67 77 6f 72  64 0d 1c de 25 53 57 49  |wrongword...%SWI|
00004ed0  20 22 4f 53 5f 57 72 69  74 65 30 22 20 20 20 3b  | "OS_Write0"   ;|
00004ee0  70 72 69 6e 74 20 27 62  61 64 20 70 77 27 0d 1c  |print 'bad pw'..|
00004ef0  e8 1b 4c 44 4d 46 44 20  52 31 33 21 2c 7b 50 43  |..LDMFD R13!,{PC|
00004f00  7d 20 20 20 3b 65 78 69  74 0d 1c f2 05 3a 0d 1c  |}   ;exit....:..|
00004f10  fc 24 2e 63 6f 72 72 65  63 74 20 20 20 20 20 20  |.$.correct      |
00004f20  20 20 20 20 3b 63 6f 72  72 65 63 74 20 70 77 21  |    ;correct pw!|
00004f30  21 21 0d 1d 06 24 4c 44  52 20 52 30 2c 66 69 6c  |!!...$LDR R0,fil|
00004f40  65 70 6f 73 20 20 20 20  3b 66 69 6c 65 20 70 6f  |epos    ;file po|
00004f50  73 69 74 69 6f 6e 0d 1d  10 30 41 44 52 20 52 31  |sition...0ADR R1|
00004f60  2c 70 6f 73 69 74 69 6f  6e 20 20 20 3b 70 6f 73  |,position   ;pos|
00004f70  69 74 69 6f 6e 20 69 6e  20 6f 75 74 70 75 74 20  |ition in output |
00004f80  73 74 72 69 6e 67 0d 1d  1a 22 4d 4f 56 20 52 32  |string..."MOV R2|
00004f90  2c 23 39 20 20 20 20 20  20 20 20 20 3b 62 75 66  |,#9         ;buf|
00004fa0  66 65 72 20 73 69 7a 65  0d 1d 24 42 53 57 49 20  |fer size..$BSWI |
00004fb0  22 4f 53 5f 43 6f 6e 76  65 72 74 48 65 78 38 22  |"OS_ConvertHex8"|
00004fc0  20 20 20 3b 69 6e 73 65  72 74 20 74 68 65 20 70  |   ;insert the p|
00004fd0  6f 73 73 69 74 69 6f 6e  20 6f 66 20 74 68 65 20  |ossition of the |
00004fe0  42 61 73 69 63 20 66 69  6c 65 0d 1d 2e 22 4c 44  |Basic file..."LD|
00004ff0  52 20 52 30 2c 66 69 6c  65 6c 65 6e 20 20 20 20  |R R0,filelen    |
00005000  3b 6c 65 6e 20 6f 66 20  66 69 6c 65 0d 1d 38 24  |;len of file..8$|
00005010  4c 44 52 20 52 31 2c 66  69 6c 65 70 6f 73 20 20  |LDR R1,filepos  |
00005020  20 20 3b 66 69 6c 65 20  70 6f 73 69 74 69 6f 6e  |  ;file position|
00005030  0d 1d 42 31 41 44 44 20  52 30 2c 52 30 2c 52 31  |..B1ADD R0,R0,R1|
00005040  20 20 20 20 20 20 3b 6e  6f 77 20 3d 20 65 6e 64  |      ;now = end|
00005050  20 6f 66 20 66 69 6c 65  20 70 6f 73 69 74 69 6f  | of file positio|
00005060  6e 0d 1d 4c 29 41 44 52  20 52 31 2c 6c 65 6e 67  |n..L)ADR R1,leng|
00005070  74 68 20 20 20 20 20 3b  70 6f 73 69 74 69 6f 6e  |th     ;position|
00005080  20 69 6e 20 73 74 72 69  6e 67 0d 1d 56 22 4d 4f  | in string..V"MO|
00005090  56 20 52 32 2c 23 39 20  20 20 20 20 20 20 20 20  |V R2,#9         |
000050a0  3b 62 75 66 66 65 72 20  73 69 7a 65 0d 1d 60 46  |;buffer size..`F|
000050b0  53 57 49 20 22 4f 53 5f  43 6f 6e 76 65 72 74 48  |SWI "OS_ConvertH|
000050c0  65 78 38 22 20 20 20 3b  69 6e 73 65 72 74 20 74  |ex8"   ;insert t|
000050d0  68 65 20 65 6e 64 20 70  6f 73 73 69 74 69 6f 6e  |he end possition|
000050e0  20 6f 66 20 74 68 65 20  42 61 73 69 63 20 66 69  | of the Basic fi|
000050f0  6c 65 0d 1d 6a 22 4d 4f  56 20 52 30 2c 23 97 22  |le..j"MOV R0,#."|
00005100  2c 22 20 20 20 20 3b 70  75 74 20 74 68 65 20 63  |,"    ;put the c|
00005110  6f 6d 6d 61 0d 1d 74 24  53 54 52 42 20 52 30 2c  |omma..t$STRB R0,|
00005120  63 6f 6d 6d 61 20 20 20  20 20 3b 69 6e 20 74 68  |comma     ;in th|
00005130  65 20 73 74 72 69 6e 67  0d 1d 7e 2b 41 44 52 20  |e string..~+ADR |
00005140  52 30 2c 62 61 73 69 63  20 20 20 20 20 20 3b 61  |R0,basic      ;a|
00005150  64 64 72 20 6f 66 20 66  75 6c 6c 20 63 6f 6d 6d  |ddr of full comm|
00005160  61 6e 64 0d 1d 88 1e 53  57 49 20 22 4f 53 5f 43  |and....SWI "OS_C|
00005170  4c 49 22 20 20 20 20 20  20 3b 63 61 6c 6c 20 69  |LI"      ;call i|
00005180  74 0d 1d 92 1b 4c 44 4d  46 44 20 52 31 33 21 2c  |t....LDMFD R13!,|
00005190  7b 50 43 7d 20 20 20 3b  65 78 69 74 0d 1d 9c 05  |{PC}   ;exit....|
000051a0  3a 0d 1d a6 2c 2e 65 6e  74 65 72 70 61 73 73 20  |:...,.enterpass |
000051b0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 70 61  |             ;pa|
000051c0  73 73 77 6f 72 64 20 73  74 72 69 6e 67 0d 1d b0  |ssword string...|
000051d0  18 45 51 55 53 20 22 50  61 73 73 77 6f 72 64 3a  |.EQUS "Password:|
000051e0  20 22 2b bd 30 0d 1d ba  05 3a 0d 1d c4 25 2e 77  | "+.0....:...%.w|
000051f0  72 6f 6e 67 77 6f 72 64  20 20 20 20 20 20 20 20  |rongword        |
00005200  20 20 20 20 20 20 3b 77  72 6f 6e 67 20 70 77 0d  |      ;wrong pw.|
00005210  1d ce 31 45 51 55 53 20  bd 28 31 33 29 2b bd 28  |..1EQUS .(13)+.(|
00005220  31 30 29 2b 22 57 72 6f  6e 67 20 70 61 73 73 77  |10)+"Wrong passw|
00005230  6f 72 64 22 2b bd 28 31  33 29 2b bd 28 31 30 29  |ord"+.(13)+.(10)|
00005240  0d 1d d8 0a 45 51 55 42  20 30 0d 1d e2 09 41 4c  |....EQUB 0....AL|
00005250  49 47 4e 0d 1d ec 05 3a  0d 1d f6 27 2e 73 61 6d  |IGN....:...'.sam|
00005260  70 6c 65 20 20 20 20 20  20 20 20 20 20 20 3b 73  |ple           ;s|
00005270  61 6d 70 6c 65 20 74 65  73 74 20 64 61 74 61 0d  |ample test data.|
00005280  1e 00 0a 45 51 55 44 20  30 0d 1e 0a 0a 45 51 55  |...EQUD 0....EQU|
00005290  44 20 30 0d 1e 14 0a 45  51 55 44 20 30 0d 1e 1e  |D 0....EQUD 0...|
000052a0  05 3a 0d 1e 28 31 2e 70  61 73 73 20 20 20 20 20  |.:..(1.pass     |
000052b0  20 20 20 20 20 20 20 20  3b 70 61 73 73 77 6f 72  |        ;passwor|
000052c0  64 20 28 77 69 74 68 20  62 6c 61 6e 6b 20 64 61  |d (with blank da|
000052d0  74 61 29 0d 1e 32 12 45  51 55 44 20 26 31 32 33  |ta)..2.EQUD &123|
000052e0  34 35 36 37 38 0d 1e 3c  12 45 51 55 44 20 26 38  |45678..<.EQUD &8|
000052f0  37 36 35 34 33 32 31 0d  1e 46 12 45 51 55 44 20  |7654321..F.EQUD |
00005300  26 31 38 32 37 33 36 34  35 0d 1e 50 05 3a 0d 1e  |&18273645..P.:..|
00005310  5a 2b 2e 66 69 6c 65 6c  65 6e 20 20 20 20 20 20  |Z+.filelen      |
00005320  20 20 20 20 3b 6c 65 6e  67 74 68 20 6f 66 20 62  |    ;length of b|
00005330  61 73 69 63 20 70 72 6f  67 0d 1e 64 0c 45 51 55  |asic prog..d.EQU|
00005340  44 20 6c 65 6e 0d 1e 6e  05 3a 0d 1e 78 21 2e 62  |D len..n.:..x!.b|
00005350  61 73 69 63 20 20 20 20  20 20 20 20 20 20 20 20  |asic            |
00005360  3b 74 68 65 20 73 74 72  69 6e 67 0d 1e 82 1a 45  |;the string....E|
00005370  51 55 53 20 22 2a 42 61  73 69 63 20 2d 71 75 69  |QUS "*Basic -qui|
00005380  74 20 20 40 22 0d 1e 8c  0d 2e 70 6f 73 69 74 69  |t  @".....positi|
00005390  6f 6e 0d 1e 96 0a 45 51  55 44 20 30 0d 1e a0 0a  |on....EQUD 0....|
000053a0  45 51 55 44 20 30 0d 1e  aa 0a 2e 63 6f 6d 6d 61  |EQUD 0.....comma|
000053b0  0d 1e b4 0a 45 51 55 42  20 30 0d 1e be 0b 2e 6c  |....EQUB 0.....l|
000053c0  65 6e 67 74 68 0d 1e c8  0a 45 51 55 44 20 30 0d  |ength....EQUD 0.|
000053d0  1e d2 0a 45 51 55 44 20  30 0d 1e dc 0a 45 51 55  |...EQUD 0....EQU|
000053e0  44 20 30 0d 1e e6 05 3a  0d 1e f0 24 2e 65 6e 64  |D 0....:...$.end|
000053f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 74  |              ;t|
00005400  68 65 20 65 6e 64 20 28  21 21 21 29 0d 1e fa 05  |he end (!!!)....|
00005410  5d 0d 1f 04 05 ed 0d 1f  0e 05 e1 0d ff           |]............|
0000541d