Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199510.adf » AW1095_1 » Freeware/MemPie2/!MemPie2/AppSource

Freeware/MemPie2/!MemPie2/AppSource

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

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

Tape/disk: Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199510.adf » AW1095_1
Filename: Freeware/MemPie2/!MemPie2/AppSource
Read OK:
File size: 44F9 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM Memory Pie 2
   20REM Show available memory in a pie-chart
   30REM (C) Sam Kington 1995
   40REM See Messages file for version (this line wonTIMEt be in the crunched code anyway)
   50REM Original version and sprite LEN Ian Jeffray 12th October 1992. (Well, not quite, I
   60REM added a white ABS2ACS to the sprite, but itTIMEs still *mainly* LEN him.)
   70
   80code=-1
   90HeapInitialised=FALSE
  100SYS "Wimp_SlotSize", -1, -1 TO slotsize, , free
  110Heap=&8000+slotsize+16
  120
  130ON ERROR ON ERROR OFF : ERROR EXT ERR, REPORT$+" at line "+STR$(ERL): END
  140
  150alias$="<MemoryPie2$Dir>"
  160taskname$="Memory Pie 2"
  170WimpInit=FALSE
  180
  190ON ERROR ONERROR OFF :PROCerror : END
  200PROCvars
  210PROCmsgtrans
  220PROCassemble
  230PROCmemorypievars
  240PROCsetup
  250PROCpollloop
  260PROCfinish
  270END
  280
  290DEFPROCpollloop
  300REPEAT
  310   PROCpoll(idlemask)
  320UNTIL FALSE
  330ENDPROC
  340
  350DEFPROCsetup
  360PROCicons
  370PROCmessageinit
  380PROCstartwimp
  390PROCloadtemplates(alias$+".Templates")
  400PROCloadsprites(alias$+".Sprites")
  410PROCwriteicon(win_info, icon_version, version$)
  420PROCbuildmenus
  430PROCgetmodevars
  440baricon%=FNiconbar
  450PROCcheckmem
  460ENDPROC
  470
  480DEFPROCvars
  490LOCAL loop
  500DIM block% 1024, string 256, in 64
  510doneiconbar=FALSE
  520stdmask= %11100000110001
  530nullmask=%11100000110000
  540idlemask=-1
  550idlegap=30
  560currenthandle%=-1
  570_EndIcon=-42
  580ENDPROC
  590
  600DEFPROCpoll(pollmask)
  610LOCAL time
  620IF pollmask<>idlemask THEN
  630   SYS "Wimp_Poll", pollmask, block% TO reason%
  640ELSE
  650   SYS "OS_ReadMonotonicTime" TO time
  660   SYS "Wimp_PollIdle", nullmask, block%, time+idlegap TO reason%
  670ENDIF
  680CASE reason% OF
  690   WHEN 0: PROCcheckmem
  700   WHEN 1: PROCredraw(_redraw)
  760   WHEN 2: PROCopen
  770   WHEN 3: PROCclose
  780   WHEN 6: PROCcheckmouse(!block%, block%!4, block%!8, block%!12, block%!16)
  790   WHEN 8: PROCcheckkeys
  800   WHEN 9
  810      SYS "Wimp_GetPointerInfo",,block%+128
  820      reopen=(block%!136 AND 1)=1
  830      PROCdofunctions(!block%)
  840      IF reopen THEN
  850         PROCreopenmenu(Iconmenu%, menux%, menuheight%)
  860      ENDIF
  870   WHEN 17, 18: PROCmessage(reason%)
  880ENDCASE
  890ENDPROC
  900
  910DEFPROCassemble
  920IF code=-1 DIM code 120
  930sp=13
  940link=14
  950pc=15
  960
  970FOR pass=0 TO 2 STEP 2
  980P%=code
  990[OPT pass
 1000REM pass back all the addresses FastTask needs in block pointed to in r0
 1010.stringread
 1020STMFD   (sp)!, {r0-r3, link}
 1030REM enter with pointer to original in r0 and output buffer in r1
 1040REM r2 holds counter, r3 actual value
 1050MOV     r2, #0
 1060.srstart
 1070LDRB    r3, [r0, r2]   ; load byte
 1080CMP     r3, #0         ; is it a null?
 1090CMPNE   r3, #13        ; is it a CR then?
 1100MOVEQ   r3, #13        ; if it is, replace by a <CR>
 1110STRB    r3, [r1, r2]   ; store it back whatever the result
 1120ADDNE   r2, r2, #1     ; if it's OK, increment the pointer
 1130BNE     srstart        ; and start again - else exit
 1140LDMIA   (sp)!, {r0-r3, pc}^
 1150
 1160.caseless
 1170STMFD   (sp)!, {r0, r1, link}
 1180.caselessstart
 1190LDRB    r1, [r0]
 1200CMP     r1, #13
 1210BEQ     quit
 1220CMP     r1, #65
 1230ADDLT   r0, r0, #1
 1240BLT     caselessstart
 1250CMP     r1, #90
 1260ADDLE   r1, r1, #32
 1270STRLEB  r1, [r0]
 1280ADD     r0, r0, #1
 1290B       caselessstart
 1300.quit
 1310LDMIA   (sp)!, {r0, r1, pc}
 1320]
 1330NEXT
 1340ENDPROC
 1350
 1360DEFPROCmemorypievars
 1370LOCAL env
 1380REM Misc
 1390version$=FNmess("Ver")
 1400SYS "XOS_GetEnv" TO env
 1410StartMemoryPie$=FNreadstring(env)
 1420DIM valid 4
 1430$valid=""
 1440DIM spriteptr 13
 1450$spriteptr="barpie"
 1460
 1470REM Memory stuff
 1480DIM memory(7), oldmemory(7)
 1490_system=0
 1500_rma=1
 1510_screen=2
 1520_sprite=3
 1530_fonts=4
 1540_ram=5
 1550_apps=6
 1560_free=7
 1570
 1580SYS "XOS_ReadMemMapInfo" TO pagesize, numpages
 1590MemSize=pagesize*numpages
 1600Update=TRUE
 1610angconst=1/MemSize*2*PI
 1620
 1630REM Window stuff
 1640winwidth=-1
 1650winheight=-1
 1660_redraw=0
 1670_update=1
 1680winopen_large=FALSE
 1690ENDPROC
 1700
 1710REM OS_Heap: 0 : initialise heap
 1720REM          1 : describe heap
 1730REM          2 : get heap block
 1740REM          3 : free heap block
 1750REM          4 : extend or shrink heap block
 1760REM          5 : extend or shrink heap
 1770REM          6 : read block size
 1780
 1790DEFPROCinitheap(size)
 1800LOCAL slotsize, free, max, total
 1810SYS "Wimp_SlotSize", -1, -1 TO slotsize, , free
 1820IF free<>0 THEN
 1830   HeapInitialised=FALSE
 1840   HeapSize=size
 1850   PROCsetslot(Heap+size)
 1860   SYS "OS_Heap", 0, Heap,,size
 1870   SYS "XOS_Heap", 1, Heap TO ,,max, total
 1880   HeapInitialised=TRUE
 1890ELSE
 1900   PROCreport(FNmess("HeapMem"), 0)
 1910ENDIF
 1920ENDPROC
 1930
 1940DEFPROCdiscardheap
 1950HeapInitialised=FALSE
 1960PROCsetslot(Heap-16)
 1970ENDPROC
 1980
 1990DEFFNheap(size)
 2000LOCAL heapblock, heapsize, freemem
 2010IF HeapInitialised=FALSE THEN PROCinitheap(256)
 2020SYS "XOS_Heap", 2, Heap,,size TO ,,heapblock
 2030SYS "XOS_Heap", 1, Heap TO ,,max,total
 2040SYS "XOS_Heap", 6, Heap, heapblock TO ,,,blocksize
 2050WHILE heapblock=0
 2060   REPEAT
 2070      SYS "Wimp_SlotSize",-1,-1 TO ,,freemem
 2080      IF freemem<size THEN
 2090         PROCpoll(nullmask)
 2100      ENDIF
 2110   UNTIL freemem>=size
 2120   heapsize=((size+3) AND (NOT 3)) + 64
 2130   HeapSize+=heapsize
 2140   SYS "Wimp_SlotSize", Heap+HeapSize-&8000, -1
 2150   PROCsetslot(Heap+HeapSize)
 2160   SYS "XOS_Heap", 5, Heap,,heapsize
 2170   SYS "XOS_Heap", 2, Heap,,size TO ,,heapblock
 2180   SYS "XOS_Heap", 6, Heap, heapblock TO ,,,blocksize
 2190   SYS "XOS_Heap", 1, Heap TO ,,max, total
 2200ENDWHILE
 2210=heapblock
 2220
 2230DEFPROCfreeheap(heapblock)
 2240LOCAL blocksize, change, newheapsize
 2250IF heapblock<>-1 THEN
 2260   SYS "XOS_Heap", 6, Heap, heapblock TO ,,,blocksize
 2270   SYS "XOS_Heap", 3, Heap, heapblock
 2280   SYS "XOS_Heap", 5, Heap,,-blocksize TO ,,,change
 2290   SYS "XOS_Heap", 1, Heap TO ,,max, total
 2300   HeapSize+=change-8
 2310   IF HeapSize<256 THEN HeapSize=256
 2320   PROCsetslot(Heap+HeapSize)
 2330ENDIF
 2340ENDPROC
 2350
 2360DEFPROCsetslot(end)
 2370SYS "Wimp_SlotSize", end-&8000, -1
 2380ENDPROC
 2390
 2400REM Errors
 2410
 2420DEFPROCfinish
 2430ON ERROR ON ERROR OFF : END
 2440ON ERROR ON ERROR OFF : ERROR EXT ERR, FNmess("Err")+STR$(ERL)+REPORT$ : END
 2450IF WimpInit THEN
 2460   SYS "Wimp_CloseDown", TaskHandle, &4B534154
 2470ENDIF
 2480END
 2490ENDPROC
 2500
 2510DEFPROCerror
 2520LOCAL result
 2530ON ERROR ON ERROR OFF : ERROR EXT ERR, "Internal error code "+STR$(ERL)+": "+REPORT$ : END
 2540!block%=ERR
 2550$(block%+4)=FNmess("Err")+STR$(ERL)+": "+REPORT$+"."+CHR$0
 2560SYS "Wimp_ReportError", block%, 3, taskname$ TO ,result
 2570IF result=2 THEN PROCareyousure
 2580ON ERROR ONERROR OFF :PROCerror : END
 2590IF doneiconbar THEN PROCfaint(-2, baricon%, FALSE)
 2600PROCpollloop
 2610ENDPROC
 2620
 2630DEFPROCareyousure
 2640LOCAL result
 2650$(block%+4)=FNmess("Sure")
 2660SYS "Wimp_ReportError", block%, 23, FNmess("Mess")+taskname$ TO ,result
 2670IF result=1 THEN PROCfinish
 2680ENDPROC
 2690
 2700DEFPROCreport(string$)
 2710LOCAL text$
 2720!block%=0
 2730$(block%+4)=string$
 2740SYS "Wimp_ReportError", block%, 3, taskname$ TO ,result
 2750IF result=2 THEN PROCareyousure
 2760ENDPROC
 2770
 2780DEFPROCalert(mess$)
 2790!block%=0
 2800$(block%+4)=mess$
 2810SYS "Wimp_ReportError", block%, 1, taskname$
 2820ENDPROC
 2830
 2840REM Keys
 2850
 2860DEFPROCcheckkeys
 2870LOCAL window, icon, caretpos, char, command$, add$
 2880LOCAL icon$, add$, nexticon
 2890window=!block%
 2900icon=block%!4
 2910caretpos=block%!20
 2920char=block%!24
 2930process=TRUE
 2940IF process SYS "Wimp_ProcessKey", char
 2950ENDPROC
 2960
 2970REM Menus
 2980
 2990DEFPROCcreatemenu(RETURN menu, title$, items, width)
 3000DIM menu 28+items*24
 3010$menu=title$
 3020menu!12=&70207
 3030menu!16=16+width*16
 3040menu!20=44
 3050menu!24=0
 3060currentmenupos=menu+28
 3070ENDPROC
 3080
 3090DEFPROCaddmenu(item$, submenu)
 3100LOCAL buffer
 3110!currentmenupos=0
 3120currentmenupos!4=submenu
 3130currentmenupos!8=&7000021
 3140IF LEN(item$)<=12 THEN
 3150   $(currentmenupos+12)=item$
 3160ELSE
 3170   DIM buffer LEN(item$)+1
 3180   $buffer=item$
 3190   currentmenupos!12=buffer
 3200   currentmenupos!16=valid
 3210   currentmenupos!20=LEN(item$)+1
 3220   currentmenupos!8+=2^8
 3230ENDIF
 3240currentmenupos+=24
 3250ENDPROC
 3260
 3270DEFPROCendmenu
 3280currentmenupos!(-24)=1<<7
 3290ENDPROC
 3300
 3310DEFPROCbuildmenus
 3320LOCAL currentmenupos, loop
 3330PROCcreatemenu(Iconmenu%, FNmess("M1T"), 5, 10)
 3340menu_info=0
 3350PROCaddmenu(FNmess("M10"), win_info)
 3360menu_key=1
 3370menu_closeup=2
 3380menu_quit=3
 3390FOR loop=menu_key TO menu_quit
 3400   PROCaddmenu(FNmess("M1"+STR$(loop)), -1)
 3410NEXT
 3420PROCendmenu
 3430menuheight%=4*44+96
 3440ENDPROC
 3450
 3460DEFPROCdofunctions(item%)
 3470CASE item% OF
 3480   WHEN menu_key : PROCopenwindowcentred(win_key)
 3490   WHEN menu_closeup : PROCopenwindowcentred(win_large)
 3500   WHEN menu_quit : PROCfinish
 3510ENDCASE
 3520ENDPROC
 3530
 3540REM Mouse
 3550
 3560DEFPROCicons
 3570REM *** Info box (win_info) ***
 3580icon_version=7
 3590ENDPROC
 3600
 3610DEFPROCcheckmouse(mx%, my%, button%, window%, icon%)
 3620LOCAL buffer, mod, keyword$
 3630LOCAL item, type, action
 3640CASE window% OF
 3650   WHEN -2
 3660      CASE button% OF
 3670         WHEN 2 : PROCploticonmenu(Iconmenu%, mx%)
 3680         WHEN 1 : PROCopenwindowcentred(win_key)
 3690         WHEN 4 : PROCopenwindowcentred(win_large)
 3700      ENDCASE
 3710ENDCASE
 3720ENDPROC
 3730
 3740REM Wimp
 3750
 3760DEFPROCstartwimp
 3770SYS "Wimp_Initialise", 310, &4B534154, taskname$, messblock TO version, TaskHandle
 3780WimpInit=TRUE
 3790ENDPROC
 3800
 3810DEFFNreadstring(offset)
 3820A%=offset
 3830B%=string
 3840CALL stringread
 3850=$string
 3860
 3870DEFPROCsetwindowtitle(window%, val$)
 3880!block%=window%
 3890SYS "Wimp_GetWindowInfo",,block% OR 1
 3900$(block%!76)=val$
 3910?(block%!76+LEN(val$))=0
 3920ENDPROC
 3930
 3940DEFPROCtrace(str$)
 3950BPUT#TRACE, str$
 3960ENDPROC
 3970
 3980DEFPROCloadsprites(file$)
 3990LOCAL flags, count, offset, maxsize, size
 4000SYS "XOS_File", 23, file$ TO found,,,,length
 4010DIM sprite% length
 4020!sprite%=length+4
 4030sprite%!8=16
 4040SYS "XOS_SpriteOp", &109, sprite%
 4050SYS "XOS_SpriteOp", &10A, sprite%, file$
 4060offset=sprite%+sprite%!8
 4070maxsize=0
 4080FOR count=1 TO sprite%!4
 4090   CASE FNreadstring(offset+4) OF
 4100      WHEN "barpie" : sprite_standard=offset
 4110      WHEN "barpie22" : sprite_multisync=offset
 4120   ENDCASE
 4130   SYS "XOS_SpriteOp", 512+62, sprite%, offset TO ,,,size
 4140   IF size>maxsize THEN maxsize=size
 4150   offset+=!offset
 4160NEXT
 4170DIM savearea maxsize
 4180ENDPROC
 4190
 4200DEFFNiconbar
 4210LOCAL width
 4220SYS "OS_SpriteOp", 512+40, sprite%, barsprite TO ,,,width
 4230!block%=-1
 4240block%!4=0
 4250block%!8=-32
 4260block%!12=(width<<XEigFactor)
 4270block%!16=120
 4280block%!20=&311A
 4290block%!24=spriteptr
 4300block%!28=sprite%
 4310block%!32=13
 4320SYS "Wimp_CreateIcon",,block% TO icon%
 4330doneiconbar=TRUE
 4340=icon%
 4350
 4360DEFPROCwriteicon(window%, icon%, string$)
 4370!block%=window%
 4380block%!4=icon%
 4390SYS "Wimp_GetIconState",,block%
 4400IF (block%!24 AND 1<<23)>1 THEN
 4410   PROCreport(FNmess("IcDel"))
 4420ELSE
 4430   $(block%!28)=string$
 4440   PROCseticonstate(window%, icon%, 0, 0)
 4450ENDIF
 4460ENDPROC
 4470
 4480DEFFNreadicon(window%, icon%)
 4490LOCAL out$
 4500!block%=window%
 4510block%!4=icon%
 4520SYS "Wimp_GetIconState",,block%
 4530IF (block%!24 AND 1<<23)>1 THEN
 4540   PROCreport("Read: "+FNmess("Icdel"))
 4550   out$=""
 4560ELSE
 4570   out$=$(block%!28)
 4580ENDIF
 4590=out$
 4600
 4610DEFPROCfaint(window%, icon%, faint%)
 4620LOCAL mask, set
 4630mask=1<<22
 4640set=(-faint%)<<22
 4650IF faint% THEN mask+=1<<21
 4660PROCseticonstate(window%, icon%, mask, set)
 4670ENDPROC
 4680
 4690DEFFNselected(window%, icon%)
 4700LOCAL loop
 4710!block%=window%
 4720block%!4=icon%
 4730SYS "Wimp_GetIconState",,block%
 4740=((block%!24 AND (1<<21))>0)
 4750
 4760DEFPROCselect(window%, icon%, sel%)
 4770LOCAL mask, set
 4780mask=1<<21
 4790set=(-sel%)<<21
 4800PROCseticonstate(window%, icon%, mask, set)
 4810ENDPROC
 4820
 4830DEFPROCseticonstate(window%, icon%, mask, bits)
 4840!block%=window%
 4850block%!4=icon%
 4860block%!8=bits
 4870block%!12=mask
 4880SYS "Wimp_SetIconState",,block%
 4890ENDPROC
 4900
 4910DEFPROCmsgtrans
 4920LOCAL flags, buflength
 4930SYS "MessageTrans_FileInfo", , alias$+".Messages" TO flags, ,buflength
 4940IF (flags AND 1)=0 THEN
 4950   DIM MsgBuffer buflength
 4960   DIM MsgDescript 20
 4970   SYS "MessageTrans_OpenFile", MsgDescript, alias$+".Messages", MsgBuffer
 4980ELSE
 4990   PROCreport("Hey, these messages are already in memory.")
 5000ENDIF
 5010ENDPROC
 5020
 5030DEFFNmess(tok$)
 5040LOCAL loop, out$, pointer, length
 5050$in=tok$+":"+tok$
 5060?(in+LEN($in))=0
 5070SYS "MessageTrans_Lookup", MsgDescript, in, 0, 0, 0, 0, 0, 0 TO ,,pointer,length
 5080FOR loop=0 TO length-1
 5090   out$+=CHR$(pointer?loop)
 5100NEXT
 5110=out$
 5120
 5130DEFFNmessarg(tok$, arg1$, arg2$, arg3$, arg4$)
 5140LOCAL loop, in$, out$, pointer, length
 5150$in=tok$+":"+tok$
 5160?(in+LEN($in))=0
 5170SYS "MessageTrans_Lookup", MsgDescript, in, string, 256, arg1$, arg2$, arg3$, arg4$ TO ,,pointer, length
 5180FOR loop=0 TO length-1
 5190   out$+=CHR$(pointer?loop)
 5200NEXT
 5210=out$
 5220
 5230DEFPROCsetcaret(window, icon, pos)
 5240IF pos=_EndIcon THEN pos=LEN(FNreadicon(window, icon))
 5250SYS "Wimp_SetCaretPosition", window, icon, -1, -1, -1, pos
 5260ENDPROC
 5270
 5280DEFFNcaseless(str$)
 5290$string=str$
 5300A%=string
 5310CALL caseless
 5320=$string
 5330
 5340REM WimpMenus
 5350
 5360DEFPROCreopenmenu(menuhandle%, menux%, menuy%)
 5370SYS "Wimp_CreateMenu",,currenthandle%, menux%-64, menuy%
 5380currenthandle%=menuhandle%
 5390ENDPROC
 5400
 5410DEFPROCploticonmenu(menuhandle%, menux%)
 5420currenthandle%=menuhandle%
 5430SYS "Wimp_CreateMenu",,currenthandle%, menux%-64, menuheight%
 5440ENDPROC
 5450
 5460REM WimpMess
 5470
 5480DEFPROCmessageinit
 5490LOCAL pos
 5500DIM messblock 256
 5510DIM palette 80
 5520DIM input 20, output 20
 5530pos=-4
 5540REPEAT
 5550   pos+=4
 5560   READ messblock!pos
 5570UNTIL messblock!pos=0
 5580DATA 9, 10, &400C1, 0
 5590ENDPROC
 5600
 5610DEFPROCmessage(reason%)
 5620LOCAL actioncode, num, address
 5630originhandle=block%!4
 5640actioncode=block%!16
 5650CASE actioncode OF
 5660   WHEN 0 : PROCfinish
 5670   WHEN 10 : PROCsavedesktop
 5680   WHEN 9, &400C1
 5690      PROCgetmodevars
 5700      Update=TRUE
 5710      PROCcheckmem
 5720ENDCASE
 5730ENDPROC
 5740
 5750DEFPROCgetmodevars
 5760LOCAL input, output, loop
 5770DIM input 24, output 24
 5780!input=130: REM Right-hand column of graphics window
 5790input!4=131 : REM Top row of graphics window
 5800input!8=4 : REM XEigFactor, shift pixels to obtain OS units
 5810input!12=5 : REM YEigFactor
 5820input!16=9 : REM Log2BPP
 5830input!20=-1
 5840VDU 26 : REM Reset window just in case
 5850SYS "OS_ReadVduVariables", input, output
 5860XEigFactor=output!8
 5870YEigFactor=output!12
 5880BPP=(1<<output!16)/8
 5890MaxXCoord=!output<<XEigFactor
 5900MaxYCoord=output!4<<YEigFactor
 5910IF YEigFactor=1 THEN
 5920   barsprite=sprite_multisync
 5930   $spriteptr="barpie22"
 5940ELSE
 5950   barsprite=sprite_standard
 5960   $spriteptr="barpie"
 5970ENDIF
 5980SYS "Wimp_ReadPalette",,palette
 5990FOR loop=0 TO 15
 5991   barsprite!(loop*8+44)=(palette!(loop*4) AND &FFFFFF00)+(((palette!(loop*4) AND &F0F0F000)>>4) AND &0FFFFFFF)
 5992   barsprite!(loop*8+48)=barsprite!(loop*8+44)
 6000NEXT
 6020ENDPROC
 6030
 6040DEFPROCsavedesktop
 6050LOCAL handle
 6060handle=block%!20
 6070BPUT#handle, StartMemoryPie$
 6080ENDPROC
 6090
 6100DEFFNreadvar(var$)
 6110LOCAL numread
 6120SYS "XOS_ReadVarVal", var$, block%, 255, 0, 3 TO ,,numread
 6130block%?numread=13
 6140=$block%
 6150
 6160DEFPROCsetvar(var$, val$)
 6170SYS "XOS_SetVarVal", var$, val$, LEN(val$), 0, 0
 6180ENDPROC
 6190REM Windows
 6200
 6210DEFPROCloadtemplates(file$)
 6220LOCAL loop, winpos, win, ind, slotsize, templates, free
 6230SYS "Wimp_OpenTemplate",,file$
 6240win_info=FNloadwindow("Info")
 6250win_key=FNloadwindow("Key")
 6260win_large=FNloadwindow("Large")
 6270SYS "Wimp_CloseTemplate"
 6280PROCdiscardheap
 6290ENDPROC
 6300
 6310DEFFNloadwindow(win$)
 6320LOCAL win, bufsize, indsize, buffer, ind
 6330SYS "Wimp_LoadTemplate",,-1,,,, win$, 0 TO ,bufsize, indsize
 6340buffer=FNheap(bufsize)
 6350DIM ind indsize
 6360SYS "Wimp_LoadTemplate",,buffer, ind, ind+indsize, -1, win$, 0
 6370SYS "Wimp_CreateWindow",,buffer TO win
 6380PROCfreeheap(buffer)
 6390=win
 6400
 6410DEFPROCopenwindowcentred(window%)
 6420LOCAL width, height
 6430!block%=window%
 6440SYS "Wimp_GetWindowState",,block%
 6450width=block%!12-block%!4
 6460height=block%!16-block%!8
 6470block%!4=(MaxXCoord-width)/2
 6480block%!8=(MaxYCoord-height)/2
 6490block%!12=block%!4+width
 6500block%!16=block%!8+height
 6510block%!28=-1
 6520PROCopen
 6530ENDPROC
 6540
 6550DEFPROCopen
 6560LOCAL height,width
 6570IF !block%=win_large THEN
 6580   winopen_large=TRUE
 6590   height=block%!16-block%!8
 6600   width=block%!12-block%!4
 6610   IF (height<>winheight OR width<>winwidth) THEN
 6620      radius=INT(width/2)-XEigFactor
 6630      SYS "Wimp_ForceRedraw", win_large, 0, -height, width, 0
 6640      winheight=height
 6650      winwidth=width
 6660   ENDIF
 6670ENDIF
 6680SYS "Wimp_OpenWindow",,block%
 6690ENDPROC
 6700
 6710DEFPROCclosewindow(window%)
 6720!block%=window%
 6730IF window%=win_choices THEN winopen_choices=FALSE
 6740PROCclose
 6750ENDPROC
 6760
 6770DEFPROCclose
 6780LOCAL buffer, loop
 6790IF !block%=win_large THEN winopen_large=FALSE
 6800SYS "Wimp_CloseWindow",,block%
 6810ENDPROC
 6820
 6830DEFPROCforceredraw(window%)
 6840!block%=window%
 6850SYS "XWimp_GetWindowState",,block%
 6860SYS "XWimp_ForceRedraw", -1, block%!4, block%!8, block%!12, block%!16
 6870ENDPROC
 6880
 6890DEFFNarea(num)
 6900LOCAL size
 6910SYS "XOS_ReadDynamicArea", num TO ,size
 6920=((size+pagesize-1) DIV pagesize)*pagesize
 6930
 6940DEFFNK(val)
 6950=STR$(val DIV 1024)
 6960
 6970DEFPROCcheckmem
 6980LOCAL loop, sum
 6990
 7000sum=0
 7010FOR loop=_system TO _ram
 7020   memory(loop)=FNarea(loop)
 7030   sum+=memory(loop)
 7040NEXT
 7050SYS "Wimp_SlotSize", -1, -1 TO ,,memory(_free)
 7060sum+=memory(_free)
 7070memory(_apps)=MemSize-sum
 7080FOR loop=_system TO _free
 7090   IF memory(loop)<>oldmemory(loop) THEN Update=TRUE
 7100NEXT
 7110
 7120IF Update THEN
 7130   PROCplotpiesprite(barsprite)
 7140   PROCseticonstate(-2, baricon%, 0, 0)
 7150   PROCredraw(_update)
 7160   oldmemory()=memory()
 7170   Update=FALSE
 7180ENDIF
 7190ENDPROC
 7200
 7210DEFPROCplotpiesprite(piesprite)
 7220LOCAL xpos, ypos, width, height, radius, realwidth, realheight, realradius
 7230LOCAL r0,r1,r2,r3, angle
 7240SYS "XOS_SpriteOp", 512+40, sprite%, piesprite TO ,,,width,height
 7250realwidth=width<<XEigFactor
 7260realheight=height<<YEigFactor
 7270xpos=realwidth/2
 7280ypos=realheight/2
 7290width=(width-2)<<XEigFactor
 7300height=(height-2)<<YEigFactor
 7310radius=INT(realwidth+realheight)/4-XEigFactor
 7320!savearea=0
 7330SYS "OS_SpriteOp", 512+60, sprite%, piesprite, savearea TO r0,r1,r2,r3
 7340ORIGIN xpos, ypos
 7350angle=0
 7360PROCsector(11, _free)
 7370PROCsector(14, _apps)
 7380PROCsector(9, _screen)
 7390PROCsector(10, _system)
 7400PROCsector(13, _rma)
 7410PROCsector(15, _fonts)
 7420PROCsector(8, _sprite)
 7430PROCsector(0, _ram)
 7440SYS "Wimp_SetColour", 7
 7450CIRCLE 0, 0, radius
 7460SYS "OS_SpriteOp", r0,r1,r2,r3
 7470ENDPROC
 7480
 7490DEFPROCsector(colour, size)
 7500IF memory(size)=0 ENDPROC
 7510SYS "Wimp_SetColour", colour
 7520MOVE 0,0
 7530MOVE SIN(angle)*radius, COS(angle)*radius
 7540angle-=memory(size)*angconst
 7550PLOT &B5, SIN(angle)*radius, COS(angle)*radius
 7560ENDPROC
 7570
 7700DEFPROCredraw(code)
 7710LOCAL more, angle
 7720CASE code OF
 7730   WHEN _redraw
 7740      SYS "Wimp_RedrawWindow",,block% TO more
 7750   WHEN _update
 7760      !block%=win_large
 7770      block%!4=0
 7780      block%!8=-winheight
 7790      block%!12=winwidth
 7800      block%!16=0
 7810      SYS "Wimp_UpdateWindow",,block% TO more
 7820ENDCASE
 7830xpos=(block%!4+block%!12)/2
 7840ypos=(block%!8+block%!16)/2
 7850WHILE more
 7860   ORIGIN xpos, ypos
 7870   angle=0
 7880   PROCsector(11, _free)
 7890   PROCsector(14, _apps)
 7900   PROCsector(9, _screen)
 7910   PROCsector(10, _system)
 7920   PROCsector(13, _rma)
 7930   PROCsector(15, _fonts)
 7940   PROCsector(8, _sprite)
 7950   PROCsector(0, _ram)
 7960   SYS "Wimp_SetColour", 7
 7970   CIRCLE 0, 0, radius
 7980   CIRCLE 0, 0, radius+XEigFactor
 7990   ORIGIN 0,0
 8000   SYS "Wimp_GetRectangle",, block% TO more
 8010ENDWHILE
 8020ENDPROC

� Memory Pie 2
*� Show available memory in a pie-chart
� (C) Sam Kington 1995
(T� See Messages file for version (this line won�t be in the crunched code anyway)
2V� Original version and sprite � Ian Jeffray 12th October 1992. (Well, not quite, I
<F� added a white �2� to the sprite, but it�s still *mainly* � him.)
F
Pcode=-1
ZHeapInitialised=�
d1ș "Wimp_SlotSize", -1, -1 � slotsize, , free
nHeap=&8000+slotsize+16
x
�-� � � � � : � � �, �$+" at line "+�(�): �
�
�alias$="<MemoryPie2$Dir>"
�taskname$="Memory Pie 2"
�WimpInit=�
�
�� � � � :�error : �
�	�vars
�
�msgtrans
�
�assemble
��memorypievars
�
�setup
�
�pollloop
�finish
�

"��pollloop
,�
6   �poll(idlemask)
@� �
J�
T
^��setup
h
�icons
r�messageinit
|�startwimp
�'�loadtemplates(alias$+".Templates")
�#�loadsprites(alias$+".Sprites")
�0�writeicon(win_info, icon_version, version$)
��buildmenus
��getmodevars
�baricon%=�iconbar
�
�checkmem
��
�
�
��vars
�
� loop
�$� block% 1024, string 256, in 64
�doneiconbar=�
stdmask= %11100000110001
nullmask=%11100000110000
idlemask=-1
&idlegap=30
0currenthandle%=-1
:_EndIcon=-42
D�
N
X��poll(pollmask)
b
� time
l� pollmask<>idlemask �
v1   ș "Wimp_Poll", pollmask, block% � reason%
��
�'   ș "OS_ReadMonotonicTime" � time
�C   ș "Wimp_PollIdle", nullmask, block%, time+idlegap � reason%
��
�Ȏ reason% �
�   � 0: �checkmem
�   � 1: �redraw(_redraw)
�   � 2: �open
   � 3: �close
J   � 6: �checkmouse(!block%, block%!4, block%!8, block%!12, block%!16)
   � 8: �checkkeys
 
   � 9
*.      ș "Wimp_GetPointerInfo",,block%+128
4#      reopen=(block%!136 � 1)=1
>      �dofunctions(!block%)
H      � reopen �
R8         �reopenmenu(Iconmenu%, menux%, menuheight%)
\      �
f"   � 17, 18: �message(reason%)
p�
z�
�
���assemble
�� code=-1 � code 120
�	sp=13
�link=14
�	pc=15
�
�� pass=0 � 2 � 2
�P%=code
�
[OPT pass
�J� pass back all the addresses FastTask needs in block pointed to in r0
�.stringread
� STMFD   (sp)!, {r0-r3, link}
B� enter with pointer to original in r0 and output buffer in r1
'� r2 holds counter, r3 actual value
MOV     r2, #0
$.srstart
.&LDRB    r3, [r0, r2]   ; load byte
8*CMP     r3, #0         ; is it a null?
B-CMPNE   r3, #13        ; is it a CR then?
L5�Q   r3, #13        ; if it is, replace by a <CR>
V>STRB    r3, [r1, r2]   ; store it back whatever the result
`>ADDNE   r2, r2, #1     ; if it's OK, increment the pointer
j8BNE     srstart        ; and start again - else exit
tLDMIA   (sp)!, {r0-r3, pc}^
~
�
.caseless
�!STMFD   (sp)!, {r0, r1, link}
�.caselessstart
�LDRB    r1, [r0]
�CMP     r1, #13
�BEQ     quit
�CMP     r1, #65
�ADDLT   r0, r0, #1
�BLT     caselessstart
�CMP     r1, #90
�ADDLE   r1, r1, #32
�STRLEB  r1, [r0]
ADD     r0, r0, #1

B       caselessstart
	.quit
LDMIA   (sp)!, {r0, r1, pc}
(]
2�
<�
F
P��memorypievars
Z	� env
d
� Misc
nversion$=�mess("Ver")
xș "XOS_GetEnv" � env
�$StartMemoryPie$=�readstring(env)
�
� valid 4
�
$valid=""
�� spriteptr 13
�$spriteptr="barpie"
�
�� Memory stuff
�� memory(7), oldmemory(7)
�
_system=0
�
_rma=1
�
_screen=2
�
_sprite=3
�_fonts=4

_ram=5
_apps=6
_free=7
"
,0ș "XOS_ReadMemMapInfo" � pagesize, numpages
6MemSize=pagesize*numpages
@Update=�
Jangconst=1/MemSize*2*�
T
^� Window stuff
hwinwidth=-1
rwinheight=-1
|
_redraw=0
�
_update=1
�winopen_large=�
��
�
�"� OS_Heap: 0 : initialise heap
� �          1 : describe heap
�!�          2 : get heap block
�"�          3 : free heap block
�.�          4 : extend or shrink heap block
�(�          5 : extend or shrink heap
�"�          6 : read block size
�
���initheap(size)
 � slotsize, free, max, total
1ș "Wimp_SlotSize", -1, -1 � slotsize, , free
� free<>0 �
&   HeapInitialised=�
0   HeapSize=size
:   �setslot(Heap+size)
D"   ș "OS_Heap", 0, Heap,,size
N,   ș "XOS_Heap", 1, Heap � ,,max, total
X   HeapInitialised=�
b�
l#   �report(�mess("HeapMem"), 0)
v�
��
�
���discardheap
�HeapInitialised=�
��setslot(Heap-16)
��
�
�ݤheap(size)
�"� heapblock, heapsize, freemem
�(� HeapInitialised=� � �initheap(256)
�.ș "XOS_Heap", 2, Heap,,size � ,,heapblock
�(ș "XOS_Heap", 1, Heap � ,,max,total
�4ș "XOS_Heap", 6, Heap, heapblock � ,,,blocksize
ȕ heapblock=0
   �
.      ș "Wimp_SlotSize",-1,-1 � ,,freemem
       � freemem<size �
*         �poll(nullmask)
4      �
>   � freemem>=size
H'   heapsize=((size+3) � (� 3)) + 64
R   HeapSize+=heapsize
\2   ș "Wimp_SlotSize", Heap+HeapSize-&8000, -1
f   �setslot(Heap+HeapSize)
p'   ș "XOS_Heap", 5, Heap,,heapsize
z1   ș "XOS_Heap", 2, Heap,,size � ,,heapblock
�7   ș "XOS_Heap", 6, Heap, heapblock � ,,,blocksize
�,   ș "XOS_Heap", 1, Heap � ,,max, total
��
�=heapblock
�
���freeheap(heapblock)
�$� blocksize, change, newheapsize
�� heapblock<>-1 �
�7   ș "XOS_Heap", 6, Heap, heapblock � ,,,blocksize
�(   ș "XOS_Heap", 3, Heap, heapblock
�5   ș "XOS_Heap", 5, Heap,,-blocksize � ,,,change
�,   ș "XOS_Heap", 1, Heap � ,,max, total
�   HeapSize+=change-8
	$   � HeapSize<256 � HeapSize=256
	   �setslot(Heap+HeapSize)
	�
	$�
	.
	8��setslot(end)
	B%ș "Wimp_SlotSize", end-&8000, -1
	L�
	V
	`� Errors
	j
	t��finish
	~� � � � � : �
	�/� � � � � : � � �, �mess("Err")+�(�)+�$ : �
	�� WimpInit �
	�1   ș "Wimp_CloseDown", TaskHandle, &4B534154
	��
	��
	��
	�
	���error
	�� result
	�>� � � � � : � � �, "Internal error code "+�(�)+": "+�$ : �
	�
!block%=�
	�0$(block%+4)=�mess("Err")+�(�)+": "+�$+"."+�0
9ș "Wimp_ReportError", block%, 3, taskname$ � ,result

� result=2 � �areyousure
� � � � :�error : �
+� doneiconbar � �faint(-2, baricon%, �)
(
�pollloop
2�
<
F��areyousure
P� result
Z$(block%+4)=�mess("Sure")
dHș "Wimp_ReportError", block%, 23, �mess("Mess")+taskname$ � ,result
n� result=1 � �finish
x�
�
���report(string$)
�� text$
�
!block%=0
�$(block%+4)=string$
�9ș "Wimp_ReportError", block%, 3, taskname$ � ,result
�� result=2 � �areyousure
��
�
���alert(mess$)
�
!block%=0
�$(block%+4)=mess$
�/ș "Wimp_ReportError", block%, 1, taskname$
�


� Keys
"
,��checkkeys
62� window, icon, caretpos, char, command$, add$
@� icon$, add$, nexticon
Jwindow=!block%
Ticon=block%!4
^caretpos=block%!20
hchar=block%!24
r
process=�
|(� process ș "Wimp_ProcessKey", char
��
�
�� Menus
�
�.��createmenu(� menu, title$, items, width)
�� menu 28+items*24
�$menu=title$
�menu!12=&70207
�menu!16=16+width*16
�menu!20=44
�
menu!24=0
�currentmenupos=menu+28
��

��addmenu(item$, submenu)
� buffer
&!currentmenupos=0
0currentmenupos!4=submenu
:currentmenupos!8=&7000021
D� �(item$)<=12 �
N!   $(currentmenupos+12)=item$
X�
b   � buffer �(item$)+1
l   $buffer=item$
v   currentmenupos!12=buffer
�   currentmenupos!16=valid
�#   currentmenupos!20=�(item$)+1
�   currentmenupos!8+=2^8
��
�currentmenupos+=24
��
�
�
��endmenu
�currentmenupos!(-24)=1<<7
��
�
���buildmenus
�� currentmenupos, loop

/�createmenu(Iconmenu%, �mess("M1T"), 5, 10)

menu_info=0

$�addmenu(�mess("M10"), win_info)

 menu_key=1

*menu_closeup=2

4menu_quit=3

>� loop=menu_key � menu_quit

H(   �addmenu(�mess("M1"+�(loop)), -1)

R�

\�endmenu

fmenuheight%=4*44+96

p�

z

���dofunctions(item%)

�Ȏ item% �

�/   � menu_key : �openwindowcentred(win_key)

�5   � menu_closeup : �openwindowcentred(win_large)

�   � menu_quit : �finish

��

��

�

�� Mouse

�

���icons

�!� *** Info box (win_info) ***

�icon_version=7
�

3��checkmouse(mx%, my%, button%, window%, icon%)
$� buffer, mod, keyword$
.� item, type, action
8Ȏ window% �
B   � -2
L      Ȏ button% �
V0         � 2 : �ploticonmenu(Iconmenu%, mx%)
`.         � 1 : �openwindowcentred(win_key)
j0         � 4 : �openwindowcentred(win_large)
t      �
~�
��
�
�
� Wimp
�
���startwimp
�Tș "Wimp_Initialise", 310, &4B534154, taskname$, messblock � version, TaskHandle
�WimpInit=�
��
�
�ݤreadstring(offset)
�
A%=offset
�
B%=string
� stringread

=$string

#��setwindowtitle(window%, val$)
(!block%=window%
2'ș "Wimp_GetWindowInfo",,block% � 1
<$(block%!76)=val$
F?(block%!76+�(val$))=0
P�
Z
d��trace(str$)
n
�#�, str$
x�
�
���loadsprites(file$)
�)� flags, count, offset, maxsize, size
�.ș "XOS_File", 23, file$ � found,,,,length
�� sprite% length
�!sprite%=length+4
�sprite%!8=16
�$ș "XOS_SpriteOp", &109, sprite%
�+ș "XOS_SpriteOp", &10A, sprite%, file$
�offset=sprite%+sprite%!8
�
maxsize=0
�� count=1 � sprite%!4
�!   Ȏ �readstring(offset+4) �
-      � "barpie" : sprite_standard=offset
0      � "barpie22" : sprite_multisync=offset
   �
";   ș "XOS_SpriteOp", 512+62, sprite%, offset � ,,,size
,$   � size>maxsize � maxsize=size
6   offset+=!offset
@�
J� savearea maxsize
T�
^
h
ݤiconbar
r� width
|;ș "OS_SpriteOp", 512+40, sprite%, barsprite � ,,,width
�!block%=-1
�block%!4=0
�block%!8=-32
�!block%!12=(width<<XEigFactor)
�block%!16=120
�block%!20=&311A
�block%!24=spriteptr
�block%!28=sprite%
�block%!32=13
�(ș "Wimp_CreateIcon",,block% � icon%
�doneiconbar=�
�
=icon%
�
(��writeicon(window%, icon%, string$)
!block%=window%
block%!4=icon%
&"ș "Wimp_GetIconState",,block%
0� (block%!24 � 1<<23)>1 �
:   �report(�mess("IcDel"))
D�
N   $(block%!28)=string$
X*   �seticonstate(window%, icon%, 0, 0)
b�
l�
v
�ݤreadicon(window%, icon%)
�
� out$
�!block%=window%
�block%!4=icon%
�"ș "Wimp_GetIconState",,block%
�� (block%!24 � 1<<23)>1 �
�'   �report("Read: "+�mess("Icdel"))
�   out$=""
��
�   out$=$(block%!28)
��
�	=out$
�
#��faint(window%, icon%, faint%)
� mask, set
mask=1<<22
 set=(-faint%)<<22
*� faint% � mask+=1<<21
4,�seticonstate(window%, icon%, mask, set)
>�
H
Rݤselected(window%, icon%)
\
� loop
f!block%=window%
pblock%!4=icon%
z"ș "Wimp_GetIconState",,block%
�=((block%!24 � (1<<21))>0)
�
�"��select(window%, icon%, sel%)
�� mask, set
�mask=1<<21
�set=(-sel%)<<21
�,�seticonstate(window%, icon%, mask, set)
��
�
�.��seticonstate(window%, icon%, mask, bits)
�!block%=window%
�block%!4=icon%
�block%!8=bits
block%!12=mask
"ș "Wimp_SetIconState",,block%
�
$
.��msgtrans
8� flags, buflength
BHș "MessageTrans_FileInfo", , alias$+".Messages" � flags, ,buflength
L� (flags � 1)=0 �
V   � MsgBuffer buflength
`   � MsgDescript 20
jM   ș "MessageTrans_OpenFile", MsgDescript, alias$+".Messages", MsgBuffer
t�
~<   �report("Hey, these messages are already in memory.")
��
��
�
�ݤmess(tok$)
�!� loop, out$, pointer, length
�$in=tok$+":"+tok$
�?(in+�($in))=0
�Rș "MessageTrans_Lookup", MsgDescript, in, 0, 0, 0, 0, 0, 0 � ,,pointer,length
�� loop=0 � length-1
�   out$+=�(pointer?loop)
��
�	=out$


/ݤmessarg(tok$, arg1$, arg2$, arg3$, arg4$)
&� loop, in$, out$, pointer, length
$in=tok$+":"+tok$
(?(in+�($in))=0
2jș "MessageTrans_Lookup", MsgDescript, in, string, 256, arg1$, arg2$, arg3$, arg4$ � ,,pointer, length
<� loop=0 � length-1
F   out$+=�(pointer?loop)
P�
Z	=out$
d
n!��setcaret(window, icon, pos)
x3� pos=_EndIcon � pos=�(�readicon(window, icon))
�=ș "Wimp_SetCaretPosition", window, icon, -1, -1, -1, pos
��
�
�ݤcaseless(str$)
�$string=str$
�
A%=string
�� caseless
�=$string
�
�� WimpMenus
�
�-��reopenmenu(menuhandle%, menux%, menuy%)
�;ș "Wimp_CreateMenu",,currenthandle%, menux%-64, menuy%
currenthandle%=menuhandle%
�

"'��ploticonmenu(menuhandle%, menux%)
,currenthandle%=menuhandle%
6@ș "Wimp_CreateMenu",,currenthandle%, menux%-64, menuheight%
@�
J
T� WimpMess
^
h��messageinit
r	� pos
|� messblock 256
�� palette 80
�� input 20, output 20
�
pos=-4
��
�
   pos+=4
�   � messblock!pos
�� messblock!pos=0
�� 9, 10, &400C1, 0
��
�
���message(reason%)
�� actioncode, num, address
�originhandle=block%!4
actioncode=block%!16
Ȏ actioncode �
   � 0 : �finish
&   � 10 : �savedesktop
0   � 9, &400C1
:      �getmodevars
D      Update=�
N      �checkmem
X�
b�
l
v��getmodevars
�� input, output, loop
�� input 24, output 24
�6!input=130: � Right-hand column of graphics window
�.input!4=131 : � Top row of graphics window
�=input!8=4 : � XEigFactor, shift pixels to obtain OS units
�input!12=5 : � YEigFactor
�input!16=9 : � Log2BPP
�input!20=-1
�&� 26 : � Reset window just in case
�+ș "OS_ReadVduVariables", input, output
�XEigFactor=output!8
�YEigFactor=output!12
�BPP=(1<<output!16)/8
!MaxXCoord=!output<<XEigFactor
"MaxYCoord=output!4<<YEigFactor
� YEigFactor=1 �
 !   barsprite=sprite_multisync
*   $spriteptr="barpie22"
4�
>    barsprite=sprite_standard
H   $spriteptr="barpie"
R�
\"ș "Wimp_ReadPalette",,palette
f� loop=0 � 15
gm   barsprite!(loop*8+44)=(palette!(loop*4) � &FFFFFF00)+(((palette!(loop*4) � &F0F0F000)>>4) � &0FFFFFFF)
h2   barsprite!(loop*8+48)=barsprite!(loop*8+44)
p�
��
�
���savedesktop
�� handle
�handle=block%!20
��#handle, StartMemoryPie$
��
�
�ݤreadvar(var$)
�
� numread
�<ș "XOS_ReadVarVal", var$, block%, 255, 0, 3 � ,,numread
�block%?numread=13
�=$block%

��setvar(var$, val$)
1ș "XOS_SetVarVal", var$, val$, �(val$), 0, 0
$�
.
� Windows
8
B��loadtemplates(file$)
L7� loop, winpos, win, ind, slotsize, templates, free
V!ș "Wimp_OpenTemplate",,file$
` win_info=�loadwindow("Info")
jwin_key=�loadwindow("Key")
t"win_large=�loadwindow("Large")
~ș "Wimp_CloseTemplate"
��discardheap
��
�
�ݤloadwindow(win$)
�(� win, bufsize, indsize, buffer, ind
�>ș "Wimp_LoadTemplate",,-1,,,, win$, 0 � ,bufsize, indsize
�buffer=�heap(bufsize)
�� ind indsize
�Aș "Wimp_LoadTemplate",,buffer, ind, ind+indsize, -1, win$, 0
�(ș "Wimp_CreateWindow",,buffer � win
��freeheap(buffer)
�=win


 ��openwindowcentred(window%)
� width, height
!block%=window%
($ș "Wimp_GetWindowState",,block%
2width=block%!12-block%!4
<height=block%!16-block%!8
F block%!4=(MaxXCoord-width)/2
P!block%!8=(MaxYCoord-height)/2
Zblock%!12=block%!4+width
dblock%!16=block%!8+height
nblock%!28=-1
x	�open
��
�
�
��open
�� height,width
�� !block%=win_large �
�   winopen_large=�
�    height=block%!16-block%!8
�   width=block%!12-block%!4
�0   � (height<>winheight � width<>winwidth) �
�&      radius=�(width/2)-XEigFactor
�@      ș "Wimp_ForceRedraw", win_large, 0, -height, width, 0
�      winheight=height
�      winwidth=width
   �
�
 ș "Wimp_OpenWindow",,block%
"�
,
6��closewindow(window%)
@!block%=window%
J-� window%=win_choices � winopen_choices=�
T
�close
^�
h
r��close
|� buffer, loop
�)� !block%=win_large � winopen_large=�
�!ș "Wimp_CloseWindow",,block%
��
�
���forceredraw(window%)
�!block%=window%
�%ș "XWimp_GetWindowState",,block%
�Hș "XWimp_ForceRedraw", -1, block%!4, block%!8, block%!12, block%!16
��
�
�ݤarea(num)
�
� size
�)ș "XOS_ReadDynamicArea", num � ,size
,=((size+pagesize-1) � pagesize)*pagesize

ݤK(val)
&=�(val � 1024)
0
:��checkmem
D� loop, sum
N
X	sum=0
b� loop=_system � _ram
l   memory(loop)=�area(loop)
v   sum+=memory(loop)
��
�0ș "Wimp_SlotSize", -1, -1 � ,,memory(_free)
�sum+=memory(_free)
�memory(_apps)=MemSize-sum
�� loop=_system � _free
�1   � memory(loop)<>oldmemory(loop) � Update=�
��
�
�� Update �
�    �plotpiesprite(barsprite)
�(   �seticonstate(-2, baricon%, 0, 0)
�   �redraw(_update)
�   oldmemory()=memory()
   Update=�
�
�
 
*��plotpiesprite(piesprite)
4J� xpos, ypos, width, height, radius, realwidth, realheight, realradius
>� r0,r1,r2,r3, angle
HCș "XOS_SpriteOp", 512+40, sprite%, piesprite � ,,,width,height
Rrealwidth=width<<XEigFactor
\!realheight=height<<YEigFactor
fxpos=realwidth/2
pypos=realheight/2
zwidth=(width-2)<<XEigFactor
�!height=(height-2)<<YEigFactor
�/radius=�(realwidth+realheight)/4-XEigFactor
�!savearea=0
�Hș "OS_SpriteOp", 512+60, sprite%, piesprite, savearea � r0,r1,r2,r3
�ȑ xpos, ypos
�angle=0
��sector(11, _free)
��sector(14, _apps)
��sector(9, _screen)
��sector(10, _system)
��sector(13, _rma)
��sector(15, _fonts)
��sector(8, _sprite)
�sector(0, _ram)
ș "Wimp_SetColour", 7
ȏ 0, 0, radius
$!ș "OS_SpriteOp", r0,r1,r2,r3
.�
8
B��sector(colour, size)
L� memory(size)=0 �
Vș "Wimp_SetColour", colour
`	� 0,0
j&� �(angle)*radius, �(angle)*radius
t angle-=memory(size)*angconst
~+� &B5, �(angle)*radius, �(angle)*radius
��
�
��redraw(code)
� more, angle
(
Ȏ code �
2   � _redraw
</      ș "Wimp_RedrawWindow",,block% � more
F   � _update
P      !block%=win_large
Z      block%!4=0
d      block%!8=-winheight
n      block%!12=winwidth
x      block%!16=0
�/      ș "Wimp_UpdateWindow",,block% � more
��
�xpos=(block%!4+block%!12)/2
�ypos=(block%!8+block%!16)/2
�ȕ more
�   ȑ xpos, ypos
�   angle=0
�   �sector(11, _free)
�   �sector(14, _apps)
�   �sector(9, _screen)
�   �sector(10, _system)
�   �sector(13, _rma)
�   �sector(15, _fonts)
   �sector(8, _sprite)
   �sector(0, _ram)
   ș "Wimp_SetColour", 7
"   ȏ 0, 0, radius
,!   ȏ 0, 0, radius+XEigFactor
6
   ȑ 0,0
@-   ș "Wimp_GetRectangle",, block% � more
J�
T�
�
00000000  0d 00 0a 12 f4 20 4d 65  6d 6f 72 79 20 50 69 65  |..... Memory Pie|
00000010  20 32 0d 00 14 2a f4 20  53 68 6f 77 20 61 76 61  | 2...*. Show ava|
00000020  69 6c 61 62 6c 65 20 6d  65 6d 6f 72 79 20 69 6e  |ilable memory in|
00000030  20 61 20 70 69 65 2d 63  68 61 72 74 0d 00 1e 1a  | a pie-chart....|
00000040  f4 20 28 43 29 20 53 61  6d 20 4b 69 6e 67 74 6f  |. (C) Sam Kingto|
00000050  6e 20 31 39 39 35 0d 00  28 54 f4 20 53 65 65 20  |n 1995..(T. See |
00000060  4d 65 73 73 61 67 65 73  20 66 69 6c 65 20 66 6f  |Messages file fo|
00000070  72 20 76 65 72 73 69 6f  6e 20 28 74 68 69 73 20  |r version (this |
00000080  6c 69 6e 65 20 77 6f 6e  91 74 20 62 65 20 69 6e  |line won.t be in|
00000090  20 74 68 65 20 63 72 75  6e 63 68 65 64 20 63 6f  | the crunched co|
000000a0  64 65 20 61 6e 79 77 61  79 29 0d 00 32 56 f4 20  |de anyway)..2V. |
000000b0  4f 72 69 67 69 6e 61 6c  20 76 65 72 73 69 6f 6e  |Original version|
000000c0  20 61 6e 64 20 73 70 72  69 74 65 20 a9 20 49 61  | and sprite . Ia|
000000d0  6e 20 4a 65 66 66 72 61  79 20 31 32 74 68 20 4f  |n Jeffray 12th O|
000000e0  63 74 6f 62 65 72 20 31  39 39 32 2e 20 28 57 65  |ctober 1992. (We|
000000f0  6c 6c 2c 20 6e 6f 74 20  71 75 69 74 65 2c 20 49  |ll, not quite, I|
00000100  0d 00 3c 46 f4 20 61 64  64 65 64 20 61 20 77 68  |..<F. added a wh|
00000110  69 74 65 20 94 32 95 20  74 6f 20 74 68 65 20 73  |ite .2. to the s|
00000120  70 72 69 74 65 2c 20 62  75 74 20 69 74 91 73 20  |prite, but it.s |
00000130  73 74 69 6c 6c 20 2a 6d  61 69 6e 6c 79 2a 20 a9  |still *mainly* .|
00000140  20 68 69 6d 2e 29 0d 00  46 04 0d 00 50 0b 63 6f  | him.)..F...P.co|
00000150  64 65 3d 2d 31 0d 00 5a  15 48 65 61 70 49 6e 69  |de=-1..Z.HeapIni|
00000160  74 69 61 6c 69 73 65 64  3d a3 0d 00 64 31 c8 99  |tialised=...d1..|
00000170  20 22 57 69 6d 70 5f 53  6c 6f 74 53 69 7a 65 22  | "Wimp_SlotSize"|
00000180  2c 20 2d 31 2c 20 2d 31  20 b8 20 73 6c 6f 74 73  |, -1, -1 . slots|
00000190  69 7a 65 2c 20 2c 20 66  72 65 65 0d 00 6e 1a 48  |ize, , free..n.H|
000001a0  65 61 70 3d 26 38 30 30  30 2b 73 6c 6f 74 73 69  |eap=&8000+slotsi|
000001b0  7a 65 2b 31 36 0d 00 78  04 0d 00 82 2d ee 20 85  |ze+16..x....-. .|
000001c0  20 ee 20 85 20 87 20 3a  20 85 20 a2 20 9f 2c 20  | . . . : . . ., |
000001d0  f6 24 2b 22 20 61 74 20  6c 69 6e 65 20 22 2b c3  |.$+" at line "+.|
000001e0  28 9e 29 3a 20 e0 0d 00  8c 04 0d 00 96 1d 61 6c  |(.): .........al|
000001f0  69 61 73 24 3d 22 3c 4d  65 6d 6f 72 79 50 69 65  |ias$="<MemoryPie|
00000200  32 24 44 69 72 3e 22 0d  00 a0 1c 74 61 73 6b 6e  |2$Dir>"....taskn|
00000210  61 6d 65 24 3d 22 4d 65  6d 6f 72 79 20 50 69 65  |ame$="Memory Pie|
00000220  20 32 22 0d 00 aa 0e 57  69 6d 70 49 6e 69 74 3d  | 2"....WimpInit=|
00000230  a3 0d 00 b4 04 0d 00 be  18 ee 20 85 20 ee 85 20  |.......... . .. |
00000240  87 20 3a f2 65 72 72 6f  72 20 3a 20 e0 0d 00 c8  |. :.error : ....|
00000250  09 f2 76 61 72 73 0d 00  d2 0d f2 6d 73 67 74 72  |..vars.....msgtr|
00000260  61 6e 73 0d 00 dc 0d f2  61 73 73 65 6d 62 6c 65  |ans.....assemble|
00000270  0d 00 e6 12 f2 6d 65 6d  6f 72 79 70 69 65 76 61  |.....memorypieva|
00000280  72 73 0d 00 f0 0a f2 73  65 74 75 70 0d 00 fa 0d  |rs.....setup....|
00000290  f2 70 6f 6c 6c 6c 6f 6f  70 0d 01 04 0b f2 66 69  |.pollloop.....fi|
000002a0  6e 69 73 68 0d 01 0e 05  e0 0d 01 18 04 0d 01 22  |nish..........."|
000002b0  0e dd f2 70 6f 6c 6c 6c  6f 6f 70 0d 01 2c 05 f5  |...pollloop..,..|
000002c0  0d 01 36 16 20 20 20 f2  70 6f 6c 6c 28 69 64 6c  |..6.   .poll(idl|
000002d0  65 6d 61 73 6b 29 0d 01  40 07 fd 20 a3 0d 01 4a  |emask)..@.. ...J|
000002e0  05 e1 0d 01 54 04 0d 01  5e 0b dd f2 73 65 74 75  |....T...^...setu|
000002f0  70 0d 01 68 0a f2 69 63  6f 6e 73 0d 01 72 10 f2  |p..h..icons..r..|
00000300  6d 65 73 73 61 67 65 69  6e 69 74 0d 01 7c 0e f2  |messageinit..|..|
00000310  73 74 61 72 74 77 69 6d  70 0d 01 86 27 f2 6c 6f  |startwimp...'.lo|
00000320  61 64 74 65 6d 70 6c 61  74 65 73 28 61 6c 69 61  |adtemplates(alia|
00000330  73 24 2b 22 2e 54 65 6d  70 6c 61 74 65 73 22 29  |s$+".Templates")|
00000340  0d 01 90 23 f2 6c 6f 61  64 73 70 72 69 74 65 73  |...#.loadsprites|
00000350  28 61 6c 69 61 73 24 2b  22 2e 53 70 72 69 74 65  |(alias$+".Sprite|
00000360  73 22 29 0d 01 9a 30 f2  77 72 69 74 65 69 63 6f  |s")...0.writeico|
00000370  6e 28 77 69 6e 5f 69 6e  66 6f 2c 20 69 63 6f 6e  |n(win_info, icon|
00000380  5f 76 65 72 73 69 6f 6e  2c 20 76 65 72 73 69 6f  |_version, versio|
00000390  6e 24 29 0d 01 a4 0f f2  62 75 69 6c 64 6d 65 6e  |n$).....buildmen|
000003a0  75 73 0d 01 ae 10 f2 67  65 74 6d 6f 64 65 76 61  |us.....getmodeva|
000003b0  72 73 0d 01 b8 15 62 61  72 69 63 6f 6e 25 3d a4  |rs....baricon%=.|
000003c0  69 63 6f 6e 62 61 72 0d  01 c2 0d f2 63 68 65 63  |iconbar.....chec|
000003d0  6b 6d 65 6d 0d 01 cc 05  e1 0d 01 d6 04 0d 01 e0  |kmem............|
000003e0  0a dd f2 76 61 72 73 0d  01 ea 0a ea 20 6c 6f 6f  |...vars..... loo|
000003f0  70 0d 01 f4 24 de 20 62  6c 6f 63 6b 25 20 31 30  |p...$. block% 10|
00000400  32 34 2c 20 73 74 72 69  6e 67 20 32 35 36 2c 20  |24, string 256, |
00000410  69 6e 20 36 34 0d 01 fe  11 64 6f 6e 65 69 63 6f  |in 64....doneico|
00000420  6e 62 61 72 3d a3 0d 02  08 1c 73 74 64 6d 61 73  |nbar=.....stdmas|
00000430  6b 3d 20 25 31 31 31 30  30 30 30 30 31 31 30 30  |k= %111000001100|
00000440  30 31 0d 02 12 1c 6e 75  6c 6c 6d 61 73 6b 3d 25  |01....nullmask=%|
00000450  31 31 31 30 30 30 30 30  31 31 30 30 30 30 0d 02  |11100000110000..|
00000460  1c 0f 69 64 6c 65 6d 61  73 6b 3d 2d 31 0d 02 26  |..idlemask=-1..&|
00000470  0e 69 64 6c 65 67 61 70  3d 33 30 0d 02 30 15 63  |.idlegap=30..0.c|
00000480  75 72 72 65 6e 74 68 61  6e 64 6c 65 25 3d 2d 31  |urrenthandle%=-1|
00000490  0d 02 3a 10 5f 45 6e 64  49 63 6f 6e 3d 2d 34 32  |..:._EndIcon=-42|
000004a0  0d 02 44 05 e1 0d 02 4e  04 0d 02 58 14 dd f2 70  |..D....N...X...p|
000004b0  6f 6c 6c 28 70 6f 6c 6c  6d 61 73 6b 29 0d 02 62  |oll(pollmask)..b|
000004c0  0a ea 20 74 69 6d 65 0d  02 6c 1a e7 20 70 6f 6c  |.. time..l.. pol|
000004d0  6c 6d 61 73 6b 3c 3e 69  64 6c 65 6d 61 73 6b 20  |lmask<>idlemask |
000004e0  8c 0d 02 76 31 20 20 20  c8 99 20 22 57 69 6d 70  |...v1   .. "Wimp|
000004f0  5f 50 6f 6c 6c 22 2c 20  70 6f 6c 6c 6d 61 73 6b  |_Poll", pollmask|
00000500  2c 20 62 6c 6f 63 6b 25  20 b8 20 72 65 61 73 6f  |, block% . reaso|
00000510  6e 25 0d 02 80 05 cc 0d  02 8a 27 20 20 20 c8 99  |n%........'   ..|
00000520  20 22 4f 53 5f 52 65 61  64 4d 6f 6e 6f 74 6f 6e  | "OS_ReadMonoton|
00000530  69 63 54 69 6d 65 22 20  b8 20 74 69 6d 65 0d 02  |icTime" . time..|
00000540  94 43 20 20 20 c8 99 20  22 57 69 6d 70 5f 50 6f  |.C   .. "Wimp_Po|
00000550  6c 6c 49 64 6c 65 22 2c  20 6e 75 6c 6c 6d 61 73  |llIdle", nullmas|
00000560  6b 2c 20 62 6c 6f 63 6b  25 2c 20 74 69 6d 65 2b  |k, block%, time+|
00000570  69 64 6c 65 67 61 70 20  b8 20 72 65 61 73 6f 6e  |idlegap . reason|
00000580  25 0d 02 9e 05 cd 0d 02  a8 10 c8 8e 20 72 65 61  |%........... rea|
00000590  73 6f 6e 25 20 ca 0d 02  b2 15 20 20 20 c9 20 30  |son% .....   . 0|
000005a0  3a 20 f2 63 68 65 63 6b  6d 65 6d 0d 02 bc 1c 20  |: .checkmem.... |
000005b0  20 20 c9 20 31 3a 20 f2  72 65 64 72 61 77 28 5f  |  . 1: .redraw(_|
000005c0  72 65 64 72 61 77 29 0d  02 f8 11 20 20 20 c9 20  |redraw)....   . |
000005d0  32 3a 20 f2 6f 70 65 6e  0d 03 02 12 20 20 20 c9  |2: .open....   .|
000005e0  20 33 3a 20 f2 63 6c 6f  73 65 0d 03 0c 4a 20 20  | 3: .close...J  |
000005f0  20 c9 20 36 3a 20 f2 63  68 65 63 6b 6d 6f 75 73  | . 6: .checkmous|
00000600  65 28 21 62 6c 6f 63 6b  25 2c 20 62 6c 6f 63 6b  |e(!block%, block|
00000610  25 21 34 2c 20 62 6c 6f  63 6b 25 21 38 2c 20 62  |%!4, block%!8, b|
00000620  6c 6f 63 6b 25 21 31 32  2c 20 62 6c 6f 63 6b 25  |lock%!12, block%|
00000630  21 31 36 29 0d 03 16 16  20 20 20 c9 20 38 3a 20  |!16)....   . 8: |
00000640  f2 63 68 65 63 6b 6b 65  79 73 0d 03 20 0a 20 20  |.checkkeys.. .  |
00000650  20 c9 20 39 0d 03 2a 2e  20 20 20 20 20 20 c8 99  | . 9..*.      ..|
00000660  20 22 57 69 6d 70 5f 47  65 74 50 6f 69 6e 74 65  | "Wimp_GetPointe|
00000670  72 49 6e 66 6f 22 2c 2c  62 6c 6f 63 6b 25 2b 31  |rInfo",,block%+1|
00000680  32 38 0d 03 34 23 20 20  20 20 20 20 72 65 6f 70  |28..4#      reop|
00000690  65 6e 3d 28 62 6c 6f 63  6b 25 21 31 33 36 20 80  |en=(block%!136 .|
000006a0  20 31 29 3d 31 0d 03 3e  1f 20 20 20 20 20 20 f2  | 1)=1..>.      .|
000006b0  64 6f 66 75 6e 63 74 69  6f 6e 73 28 21 62 6c 6f  |dofunctions(!blo|
000006c0  63 6b 25 29 0d 03 48 14  20 20 20 20 20 20 e7 20  |ck%)..H.      . |
000006d0  72 65 6f 70 65 6e 20 8c  0d 03 52 38 20 20 20 20  |reopen ...R8    |
000006e0  20 20 20 20 20 f2 72 65  6f 70 65 6e 6d 65 6e 75  |     .reopenmenu|
000006f0  28 49 63 6f 6e 6d 65 6e  75 25 2c 20 6d 65 6e 75  |(Iconmenu%, menu|
00000700  78 25 2c 20 6d 65 6e 75  68 65 69 67 68 74 25 29  |x%, menuheight%)|
00000710  0d 03 5c 0b 20 20 20 20  20 20 cd 0d 03 66 22 20  |..\.      ...f" |
00000720  20 20 c9 20 31 37 2c 20  31 38 3a 20 f2 6d 65 73  |  . 17, 18: .mes|
00000730  73 61 67 65 28 72 65 61  73 6f 6e 25 29 0d 03 70  |sage(reason%)..p|
00000740  05 cb 0d 03 7a 05 e1 0d  03 84 04 0d 03 8e 0e dd  |....z...........|
00000750  f2 61 73 73 65 6d 62 6c  65 0d 03 98 18 e7 20 63  |.assemble..... c|
00000760  6f 64 65 3d 2d 31 20 de  20 63 6f 64 65 20 31 32  |ode=-1 . code 12|
00000770  30 0d 03 a2 09 73 70 3d  31 33 0d 03 ac 0b 6c 69  |0....sp=13....li|
00000780  6e 6b 3d 31 34 0d 03 b6  09 70 63 3d 31 35 0d 03  |nk=14....pc=15..|
00000790  c0 04 0d 03 ca 14 e3 20  70 61 73 73 3d 30 20 b8  |....... pass=0 .|
000007a0  20 32 20 88 20 32 0d 03  d4 0b 50 25 3d 63 6f 64  | 2 . 2....P%=cod|
000007b0  65 0d 03 de 0d 5b 4f 50  54 20 70 61 73 73 0d 03  |e....[OPT pass..|
000007c0  e8 4a f4 20 70 61 73 73  20 62 61 63 6b 20 61 6c  |.J. pass back al|
000007d0  6c 20 74 68 65 20 61 64  64 72 65 73 73 65 73 20  |l the addresses |
000007e0  46 61 73 74 54 61 73 6b  20 6e 65 65 64 73 20 69  |FastTask needs i|
000007f0  6e 20 62 6c 6f 63 6b 20  70 6f 69 6e 74 65 64 20  |n block pointed |
00000800  74 6f 20 69 6e 20 72 30  0d 03 f2 0f 2e 73 74 72  |to in r0.....str|
00000810  69 6e 67 72 65 61 64 0d  03 fc 20 53 54 4d 46 44  |ingread... STMFD|
00000820  20 20 20 28 73 70 29 21  2c 20 7b 72 30 2d 72 33  |   (sp)!, {r0-r3|
00000830  2c 20 6c 69 6e 6b 7d 0d  04 06 42 f4 20 65 6e 74  |, link}...B. ent|
00000840  65 72 20 77 69 74 68 20  70 6f 69 6e 74 65 72 20  |er with pointer |
00000850  74 6f 20 6f 72 69 67 69  6e 61 6c 20 69 6e 20 72  |to original in r|
00000860  30 20 61 6e 64 20 6f 75  74 70 75 74 20 62 75 66  |0 and output buf|
00000870  66 65 72 20 69 6e 20 72  31 0d 04 10 27 f4 20 72  |fer in r1...'. r|
00000880  32 20 68 6f 6c 64 73 20  63 6f 75 6e 74 65 72 2c  |2 holds counter,|
00000890  20 72 33 20 61 63 74 75  61 6c 20 76 61 6c 75 65  | r3 actual value|
000008a0  0d 04 1a 12 4d 4f 56 20  20 20 20 20 72 32 2c 20  |....MOV     r2, |
000008b0  23 30 0d 04 24 0c 2e 73  72 73 74 61 72 74 0d 04  |#0..$..srstart..|
000008c0  2e 26 4c 44 52 42 20 20  20 20 72 33 2c 20 5b 72  |.&LDRB    r3, [r|
000008d0  30 2c 20 72 32 5d 20 20  20 3b 20 6c 6f 61 64 20  |0, r2]   ; load |
000008e0  62 79 74 65 0d 04 38 2a  43 4d 50 20 20 20 20 20  |byte..8*CMP     |
000008f0  72 33 2c 20 23 30 20 20  20 20 20 20 20 20 20 3b  |r3, #0         ;|
00000900  20 69 73 20 69 74 20 61  20 6e 75 6c 6c 3f 0d 04  | is it a null?..|
00000910  42 2d 43 4d 50 4e 45 20  20 20 72 33 2c 20 23 31  |B-CMPNE   r3, #1|
00000920  33 20 20 20 20 20 20 20  20 3b 20 69 73 20 69 74  |3        ; is it|
00000930  20 61 20 43 52 20 74 68  65 6e 3f 0d 04 4c 35 ec  | a CR then?..L5.|
00000940  51 20 20 20 72 33 2c 20  23 31 33 20 20 20 20 20  |Q   r3, #13     |
00000950  20 20 20 3b 20 69 66 20  69 74 20 69 73 2c 20 72  |   ; if it is, r|
00000960  65 70 6c 61 63 65 20 62  79 20 61 20 3c 43 52 3e  |eplace by a <CR>|
00000970  0d 04 56 3e 53 54 52 42  20 20 20 20 72 33 2c 20  |..V>STRB    r3, |
00000980  5b 72 31 2c 20 72 32 5d  20 20 20 3b 20 73 74 6f  |[r1, r2]   ; sto|
00000990  72 65 20 69 74 20 62 61  63 6b 20 77 68 61 74 65  |re it back whate|
000009a0  76 65 72 20 74 68 65 20  72 65 73 75 6c 74 0d 04  |ver the result..|
000009b0  60 3e 41 44 44 4e 45 20  20 20 72 32 2c 20 72 32  |`>ADDNE   r2, r2|
000009c0  2c 20 23 31 20 20 20 20  20 3b 20 69 66 20 69 74  |, #1     ; if it|
000009d0  27 73 20 4f 4b 2c 20 69  6e 63 72 65 6d 65 6e 74  |'s OK, increment|
000009e0  20 74 68 65 20 70 6f 69  6e 74 65 72 0d 04 6a 38  | the pointer..j8|
000009f0  42 4e 45 20 20 20 20 20  73 72 73 74 61 72 74 20  |BNE     srstart |
00000a00  20 20 20 20 20 20 20 3b  20 61 6e 64 20 73 74 61  |       ; and sta|
00000a10  72 74 20 61 67 61 69 6e  20 2d 20 65 6c 73 65 20  |rt again - else |
00000a20  65 78 69 74 0d 04 74 1f  4c 44 4d 49 41 20 20 20  |exit..t.LDMIA   |
00000a30  28 73 70 29 21 2c 20 7b  72 30 2d 72 33 2c 20 70  |(sp)!, {r0-r3, p|
00000a40  63 7d 5e 0d 04 7e 04 0d  04 88 0d 2e 63 61 73 65  |c}^..~......case|
00000a50  6c 65 73 73 0d 04 92 21  53 54 4d 46 44 20 20 20  |less...!STMFD   |
00000a60  28 73 70 29 21 2c 20 7b  72 30 2c 20 72 31 2c 20  |(sp)!, {r0, r1, |
00000a70  6c 69 6e 6b 7d 0d 04 9c  12 2e 63 61 73 65 6c 65  |link}.....casele|
00000a80  73 73 73 74 61 72 74 0d  04 a6 14 4c 44 52 42 20  |ssstart....LDRB |
00000a90  20 20 20 72 31 2c 20 5b  72 30 5d 0d 04 b0 13 43  |   r1, [r0]....C|
00000aa0  4d 50 20 20 20 20 20 72  31 2c 20 23 31 33 0d 04  |MP     r1, #13..|
00000ab0  ba 10 42 45 51 20 20 20  20 20 71 75 69 74 0d 04  |..BEQ     quit..|
00000ac0  c4 13 43 4d 50 20 20 20  20 20 72 31 2c 20 23 36  |..CMP     r1, #6|
00000ad0  35 0d 04 ce 16 41 44 44  4c 54 20 20 20 72 30 2c  |5....ADDLT   r0,|
00000ae0  20 72 30 2c 20 23 31 0d  04 d8 19 42 4c 54 20 20  | r0, #1....BLT  |
00000af0  20 20 20 63 61 73 65 6c  65 73 73 73 74 61 72 74  |   caselessstart|
00000b00  0d 04 e2 13 43 4d 50 20  20 20 20 20 72 31 2c 20  |....CMP     r1, |
00000b10  23 39 30 0d 04 ec 17 41  44 44 4c 45 20 20 20 72  |#90....ADDLE   r|
00000b20  31 2c 20 72 31 2c 20 23  33 32 0d 04 f6 14 53 54  |1, r1, #32....ST|
00000b30  52 4c 45 42 20 20 72 31  2c 20 5b 72 30 5d 0d 05  |RLEB  r1, [r0]..|
00000b40  00 16 41 44 44 20 20 20  20 20 72 30 2c 20 72 30  |..ADD     r0, r0|
00000b50  2c 20 23 31 0d 05 0a 19  42 20 20 20 20 20 20 20  |, #1....B       |
00000b60  63 61 73 65 6c 65 73 73  73 74 61 72 74 0d 05 14  |caselessstart...|
00000b70  09 2e 71 75 69 74 0d 05  1e 1f 4c 44 4d 49 41 20  |..quit....LDMIA |
00000b80  20 20 28 73 70 29 21 2c  20 7b 72 30 2c 20 72 31  |  (sp)!, {r0, r1|
00000b90  2c 20 70 63 7d 0d 05 28  05 5d 0d 05 32 05 ed 0d  |, pc}..(.]..2...|
00000ba0  05 3c 05 e1 0d 05 46 04  0d 05 50 13 dd f2 6d 65  |.<....F...P...me|
00000bb0  6d 6f 72 79 70 69 65 76  61 72 73 0d 05 5a 09 ea  |morypievars..Z..|
00000bc0  20 65 6e 76 0d 05 64 0a  f4 20 4d 69 73 63 0d 05  | env..d.. Misc..|
00000bd0  6e 19 76 65 72 73 69 6f  6e 24 3d a4 6d 65 73 73  |n.version$=.mess|
00000be0  28 22 56 65 72 22 29 0d  05 78 19 c8 99 20 22 58  |("Ver")..x... "X|
00000bf0  4f 53 5f 47 65 74 45 6e  76 22 20 b8 20 65 6e 76  |OS_GetEnv" . env|
00000c00  0d 05 82 24 53 74 61 72  74 4d 65 6d 6f 72 79 50  |...$StartMemoryP|
00000c10  69 65 24 3d a4 72 65 61  64 73 74 72 69 6e 67 28  |ie$=.readstring(|
00000c20  65 6e 76 29 0d 05 8c 0d  de 20 76 61 6c 69 64 20  |env)..... valid |
00000c30  34 0d 05 96 0d 24 76 61  6c 69 64 3d 22 22 0d 05  |4....$valid=""..|
00000c40  a0 12 de 20 73 70 72 69  74 65 70 74 72 20 31 33  |... spriteptr 13|
00000c50  0d 05 aa 17 24 73 70 72  69 74 65 70 74 72 3d 22  |....$spriteptr="|
00000c60  62 61 72 70 69 65 22 0d  05 b4 04 0d 05 be 12 f4  |barpie".........|
00000c70  20 4d 65 6d 6f 72 79 20  73 74 75 66 66 0d 05 c8  | Memory stuff...|
00000c80  1d de 20 6d 65 6d 6f 72  79 28 37 29 2c 20 6f 6c  |.. memory(7), ol|
00000c90  64 6d 65 6d 6f 72 79 28  37 29 0d 05 d2 0d 5f 73  |dmemory(7)...._s|
00000ca0  79 73 74 65 6d 3d 30 0d  05 dc 0a 5f 72 6d 61 3d  |ystem=0...._rma=|
00000cb0  31 0d 05 e6 0d 5f 73 63  72 65 65 6e 3d 32 0d 05  |1...._screen=2..|
00000cc0  f0 0d 5f 73 70 72 69 74  65 3d 33 0d 05 fa 0c 5f  |.._sprite=3...._|
00000cd0  66 6f 6e 74 73 3d 34 0d  06 04 0a 5f 72 61 6d 3d  |fonts=4...._ram=|
00000ce0  35 0d 06 0e 0b 5f 61 70  70 73 3d 36 0d 06 18 0b  |5...._apps=6....|
00000cf0  5f 66 72 65 65 3d 37 0d  06 22 04 0d 06 2c 30 c8  |_free=7.."...,0.|
00000d00  99 20 22 58 4f 53 5f 52  65 61 64 4d 65 6d 4d 61  |. "XOS_ReadMemMa|
00000d10  70 49 6e 66 6f 22 20 b8  20 70 61 67 65 73 69 7a  |pInfo" . pagesiz|
00000d20  65 2c 20 6e 75 6d 70 61  67 65 73 0d 06 36 1d 4d  |e, numpages..6.M|
00000d30  65 6d 53 69 7a 65 3d 70  61 67 65 73 69 7a 65 2a  |emSize=pagesize*|
00000d40  6e 75 6d 70 61 67 65 73  0d 06 40 0c 55 70 64 61  |numpages..@.Upda|
00000d50  74 65 3d b9 0d 06 4a 1a  61 6e 67 63 6f 6e 73 74  |te=...J.angconst|
00000d60  3d 31 2f 4d 65 6d 53 69  7a 65 2a 32 2a af 0d 06  |=1/MemSize*2*...|
00000d70  54 04 0d 06 5e 12 f4 20  57 69 6e 64 6f 77 20 73  |T...^.. Window s|
00000d80  74 75 66 66 0d 06 68 0f  77 69 6e 77 69 64 74 68  |tuff..h.winwidth|
00000d90  3d 2d 31 0d 06 72 10 77  69 6e 68 65 69 67 68 74  |=-1..r.winheight|
00000da0  3d 2d 31 0d 06 7c 0d 5f  72 65 64 72 61 77 3d 30  |=-1..|._redraw=0|
00000db0  0d 06 86 0d 5f 75 70 64  61 74 65 3d 31 0d 06 90  |...._update=1...|
00000dc0  13 77 69 6e 6f 70 65 6e  5f 6c 61 72 67 65 3d a3  |.winopen_large=.|
00000dd0  0d 06 9a 05 e1 0d 06 a4  04 0d 06 ae 22 f4 20 4f  |............". O|
00000de0  53 5f 48 65 61 70 3a 20  30 20 3a 20 69 6e 69 74  |S_Heap: 0 : init|
00000df0  69 61 6c 69 73 65 20 68  65 61 70 0d 06 b8 20 f4  |ialise heap... .|
00000e00  20 20 20 20 20 20 20 20  20 20 31 20 3a 20 64 65  |          1 : de|
00000e10  73 63 72 69 62 65 20 68  65 61 70 0d 06 c2 21 f4  |scribe heap...!.|
00000e20  20 20 20 20 20 20 20 20  20 20 32 20 3a 20 67 65  |          2 : ge|
00000e30  74 20 68 65 61 70 20 62  6c 6f 63 6b 0d 06 cc 22  |t heap block..."|
00000e40  f4 20 20 20 20 20 20 20  20 20 20 33 20 3a 20 66  |.          3 : f|
00000e50  72 65 65 20 68 65 61 70  20 62 6c 6f 63 6b 0d 06  |ree heap block..|
00000e60  d6 2e f4 20 20 20 20 20  20 20 20 20 20 34 20 3a  |...          4 :|
00000e70  20 65 78 74 65 6e 64 20  6f 72 20 73 68 72 69 6e  | extend or shrin|
00000e80  6b 20 68 65 61 70 20 62  6c 6f 63 6b 0d 06 e0 28  |k heap block...(|
00000e90  f4 20 20 20 20 20 20 20  20 20 20 35 20 3a 20 65  |.          5 : e|
00000ea0  78 74 65 6e 64 20 6f 72  20 73 68 72 69 6e 6b 20  |xtend or shrink |
00000eb0  68 65 61 70 0d 06 ea 22  f4 20 20 20 20 20 20 20  |heap...".       |
00000ec0  20 20 20 36 20 3a 20 72  65 61 64 20 62 6c 6f 63  |   6 : read bloc|
00000ed0  6b 20 73 69 7a 65 0d 06  f4 04 0d 06 fe 14 dd f2  |k size..........|
00000ee0  69 6e 69 74 68 65 61 70  28 73 69 7a 65 29 0d 07  |initheap(size)..|
00000ef0  08 20 ea 20 73 6c 6f 74  73 69 7a 65 2c 20 66 72  |. . slotsize, fr|
00000f00  65 65 2c 20 6d 61 78 2c  20 74 6f 74 61 6c 0d 07  |ee, max, total..|
00000f10  12 31 c8 99 20 22 57 69  6d 70 5f 53 6c 6f 74 53  |.1.. "Wimp_SlotS|
00000f20  69 7a 65 22 2c 20 2d 31  2c 20 2d 31 20 b8 20 73  |ize", -1, -1 . s|
00000f30  6c 6f 74 73 69 7a 65 2c  20 2c 20 66 72 65 65 0d  |lotsize, , free.|
00000f40  07 1c 0f e7 20 66 72 65  65 3c 3e 30 20 8c 0d 07  |.... free<>0 ...|
00000f50  26 18 20 20 20 48 65 61  70 49 6e 69 74 69 61 6c  |&.   HeapInitial|
00000f60  69 73 65 64 3d a3 0d 07  30 14 20 20 20 48 65 61  |ised=...0.   Hea|
00000f70  70 53 69 7a 65 3d 73 69  7a 65 0d 07 3a 1a 20 20  |pSize=size..:.  |
00000f80  20 f2 73 65 74 73 6c 6f  74 28 48 65 61 70 2b 73  | .setslot(Heap+s|
00000f90  69 7a 65 29 0d 07 44 22  20 20 20 c8 99 20 22 4f  |ize)..D"   .. "O|
00000fa0  53 5f 48 65 61 70 22 2c  20 30 2c 20 48 65 61 70  |S_Heap", 0, Heap|
00000fb0  2c 2c 73 69 7a 65 0d 07  4e 2c 20 20 20 c8 99 20  |,,size..N,   .. |
00000fc0  22 58 4f 53 5f 48 65 61  70 22 2c 20 31 2c 20 48  |"XOS_Heap", 1, H|
00000fd0  65 61 70 20 b8 20 2c 2c  6d 61 78 2c 20 74 6f 74  |eap . ,,max, tot|
00000fe0  61 6c 0d 07 58 18 20 20  20 48 65 61 70 49 6e 69  |al..X.   HeapIni|
00000ff0  74 69 61 6c 69 73 65 64  3d b9 0d 07 62 05 cc 0d  |tialised=...b...|
00001000  07 6c 23 20 20 20 f2 72  65 70 6f 72 74 28 a4 6d  |.l#   .report(.m|
00001010  65 73 73 28 22 48 65 61  70 4d 65 6d 22 29 2c 20  |ess("HeapMem"), |
00001020  30 29 0d 07 76 05 cd 0d  07 80 05 e1 0d 07 8a 04  |0)..v...........|
00001030  0d 07 94 11 dd f2 64 69  73 63 61 72 64 68 65 61  |......discardhea|
00001040  70 0d 07 9e 15 48 65 61  70 49 6e 69 74 69 61 6c  |p....HeapInitial|
00001050  69 73 65 64 3d a3 0d 07  a8 15 f2 73 65 74 73 6c  |ised=......setsl|
00001060  6f 74 28 48 65 61 70 2d  31 36 29 0d 07 b2 05 e1  |ot(Heap-16).....|
00001070  0d 07 bc 04 0d 07 c6 10  dd a4 68 65 61 70 28 73  |..........heap(s|
00001080  69 7a 65 29 0d 07 d0 22  ea 20 68 65 61 70 62 6c  |ize)...". heapbl|
00001090  6f 63 6b 2c 20 68 65 61  70 73 69 7a 65 2c 20 66  |ock, heapsize, f|
000010a0  72 65 65 6d 65 6d 0d 07  da 28 e7 20 48 65 61 70  |reemem...(. Heap|
000010b0  49 6e 69 74 69 61 6c 69  73 65 64 3d a3 20 8c 20  |Initialised=. . |
000010c0  f2 69 6e 69 74 68 65 61  70 28 32 35 36 29 0d 07  |.initheap(256)..|
000010d0  e4 2e c8 99 20 22 58 4f  53 5f 48 65 61 70 22 2c  |.... "XOS_Heap",|
000010e0  20 32 2c 20 48 65 61 70  2c 2c 73 69 7a 65 20 b8  | 2, Heap,,size .|
000010f0  20 2c 2c 68 65 61 70 62  6c 6f 63 6b 0d 07 ee 28  | ,,heapblock...(|
00001100  c8 99 20 22 58 4f 53 5f  48 65 61 70 22 2c 20 31  |.. "XOS_Heap", 1|
00001110  2c 20 48 65 61 70 20 b8  20 2c 2c 6d 61 78 2c 74  |, Heap . ,,max,t|
00001120  6f 74 61 6c 0d 07 f8 34  c8 99 20 22 58 4f 53 5f  |otal...4.. "XOS_|
00001130  48 65 61 70 22 2c 20 36  2c 20 48 65 61 70 2c 20  |Heap", 6, Heap, |
00001140  68 65 61 70 62 6c 6f 63  6b 20 b8 20 2c 2c 2c 62  |heapblock . ,,,b|
00001150  6c 6f 63 6b 73 69 7a 65  0d 08 02 12 c8 95 20 68  |locksize...... h|
00001160  65 61 70 62 6c 6f 63 6b  3d 30 0d 08 0c 08 20 20  |eapblock=0....  |
00001170  20 f5 0d 08 16 2e 20 20  20 20 20 20 c8 99 20 22  | .....      .. "|
00001180  57 69 6d 70 5f 53 6c 6f  74 53 69 7a 65 22 2c 2d  |Wimp_SlotSize",-|
00001190  31 2c 2d 31 20 b8 20 2c  2c 66 72 65 65 6d 65 6d  |1,-1 . ,,freemem|
000011a0  0d 08 20 1a 20 20 20 20  20 20 e7 20 66 72 65 65  |.. .      . free|
000011b0  6d 65 6d 3c 73 69 7a 65  20 8c 0d 08 2a 1c 20 20  |mem<size ...*.  |
000011c0  20 20 20 20 20 20 20 f2  70 6f 6c 6c 28 6e 75 6c  |       .poll(nul|
000011d0  6c 6d 61 73 6b 29 0d 08  34 0b 20 20 20 20 20 20  |lmask)..4.      |
000011e0  cd 0d 08 3e 16 20 20 20  fd 20 66 72 65 65 6d 65  |...>.   . freeme|
000011f0  6d 3e 3d 73 69 7a 65 0d  08 48 27 20 20 20 68 65  |m>=size..H'   he|
00001200  61 70 73 69 7a 65 3d 28  28 73 69 7a 65 2b 33 29  |apsize=((size+3)|
00001210  20 80 20 28 ac 20 33 29  29 20 2b 20 36 34 0d 08  | . (. 3)) + 64..|
00001220  52 19 20 20 20 48 65 61  70 53 69 7a 65 2b 3d 68  |R.   HeapSize+=h|
00001230  65 61 70 73 69 7a 65 0d  08 5c 32 20 20 20 c8 99  |eapsize..\2   ..|
00001240  20 22 57 69 6d 70 5f 53  6c 6f 74 53 69 7a 65 22  | "Wimp_SlotSize"|
00001250  2c 20 48 65 61 70 2b 48  65 61 70 53 69 7a 65 2d  |, Heap+HeapSize-|
00001260  26 38 30 30 30 2c 20 2d  31 0d 08 66 1e 20 20 20  |&8000, -1..f.   |
00001270  f2 73 65 74 73 6c 6f 74  28 48 65 61 70 2b 48 65  |.setslot(Heap+He|
00001280  61 70 53 69 7a 65 29 0d  08 70 27 20 20 20 c8 99  |apSize)..p'   ..|
00001290  20 22 58 4f 53 5f 48 65  61 70 22 2c 20 35 2c 20  | "XOS_Heap", 5, |
000012a0  48 65 61 70 2c 2c 68 65  61 70 73 69 7a 65 0d 08  |Heap,,heapsize..|
000012b0  7a 31 20 20 20 c8 99 20  22 58 4f 53 5f 48 65 61  |z1   .. "XOS_Hea|
000012c0  70 22 2c 20 32 2c 20 48  65 61 70 2c 2c 73 69 7a  |p", 2, Heap,,siz|
000012d0  65 20 b8 20 2c 2c 68 65  61 70 62 6c 6f 63 6b 0d  |e . ,,heapblock.|
000012e0  08 84 37 20 20 20 c8 99  20 22 58 4f 53 5f 48 65  |..7   .. "XOS_He|
000012f0  61 70 22 2c 20 36 2c 20  48 65 61 70 2c 20 68 65  |ap", 6, Heap, he|
00001300  61 70 62 6c 6f 63 6b 20  b8 20 2c 2c 2c 62 6c 6f  |apblock . ,,,blo|
00001310  63 6b 73 69 7a 65 0d 08  8e 2c 20 20 20 c8 99 20  |cksize...,   .. |
00001320  22 58 4f 53 5f 48 65 61  70 22 2c 20 31 2c 20 48  |"XOS_Heap", 1, H|
00001330  65 61 70 20 b8 20 2c 2c  6d 61 78 2c 20 74 6f 74  |eap . ,,max, tot|
00001340  61 6c 0d 08 98 05 ce 0d  08 a2 0e 3d 68 65 61 70  |al.........=heap|
00001350  62 6c 6f 63 6b 0d 08 ac  04 0d 08 b6 19 dd f2 66  |block..........f|
00001360  72 65 65 68 65 61 70 28  68 65 61 70 62 6c 6f 63  |reeheap(heapbloc|
00001370  6b 29 0d 08 c0 24 ea 20  62 6c 6f 63 6b 73 69 7a  |k)...$. blocksiz|
00001380  65 2c 20 63 68 61 6e 67  65 2c 20 6e 65 77 68 65  |e, change, newhe|
00001390  61 70 73 69 7a 65 0d 08  ca 15 e7 20 68 65 61 70  |apsize..... heap|
000013a0  62 6c 6f 63 6b 3c 3e 2d  31 20 8c 0d 08 d4 37 20  |block<>-1 ....7 |
000013b0  20 20 c8 99 20 22 58 4f  53 5f 48 65 61 70 22 2c  |  .. "XOS_Heap",|
000013c0  20 36 2c 20 48 65 61 70  2c 20 68 65 61 70 62 6c  | 6, Heap, heapbl|
000013d0  6f 63 6b 20 b8 20 2c 2c  2c 62 6c 6f 63 6b 73 69  |ock . ,,,blocksi|
000013e0  7a 65 0d 08 de 28 20 20  20 c8 99 20 22 58 4f 53  |ze...(   .. "XOS|
000013f0  5f 48 65 61 70 22 2c 20  33 2c 20 48 65 61 70 2c  |_Heap", 3, Heap,|
00001400  20 68 65 61 70 62 6c 6f  63 6b 0d 08 e8 35 20 20  | heapblock...5  |
00001410  20 c8 99 20 22 58 4f 53  5f 48 65 61 70 22 2c 20  | .. "XOS_Heap", |
00001420  35 2c 20 48 65 61 70 2c  2c 2d 62 6c 6f 63 6b 73  |5, Heap,,-blocks|
00001430  69 7a 65 20 b8 20 2c 2c  2c 63 68 61 6e 67 65 0d  |ize . ,,,change.|
00001440  08 f2 2c 20 20 20 c8 99  20 22 58 4f 53 5f 48 65  |..,   .. "XOS_He|
00001450  61 70 22 2c 20 31 2c 20  48 65 61 70 20 b8 20 2c  |ap", 1, Heap . ,|
00001460  2c 6d 61 78 2c 20 74 6f  74 61 6c 0d 08 fc 19 20  |,max, total.... |
00001470  20 20 48 65 61 70 53 69  7a 65 2b 3d 63 68 61 6e  |  HeapSize+=chan|
00001480  67 65 2d 38 0d 09 06 24  20 20 20 e7 20 48 65 61  |ge-8...$   . Hea|
00001490  70 53 69 7a 65 3c 32 35  36 20 8c 20 48 65 61 70  |pSize<256 . Heap|
000014a0  53 69 7a 65 3d 32 35 36  0d 09 10 1e 20 20 20 f2  |Size=256....   .|
000014b0  73 65 74 73 6c 6f 74 28  48 65 61 70 2b 48 65 61  |setslot(Heap+Hea|
000014c0  70 53 69 7a 65 29 0d 09  1a 05 cd 0d 09 24 05 e1  |pSize).......$..|
000014d0  0d 09 2e 04 0d 09 38 12  dd f2 73 65 74 73 6c 6f  |......8...setslo|
000014e0  74 28 65 6e 64 29 0d 09  42 25 c8 99 20 22 57 69  |t(end)..B%.. "Wi|
000014f0  6d 70 5f 53 6c 6f 74 53  69 7a 65 22 2c 20 65 6e  |mp_SlotSize", en|
00001500  64 2d 26 38 30 30 30 2c  20 2d 31 0d 09 4c 05 e1  |d-&8000, -1..L..|
00001510  0d 09 56 04 0d 09 60 0c  f4 20 45 72 72 6f 72 73  |..V...`.. Errors|
00001520  0d 09 6a 04 0d 09 74 0c  dd f2 66 69 6e 69 73 68  |..j...t...finish|
00001530  0d 09 7e 11 ee 20 85 20  ee 20 85 20 87 20 3a 20  |..~.. . . . . : |
00001540  e0 0d 09 88 2f ee 20 85  20 ee 20 85 20 87 20 3a  |..../. . . . . :|
00001550  20 85 20 a2 20 9f 2c 20  a4 6d 65 73 73 28 22 45  | . . ., .mess("E|
00001560  72 72 22 29 2b c3 28 9e  29 2b f6 24 20 3a 20 e0  |rr")+.(.)+.$ : .|
00001570  0d 09 92 10 e7 20 57 69  6d 70 49 6e 69 74 20 8c  |..... WimpInit .|
00001580  0d 09 9c 31 20 20 20 c8  99 20 22 57 69 6d 70 5f  |...1   .. "Wimp_|
00001590  43 6c 6f 73 65 44 6f 77  6e 22 2c 20 54 61 73 6b  |CloseDown", Task|
000015a0  48 61 6e 64 6c 65 2c 20  26 34 42 35 33 34 31 35  |Handle, &4B53415|
000015b0  34 0d 09 a6 05 cd 0d 09  b0 05 e0 0d 09 ba 05 e1  |4...............|
000015c0  0d 09 c4 04 0d 09 ce 0b  dd f2 65 72 72 6f 72 0d  |..........error.|
000015d0  09 d8 0c ea 20 72 65 73  75 6c 74 0d 09 e2 3e ee  |.... result...>.|
000015e0  20 85 20 ee 20 85 20 87  20 3a 20 85 20 a2 20 9f  | . . . . : . . .|
000015f0  2c 20 22 49 6e 74 65 72  6e 61 6c 20 65 72 72 6f  |, "Internal erro|
00001600  72 20 63 6f 64 65 20 22  2b c3 28 9e 29 2b 22 3a  |r code "+.(.)+":|
00001610  20 22 2b f6 24 20 3a 20  e0 0d 09 ec 0d 21 62 6c  | "+.$ : .....!bl|
00001620  6f 63 6b 25 3d 9f 0d 09  f6 30 24 28 62 6c 6f 63  |ock%=....0$(bloc|
00001630  6b 25 2b 34 29 3d a4 6d  65 73 73 28 22 45 72 72  |k%+4)=.mess("Err|
00001640  22 29 2b c3 28 9e 29 2b  22 3a 20 22 2b f6 24 2b  |")+.(.)+": "+.$+|
00001650  22 2e 22 2b bd 30 0d 0a  00 39 c8 99 20 22 57 69  |"."+.0...9.. "Wi|
00001660  6d 70 5f 52 65 70 6f 72  74 45 72 72 6f 72 22 2c  |mp_ReportError",|
00001670  20 62 6c 6f 63 6b 25 2c  20 33 2c 20 74 61 73 6b  | block%, 3, task|
00001680  6e 61 6d 65 24 20 b8 20  2c 72 65 73 75 6c 74 0d  |name$ . ,result.|
00001690  0a 0a 1c e7 20 72 65 73  75 6c 74 3d 32 20 8c 20  |.... result=2 . |
000016a0  f2 61 72 65 79 6f 75 73  75 72 65 0d 0a 14 18 ee  |.areyousure.....|
000016b0  20 85 20 ee 85 20 87 20  3a f2 65 72 72 6f 72 20  | . .. . :.error |
000016c0  3a 20 e0 0d 0a 1e 2b e7  20 64 6f 6e 65 69 63 6f  |: ....+. doneico|
000016d0  6e 62 61 72 20 8c 20 f2  66 61 69 6e 74 28 2d 32  |nbar . .faint(-2|
000016e0  2c 20 62 61 72 69 63 6f  6e 25 2c 20 a3 29 0d 0a  |, baricon%, .)..|
000016f0  28 0d f2 70 6f 6c 6c 6c  6f 6f 70 0d 0a 32 05 e1  |(..pollloop..2..|
00001700  0d 0a 3c 04 0d 0a 46 10  dd f2 61 72 65 79 6f 75  |..<...F...areyou|
00001710  73 75 72 65 0d 0a 50 0c  ea 20 72 65 73 75 6c 74  |sure..P.. result|
00001720  0d 0a 5a 1d 24 28 62 6c  6f 63 6b 25 2b 34 29 3d  |..Z.$(block%+4)=|
00001730  a4 6d 65 73 73 28 22 53  75 72 65 22 29 0d 0a 64  |.mess("Sure")..d|
00001740  48 c8 99 20 22 57 69 6d  70 5f 52 65 70 6f 72 74  |H.. "Wimp_Report|
00001750  45 72 72 6f 72 22 2c 20  62 6c 6f 63 6b 25 2c 20  |Error", block%, |
00001760  32 33 2c 20 a4 6d 65 73  73 28 22 4d 65 73 73 22  |23, .mess("Mess"|
00001770  29 2b 74 61 73 6b 6e 61  6d 65 24 20 b8 20 2c 72  |)+taskname$ . ,r|
00001780  65 73 75 6c 74 0d 0a 6e  18 e7 20 72 65 73 75 6c  |esult..n.. resul|
00001790  74 3d 31 20 8c 20 f2 66  69 6e 69 73 68 0d 0a 78  |t=1 . .finish..x|
000017a0  05 e1 0d 0a 82 04 0d 0a  8c 15 dd f2 72 65 70 6f  |............repo|
000017b0  72 74 28 73 74 72 69 6e  67 24 29 0d 0a 96 0b ea  |rt(string$).....|
000017c0  20 74 65 78 74 24 0d 0a  a0 0d 21 62 6c 6f 63 6b  | text$....!block|
000017d0  25 3d 30 0d 0a aa 17 24  28 62 6c 6f 63 6b 25 2b  |%=0....$(block%+|
000017e0  34 29 3d 73 74 72 69 6e  67 24 0d 0a b4 39 c8 99  |4)=string$...9..|
000017f0  20 22 57 69 6d 70 5f 52  65 70 6f 72 74 45 72 72  | "Wimp_ReportErr|
00001800  6f 72 22 2c 20 62 6c 6f  63 6b 25 2c 20 33 2c 20  |or", block%, 3, |
00001810  74 61 73 6b 6e 61 6d 65  24 20 b8 20 2c 72 65 73  |taskname$ . ,res|
00001820  75 6c 74 0d 0a be 1c e7  20 72 65 73 75 6c 74 3d  |ult..... result=|
00001830  32 20 8c 20 f2 61 72 65  79 6f 75 73 75 72 65 0d  |2 . .areyousure.|
00001840  0a c8 05 e1 0d 0a d2 04  0d 0a dc 12 dd f2 61 6c  |..............al|
00001850  65 72 74 28 6d 65 73 73  24 29 0d 0a e6 0d 21 62  |ert(mess$)....!b|
00001860  6c 6f 63 6b 25 3d 30 0d  0a f0 15 24 28 62 6c 6f  |lock%=0....$(blo|
00001870  63 6b 25 2b 34 29 3d 6d  65 73 73 24 0d 0a fa 2f  |ck%+4)=mess$.../|
00001880  c8 99 20 22 57 69 6d 70  5f 52 65 70 6f 72 74 45  |.. "Wimp_ReportE|
00001890  72 72 6f 72 22 2c 20 62  6c 6f 63 6b 25 2c 20 31  |rror", block%, 1|
000018a0  2c 20 74 61 73 6b 6e 61  6d 65 24 0d 0b 04 05 e1  |, taskname$.....|
000018b0  0d 0b 0e 04 0d 0b 18 0a  f4 20 4b 65 79 73 0d 0b  |......... Keys..|
000018c0  22 04 0d 0b 2c 0f dd f2  63 68 65 63 6b 6b 65 79  |"...,...checkkey|
000018d0  73 0d 0b 36 32 ea 20 77  69 6e 64 6f 77 2c 20 69  |s..62. window, i|
000018e0  63 6f 6e 2c 20 63 61 72  65 74 70 6f 73 2c 20 63  |con, caretpos, c|
000018f0  68 61 72 2c 20 63 6f 6d  6d 61 6e 64 24 2c 20 61  |har, command$, a|
00001900  64 64 24 0d 0b 40 1b ea  20 69 63 6f 6e 24 2c 20  |dd$..@.. icon$, |
00001910  61 64 64 24 2c 20 6e 65  78 74 69 63 6f 6e 0d 0b  |add$, nexticon..|
00001920  4a 12 77 69 6e 64 6f 77  3d 21 62 6c 6f 63 6b 25  |J.window=!block%|
00001930  0d 0b 54 11 69 63 6f 6e  3d 62 6c 6f 63 6b 25 21  |..T.icon=block%!|
00001940  34 0d 0b 5e 16 63 61 72  65 74 70 6f 73 3d 62 6c  |4..^.caretpos=bl|
00001950  6f 63 6b 25 21 32 30 0d  0b 68 12 63 68 61 72 3d  |ock%!20..h.char=|
00001960  62 6c 6f 63 6b 25 21 32  34 0d 0b 72 0d 70 72 6f  |block%!24..r.pro|
00001970  63 65 73 73 3d b9 0d 0b  7c 28 e7 20 70 72 6f 63  |cess=...|(. proc|
00001980  65 73 73 20 c8 99 20 22  57 69 6d 70 5f 50 72 6f  |ess .. "Wimp_Pro|
00001990  63 65 73 73 4b 65 79 22  2c 20 63 68 61 72 0d 0b  |cessKey", char..|
000019a0  86 05 e1 0d 0b 90 04 0d  0b 9a 0b f4 20 4d 65 6e  |............ Men|
000019b0  75 73 0d 0b a4 04 0d 0b  ae 2e dd f2 63 72 65 61  |us..........crea|
000019c0  74 65 6d 65 6e 75 28 f8  20 6d 65 6e 75 2c 20 74  |temenu(. menu, t|
000019d0  69 74 6c 65 24 2c 20 69  74 65 6d 73 2c 20 77 69  |itle$, items, wi|
000019e0  64 74 68 29 0d 0b b8 16  de 20 6d 65 6e 75 20 32  |dth)..... menu 2|
000019f0  38 2b 69 74 65 6d 73 2a  32 34 0d 0b c2 10 24 6d  |8+items*24....$m|
00001a00  65 6e 75 3d 74 69 74 6c  65 24 0d 0b cc 12 6d 65  |enu=title$....me|
00001a10  6e 75 21 31 32 3d 26 37  30 32 30 37 0d 0b d6 17  |nu!12=&70207....|
00001a20  6d 65 6e 75 21 31 36 3d  31 36 2b 77 69 64 74 68  |menu!16=16+width|
00001a30  2a 31 36 0d 0b e0 0e 6d  65 6e 75 21 32 30 3d 34  |*16....menu!20=4|
00001a40  34 0d 0b ea 0d 6d 65 6e  75 21 32 34 3d 30 0d 0b  |4....menu!24=0..|
00001a50  f4 1a 63 75 72 72 65 6e  74 6d 65 6e 75 70 6f 73  |..currentmenupos|
00001a60  3d 6d 65 6e 75 2b 32 38  0d 0b fe 05 e1 0d 0c 08  |=menu+28........|
00001a70  04 0d 0c 12 1d dd f2 61  64 64 6d 65 6e 75 28 69  |.......addmenu(i|
00001a80  74 65 6d 24 2c 20 73 75  62 6d 65 6e 75 29 0d 0c  |tem$, submenu)..|
00001a90  1c 0c ea 20 62 75 66 66  65 72 0d 0c 26 15 21 63  |... buffer..&.!c|
00001aa0  75 72 72 65 6e 74 6d 65  6e 75 70 6f 73 3d 30 0d  |urrentmenupos=0.|
00001ab0  0c 30 1c 63 75 72 72 65  6e 74 6d 65 6e 75 70 6f  |.0.currentmenupo|
00001ac0  73 21 34 3d 73 75 62 6d  65 6e 75 0d 0c 3a 1d 63  |s!4=submenu..:.c|
00001ad0  75 72 72 65 6e 74 6d 65  6e 75 70 6f 73 21 38 3d  |urrentmenupos!8=|
00001ae0  26 37 30 30 30 30 32 31  0d 0c 44 14 e7 20 a9 28  |&7000021..D.. .(|
00001af0  69 74 65 6d 24 29 3c 3d  31 32 20 8c 0d 0c 4e 21  |item$)<=12 ...N!|
00001b00  20 20 20 24 28 63 75 72  72 65 6e 74 6d 65 6e 75  |   $(currentmenu|
00001b10  70 6f 73 2b 31 32 29 3d  69 74 65 6d 24 0d 0c 58  |pos+12)=item$..X|
00001b20  05 cc 0d 0c 62 1a 20 20  20 de 20 62 75 66 66 65  |....b.   . buffe|
00001b30  72 20 a9 28 69 74 65 6d  24 29 2b 31 0d 0c 6c 14  |r .(item$)+1..l.|
00001b40  20 20 20 24 62 75 66 66  65 72 3d 69 74 65 6d 24  |   $buffer=item$|
00001b50  0d 0c 76 1f 20 20 20 63  75 72 72 65 6e 74 6d 65  |..v.   currentme|
00001b60  6e 75 70 6f 73 21 31 32  3d 62 75 66 66 65 72 0d  |nupos!12=buffer.|
00001b70  0c 80 1e 20 20 20 63 75  72 72 65 6e 74 6d 65 6e  |...   currentmen|
00001b80  75 70 6f 73 21 31 36 3d  76 61 6c 69 64 0d 0c 8a  |upos!16=valid...|
00001b90  23 20 20 20 63 75 72 72  65 6e 74 6d 65 6e 75 70  |#   currentmenup|
00001ba0  6f 73 21 32 30 3d a9 28  69 74 65 6d 24 29 2b 31  |os!20=.(item$)+1|
00001bb0  0d 0c 94 1c 20 20 20 63  75 72 72 65 6e 74 6d 65  |....   currentme|
00001bc0  6e 75 70 6f 73 21 38 2b  3d 32 5e 38 0d 0c 9e 05  |nupos!8+=2^8....|
00001bd0  cd 0d 0c a8 16 63 75 72  72 65 6e 74 6d 65 6e 75  |.....currentmenu|
00001be0  70 6f 73 2b 3d 32 34 0d  0c b2 05 e1 0d 0c bc 04  |pos+=24.........|
00001bf0  0d 0c c6 0d dd f2 65 6e  64 6d 65 6e 75 0d 0c d0  |......endmenu...|
00001c00  1d 63 75 72 72 65 6e 74  6d 65 6e 75 70 6f 73 21  |.currentmenupos!|
00001c10  28 2d 32 34 29 3d 31 3c  3c 37 0d 0c da 05 e1 0d  |(-24)=1<<7......|
00001c20  0c e4 04 0d 0c ee 10 dd  f2 62 75 69 6c 64 6d 65  |.........buildme|
00001c30  6e 75 73 0d 0c f8 1a ea  20 63 75 72 72 65 6e 74  |nus..... current|
00001c40  6d 65 6e 75 70 6f 73 2c  20 6c 6f 6f 70 0d 0d 02  |menupos, loop...|
00001c50  2f f2 63 72 65 61 74 65  6d 65 6e 75 28 49 63 6f  |/.createmenu(Ico|
00001c60  6e 6d 65 6e 75 25 2c 20  a4 6d 65 73 73 28 22 4d  |nmenu%, .mess("M|
00001c70  31 54 22 29 2c 20 35 2c  20 31 30 29 0d 0d 0c 0f  |1T"), 5, 10)....|
00001c80  6d 65 6e 75 5f 69 6e 66  6f 3d 30 0d 0d 16 24 f2  |menu_info=0...$.|
00001c90  61 64 64 6d 65 6e 75 28  a4 6d 65 73 73 28 22 4d  |addmenu(.mess("M|
00001ca0  31 30 22 29 2c 20 77 69  6e 5f 69 6e 66 6f 29 0d  |10"), win_info).|
00001cb0  0d 20 0e 6d 65 6e 75 5f  6b 65 79 3d 31 0d 0d 2a  |. .menu_key=1..*|
00001cc0  12 6d 65 6e 75 5f 63 6c  6f 73 65 75 70 3d 32 0d  |.menu_closeup=2.|
00001cd0  0d 34 0f 6d 65 6e 75 5f  71 75 69 74 3d 33 0d 0d  |.4.menu_quit=3..|
00001ce0  3e 1f e3 20 6c 6f 6f 70  3d 6d 65 6e 75 5f 6b 65  |>.. loop=menu_ke|
00001cf0  79 20 b8 20 6d 65 6e 75  5f 71 75 69 74 0d 0d 48  |y . menu_quit..H|
00001d00  28 20 20 20 f2 61 64 64  6d 65 6e 75 28 a4 6d 65  |(   .addmenu(.me|
00001d10  73 73 28 22 4d 31 22 2b  c3 28 6c 6f 6f 70 29 29  |ss("M1"+.(loop))|
00001d20  2c 20 2d 31 29 0d 0d 52  05 ed 0d 0d 5c 0c f2 65  |, -1)..R....\..e|
00001d30  6e 64 6d 65 6e 75 0d 0d  66 17 6d 65 6e 75 68 65  |ndmenu..f.menuhe|
00001d40  69 67 68 74 25 3d 34 2a  34 34 2b 39 36 0d 0d 70  |ight%=4*44+96..p|
00001d50  05 e1 0d 0d 7a 04 0d 0d  84 18 dd f2 64 6f 66 75  |....z.......dofu|
00001d60  6e 63 74 69 6f 6e 73 28  69 74 65 6d 25 29 0d 0d  |nctions(item%)..|
00001d70  8e 0e c8 8e 20 69 74 65  6d 25 20 ca 0d 0d 98 2f  |.... item% ..../|
00001d80  20 20 20 c9 20 6d 65 6e  75 5f 6b 65 79 20 3a 20  |   . menu_key : |
00001d90  f2 6f 70 65 6e 77 69 6e  64 6f 77 63 65 6e 74 72  |.openwindowcentr|
00001da0  65 64 28 77 69 6e 5f 6b  65 79 29 0d 0d a2 35 20  |ed(win_key)...5 |
00001db0  20 20 c9 20 6d 65 6e 75  5f 63 6c 6f 73 65 75 70  |  . menu_closeup|
00001dc0  20 3a 20 f2 6f 70 65 6e  77 69 6e 64 6f 77 63 65  | : .openwindowce|
00001dd0  6e 74 72 65 64 28 77 69  6e 5f 6c 61 72 67 65 29  |ntred(win_large)|
00001de0  0d 0d ac 1c 20 20 20 c9  20 6d 65 6e 75 5f 71 75  |....   . menu_qu|
00001df0  69 74 20 3a 20 f2 66 69  6e 69 73 68 0d 0d b6 05  |it : .finish....|
00001e00  cb 0d 0d c0 05 e1 0d 0d  ca 04 0d 0d d4 0b f4 20  |............... |
00001e10  4d 6f 75 73 65 0d 0d de  04 0d 0d e8 0b dd f2 69  |Mouse..........i|
00001e20  63 6f 6e 73 0d 0d f2 21  f4 20 2a 2a 2a 20 49 6e  |cons...!. *** In|
00001e30  66 6f 20 62 6f 78 20 28  77 69 6e 5f 69 6e 66 6f  |fo box (win_info|
00001e40  29 20 2a 2a 2a 0d 0d fc  12 69 63 6f 6e 5f 76 65  |) ***....icon_ve|
00001e50  72 73 69 6f 6e 3d 37 0d  0e 06 05 e1 0d 0e 10 04  |rsion=7.........|
00001e60  0d 0e 1a 33 dd f2 63 68  65 63 6b 6d 6f 75 73 65  |...3..checkmouse|
00001e70  28 6d 78 25 2c 20 6d 79  25 2c 20 62 75 74 74 6f  |(mx%, my%, butto|
00001e80  6e 25 2c 20 77 69 6e 64  6f 77 25 2c 20 69 63 6f  |n%, window%, ico|
00001e90  6e 25 29 0d 0e 24 1b ea  20 62 75 66 66 65 72 2c  |n%)..$.. buffer,|
00001ea0  20 6d 6f 64 2c 20 6b 65  79 77 6f 72 64 24 0d 0e  | mod, keyword$..|
00001eb0  2e 18 ea 20 69 74 65 6d  2c 20 74 79 70 65 2c 20  |... item, type, |
00001ec0  61 63 74 69 6f 6e 0d 0e  38 10 c8 8e 20 77 69 6e  |action..8... win|
00001ed0  64 6f 77 25 20 ca 0d 0e  42 0b 20 20 20 c9 20 2d  |dow% ...B.   . -|
00001ee0  32 0d 0e 4c 16 20 20 20  20 20 20 c8 8e 20 62 75  |2..L.      .. bu|
00001ef0  74 74 6f 6e 25 20 ca 0d  0e 56 30 20 20 20 20 20  |tton% ...V0     |
00001f00  20 20 20 20 c9 20 32 20  3a 20 f2 70 6c 6f 74 69  |    . 2 : .ploti|
00001f10  63 6f 6e 6d 65 6e 75 28  49 63 6f 6e 6d 65 6e 75  |conmenu(Iconmenu|
00001f20  25 2c 20 6d 78 25 29 0d  0e 60 2e 20 20 20 20 20  |%, mx%)..`.     |
00001f30  20 20 20 20 c9 20 31 20  3a 20 f2 6f 70 65 6e 77  |    . 1 : .openw|
00001f40  69 6e 64 6f 77 63 65 6e  74 72 65 64 28 77 69 6e  |indowcentred(win|
00001f50  5f 6b 65 79 29 0d 0e 6a  30 20 20 20 20 20 20 20  |_key)..j0       |
00001f60  20 20 c9 20 34 20 3a 20  f2 6f 70 65 6e 77 69 6e  |  . 4 : .openwin|
00001f70  64 6f 77 63 65 6e 74 72  65 64 28 77 69 6e 5f 6c  |dowcentred(win_l|
00001f80  61 72 67 65 29 0d 0e 74  0b 20 20 20 20 20 20 cb  |arge)..t.      .|
00001f90  0d 0e 7e 05 cb 0d 0e 88  05 e1 0d 0e 92 04 0d 0e  |..~.............|
00001fa0  9c 0a f4 20 57 69 6d 70  0d 0e a6 04 0d 0e b0 0f  |... Wimp........|
00001fb0  dd f2 73 74 61 72 74 77  69 6d 70 0d 0e ba 54 c8  |..startwimp...T.|
00001fc0  99 20 22 57 69 6d 70 5f  49 6e 69 74 69 61 6c 69  |. "Wimp_Initiali|
00001fd0  73 65 22 2c 20 33 31 30  2c 20 26 34 42 35 33 34  |se", 310, &4B534|
00001fe0  31 35 34 2c 20 74 61 73  6b 6e 61 6d 65 24 2c 20  |154, taskname$, |
00001ff0  6d 65 73 73 62 6c 6f 63  6b 20 b8 20 76 65 72 73  |messblock . vers|
00002000  69 6f 6e 2c 20 54 61 73  6b 48 61 6e 64 6c 65 0d  |ion, TaskHandle.|
00002010  0e c4 0e 57 69 6d 70 49  6e 69 74 3d b9 0d 0e ce  |...WimpInit=....|
00002020  05 e1 0d 0e d8 04 0d 0e  e2 18 dd a4 72 65 61 64  |............read|
00002030  73 74 72 69 6e 67 28 6f  66 66 73 65 74 29 0d 0e  |string(offset)..|
00002040  ec 0d 41 25 3d 6f 66 66  73 65 74 0d 0e f6 0d 42  |..A%=offset....B|
00002050  25 3d 73 74 72 69 6e 67  0d 0f 00 10 d6 20 73 74  |%=string..... st|
00002060  72 69 6e 67 72 65 61 64  0d 0f 0a 0c 3d 24 73 74  |ringread....=$st|
00002070  72 69 6e 67 0d 0f 14 04  0d 0f 1e 23 dd f2 73 65  |ring.......#..se|
00002080  74 77 69 6e 64 6f 77 74  69 74 6c 65 28 77 69 6e  |twindowtitle(win|
00002090  64 6f 77 25 2c 20 76 61  6c 24 29 0d 0f 28 13 21  |dow%, val$)..(.!|
000020a0  62 6c 6f 63 6b 25 3d 77  69 6e 64 6f 77 25 0d 0f  |block%=window%..|
000020b0  32 27 c8 99 20 22 57 69  6d 70 5f 47 65 74 57 69  |2'.. "Wimp_GetWi|
000020c0  6e 64 6f 77 49 6e 66 6f  22 2c 2c 62 6c 6f 63 6b  |ndowInfo",,block|
000020d0  25 20 84 20 31 0d 0f 3c  15 24 28 62 6c 6f 63 6b  |% . 1..<.$(block|
000020e0  25 21 37 36 29 3d 76 61  6c 24 0d 0f 46 1a 3f 28  |%!76)=val$..F.?(|
000020f0  62 6c 6f 63 6b 25 21 37  36 2b a9 28 76 61 6c 24  |block%!76+.(val$|
00002100  29 29 3d 30 0d 0f 50 05  e1 0d 0f 5a 04 0d 0f 64  |))=0..P....Z...d|
00002110  11 dd f2 74 72 61 63 65  28 73 74 72 24 29 0d 0f  |...trace(str$)..|
00002120  6e 0d d5 23 fc 2c 20 73  74 72 24 0d 0f 78 05 e1  |n..#., str$..x..|
00002130  0d 0f 82 04 0d 0f 8c 18  dd f2 6c 6f 61 64 73 70  |..........loadsp|
00002140  72 69 74 65 73 28 66 69  6c 65 24 29 0d 0f 96 29  |rites(file$)...)|
00002150  ea 20 66 6c 61 67 73 2c  20 63 6f 75 6e 74 2c 20  |. flags, count, |
00002160  6f 66 66 73 65 74 2c 20  6d 61 78 73 69 7a 65 2c  |offset, maxsize,|
00002170  20 73 69 7a 65 0d 0f a0  2e c8 99 20 22 58 4f 53  | size...... "XOS|
00002180  5f 46 69 6c 65 22 2c 20  32 33 2c 20 66 69 6c 65  |_File", 23, file|
00002190  24 20 b8 20 66 6f 75 6e  64 2c 2c 2c 2c 6c 65 6e  |$ . found,,,,len|
000021a0  67 74 68 0d 0f aa 14 de  20 73 70 72 69 74 65 25  |gth..... sprite%|
000021b0  20 6c 65 6e 67 74 68 0d  0f b4 15 21 73 70 72 69  | length....!spri|
000021c0  74 65 25 3d 6c 65 6e 67  74 68 2b 34 0d 0f be 10  |te%=length+4....|
000021d0  73 70 72 69 74 65 25 21  38 3d 31 36 0d 0f c8 24  |sprite%!8=16...$|
000021e0  c8 99 20 22 58 4f 53 5f  53 70 72 69 74 65 4f 70  |.. "XOS_SpriteOp|
000021f0  22 2c 20 26 31 30 39 2c  20 73 70 72 69 74 65 25  |", &109, sprite%|
00002200  0d 0f d2 2b c8 99 20 22  58 4f 53 5f 53 70 72 69  |...+.. "XOS_Spri|
00002210  74 65 4f 70 22 2c 20 26  31 30 41 2c 20 73 70 72  |teOp", &10A, spr|
00002220  69 74 65 25 2c 20 66 69  6c 65 24 0d 0f dc 1c 6f  |ite%, file$....o|
00002230  66 66 73 65 74 3d 73 70  72 69 74 65 25 2b 73 70  |ffset=sprite%+sp|
00002240  72 69 74 65 25 21 38 0d  0f e6 0d 6d 61 78 73 69  |rite%!8....maxsi|
00002250  7a 65 3d 30 0d 0f f0 19  e3 20 63 6f 75 6e 74 3d  |ze=0..... count=|
00002260  31 20 b8 20 73 70 72 69  74 65 25 21 34 0d 0f fa  |1 . sprite%!4...|
00002270  21 20 20 20 c8 8e 20 a4  72 65 61 64 73 74 72 69  |!   .. .readstri|
00002280  6e 67 28 6f 66 66 73 65  74 2b 34 29 20 ca 0d 10  |ng(offset+4) ...|
00002290  04 2d 20 20 20 20 20 20  c9 20 22 62 61 72 70 69  |.-      . "barpi|
000022a0  65 22 20 3a 20 73 70 72  69 74 65 5f 73 74 61 6e  |e" : sprite_stan|
000022b0  64 61 72 64 3d 6f 66 66  73 65 74 0d 10 0e 30 20  |dard=offset...0 |
000022c0  20 20 20 20 20 c9 20 22  62 61 72 70 69 65 32 32  |     . "barpie22|
000022d0  22 20 3a 20 73 70 72 69  74 65 5f 6d 75 6c 74 69  |" : sprite_multi|
000022e0  73 79 6e 63 3d 6f 66 66  73 65 74 0d 10 18 08 20  |sync=offset.... |
000022f0  20 20 cb 0d 10 22 3b 20  20 20 c8 99 20 22 58 4f  |  ...";   .. "XO|
00002300  53 5f 53 70 72 69 74 65  4f 70 22 2c 20 35 31 32  |S_SpriteOp", 512|
00002310  2b 36 32 2c 20 73 70 72  69 74 65 25 2c 20 6f 66  |+62, sprite%, of|
00002320  66 73 65 74 20 b8 20 2c  2c 2c 73 69 7a 65 0d 10  |fset . ,,,size..|
00002330  2c 24 20 20 20 e7 20 73  69 7a 65 3e 6d 61 78 73  |,$   . size>maxs|
00002340  69 7a 65 20 8c 20 6d 61  78 73 69 7a 65 3d 73 69  |ize . maxsize=si|
00002350  7a 65 0d 10 36 16 20 20  20 6f 66 66 73 65 74 2b  |ze..6.   offset+|
00002360  3d 21 6f 66 66 73 65 74  0d 10 40 05 ed 0d 10 4a  |=!offset..@....J|
00002370  16 de 20 73 61 76 65 61  72 65 61 20 6d 61 78 73  |.. savearea maxs|
00002380  69 7a 65 0d 10 54 05 e1  0d 10 5e 04 0d 10 68 0d  |ize..T....^...h.|
00002390  dd a4 69 63 6f 6e 62 61  72 0d 10 72 0b ea 20 77  |..iconbar..r.. w|
000023a0  69 64 74 68 0d 10 7c 3b  c8 99 20 22 4f 53 5f 53  |idth..|;.. "OS_S|
000023b0  70 72 69 74 65 4f 70 22  2c 20 35 31 32 2b 34 30  |priteOp", 512+40|
000023c0  2c 20 73 70 72 69 74 65  25 2c 20 62 61 72 73 70  |, sprite%, barsp|
000023d0  72 69 74 65 20 b8 20 2c  2c 2c 77 69 64 74 68 0d  |rite . ,,,width.|
000023e0  10 86 0e 21 62 6c 6f 63  6b 25 3d 2d 31 0d 10 90  |...!block%=-1...|
000023f0  0e 62 6c 6f 63 6b 25 21  34 3d 30 0d 10 9a 10 62  |.block%!4=0....b|
00002400  6c 6f 63 6b 25 21 38 3d  2d 33 32 0d 10 a4 21 62  |lock%!8=-32...!b|
00002410  6c 6f 63 6b 25 21 31 32  3d 28 77 69 64 74 68 3c  |lock%!12=(width<|
00002420  3c 58 45 69 67 46 61 63  74 6f 72 29 0d 10 ae 11  |<XEigFactor)....|
00002430  62 6c 6f 63 6b 25 21 31  36 3d 31 32 30 0d 10 b8  |block%!16=120...|
00002440  13 62 6c 6f 63 6b 25 21  32 30 3d 26 33 31 31 41  |.block%!20=&311A|
00002450  0d 10 c2 17 62 6c 6f 63  6b 25 21 32 34 3d 73 70  |....block%!24=sp|
00002460  72 69 74 65 70 74 72 0d  10 cc 15 62 6c 6f 63 6b  |riteptr....block|
00002470  25 21 32 38 3d 73 70 72  69 74 65 25 0d 10 d6 10  |%!28=sprite%....|
00002480  62 6c 6f 63 6b 25 21 33  32 3d 31 33 0d 10 e0 28  |block%!32=13...(|
00002490  c8 99 20 22 57 69 6d 70  5f 43 72 65 61 74 65 49  |.. "Wimp_CreateI|
000024a0  63 6f 6e 22 2c 2c 62 6c  6f 63 6b 25 20 b8 20 69  |con",,block% . i|
000024b0  63 6f 6e 25 0d 10 ea 11  64 6f 6e 65 69 63 6f 6e  |con%....doneicon|
000024c0  62 61 72 3d b9 0d 10 f4  0a 3d 69 63 6f 6e 25 0d  |bar=.....=icon%.|
000024d0  10 fe 04 0d 11 08 28 dd  f2 77 72 69 74 65 69 63  |......(..writeic|
000024e0  6f 6e 28 77 69 6e 64 6f  77 25 2c 20 69 63 6f 6e  |on(window%, icon|
000024f0  25 2c 20 73 74 72 69 6e  67 24 29 0d 11 12 13 21  |%, string$)....!|
00002500  62 6c 6f 63 6b 25 3d 77  69 6e 64 6f 77 25 0d 11  |block%=window%..|
00002510  1c 12 62 6c 6f 63 6b 25  21 34 3d 69 63 6f 6e 25  |..block%!4=icon%|
00002520  0d 11 26 22 c8 99 20 22  57 69 6d 70 5f 47 65 74  |..&".. "Wimp_Get|
00002530  49 63 6f 6e 53 74 61 74  65 22 2c 2c 62 6c 6f 63  |IconState",,bloc|
00002540  6b 25 0d 11 30 1d e7 20  28 62 6c 6f 63 6b 25 21  |k%..0.. (block%!|
00002550  32 34 20 80 20 31 3c 3c  32 33 29 3e 31 20 8c 0d  |24 . 1<<23)>1 ..|
00002560  11 3a 1e 20 20 20 f2 72  65 70 6f 72 74 28 a4 6d  |.:.   .report(.m|
00002570  65 73 73 28 22 49 63 44  65 6c 22 29 29 0d 11 44  |ess("IcDel"))..D|
00002580  05 cc 0d 11 4e 1b 20 20  20 24 28 62 6c 6f 63 6b  |....N.   $(block|
00002590  25 21 32 38 29 3d 73 74  72 69 6e 67 24 0d 11 58  |%!28)=string$..X|
000025a0  2a 20 20 20 f2 73 65 74  69 63 6f 6e 73 74 61 74  |*   .seticonstat|
000025b0  65 28 77 69 6e 64 6f 77  25 2c 20 69 63 6f 6e 25  |e(window%, icon%|
000025c0  2c 20 30 2c 20 30 29 0d  11 62 05 cd 0d 11 6c 05  |, 0, 0)..b....l.|
000025d0  e1 0d 11 76 04 0d 11 80  1e dd a4 72 65 61 64 69  |...v.......readi|
000025e0  63 6f 6e 28 77 69 6e 64  6f 77 25 2c 20 69 63 6f  |con(window%, ico|
000025f0  6e 25 29 0d 11 8a 0a ea  20 6f 75 74 24 0d 11 94  |n%)..... out$...|
00002600  13 21 62 6c 6f 63 6b 25  3d 77 69 6e 64 6f 77 25  |.!block%=window%|
00002610  0d 11 9e 12 62 6c 6f 63  6b 25 21 34 3d 69 63 6f  |....block%!4=ico|
00002620  6e 25 0d 11 a8 22 c8 99  20 22 57 69 6d 70 5f 47  |n%...".. "Wimp_G|
00002630  65 74 49 63 6f 6e 53 74  61 74 65 22 2c 2c 62 6c  |etIconState",,bl|
00002640  6f 63 6b 25 0d 11 b2 1d  e7 20 28 62 6c 6f 63 6b  |ock%..... (block|
00002650  25 21 32 34 20 80 20 31  3c 3c 32 33 29 3e 31 20  |%!24 . 1<<23)>1 |
00002660  8c 0d 11 bc 27 20 20 20  f2 72 65 70 6f 72 74 28  |....'   .report(|
00002670  22 52 65 61 64 3a 20 22  2b a4 6d 65 73 73 28 22  |"Read: "+.mess("|
00002680  49 63 64 65 6c 22 29 29  0d 11 c6 0e 20 20 20 6f  |Icdel"))....   o|
00002690  75 74 24 3d 22 22 0d 11  d0 05 cc 0d 11 da 18 20  |ut$=""......... |
000026a0  20 20 6f 75 74 24 3d 24  28 62 6c 6f 63 6b 25 21  |  out$=$(block%!|
000026b0  32 38 29 0d 11 e4 05 cd  0d 11 ee 09 3d 6f 75 74  |28).........=out|
000026c0  24 0d 11 f8 04 0d 12 02  23 dd f2 66 61 69 6e 74  |$.......#..faint|
000026d0  28 77 69 6e 64 6f 77 25  2c 20 69 63 6f 6e 25 2c  |(window%, icon%,|
000026e0  20 66 61 69 6e 74 25 29  0d 12 0c 0f ea 20 6d 61  | faint%)..... ma|
000026f0  73 6b 2c 20 73 65 74 0d  12 16 0e 6d 61 73 6b 3d  |sk, set....mask=|
00002700  31 3c 3c 32 32 0d 12 20  15 73 65 74 3d 28 2d 66  |1<<22.. .set=(-f|
00002710  61 69 6e 74 25 29 3c 3c  32 32 0d 12 2a 1a e7 20  |aint%)<<22..*.. |
00002720  66 61 69 6e 74 25 20 8c  20 6d 61 73 6b 2b 3d 31  |faint% . mask+=1|
00002730  3c 3c 32 31 0d 12 34 2c  f2 73 65 74 69 63 6f 6e  |<<21..4,.seticon|
00002740  73 74 61 74 65 28 77 69  6e 64 6f 77 25 2c 20 69  |state(window%, i|
00002750  63 6f 6e 25 2c 20 6d 61  73 6b 2c 20 73 65 74 29  |con%, mask, set)|
00002760  0d 12 3e 05 e1 0d 12 48  04 0d 12 52 1e dd a4 73  |..>....H...R...s|
00002770  65 6c 65 63 74 65 64 28  77 69 6e 64 6f 77 25 2c  |elected(window%,|
00002780  20 69 63 6f 6e 25 29 0d  12 5c 0a ea 20 6c 6f 6f  | icon%)..\.. loo|
00002790  70 0d 12 66 13 21 62 6c  6f 63 6b 25 3d 77 69 6e  |p..f.!block%=win|
000027a0  64 6f 77 25 0d 12 70 12  62 6c 6f 63 6b 25 21 34  |dow%..p.block%!4|
000027b0  3d 69 63 6f 6e 25 0d 12  7a 22 c8 99 20 22 57 69  |=icon%..z".. "Wi|
000027c0  6d 70 5f 47 65 74 49 63  6f 6e 53 74 61 74 65 22  |mp_GetIconState"|
000027d0  2c 2c 62 6c 6f 63 6b 25  0d 12 84 1e 3d 28 28 62  |,,block%....=((b|
000027e0  6c 6f 63 6b 25 21 32 34  20 80 20 28 31 3c 3c 32  |lock%!24 . (1<<2|
000027f0  31 29 29 3e 30 29 0d 12  8e 04 0d 12 98 22 dd f2  |1))>0)......."..|
00002800  73 65 6c 65 63 74 28 77  69 6e 64 6f 77 25 2c 20  |select(window%, |
00002810  69 63 6f 6e 25 2c 20 73  65 6c 25 29 0d 12 a2 0f  |icon%, sel%)....|
00002820  ea 20 6d 61 73 6b 2c 20  73 65 74 0d 12 ac 0e 6d  |. mask, set....m|
00002830  61 73 6b 3d 31 3c 3c 32  31 0d 12 b6 13 73 65 74  |ask=1<<21....set|
00002840  3d 28 2d 73 65 6c 25 29  3c 3c 32 31 0d 12 c0 2c  |=(-sel%)<<21...,|
00002850  f2 73 65 74 69 63 6f 6e  73 74 61 74 65 28 77 69  |.seticonstate(wi|
00002860  6e 64 6f 77 25 2c 20 69  63 6f 6e 25 2c 20 6d 61  |ndow%, icon%, ma|
00002870  73 6b 2c 20 73 65 74 29  0d 12 ca 05 e1 0d 12 d4  |sk, set)........|
00002880  04 0d 12 de 2e dd f2 73  65 74 69 63 6f 6e 73 74  |.......seticonst|
00002890  61 74 65 28 77 69 6e 64  6f 77 25 2c 20 69 63 6f  |ate(window%, ico|
000028a0  6e 25 2c 20 6d 61 73 6b  2c 20 62 69 74 73 29 0d  |n%, mask, bits).|
000028b0  12 e8 13 21 62 6c 6f 63  6b 25 3d 77 69 6e 64 6f  |...!block%=windo|
000028c0  77 25 0d 12 f2 12 62 6c  6f 63 6b 25 21 34 3d 69  |w%....block%!4=i|
000028d0  63 6f 6e 25 0d 12 fc 11  62 6c 6f 63 6b 25 21 38  |con%....block%!8|
000028e0  3d 62 69 74 73 0d 13 06  12 62 6c 6f 63 6b 25 21  |=bits....block%!|
000028f0  31 32 3d 6d 61 73 6b 0d  13 10 22 c8 99 20 22 57  |12=mask...".. "W|
00002900  69 6d 70 5f 53 65 74 49  63 6f 6e 53 74 61 74 65  |imp_SetIconState|
00002910  22 2c 2c 62 6c 6f 63 6b  25 0d 13 1a 05 e1 0d 13  |",,block%.......|
00002920  24 04 0d 13 2e 0e dd f2  6d 73 67 74 72 61 6e 73  |$.......msgtrans|
00002930  0d 13 38 16 ea 20 66 6c  61 67 73 2c 20 62 75 66  |..8.. flags, buf|
00002940  6c 65 6e 67 74 68 0d 13  42 48 c8 99 20 22 4d 65  |length..BH.. "Me|
00002950  73 73 61 67 65 54 72 61  6e 73 5f 46 69 6c 65 49  |ssageTrans_FileI|
00002960  6e 66 6f 22 2c 20 2c 20  61 6c 69 61 73 24 2b 22  |nfo", , alias$+"|
00002970  2e 4d 65 73 73 61 67 65  73 22 20 b8 20 66 6c 61  |.Messages" . fla|
00002980  67 73 2c 20 2c 62 75 66  6c 65 6e 67 74 68 0d 13  |gs, ,buflength..|
00002990  4c 15 e7 20 28 66 6c 61  67 73 20 80 20 31 29 3d  |L.. (flags . 1)=|
000029a0  30 20 8c 0d 13 56 1c 20  20 20 de 20 4d 73 67 42  |0 ...V.   . MsgB|
000029b0  75 66 66 65 72 20 62 75  66 6c 65 6e 67 74 68 0d  |uffer buflength.|
000029c0  13 60 17 20 20 20 de 20  4d 73 67 44 65 73 63 72  |.`.   . MsgDescr|
000029d0  69 70 74 20 32 30 0d 13  6a 4d 20 20 20 c8 99 20  |ipt 20..jM   .. |
000029e0  22 4d 65 73 73 61 67 65  54 72 61 6e 73 5f 4f 70  |"MessageTrans_Op|
000029f0  65 6e 46 69 6c 65 22 2c  20 4d 73 67 44 65 73 63  |enFile", MsgDesc|
00002a00  72 69 70 74 2c 20 61 6c  69 61 73 24 2b 22 2e 4d  |ript, alias$+".M|
00002a10  65 73 73 61 67 65 73 22  2c 20 4d 73 67 42 75 66  |essages", MsgBuf|
00002a20  66 65 72 0d 13 74 05 cc  0d 13 7e 3c 20 20 20 f2  |fer..t....~<   .|
00002a30  72 65 70 6f 72 74 28 22  48 65 79 2c 20 74 68 65  |report("Hey, the|
00002a40  73 65 20 6d 65 73 73 61  67 65 73 20 61 72 65 20  |se messages are |
00002a50  61 6c 72 65 61 64 79 20  69 6e 20 6d 65 6d 6f 72  |already in memor|
00002a60  79 2e 22 29 0d 13 88 05  cd 0d 13 92 05 e1 0d 13  |y.")............|
00002a70  9c 04 0d 13 a6 10 dd a4  6d 65 73 73 28 74 6f 6b  |........mess(tok|
00002a80  24 29 0d 13 b0 21 ea 20  6c 6f 6f 70 2c 20 6f 75  |$)...!. loop, ou|
00002a90  74 24 2c 20 70 6f 69 6e  74 65 72 2c 20 6c 65 6e  |t$, pointer, len|
00002aa0  67 74 68 0d 13 ba 15 24  69 6e 3d 74 6f 6b 24 2b  |gth....$in=tok$+|
00002ab0  22 3a 22 2b 74 6f 6b 24  0d 13 c4 12 3f 28 69 6e  |":"+tok$....?(in|
00002ac0  2b a9 28 24 69 6e 29 29  3d 30 0d 13 ce 52 c8 99  |+.($in))=0...R..|
00002ad0  20 22 4d 65 73 73 61 67  65 54 72 61 6e 73 5f 4c  | "MessageTrans_L|
00002ae0  6f 6f 6b 75 70 22 2c 20  4d 73 67 44 65 73 63 72  |ookup", MsgDescr|
00002af0  69 70 74 2c 20 69 6e 2c  20 30 2c 20 30 2c 20 30  |ipt, in, 0, 0, 0|
00002b00  2c 20 30 2c 20 30 2c 20  30 20 b8 20 2c 2c 70 6f  |, 0, 0, 0 . ,,po|
00002b10  69 6e 74 65 72 2c 6c 65  6e 67 74 68 0d 13 d8 17  |inter,length....|
00002b20  e3 20 6c 6f 6f 70 3d 30  20 b8 20 6c 65 6e 67 74  |. loop=0 . lengt|
00002b30  68 2d 31 0d 13 e2 1c 20  20 20 6f 75 74 24 2b 3d  |h-1....   out$+=|
00002b40  bd 28 70 6f 69 6e 74 65  72 3f 6c 6f 6f 70 29 0d  |.(pointer?loop).|
00002b50  13 ec 05 ed 0d 13 f6 09  3d 6f 75 74 24 0d 14 00  |........=out$...|
00002b60  04 0d 14 0a 2f dd a4 6d  65 73 73 61 72 67 28 74  |..../..messarg(t|
00002b70  6f 6b 24 2c 20 61 72 67  31 24 2c 20 61 72 67 32  |ok$, arg1$, arg2|
00002b80  24 2c 20 61 72 67 33 24  2c 20 61 72 67 34 24 29  |$, arg3$, arg4$)|
00002b90  0d 14 14 26 ea 20 6c 6f  6f 70 2c 20 69 6e 24 2c  |...&. loop, in$,|
00002ba0  20 6f 75 74 24 2c 20 70  6f 69 6e 74 65 72 2c 20  | out$, pointer, |
00002bb0  6c 65 6e 67 74 68 0d 14  1e 15 24 69 6e 3d 74 6f  |length....$in=to|
00002bc0  6b 24 2b 22 3a 22 2b 74  6f 6b 24 0d 14 28 12 3f  |k$+":"+tok$..(.?|
00002bd0  28 69 6e 2b a9 28 24 69  6e 29 29 3d 30 0d 14 32  |(in+.($in))=0..2|
00002be0  6a c8 99 20 22 4d 65 73  73 61 67 65 54 72 61 6e  |j.. "MessageTran|
00002bf0  73 5f 4c 6f 6f 6b 75 70  22 2c 20 4d 73 67 44 65  |s_Lookup", MsgDe|
00002c00  73 63 72 69 70 74 2c 20  69 6e 2c 20 73 74 72 69  |script, in, stri|
00002c10  6e 67 2c 20 32 35 36 2c  20 61 72 67 31 24 2c 20  |ng, 256, arg1$, |
00002c20  61 72 67 32 24 2c 20 61  72 67 33 24 2c 20 61 72  |arg2$, arg3$, ar|
00002c30  67 34 24 20 b8 20 2c 2c  70 6f 69 6e 74 65 72 2c  |g4$ . ,,pointer,|
00002c40  20 6c 65 6e 67 74 68 0d  14 3c 17 e3 20 6c 6f 6f  | length..<.. loo|
00002c50  70 3d 30 20 b8 20 6c 65  6e 67 74 68 2d 31 0d 14  |p=0 . length-1..|
00002c60  46 1c 20 20 20 6f 75 74  24 2b 3d bd 28 70 6f 69  |F.   out$+=.(poi|
00002c70  6e 74 65 72 3f 6c 6f 6f  70 29 0d 14 50 05 ed 0d  |nter?loop)..P...|
00002c80  14 5a 09 3d 6f 75 74 24  0d 14 64 04 0d 14 6e 21  |.Z.=out$..d...n!|
00002c90  dd f2 73 65 74 63 61 72  65 74 28 77 69 6e 64 6f  |..setcaret(windo|
00002ca0  77 2c 20 69 63 6f 6e 2c  20 70 6f 73 29 0d 14 78  |w, icon, pos)..x|
00002cb0  33 e7 20 70 6f 73 3d 5f  45 6e 64 49 63 6f 6e 20  |3. pos=_EndIcon |
00002cc0  8c 20 70 6f 73 3d a9 28  a4 72 65 61 64 69 63 6f  |. pos=.(.readico|
00002cd0  6e 28 77 69 6e 64 6f 77  2c 20 69 63 6f 6e 29 29  |n(window, icon))|
00002ce0  0d 14 82 3d c8 99 20 22  57 69 6d 70 5f 53 65 74  |...=.. "Wimp_Set|
00002cf0  43 61 72 65 74 50 6f 73  69 74 69 6f 6e 22 2c 20  |CaretPosition", |
00002d00  77 69 6e 64 6f 77 2c 20  69 63 6f 6e 2c 20 2d 31  |window, icon, -1|
00002d10  2c 20 2d 31 2c 20 2d 31  2c 20 70 6f 73 0d 14 8c  |, -1, -1, pos...|
00002d20  05 e1 0d 14 96 04 0d 14  a0 14 dd a4 63 61 73 65  |............case|
00002d30  6c 65 73 73 28 73 74 72  24 29 0d 14 aa 10 24 73  |less(str$)....$s|
00002d40  74 72 69 6e 67 3d 73 74  72 24 0d 14 b4 0d 41 25  |tring=str$....A%|
00002d50  3d 73 74 72 69 6e 67 0d  14 be 0e d6 20 63 61 73  |=string..... cas|
00002d60  65 6c 65 73 73 0d 14 c8  0c 3d 24 73 74 72 69 6e  |eless....=$strin|
00002d70  67 0d 14 d2 04 0d 14 dc  0f f4 20 57 69 6d 70 4d  |g......... WimpM|
00002d80  65 6e 75 73 0d 14 e6 04  0d 14 f0 2d dd f2 72 65  |enus.......-..re|
00002d90  6f 70 65 6e 6d 65 6e 75  28 6d 65 6e 75 68 61 6e  |openmenu(menuhan|
00002da0  64 6c 65 25 2c 20 6d 65  6e 75 78 25 2c 20 6d 65  |dle%, menux%, me|
00002db0  6e 75 79 25 29 0d 14 fa  3b c8 99 20 22 57 69 6d  |nuy%)...;.. "Wim|
00002dc0  70 5f 43 72 65 61 74 65  4d 65 6e 75 22 2c 2c 63  |p_CreateMenu",,c|
00002dd0  75 72 72 65 6e 74 68 61  6e 64 6c 65 25 2c 20 6d  |urrenthandle%, m|
00002de0  65 6e 75 78 25 2d 36 34  2c 20 6d 65 6e 75 79 25  |enux%-64, menuy%|
00002df0  0d 15 04 1e 63 75 72 72  65 6e 74 68 61 6e 64 6c  |....currenthandl|
00002e00  65 25 3d 6d 65 6e 75 68  61 6e 64 6c 65 25 0d 15  |e%=menuhandle%..|
00002e10  0e 05 e1 0d 15 18 04 0d  15 22 27 dd f2 70 6c 6f  |........."'..plo|
00002e20  74 69 63 6f 6e 6d 65 6e  75 28 6d 65 6e 75 68 61  |ticonmenu(menuha|
00002e30  6e 64 6c 65 25 2c 20 6d  65 6e 75 78 25 29 0d 15  |ndle%, menux%)..|
00002e40  2c 1e 63 75 72 72 65 6e  74 68 61 6e 64 6c 65 25  |,.currenthandle%|
00002e50  3d 6d 65 6e 75 68 61 6e  64 6c 65 25 0d 15 36 40  |=menuhandle%..6@|
00002e60  c8 99 20 22 57 69 6d 70  5f 43 72 65 61 74 65 4d  |.. "Wimp_CreateM|
00002e70  65 6e 75 22 2c 2c 63 75  72 72 65 6e 74 68 61 6e  |enu",,currenthan|
00002e80  64 6c 65 25 2c 20 6d 65  6e 75 78 25 2d 36 34 2c  |dle%, menux%-64,|
00002e90  20 6d 65 6e 75 68 65 69  67 68 74 25 0d 15 40 05  | menuheight%..@.|
00002ea0  e1 0d 15 4a 04 0d 15 54  0e f4 20 57 69 6d 70 4d  |...J...T.. WimpM|
00002eb0  65 73 73 0d 15 5e 04 0d  15 68 11 dd f2 6d 65 73  |ess..^...h...mes|
00002ec0  73 61 67 65 69 6e 69 74  0d 15 72 09 ea 20 70 6f  |sageinit..r.. po|
00002ed0  73 0d 15 7c 13 de 20 6d  65 73 73 62 6c 6f 63 6b  |s..|.. messblock|
00002ee0  20 32 35 36 0d 15 86 10  de 20 70 61 6c 65 74 74  | 256..... palett|
00002ef0  65 20 38 30 0d 15 90 19  de 20 69 6e 70 75 74 20  |e 80..... input |
00002f00  32 30 2c 20 6f 75 74 70  75 74 20 32 30 0d 15 9a  |20, output 20...|
00002f10  0a 70 6f 73 3d 2d 34 0d  15 a4 05 f5 0d 15 ae 0d  |.pos=-4.........|
00002f20  20 20 20 70 6f 73 2b 3d  34 0d 15 b8 16 20 20 20  |   pos+=4....   |
00002f30  f3 20 6d 65 73 73 62 6c  6f 63 6b 21 70 6f 73 0d  |. messblock!pos.|
00002f40  15 c2 15 fd 20 6d 65 73  73 62 6c 6f 63 6b 21 70  |.... messblock!p|
00002f50  6f 73 3d 30 0d 15 cc 16  dc 20 39 2c 20 31 30 2c  |os=0..... 9, 10,|
00002f60  20 26 34 30 30 43 31 2c  20 30 0d 15 d6 05 e1 0d  | &400C1, 0......|
00002f70  15 e0 04 0d 15 ea 16 dd  f2 6d 65 73 73 61 67 65  |.........message|
00002f80  28 72 65 61 73 6f 6e 25  29 0d 15 f4 1e ea 20 61  |(reason%)..... a|
00002f90  63 74 69 6f 6e 63 6f 64  65 2c 20 6e 75 6d 2c 20  |ctioncode, num, |
00002fa0  61 64 64 72 65 73 73 0d  15 fe 19 6f 72 69 67 69  |address....origi|
00002fb0  6e 68 61 6e 64 6c 65 3d  62 6c 6f 63 6b 25 21 34  |nhandle=block%!4|
00002fc0  0d 16 08 18 61 63 74 69  6f 6e 63 6f 64 65 3d 62  |....actioncode=b|
00002fd0  6c 6f 63 6b 25 21 31 36  0d 16 12 13 c8 8e 20 61  |lock%!16...... a|
00002fe0  63 74 69 6f 6e 63 6f 64  65 20 ca 0d 16 1c 14 20  |ctioncode ..... |
00002ff0  20 20 c9 20 30 20 3a 20  f2 66 69 6e 69 73 68 0d  |  . 0 : .finish.|
00003000  16 26 1a 20 20 20 c9 20  31 30 20 3a 20 f2 73 61  |.&.   . 10 : .sa|
00003010  76 65 64 65 73 6b 74 6f  70 0d 16 30 12 20 20 20  |vedesktop..0.   |
00003020  c9 20 39 2c 20 26 34 30  30 43 31 0d 16 3a 16 20  |. 9, &400C1..:. |
00003030  20 20 20 20 20 f2 67 65  74 6d 6f 64 65 76 61 72  |     .getmodevar|
00003040  73 0d 16 44 12 20 20 20  20 20 20 55 70 64 61 74  |s..D.      Updat|
00003050  65 3d b9 0d 16 4e 13 20  20 20 20 20 20 f2 63 68  |e=...N.      .ch|
00003060  65 63 6b 6d 65 6d 0d 16  58 05 cb 0d 16 62 05 e1  |eckmem..X....b..|
00003070  0d 16 6c 04 0d 16 76 11  dd f2 67 65 74 6d 6f 64  |..l...v...getmod|
00003080  65 76 61 72 73 0d 16 80  19 ea 20 69 6e 70 75 74  |evars..... input|
00003090  2c 20 6f 75 74 70 75 74  2c 20 6c 6f 6f 70 0d 16  |, output, loop..|
000030a0  8a 19 de 20 69 6e 70 75  74 20 32 34 2c 20 6f 75  |... input 24, ou|
000030b0  74 70 75 74 20 32 34 0d  16 94 36 21 69 6e 70 75  |tput 24...6!inpu|
000030c0  74 3d 31 33 30 3a 20 f4  20 52 69 67 68 74 2d 68  |t=130: . Right-h|
000030d0  61 6e 64 20 63 6f 6c 75  6d 6e 20 6f 66 20 67 72  |and column of gr|
000030e0  61 70 68 69 63 73 20 77  69 6e 64 6f 77 0d 16 9e  |aphics window...|
000030f0  2e 69 6e 70 75 74 21 34  3d 31 33 31 20 3a 20 f4  |.input!4=131 : .|
00003100  20 54 6f 70 20 72 6f 77  20 6f 66 20 67 72 61 70  | Top row of grap|
00003110  68 69 63 73 20 77 69 6e  64 6f 77 0d 16 a8 3d 69  |hics window...=i|
00003120  6e 70 75 74 21 38 3d 34  20 3a 20 f4 20 58 45 69  |nput!8=4 : . XEi|
00003130  67 46 61 63 74 6f 72 2c  20 73 68 69 66 74 20 70  |gFactor, shift p|
00003140  69 78 65 6c 73 20 74 6f  20 6f 62 74 61 69 6e 20  |ixels to obtain |
00003150  4f 53 20 75 6e 69 74 73  0d 16 b2 1d 69 6e 70 75  |OS units....inpu|
00003160  74 21 31 32 3d 35 20 3a  20 f4 20 59 45 69 67 46  |t!12=5 : . YEigF|
00003170  61 63 74 6f 72 0d 16 bc  1a 69 6e 70 75 74 21 31  |actor....input!1|
00003180  36 3d 39 20 3a 20 f4 20  4c 6f 67 32 42 50 50 0d  |6=9 : . Log2BPP.|
00003190  16 c6 0f 69 6e 70 75 74  21 32 30 3d 2d 31 0d 16  |...input!20=-1..|
000031a0  d0 26 ef 20 32 36 20 3a  20 f4 20 52 65 73 65 74  |.&. 26 : . Reset|
000031b0  20 77 69 6e 64 6f 77 20  6a 75 73 74 20 69 6e 20  | window just in |
000031c0  63 61 73 65 0d 16 da 2b  c8 99 20 22 4f 53 5f 52  |case...+.. "OS_R|
000031d0  65 61 64 56 64 75 56 61  72 69 61 62 6c 65 73 22  |eadVduVariables"|
000031e0  2c 20 69 6e 70 75 74 2c  20 6f 75 74 70 75 74 0d  |, input, output.|
000031f0  16 e4 17 58 45 69 67 46  61 63 74 6f 72 3d 6f 75  |...XEigFactor=ou|
00003200  74 70 75 74 21 38 0d 16  ee 18 59 45 69 67 46 61  |tput!8....YEigFa|
00003210  63 74 6f 72 3d 6f 75 74  70 75 74 21 31 32 0d 16  |ctor=output!12..|
00003220  f8 18 42 50 50 3d 28 31  3c 3c 6f 75 74 70 75 74  |..BPP=(1<<output|
00003230  21 31 36 29 2f 38 0d 17  02 21 4d 61 78 58 43 6f  |!16)/8...!MaxXCo|
00003240  6f 72 64 3d 21 6f 75 74  70 75 74 3c 3c 58 45 69  |ord=!output<<XEi|
00003250  67 46 61 63 74 6f 72 0d  17 0c 22 4d 61 78 59 43  |gFactor..."MaxYC|
00003260  6f 6f 72 64 3d 6f 75 74  70 75 74 21 34 3c 3c 59  |oord=output!4<<Y|
00003270  45 69 67 46 61 63 74 6f  72 0d 17 16 14 e7 20 59  |EigFactor..... Y|
00003280  45 69 67 46 61 63 74 6f  72 3d 31 20 8c 0d 17 20  |EigFactor=1 ... |
00003290  21 20 20 20 62 61 72 73  70 72 69 74 65 3d 73 70  |!   barsprite=sp|
000032a0  72 69 74 65 5f 6d 75 6c  74 69 73 79 6e 63 0d 17  |rite_multisync..|
000032b0  2a 1c 20 20 20 24 73 70  72 69 74 65 70 74 72 3d  |*.   $spriteptr=|
000032c0  22 62 61 72 70 69 65 32  32 22 0d 17 34 05 cc 0d  |"barpie22"..4...|
000032d0  17 3e 20 20 20 20 62 61  72 73 70 72 69 74 65 3d  |.>    barsprite=|
000032e0  73 70 72 69 74 65 5f 73  74 61 6e 64 61 72 64 0d  |sprite_standard.|
000032f0  17 48 1a 20 20 20 24 73  70 72 69 74 65 70 74 72  |.H.   $spriteptr|
00003300  3d 22 62 61 72 70 69 65  22 0d 17 52 05 cd 0d 17  |="barpie"..R....|
00003310  5c 22 c8 99 20 22 57 69  6d 70 5f 52 65 61 64 50  |\".. "Wimp_ReadP|
00003320  61 6c 65 74 74 65 22 2c  2c 70 61 6c 65 74 74 65  |alette",,palette|
00003330  0d 17 66 11 e3 20 6c 6f  6f 70 3d 30 20 b8 20 31  |..f.. loop=0 . 1|
00003340  35 0d 17 67 6d 20 20 20  62 61 72 73 70 72 69 74  |5..gm   barsprit|
00003350  65 21 28 6c 6f 6f 70 2a  38 2b 34 34 29 3d 28 70  |e!(loop*8+44)=(p|
00003360  61 6c 65 74 74 65 21 28  6c 6f 6f 70 2a 34 29 20  |alette!(loop*4) |
00003370  80 20 26 46 46 46 46 46  46 30 30 29 2b 28 28 28  |. &FFFFFF00)+(((|
00003380  70 61 6c 65 74 74 65 21  28 6c 6f 6f 70 2a 34 29  |palette!(loop*4)|
00003390  20 80 20 26 46 30 46 30  46 30 30 30 29 3e 3e 34  | . &F0F0F000)>>4|
000033a0  29 20 80 20 26 30 46 46  46 46 46 46 46 29 0d 17  |) . &0FFFFFFF)..|
000033b0  68 32 20 20 20 62 61 72  73 70 72 69 74 65 21 28  |h2   barsprite!(|
000033c0  6c 6f 6f 70 2a 38 2b 34  38 29 3d 62 61 72 73 70  |loop*8+48)=barsp|
000033d0  72 69 74 65 21 28 6c 6f  6f 70 2a 38 2b 34 34 29  |rite!(loop*8+44)|
000033e0  0d 17 70 05 ed 0d 17 84  05 e1 0d 17 8e 04 0d 17  |..p.............|
000033f0  98 11 dd f2 73 61 76 65  64 65 73 6b 74 6f 70 0d  |....savedesktop.|
00003400  17 a2 0c ea 20 68 61 6e  64 6c 65 0d 17 ac 14 68  |.... handle....h|
00003410  61 6e 64 6c 65 3d 62 6c  6f 63 6b 25 21 32 30 0d  |andle=block%!20.|
00003420  17 b6 1d d5 23 68 61 6e  64 6c 65 2c 20 53 74 61  |....#handle, Sta|
00003430  72 74 4d 65 6d 6f 72 79  50 69 65 24 0d 17 c0 05  |rtMemoryPie$....|
00003440  e1 0d 17 ca 04 0d 17 d4  13 dd a4 72 65 61 64 76  |...........readv|
00003450  61 72 28 76 61 72 24 29  0d 17 de 0d ea 20 6e 75  |ar(var$)..... nu|
00003460  6d 72 65 61 64 0d 17 e8  3c c8 99 20 22 58 4f 53  |mread...<.. "XOS|
00003470  5f 52 65 61 64 56 61 72  56 61 6c 22 2c 20 76 61  |_ReadVarVal", va|
00003480  72 24 2c 20 62 6c 6f 63  6b 25 2c 20 32 35 35 2c  |r$, block%, 255,|
00003490  20 30 2c 20 33 20 b8 20  2c 2c 6e 75 6d 72 65 61  | 0, 3 . ,,numrea|
000034a0  64 0d 17 f2 15 62 6c 6f  63 6b 25 3f 6e 75 6d 72  |d....block%?numr|
000034b0  65 61 64 3d 31 33 0d 17  fc 0c 3d 24 62 6c 6f 63  |ead=13....=$bloc|
000034c0  6b 25 0d 18 06 04 0d 18  10 18 dd f2 73 65 74 76  |k%..........setv|
000034d0  61 72 28 76 61 72 24 2c  20 76 61 6c 24 29 0d 18  |ar(var$, val$)..|
000034e0  1a 31 c8 99 20 22 58 4f  53 5f 53 65 74 56 61 72  |.1.. "XOS_SetVar|
000034f0  56 61 6c 22 2c 20 76 61  72 24 2c 20 76 61 6c 24  |Val", var$, val$|
00003500  2c 20 a9 28 76 61 6c 24  29 2c 20 30 2c 20 30 0d  |, .(val$), 0, 0.|
00003510  18 24 05 e1 0d 18 2e 0d  f4 20 57 69 6e 64 6f 77  |.$....... Window|
00003520  73 0d 18 38 04 0d 18 42  1a dd f2 6c 6f 61 64 74  |s..8...B...loadt|
00003530  65 6d 70 6c 61 74 65 73  28 66 69 6c 65 24 29 0d  |emplates(file$).|
00003540  18 4c 37 ea 20 6c 6f 6f  70 2c 20 77 69 6e 70 6f  |.L7. loop, winpo|
00003550  73 2c 20 77 69 6e 2c 20  69 6e 64 2c 20 73 6c 6f  |s, win, ind, slo|
00003560  74 73 69 7a 65 2c 20 74  65 6d 70 6c 61 74 65 73  |tsize, templates|
00003570  2c 20 66 72 65 65 0d 18  56 21 c8 99 20 22 57 69  |, free..V!.. "Wi|
00003580  6d 70 5f 4f 70 65 6e 54  65 6d 70 6c 61 74 65 22  |mp_OpenTemplate"|
00003590  2c 2c 66 69 6c 65 24 0d  18 60 20 77 69 6e 5f 69  |,,file$..` win_i|
000035a0  6e 66 6f 3d a4 6c 6f 61  64 77 69 6e 64 6f 77 28  |nfo=.loadwindow(|
000035b0  22 49 6e 66 6f 22 29 0d  18 6a 1e 77 69 6e 5f 6b  |"Info")..j.win_k|
000035c0  65 79 3d a4 6c 6f 61 64  77 69 6e 64 6f 77 28 22  |ey=.loadwindow("|
000035d0  4b 65 79 22 29 0d 18 74  22 77 69 6e 5f 6c 61 72  |Key")..t"win_lar|
000035e0  67 65 3d a4 6c 6f 61 64  77 69 6e 64 6f 77 28 22  |ge=.loadwindow("|
000035f0  4c 61 72 67 65 22 29 0d  18 7e 1b c8 99 20 22 57  |Large")..~... "W|
00003600  69 6d 70 5f 43 6c 6f 73  65 54 65 6d 70 6c 61 74  |imp_CloseTemplat|
00003610  65 22 0d 18 88 10 f2 64  69 73 63 61 72 64 68 65  |e".....discardhe|
00003620  61 70 0d 18 92 05 e1 0d  18 9c 04 0d 18 a6 16 dd  |ap..............|
00003630  a4 6c 6f 61 64 77 69 6e  64 6f 77 28 77 69 6e 24  |.loadwindow(win$|
00003640  29 0d 18 b0 28 ea 20 77  69 6e 2c 20 62 75 66 73  |)...(. win, bufs|
00003650  69 7a 65 2c 20 69 6e 64  73 69 7a 65 2c 20 62 75  |ize, indsize, bu|
00003660  66 66 65 72 2c 20 69 6e  64 0d 18 ba 3e c8 99 20  |ffer, ind...>.. |
00003670  22 57 69 6d 70 5f 4c 6f  61 64 54 65 6d 70 6c 61  |"Wimp_LoadTempla|
00003680  74 65 22 2c 2c 2d 31 2c  2c 2c 2c 20 77 69 6e 24  |te",,-1,,,, win$|
00003690  2c 20 30 20 b8 20 2c 62  75 66 73 69 7a 65 2c 20  |, 0 . ,bufsize, |
000036a0  69 6e 64 73 69 7a 65 0d  18 c4 19 62 75 66 66 65  |indsize....buffe|
000036b0  72 3d a4 68 65 61 70 28  62 75 66 73 69 7a 65 29  |r=.heap(bufsize)|
000036c0  0d 18 ce 11 de 20 69 6e  64 20 69 6e 64 73 69 7a  |..... ind indsiz|
000036d0  65 0d 18 d8 41 c8 99 20  22 57 69 6d 70 5f 4c 6f  |e...A.. "Wimp_Lo|
000036e0  61 64 54 65 6d 70 6c 61  74 65 22 2c 2c 62 75 66  |adTemplate",,buf|
000036f0  66 65 72 2c 20 69 6e 64  2c 20 69 6e 64 2b 69 6e  |fer, ind, ind+in|
00003700  64 73 69 7a 65 2c 20 2d  31 2c 20 77 69 6e 24 2c  |dsize, -1, win$,|
00003710  20 30 0d 18 e2 28 c8 99  20 22 57 69 6d 70 5f 43  | 0...(.. "Wimp_C|
00003720  72 65 61 74 65 57 69 6e  64 6f 77 22 2c 2c 62 75  |reateWindow",,bu|
00003730  66 66 65 72 20 b8 20 77  69 6e 0d 18 ec 15 f2 66  |ffer . win.....f|
00003740  72 65 65 68 65 61 70 28  62 75 66 66 65 72 29 0d  |reeheap(buffer).|
00003750  18 f6 08 3d 77 69 6e 0d  19 00 04 0d 19 0a 20 dd  |...=win....... .|
00003760  f2 6f 70 65 6e 77 69 6e  64 6f 77 63 65 6e 74 72  |.openwindowcentr|
00003770  65 64 28 77 69 6e 64 6f  77 25 29 0d 19 14 13 ea  |ed(window%).....|
00003780  20 77 69 64 74 68 2c 20  68 65 69 67 68 74 0d 19  | width, height..|
00003790  1e 13 21 62 6c 6f 63 6b  25 3d 77 69 6e 64 6f 77  |..!block%=window|
000037a0  25 0d 19 28 24 c8 99 20  22 57 69 6d 70 5f 47 65  |%..($.. "Wimp_Ge|
000037b0  74 57 69 6e 64 6f 77 53  74 61 74 65 22 2c 2c 62  |tWindowState",,b|
000037c0  6c 6f 63 6b 25 0d 19 32  1c 77 69 64 74 68 3d 62  |lock%..2.width=b|
000037d0  6c 6f 63 6b 25 21 31 32  2d 62 6c 6f 63 6b 25 21  |lock%!12-block%!|
000037e0  34 0d 19 3c 1d 68 65 69  67 68 74 3d 62 6c 6f 63  |4..<.height=bloc|
000037f0  6b 25 21 31 36 2d 62 6c  6f 63 6b 25 21 38 0d 19  |k%!16-block%!8..|
00003800  46 20 62 6c 6f 63 6b 25  21 34 3d 28 4d 61 78 58  |F block%!4=(MaxX|
00003810  43 6f 6f 72 64 2d 77 69  64 74 68 29 2f 32 0d 19  |Coord-width)/2..|
00003820  50 21 62 6c 6f 63 6b 25  21 38 3d 28 4d 61 78 59  |P!block%!8=(MaxY|
00003830  43 6f 6f 72 64 2d 68 65  69 67 68 74 29 2f 32 0d  |Coord-height)/2.|
00003840  19 5a 1c 62 6c 6f 63 6b  25 21 31 32 3d 62 6c 6f  |.Z.block%!12=blo|
00003850  63 6b 25 21 34 2b 77 69  64 74 68 0d 19 64 1d 62  |ck%!4+width..d.b|
00003860  6c 6f 63 6b 25 21 31 36  3d 62 6c 6f 63 6b 25 21  |lock%!16=block%!|
00003870  38 2b 68 65 69 67 68 74  0d 19 6e 10 62 6c 6f 63  |8+height..n.bloc|
00003880  6b 25 21 32 38 3d 2d 31  0d 19 78 09 f2 6f 70 65  |k%!28=-1..x..ope|
00003890  6e 0d 19 82 05 e1 0d 19  8c 04 0d 19 96 0a dd f2  |n...............|
000038a0  6f 70 65 6e 0d 19 a0 12  ea 20 68 65 69 67 68 74  |open..... height|
000038b0  2c 77 69 64 74 68 0d 19  aa 19 e7 20 21 62 6c 6f  |,width..... !blo|
000038c0  63 6b 25 3d 77 69 6e 5f  6c 61 72 67 65 20 8c 0d  |ck%=win_large ..|
000038d0  19 b4 16 20 20 20 77 69  6e 6f 70 65 6e 5f 6c 61  |...   winopen_la|
000038e0  72 67 65 3d b9 0d 19 be  20 20 20 20 68 65 69 67  |rge=....    heig|
000038f0  68 74 3d 62 6c 6f 63 6b  25 21 31 36 2d 62 6c 6f  |ht=block%!16-blo|
00003900  63 6b 25 21 38 0d 19 c8  1f 20 20 20 77 69 64 74  |ck%!8....   widt|
00003910  68 3d 62 6c 6f 63 6b 25  21 31 32 2d 62 6c 6f 63  |h=block%!12-bloc|
00003920  6b 25 21 34 0d 19 d2 30  20 20 20 e7 20 28 68 65  |k%!4...0   . (he|
00003930  69 67 68 74 3c 3e 77 69  6e 68 65 69 67 68 74 20  |ight<>winheight |
00003940  84 20 77 69 64 74 68 3c  3e 77 69 6e 77 69 64 74  |. width<>winwidt|
00003950  68 29 20 8c 0d 19 dc 26  20 20 20 20 20 20 72 61  |h) ....&      ra|
00003960  64 69 75 73 3d a8 28 77  69 64 74 68 2f 32 29 2d  |dius=.(width/2)-|
00003970  58 45 69 67 46 61 63 74  6f 72 0d 19 e6 40 20 20  |XEigFactor...@  |
00003980  20 20 20 20 c8 99 20 22  57 69 6d 70 5f 46 6f 72  |    .. "Wimp_For|
00003990  63 65 52 65 64 72 61 77  22 2c 20 77 69 6e 5f 6c  |ceRedraw", win_l|
000039a0  61 72 67 65 2c 20 30 2c  20 2d 68 65 69 67 68 74  |arge, 0, -height|
000039b0  2c 20 77 69 64 74 68 2c  20 30 0d 19 f0 1a 20 20  |, width, 0....  |
000039c0  20 20 20 20 77 69 6e 68  65 69 67 68 74 3d 68 65  |    winheight=he|
000039d0  69 67 68 74 0d 19 fa 18  20 20 20 20 20 20 77 69  |ight....      wi|
000039e0  6e 77 69 64 74 68 3d 77  69 64 74 68 0d 1a 04 08  |nwidth=width....|
000039f0  20 20 20 cd 0d 1a 0e 05  cd 0d 1a 18 20 c8 99 20  |   ......... .. |
00003a00  22 57 69 6d 70 5f 4f 70  65 6e 57 69 6e 64 6f 77  |"Wimp_OpenWindow|
00003a10  22 2c 2c 62 6c 6f 63 6b  25 0d 1a 22 05 e1 0d 1a  |",,block%.."....|
00003a20  2c 04 0d 1a 36 1a dd f2  63 6c 6f 73 65 77 69 6e  |,...6...closewin|
00003a30  64 6f 77 28 77 69 6e 64  6f 77 25 29 0d 1a 40 13  |dow(window%)..@.|
00003a40  21 62 6c 6f 63 6b 25 3d  77 69 6e 64 6f 77 25 0d  |!block%=window%.|
00003a50  1a 4a 2d e7 20 77 69 6e  64 6f 77 25 3d 77 69 6e  |.J-. window%=win|
00003a60  5f 63 68 6f 69 63 65 73  20 8c 20 77 69 6e 6f 70  |_choices . winop|
00003a70  65 6e 5f 63 68 6f 69 63  65 73 3d a3 0d 1a 54 0a  |en_choices=...T.|
00003a80  f2 63 6c 6f 73 65 0d 1a  5e 05 e1 0d 1a 68 04 0d  |.close..^....h..|
00003a90  1a 72 0b dd f2 63 6c 6f  73 65 0d 1a 7c 12 ea 20  |.r...close..|.. |
00003aa0  62 75 66 66 65 72 2c 20  6c 6f 6f 70 0d 1a 86 29  |buffer, loop...)|
00003ab0  e7 20 21 62 6c 6f 63 6b  25 3d 77 69 6e 5f 6c 61  |. !block%=win_la|
00003ac0  72 67 65 20 8c 20 77 69  6e 6f 70 65 6e 5f 6c 61  |rge . winopen_la|
00003ad0  72 67 65 3d a3 0d 1a 90  21 c8 99 20 22 57 69 6d  |rge=....!.. "Wim|
00003ae0  70 5f 43 6c 6f 73 65 57  69 6e 64 6f 77 22 2c 2c  |p_CloseWindow",,|
00003af0  62 6c 6f 63 6b 25 0d 1a  9a 05 e1 0d 1a a4 04 0d  |block%..........|
00003b00  1a ae 1a dd f2 66 6f 72  63 65 72 65 64 72 61 77  |.....forceredraw|
00003b10  28 77 69 6e 64 6f 77 25  29 0d 1a b8 13 21 62 6c  |(window%)....!bl|
00003b20  6f 63 6b 25 3d 77 69 6e  64 6f 77 25 0d 1a c2 25  |ock%=window%...%|
00003b30  c8 99 20 22 58 57 69 6d  70 5f 47 65 74 57 69 6e  |.. "XWimp_GetWin|
00003b40  64 6f 77 53 74 61 74 65  22 2c 2c 62 6c 6f 63 6b  |dowState",,block|
00003b50  25 0d 1a cc 48 c8 99 20  22 58 57 69 6d 70 5f 46  |%...H.. "XWimp_F|
00003b60  6f 72 63 65 52 65 64 72  61 77 22 2c 20 2d 31 2c  |orceRedraw", -1,|
00003b70  20 62 6c 6f 63 6b 25 21  34 2c 20 62 6c 6f 63 6b  | block%!4, block|
00003b80  25 21 38 2c 20 62 6c 6f  63 6b 25 21 31 32 2c 20  |%!8, block%!12, |
00003b90  62 6c 6f 63 6b 25 21 31  36 0d 1a d6 05 e1 0d 1a  |block%!16.......|
00003ba0  e0 04 0d 1a ea 0f dd a4  61 72 65 61 28 6e 75 6d  |........area(num|
00003bb0  29 0d 1a f4 0a ea 20 73  69 7a 65 0d 1a fe 29 c8  |)..... size...).|
00003bc0  99 20 22 58 4f 53 5f 52  65 61 64 44 79 6e 61 6d  |. "XOS_ReadDynam|
00003bd0  69 63 41 72 65 61 22 2c  20 6e 75 6d 20 b8 20 2c  |icArea", num . ,|
00003be0  73 69 7a 65 0d 1b 08 2c  3d 28 28 73 69 7a 65 2b  |size...,=((size+|
00003bf0  70 61 67 65 73 69 7a 65  2d 31 29 20 81 20 70 61  |pagesize-1) . pa|
00003c00  67 65 73 69 7a 65 29 2a  70 61 67 65 73 69 7a 65  |gesize)*pagesize|
00003c10  0d 1b 12 04 0d 1b 1c 0c  dd a4 4b 28 76 61 6c 29  |..........K(val)|
00003c20  0d 1b 26 12 3d c3 28 76  61 6c 20 81 20 31 30 32  |..&.=.(val . 102|
00003c30  34 29 0d 1b 30 04 0d 1b  3a 0e dd f2 63 68 65 63  |4)..0...:...chec|
00003c40  6b 6d 65 6d 0d 1b 44 0f  ea 20 6c 6f 6f 70 2c 20  |kmem..D.. loop, |
00003c50  73 75 6d 0d 1b 4e 04 0d  1b 58 09 73 75 6d 3d 30  |sum..N...X.sum=0|
00003c60  0d 1b 62 19 e3 20 6c 6f  6f 70 3d 5f 73 79 73 74  |..b.. loop=_syst|
00003c70  65 6d 20 b8 20 5f 72 61  6d 0d 1b 6c 1f 20 20 20  |em . _ram..l.   |
00003c80  6d 65 6d 6f 72 79 28 6c  6f 6f 70 29 3d a4 61 72  |memory(loop)=.ar|
00003c90  65 61 28 6c 6f 6f 70 29  0d 1b 76 18 20 20 20 73  |ea(loop)..v.   s|
00003ca0  75 6d 2b 3d 6d 65 6d 6f  72 79 28 6c 6f 6f 70 29  |um+=memory(loop)|
00003cb0  0d 1b 80 05 ed 0d 1b 8a  30 c8 99 20 22 57 69 6d  |........0.. "Wim|
00003cc0  70 5f 53 6c 6f 74 53 69  7a 65 22 2c 20 2d 31 2c  |p_SlotSize", -1,|
00003cd0  20 2d 31 20 b8 20 2c 2c  6d 65 6d 6f 72 79 28 5f  | -1 . ,,memory(_|
00003ce0  66 72 65 65 29 0d 1b 94  16 73 75 6d 2b 3d 6d 65  |free)....sum+=me|
00003cf0  6d 6f 72 79 28 5f 66 72  65 65 29 0d 1b 9e 1d 6d  |mory(_free)....m|
00003d00  65 6d 6f 72 79 28 5f 61  70 70 73 29 3d 4d 65 6d  |emory(_apps)=Mem|
00003d10  53 69 7a 65 2d 73 75 6d  0d 1b a8 1a e3 20 6c 6f  |Size-sum..... lo|
00003d20  6f 70 3d 5f 73 79 73 74  65 6d 20 b8 20 5f 66 72  |op=_system . _fr|
00003d30  65 65 0d 1b b2 31 20 20  20 e7 20 6d 65 6d 6f 72  |ee...1   . memor|
00003d40  79 28 6c 6f 6f 70 29 3c  3e 6f 6c 64 6d 65 6d 6f  |y(loop)<>oldmemo|
00003d50  72 79 28 6c 6f 6f 70 29  20 8c 20 55 70 64 61 74  |ry(loop) . Updat|
00003d60  65 3d b9 0d 1b bc 05 ed  0d 1b c6 04 0d 1b d0 0e  |e=..............|
00003d70  e7 20 55 70 64 61 74 65  20 8c 0d 1b da 20 20 20  |. Update ....   |
00003d80  20 f2 70 6c 6f 74 70 69  65 73 70 72 69 74 65 28  | .plotpiesprite(|
00003d90  62 61 72 73 70 72 69 74  65 29 0d 1b e4 28 20 20  |barsprite)...(  |
00003da0  20 f2 73 65 74 69 63 6f  6e 73 74 61 74 65 28 2d  | .seticonstate(-|
00003db0  32 2c 20 62 61 72 69 63  6f 6e 25 2c 20 30 2c 20  |2, baricon%, 0, |
00003dc0  30 29 0d 1b ee 17 20 20  20 f2 72 65 64 72 61 77  |0)....   .redraw|
00003dd0  28 5f 75 70 64 61 74 65  29 0d 1b f8 1b 20 20 20  |(_update)....   |
00003de0  6f 6c 64 6d 65 6d 6f 72  79 28 29 3d 6d 65 6d 6f  |oldmemory()=memo|
00003df0  72 79 28 29 0d 1c 02 0f  20 20 20 55 70 64 61 74  |ry()....   Updat|
00003e00  65 3d a3 0d 1c 0c 05 cd  0d 1c 16 05 e1 0d 1c 20  |e=............. |
00003e10  04 0d 1c 2a 1e dd f2 70  6c 6f 74 70 69 65 73 70  |...*...plotpiesp|
00003e20  72 69 74 65 28 70 69 65  73 70 72 69 74 65 29 0d  |rite(piesprite).|
00003e30  1c 34 4a ea 20 78 70 6f  73 2c 20 79 70 6f 73 2c  |.4J. xpos, ypos,|
00003e40  20 77 69 64 74 68 2c 20  68 65 69 67 68 74 2c 20  | width, height, |
00003e50  72 61 64 69 75 73 2c 20  72 65 61 6c 77 69 64 74  |radius, realwidt|
00003e60  68 2c 20 72 65 61 6c 68  65 69 67 68 74 2c 20 72  |h, realheight, r|
00003e70  65 61 6c 72 61 64 69 75  73 0d 1c 3e 18 ea 20 72  |ealradius..>.. r|
00003e80  30 2c 72 31 2c 72 32 2c  72 33 2c 20 61 6e 67 6c  |0,r1,r2,r3, angl|
00003e90  65 0d 1c 48 43 c8 99 20  22 58 4f 53 5f 53 70 72  |e..HC.. "XOS_Spr|
00003ea0  69 74 65 4f 70 22 2c 20  35 31 32 2b 34 30 2c 20  |iteOp", 512+40, |
00003eb0  73 70 72 69 74 65 25 2c  20 70 69 65 73 70 72 69  |sprite%, piespri|
00003ec0  74 65 20 b8 20 2c 2c 2c  77 69 64 74 68 2c 68 65  |te . ,,,width,he|
00003ed0  69 67 68 74 0d 1c 52 1f  72 65 61 6c 77 69 64 74  |ight..R.realwidt|
00003ee0  68 3d 77 69 64 74 68 3c  3c 58 45 69 67 46 61 63  |h=width<<XEigFac|
00003ef0  74 6f 72 0d 1c 5c 21 72  65 61 6c 68 65 69 67 68  |tor..\!realheigh|
00003f00  74 3d 68 65 69 67 68 74  3c 3c 59 45 69 67 46 61  |t=height<<YEigFa|
00003f10  63 74 6f 72 0d 1c 66 14  78 70 6f 73 3d 72 65 61  |ctor..f.xpos=rea|
00003f20  6c 77 69 64 74 68 2f 32  0d 1c 70 15 79 70 6f 73  |lwidth/2..p.ypos|
00003f30  3d 72 65 61 6c 68 65 69  67 68 74 2f 32 0d 1c 7a  |=realheight/2..z|
00003f40  1f 77 69 64 74 68 3d 28  77 69 64 74 68 2d 32 29  |.width=(width-2)|
00003f50  3c 3c 58 45 69 67 46 61  63 74 6f 72 0d 1c 84 21  |<<XEigFactor...!|
00003f60  68 65 69 67 68 74 3d 28  68 65 69 67 68 74 2d 32  |height=(height-2|
00003f70  29 3c 3c 59 45 69 67 46  61 63 74 6f 72 0d 1c 8e  |)<<YEigFactor...|
00003f80  2f 72 61 64 69 75 73 3d  a8 28 72 65 61 6c 77 69  |/radius=.(realwi|
00003f90  64 74 68 2b 72 65 61 6c  68 65 69 67 68 74 29 2f  |dth+realheight)/|
00003fa0  34 2d 58 45 69 67 46 61  63 74 6f 72 0d 1c 98 0f  |4-XEigFactor....|
00003fb0  21 73 61 76 65 61 72 65  61 3d 30 0d 1c a2 48 c8  |!savearea=0...H.|
00003fc0  99 20 22 4f 53 5f 53 70  72 69 74 65 4f 70 22 2c  |. "OS_SpriteOp",|
00003fd0  20 35 31 32 2b 36 30 2c  20 73 70 72 69 74 65 25  | 512+60, sprite%|
00003fe0  2c 20 70 69 65 73 70 72  69 74 65 2c 20 73 61 76  |, piesprite, sav|
00003ff0  65 61 72 65 61 20 b8 20  72 30 2c 72 31 2c 72 32  |earea . r0,r1,r2|
00004000  2c 72 33 0d 1c ac 11 c8  91 20 78 70 6f 73 2c 20  |,r3...... xpos, |
00004010  79 70 6f 73 0d 1c b6 0b  61 6e 67 6c 65 3d 30 0d  |ypos....angle=0.|
00004020  1c c0 16 f2 73 65 63 74  6f 72 28 31 31 2c 20 5f  |....sector(11, _|
00004030  66 72 65 65 29 0d 1c ca  16 f2 73 65 63 74 6f 72  |free).....sector|
00004040  28 31 34 2c 20 5f 61 70  70 73 29 0d 1c d4 17 f2  |(14, _apps).....|
00004050  73 65 63 74 6f 72 28 39  2c 20 5f 73 63 72 65 65  |sector(9, _scree|
00004060  6e 29 0d 1c de 18 f2 73  65 63 74 6f 72 28 31 30  |n).....sector(10|
00004070  2c 20 5f 73 79 73 74 65  6d 29 0d 1c e8 15 f2 73  |, _system).....s|
00004080  65 63 74 6f 72 28 31 33  2c 20 5f 72 6d 61 29 0d  |ector(13, _rma).|
00004090  1c f2 17 f2 73 65 63 74  6f 72 28 31 35 2c 20 5f  |....sector(15, _|
000040a0  66 6f 6e 74 73 29 0d 1c  fc 17 f2 73 65 63 74 6f  |fonts).....secto|
000040b0  72 28 38 2c 20 5f 73 70  72 69 74 65 29 0d 1d 06  |r(8, _sprite)...|
000040c0  14 f2 73 65 63 74 6f 72  28 30 2c 20 5f 72 61 6d  |..sector(0, _ram|
000040d0  29 0d 1d 10 1a c8 99 20  22 57 69 6d 70 5f 53 65  |)...... "Wimp_Se|
000040e0  74 43 6f 6c 6f 75 72 22  2c 20 37 0d 1d 1a 13 c8  |tColour", 7.....|
000040f0  8f 20 30 2c 20 30 2c 20  72 61 64 69 75 73 0d 1d  |. 0, 0, radius..|
00004100  24 21 c8 99 20 22 4f 53  5f 53 70 72 69 74 65 4f  |$!.. "OS_SpriteO|
00004110  70 22 2c 20 72 30 2c 72  31 2c 72 32 2c 72 33 0d  |p", r0,r1,r2,r3.|
00004120  1d 2e 05 e1 0d 1d 38 04  0d 1d 42 1a dd f2 73 65  |......8...B...se|
00004130  63 74 6f 72 28 63 6f 6c  6f 75 72 2c 20 73 69 7a  |ctor(colour, siz|
00004140  65 29 0d 1d 4c 16 e7 20  6d 65 6d 6f 72 79 28 73  |e)..L.. memory(s|
00004150  69 7a 65 29 3d 30 20 e1  0d 1d 56 1f c8 99 20 22  |ize)=0 ...V... "|
00004160  57 69 6d 70 5f 53 65 74  43 6f 6c 6f 75 72 22 2c  |Wimp_SetColour",|
00004170  20 63 6f 6c 6f 75 72 0d  1d 60 09 ec 20 30 2c 30  | colour..`.. 0,0|
00004180  0d 1d 6a 26 ec 20 b5 28  61 6e 67 6c 65 29 2a 72  |..j&. .(angle)*r|
00004190  61 64 69 75 73 2c 20 9b  28 61 6e 67 6c 65 29 2a  |adius, .(angle)*|
000041a0  72 61 64 69 75 73 0d 1d  74 20 61 6e 67 6c 65 2d  |radius..t angle-|
000041b0  3d 6d 65 6d 6f 72 79 28  73 69 7a 65 29 2a 61 6e  |=memory(size)*an|
000041c0  67 63 6f 6e 73 74 0d 1d  7e 2b f0 20 26 42 35 2c  |gconst..~+. &B5,|
000041d0  20 b5 28 61 6e 67 6c 65  29 2a 72 61 64 69 75 73  | .(angle)*radius|
000041e0  2c 20 9b 28 61 6e 67 6c  65 29 2a 72 61 64 69 75  |, .(angle)*radiu|
000041f0  73 0d 1d 88 05 e1 0d 1d  92 04 0d 1e 14 12 dd f2  |s...............|
00004200  72 65 64 72 61 77 28 63  6f 64 65 29 0d 1e 1e 11  |redraw(code)....|
00004210  ea 20 6d 6f 72 65 2c 20  61 6e 67 6c 65 0d 1e 28  |. more, angle..(|
00004220  0d c8 8e 20 63 6f 64 65  20 ca 0d 1e 32 10 20 20  |... code ...2.  |
00004230  20 c9 20 5f 72 65 64 72  61 77 0d 1e 3c 2f 20 20  | . _redraw..</  |
00004240  20 20 20 20 c8 99 20 22  57 69 6d 70 5f 52 65 64  |    .. "Wimp_Red|
00004250  72 61 77 57 69 6e 64 6f  77 22 2c 2c 62 6c 6f 63  |rawWindow",,bloc|
00004260  6b 25 20 b8 20 6d 6f 72  65 0d 1e 46 10 20 20 20  |k% . more..F.   |
00004270  c9 20 5f 75 70 64 61 74  65 0d 1e 50 1b 20 20 20  |. _update..P.   |
00004280  20 20 20 21 62 6c 6f 63  6b 25 3d 77 69 6e 5f 6c  |   !block%=win_l|
00004290  61 72 67 65 0d 1e 5a 14  20 20 20 20 20 20 62 6c  |arge..Z.      bl|
000042a0  6f 63 6b 25 21 34 3d 30  0d 1e 64 1d 20 20 20 20  |ock%!4=0..d.    |
000042b0  20 20 62 6c 6f 63 6b 25  21 38 3d 2d 77 69 6e 68  |  block%!8=-winh|
000042c0  65 69 67 68 74 0d 1e 6e  1c 20 20 20 20 20 20 62  |eight..n.      b|
000042d0  6c 6f 63 6b 25 21 31 32  3d 77 69 6e 77 69 64 74  |lock%!12=winwidt|
000042e0  68 0d 1e 78 15 20 20 20  20 20 20 62 6c 6f 63 6b  |h..x.      block|
000042f0  25 21 31 36 3d 30 0d 1e  82 2f 20 20 20 20 20 20  |%!16=0.../      |
00004300  c8 99 20 22 57 69 6d 70  5f 55 70 64 61 74 65 57  |.. "Wimp_UpdateW|
00004310  69 6e 64 6f 77 22 2c 2c  62 6c 6f 63 6b 25 20 b8  |indow",,block% .|
00004320  20 6d 6f 72 65 0d 1e 8c  05 cb 0d 1e 96 1f 78 70  | more.........xp|
00004330  6f 73 3d 28 62 6c 6f 63  6b 25 21 34 2b 62 6c 6f  |os=(block%!4+blo|
00004340  63 6b 25 21 31 32 29 2f  32 0d 1e a0 1f 79 70 6f  |ck%!12)/2....ypo|
00004350  73 3d 28 62 6c 6f 63 6b  25 21 38 2b 62 6c 6f 63  |s=(block%!8+bloc|
00004360  6b 25 21 31 36 29 2f 32  0d 1e aa 0b c8 95 20 6d  |k%!16)/2...... m|
00004370  6f 72 65 0d 1e b4 14 20  20 20 c8 91 20 78 70 6f  |ore....   .. xpo|
00004380  73 2c 20 79 70 6f 73 0d  1e be 0e 20 20 20 61 6e  |s, ypos....   an|
00004390  67 6c 65 3d 30 0d 1e c8  19 20 20 20 f2 73 65 63  |gle=0....   .sec|
000043a0  74 6f 72 28 31 31 2c 20  5f 66 72 65 65 29 0d 1e  |tor(11, _free)..|
000043b0  d2 19 20 20 20 f2 73 65  63 74 6f 72 28 31 34 2c  |..   .sector(14,|
000043c0  20 5f 61 70 70 73 29 0d  1e dc 1a 20 20 20 f2 73  | _apps)....   .s|
000043d0  65 63 74 6f 72 28 39 2c  20 5f 73 63 72 65 65 6e  |ector(9, _screen|
000043e0  29 0d 1e e6 1b 20 20 20  f2 73 65 63 74 6f 72 28  |)....   .sector(|
000043f0  31 30 2c 20 5f 73 79 73  74 65 6d 29 0d 1e f0 18  |10, _system)....|
00004400  20 20 20 f2 73 65 63 74  6f 72 28 31 33 2c 20 5f  |   .sector(13, _|
00004410  72 6d 61 29 0d 1e fa 1a  20 20 20 f2 73 65 63 74  |rma)....   .sect|
00004420  6f 72 28 31 35 2c 20 5f  66 6f 6e 74 73 29 0d 1f  |or(15, _fonts)..|
00004430  04 1a 20 20 20 f2 73 65  63 74 6f 72 28 38 2c 20  |..   .sector(8, |
00004440  5f 73 70 72 69 74 65 29  0d 1f 0e 17 20 20 20 f2  |_sprite)....   .|
00004450  73 65 63 74 6f 72 28 30  2c 20 5f 72 61 6d 29 0d  |sector(0, _ram).|
00004460  1f 18 1d 20 20 20 c8 99  20 22 57 69 6d 70 5f 53  |...   .. "Wimp_S|
00004470  65 74 43 6f 6c 6f 75 72  22 2c 20 37 0d 1f 22 16  |etColour", 7..".|
00004480  20 20 20 c8 8f 20 30 2c  20 30 2c 20 72 61 64 69  |   .. 0, 0, radi|
00004490  75 73 0d 1f 2c 21 20 20  20 c8 8f 20 30 2c 20 30  |us..,!   .. 0, 0|
000044a0  2c 20 72 61 64 69 75 73  2b 58 45 69 67 46 61 63  |, radius+XEigFac|
000044b0  74 6f 72 0d 1f 36 0d 20  20 20 c8 91 20 30 2c 30  |tor..6.   .. 0,0|
000044c0  0d 1f 40 2d 20 20 20 c8  99 20 22 57 69 6d 70 5f  |..@-   .. "Wimp_|
000044d0  47 65 74 52 65 63 74 61  6e 67 6c 65 22 2c 2c 20  |GetRectangle",, |
000044e0  62 6c 6f 63 6b 25 20 b8  20 6d 6f 72 65 0d 1f 4a  |block% . more..J|
000044f0  05 ce 0d 1f 54 05 e1 0d  ff                       |....T....|
000044f9