Home » Archimedes archive » Archimedes World » AW-1992-08.adf » AWaug92 » !AWaug92/Goodies/WimpGloss/!WimpGloss/Wimp/Misc

!AWaug92/Goodies/WimpGloss/!WimpGloss/Wimp/Misc

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

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

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1992-08.adf » AWaug92
Filename: !AWaug92/Goodies/WimpGloss/!WimpGloss/Wimp/Misc
Read OK:
File size: 0810 bytes
Load address: 0000
Exec address: 0000
File contents
DEF FNWimp_Start(TaskName$)
REM|This initialises a wimp task and sends the name
REM|TaskName$ to the task manager. 
REM|
REM|The value of the function is TaskName$.
REM|
LOCAL version%
PROCWimp_SetEventVariables
ON ERROR PROCWimp_Error(task%,TaskName$):END
$wimp%="TASK"
SYS"Wimp_Initialise",200,!wimp%,TaskName$ TO version%,task%
=TaskName$
:
DEF PROCWimp_SetEventVariables
REM|Sets up the following inviolate variables:
REM| menus%,icons%,wimp%,sprites%,icon_memory%,task%
REM| Bar_Window%,Bar_Icon%,Bar_Menu%,SaveWindow%
REM| x_origin%,y_origin%,save_event%,finished%
REM| message_quit%,message_save%,message_load%
DIM wimp% block_memory%,icons%icon_memory%
icon_end%=icons%+icon_memory%
null%=1  :draw%=2 :  pointer_leaving%=1<<4
pointer_entering%=1<<5:mouse%=1<<6:drag%=1<<7
key%=1<<8:menu%=1<<9:scroll%=1<<10
lose_caret%=1<<11:gain_caret%=1<<12:message%=(1<<17)+(1<<18)
recorder%=1<<18:acknowledge%=1<<19:window%=0
sprites%=0:version%=0:task%=0
Bar_Window%=-2:Bar_Icon%=0:Bar_Menu%=0
x_origin%=0:y_origin%=0:SaveWindow%=-3
message_quit%=0:message_save%=2:message_load%=3
mouse_button%=2:save_event%=0
ENDPROC
:
DEF PROCWimp_Error(task%,TaskName$)
REM|Generates error messages.
REM|
REM|
REM|
REM|
LOCALX$,x%
ON ERROR OFF
x%=ERL
X$=REPORT$+"atline"+STR$(x%DIV10)
DIMErrorMsg%36
ErrorMsg%!0=36:REMLengthofmessage
ErrorMsg%!12=0:REMThisisanoriginalmessage
ErrorMsg%!16=&81080:REMMessagenumbertosetcaret
ErrorMsg%!20=x%:REMLinetoputcareton
$(ErrorMsg%+24)="!RunImage":REMFiletoputcareton
SYS"Wimp_SendMessage",17,ErrorMsg%
PROCWimp_WindowAlert(TaskName$,X$)
PROCWimp_CloseDown
ENDPROC
:
DEF PROCWimp_CloseDown
REM|Causes the task to be closed down.
REM|
REM|
REM|
REM|
SYS"Wimp_CloseDown",task%,"TASK"
ENDPROC
:
DEF PROCWimp_Quit
REM|Quits the wimp!
REM|
REM|
REM|
REM|
 finished%=TRUE
ENDPROC
:
DEF FNWimp_ReadVariable(Variable$)
REM|Reads the value of a system variable.
REM|E.g.
REM|      FNWimp_ReadVariable("Obey$Dir")
REM|
REM|
LOCALlen%,result%,variable%
$wimp%=Variable$
SYS"OS_ReadVarVal",wimp%,wimp%+255,255,,3TO,,len%
wimp%?(len%+255)=13
=$(wimp%+255)
00000000  44 45 46 20 46 4e 57 69  6d 70 5f 53 74 61 72 74  |DEF FNWimp_Start|
00000010  28 54 61 73 6b 4e 61 6d  65 24 29 0a 52 45 4d 7c  |(TaskName$).REM||
00000020  54 68 69 73 20 69 6e 69  74 69 61 6c 69 73 65 73  |This initialises|
00000030  20 61 20 77 69 6d 70 20  74 61 73 6b 20 61 6e 64  | a wimp task and|
00000040  20 73 65 6e 64 73 20 74  68 65 20 6e 61 6d 65 0a  | sends the name.|
00000050  52 45 4d 7c 54 61 73 6b  4e 61 6d 65 24 20 74 6f  |REM|TaskName$ to|
00000060  20 74 68 65 20 74 61 73  6b 20 6d 61 6e 61 67 65  | the task manage|
00000070  72 2e 20 0a 52 45 4d 7c  0a 52 45 4d 7c 54 68 65  |r. .REM|.REM|The|
00000080  20 76 61 6c 75 65 20 6f  66 20 74 68 65 20 66 75  | value of the fu|
00000090  6e 63 74 69 6f 6e 20 69  73 20 54 61 73 6b 4e 61  |nction is TaskNa|
000000a0  6d 65 24 2e 0a 52 45 4d  7c 0a 4c 4f 43 41 4c 20  |me$..REM|.LOCAL |
000000b0  76 65 72 73 69 6f 6e 25  0a 50 52 4f 43 57 69 6d  |version%.PROCWim|
000000c0  70 5f 53 65 74 45 76 65  6e 74 56 61 72 69 61 62  |p_SetEventVariab|
000000d0  6c 65 73 0a 4f 4e 20 45  52 52 4f 52 20 50 52 4f  |les.ON ERROR PRO|
000000e0  43 57 69 6d 70 5f 45 72  72 6f 72 28 74 61 73 6b  |CWimp_Error(task|
000000f0  25 2c 54 61 73 6b 4e 61  6d 65 24 29 3a 45 4e 44  |%,TaskName$):END|
00000100  0a 24 77 69 6d 70 25 3d  22 54 41 53 4b 22 0a 53  |.$wimp%="TASK".S|
00000110  59 53 22 57 69 6d 70 5f  49 6e 69 74 69 61 6c 69  |YS"Wimp_Initiali|
00000120  73 65 22 2c 32 30 30 2c  21 77 69 6d 70 25 2c 54  |se",200,!wimp%,T|
00000130  61 73 6b 4e 61 6d 65 24  20 54 4f 20 76 65 72 73  |askName$ TO vers|
00000140  69 6f 6e 25 2c 74 61 73  6b 25 0a 3d 54 61 73 6b  |ion%,task%.=Task|
00000150  4e 61 6d 65 24 0a 3a 0a  44 45 46 20 50 52 4f 43  |Name$.:.DEF PROC|
00000160  57 69 6d 70 5f 53 65 74  45 76 65 6e 74 56 61 72  |Wimp_SetEventVar|
00000170  69 61 62 6c 65 73 0a 52  45 4d 7c 53 65 74 73 20  |iables.REM|Sets |
00000180  75 70 20 74 68 65 20 66  6f 6c 6c 6f 77 69 6e 67  |up the following|
00000190  20 69 6e 76 69 6f 6c 61  74 65 20 76 61 72 69 61  | inviolate varia|
000001a0  62 6c 65 73 3a 0a 52 45  4d 7c 20 6d 65 6e 75 73  |bles:.REM| menus|
000001b0  25 2c 69 63 6f 6e 73 25  2c 77 69 6d 70 25 2c 73  |%,icons%,wimp%,s|
000001c0  70 72 69 74 65 73 25 2c  69 63 6f 6e 5f 6d 65 6d  |prites%,icon_mem|
000001d0  6f 72 79 25 2c 74 61 73  6b 25 0a 52 45 4d 7c 20  |ory%,task%.REM| |
000001e0  42 61 72 5f 57 69 6e 64  6f 77 25 2c 42 61 72 5f  |Bar_Window%,Bar_|
000001f0  49 63 6f 6e 25 2c 42 61  72 5f 4d 65 6e 75 25 2c  |Icon%,Bar_Menu%,|
00000200  53 61 76 65 57 69 6e 64  6f 77 25 0a 52 45 4d 7c  |SaveWindow%.REM||
00000210  20 78 5f 6f 72 69 67 69  6e 25 2c 79 5f 6f 72 69  | x_origin%,y_ori|
00000220  67 69 6e 25 2c 73 61 76  65 5f 65 76 65 6e 74 25  |gin%,save_event%|
00000230  2c 66 69 6e 69 73 68 65  64 25 0a 52 45 4d 7c 20  |,finished%.REM| |
00000240  6d 65 73 73 61 67 65 5f  71 75 69 74 25 2c 6d 65  |message_quit%,me|
00000250  73 73 61 67 65 5f 73 61  76 65 25 2c 6d 65 73 73  |ssage_save%,mess|
00000260  61 67 65 5f 6c 6f 61 64  25 0a 44 49 4d 20 77 69  |age_load%.DIM wi|
00000270  6d 70 25 20 62 6c 6f 63  6b 5f 6d 65 6d 6f 72 79  |mp% block_memory|
00000280  25 2c 69 63 6f 6e 73 25  69 63 6f 6e 5f 6d 65 6d  |%,icons%icon_mem|
00000290  6f 72 79 25 0a 69 63 6f  6e 5f 65 6e 64 25 3d 69  |ory%.icon_end%=i|
000002a0  63 6f 6e 73 25 2b 69 63  6f 6e 5f 6d 65 6d 6f 72  |cons%+icon_memor|
000002b0  79 25 0a 6e 75 6c 6c 25  3d 31 20 20 3a 64 72 61  |y%.null%=1  :dra|
000002c0  77 25 3d 32 20 3a 20 20  70 6f 69 6e 74 65 72 5f  |w%=2 :  pointer_|
000002d0  6c 65 61 76 69 6e 67 25  3d 31 3c 3c 34 0a 70 6f  |leaving%=1<<4.po|
000002e0  69 6e 74 65 72 5f 65 6e  74 65 72 69 6e 67 25 3d  |inter_entering%=|
000002f0  31 3c 3c 35 3a 6d 6f 75  73 65 25 3d 31 3c 3c 36  |1<<5:mouse%=1<<6|
00000300  3a 64 72 61 67 25 3d 31  3c 3c 37 0a 6b 65 79 25  |:drag%=1<<7.key%|
00000310  3d 31 3c 3c 38 3a 6d 65  6e 75 25 3d 31 3c 3c 39  |=1<<8:menu%=1<<9|
00000320  3a 73 63 72 6f 6c 6c 25  3d 31 3c 3c 31 30 0a 6c  |:scroll%=1<<10.l|
00000330  6f 73 65 5f 63 61 72 65  74 25 3d 31 3c 3c 31 31  |ose_caret%=1<<11|
00000340  3a 67 61 69 6e 5f 63 61  72 65 74 25 3d 31 3c 3c  |:gain_caret%=1<<|
00000350  31 32 3a 6d 65 73 73 61  67 65 25 3d 28 31 3c 3c  |12:message%=(1<<|
00000360  31 37 29 2b 28 31 3c 3c  31 38 29 0a 72 65 63 6f  |17)+(1<<18).reco|
00000370  72 64 65 72 25 3d 31 3c  3c 31 38 3a 61 63 6b 6e  |rder%=1<<18:ackn|
00000380  6f 77 6c 65 64 67 65 25  3d 31 3c 3c 31 39 3a 77  |owledge%=1<<19:w|
00000390  69 6e 64 6f 77 25 3d 30  0a 73 70 72 69 74 65 73  |indow%=0.sprites|
000003a0  25 3d 30 3a 76 65 72 73  69 6f 6e 25 3d 30 3a 74  |%=0:version%=0:t|
000003b0  61 73 6b 25 3d 30 0a 42  61 72 5f 57 69 6e 64 6f  |ask%=0.Bar_Windo|
000003c0  77 25 3d 2d 32 3a 42 61  72 5f 49 63 6f 6e 25 3d  |w%=-2:Bar_Icon%=|
000003d0  30 3a 42 61 72 5f 4d 65  6e 75 25 3d 30 0a 78 5f  |0:Bar_Menu%=0.x_|
000003e0  6f 72 69 67 69 6e 25 3d  30 3a 79 5f 6f 72 69 67  |origin%=0:y_orig|
000003f0  69 6e 25 3d 30 3a 53 61  76 65 57 69 6e 64 6f 77  |in%=0:SaveWindow|
00000400  25 3d 2d 33 0a 6d 65 73  73 61 67 65 5f 71 75 69  |%=-3.message_qui|
00000410  74 25 3d 30 3a 6d 65 73  73 61 67 65 5f 73 61 76  |t%=0:message_sav|
00000420  65 25 3d 32 3a 6d 65 73  73 61 67 65 5f 6c 6f 61  |e%=2:message_loa|
00000430  64 25 3d 33 0a 6d 6f 75  73 65 5f 62 75 74 74 6f  |d%=3.mouse_butto|
00000440  6e 25 3d 32 3a 73 61 76  65 5f 65 76 65 6e 74 25  |n%=2:save_event%|
00000450  3d 30 0a 45 4e 44 50 52  4f 43 0a 3a 0a 44 45 46  |=0.ENDPROC.:.DEF|
00000460  20 50 52 4f 43 57 69 6d  70 5f 45 72 72 6f 72 28  | PROCWimp_Error(|
00000470  74 61 73 6b 25 2c 54 61  73 6b 4e 61 6d 65 24 29  |task%,TaskName$)|
00000480  0a 52 45 4d 7c 47 65 6e  65 72 61 74 65 73 20 65  |.REM|Generates e|
00000490  72 72 6f 72 20 6d 65 73  73 61 67 65 73 2e 0a 52  |rror messages..R|
000004a0  45 4d 7c 0a 52 45 4d 7c  0a 52 45 4d 7c 0a 52 45  |EM|.REM|.REM|.RE|
000004b0  4d 7c 0a 4c 4f 43 41 4c  58 24 2c 78 25 0a 4f 4e  |M|.LOCALX$,x%.ON|
000004c0  20 45 52 52 4f 52 20 4f  46 46 0a 78 25 3d 45 52  | ERROR OFF.x%=ER|
000004d0  4c 0a 58 24 3d 52 45 50  4f 52 54 24 2b 22 61 74  |L.X$=REPORT$+"at|
000004e0  6c 69 6e 65 22 2b 53 54  52 24 28 78 25 44 49 56  |line"+STR$(x%DIV|
000004f0  31 30 29 0a 44 49 4d 45  72 72 6f 72 4d 73 67 25  |10).DIMErrorMsg%|
00000500  33 36 0a 45 72 72 6f 72  4d 73 67 25 21 30 3d 33  |36.ErrorMsg%!0=3|
00000510  36 3a 52 45 4d 4c 65 6e  67 74 68 6f 66 6d 65 73  |6:REMLengthofmes|
00000520  73 61 67 65 0a 45 72 72  6f 72 4d 73 67 25 21 31  |sage.ErrorMsg%!1|
00000530  32 3d 30 3a 52 45 4d 54  68 69 73 69 73 61 6e 6f  |2=0:REMThisisano|
00000540  72 69 67 69 6e 61 6c 6d  65 73 73 61 67 65 0a 45  |riginalmessage.E|
00000550  72 72 6f 72 4d 73 67 25  21 31 36 3d 26 38 31 30  |rrorMsg%!16=&810|
00000560  38 30 3a 52 45 4d 4d 65  73 73 61 67 65 6e 75 6d  |80:REMMessagenum|
00000570  62 65 72 74 6f 73 65 74  63 61 72 65 74 0a 45 72  |bertosetcaret.Er|
00000580  72 6f 72 4d 73 67 25 21  32 30 3d 78 25 3a 52 45  |rorMsg%!20=x%:RE|
00000590  4d 4c 69 6e 65 74 6f 70  75 74 63 61 72 65 74 6f  |MLinetoputcareto|
000005a0  6e 0a 24 28 45 72 72 6f  72 4d 73 67 25 2b 32 34  |n.$(ErrorMsg%+24|
000005b0  29 3d 22 21 52 75 6e 49  6d 61 67 65 22 3a 52 45  |)="!RunImage":RE|
000005c0  4d 46 69 6c 65 74 6f 70  75 74 63 61 72 65 74 6f  |MFiletoputcareto|
000005d0  6e 0a 53 59 53 22 57 69  6d 70 5f 53 65 6e 64 4d  |n.SYS"Wimp_SendM|
000005e0  65 73 73 61 67 65 22 2c  31 37 2c 45 72 72 6f 72  |essage",17,Error|
000005f0  4d 73 67 25 0a 50 52 4f  43 57 69 6d 70 5f 57 69  |Msg%.PROCWimp_Wi|
00000600  6e 64 6f 77 41 6c 65 72  74 28 54 61 73 6b 4e 61  |ndowAlert(TaskNa|
00000610  6d 65 24 2c 58 24 29 0a  50 52 4f 43 57 69 6d 70  |me$,X$).PROCWimp|
00000620  5f 43 6c 6f 73 65 44 6f  77 6e 0a 45 4e 44 50 52  |_CloseDown.ENDPR|
00000630  4f 43 0a 3a 0a 44 45 46  20 50 52 4f 43 57 69 6d  |OC.:.DEF PROCWim|
00000640  70 5f 43 6c 6f 73 65 44  6f 77 6e 0a 52 45 4d 7c  |p_CloseDown.REM||
00000650  43 61 75 73 65 73 20 74  68 65 20 74 61 73 6b 20  |Causes the task |
00000660  74 6f 20 62 65 20 63 6c  6f 73 65 64 20 64 6f 77  |to be closed dow|
00000670  6e 2e 0a 52 45 4d 7c 0a  52 45 4d 7c 0a 52 45 4d  |n..REM|.REM|.REM|
00000680  7c 0a 52 45 4d 7c 0a 53  59 53 22 57 69 6d 70 5f  ||.REM|.SYS"Wimp_|
00000690  43 6c 6f 73 65 44 6f 77  6e 22 2c 74 61 73 6b 25  |CloseDown",task%|
000006a0  2c 22 54 41 53 4b 22 0a  45 4e 44 50 52 4f 43 0a  |,"TASK".ENDPROC.|
000006b0  3a 0a 44 45 46 20 50 52  4f 43 57 69 6d 70 5f 51  |:.DEF PROCWimp_Q|
000006c0  75 69 74 0a 52 45 4d 7c  51 75 69 74 73 20 74 68  |uit.REM|Quits th|
000006d0  65 20 77 69 6d 70 21 0a  52 45 4d 7c 0a 52 45 4d  |e wimp!.REM|.REM|
000006e0  7c 0a 52 45 4d 7c 0a 52  45 4d 7c 0a 20 66 69 6e  ||.REM|.REM|. fin|
000006f0  69 73 68 65 64 25 3d 54  52 55 45 0a 45 4e 44 50  |ished%=TRUE.ENDP|
00000700  52 4f 43 0a 3a 0a 44 45  46 20 46 4e 57 69 6d 70  |ROC.:.DEF FNWimp|
00000710  5f 52 65 61 64 56 61 72  69 61 62 6c 65 28 56 61  |_ReadVariable(Va|
00000720  72 69 61 62 6c 65 24 29  0a 52 45 4d 7c 52 65 61  |riable$).REM|Rea|
00000730  64 73 20 74 68 65 20 76  61 6c 75 65 20 6f 66 20  |ds the value of |
00000740  61 20 73 79 73 74 65 6d  20 76 61 72 69 61 62 6c  |a system variabl|
00000750  65 2e 0a 52 45 4d 7c 45  2e 67 2e 0a 52 45 4d 7c  |e..REM|E.g..REM||
00000760  20 20 20 20 20 20 46 4e  57 69 6d 70 5f 52 65 61  |      FNWimp_Rea|
00000770  64 56 61 72 69 61 62 6c  65 28 22 4f 62 65 79 24  |dVariable("Obey$|
00000780  44 69 72 22 29 0a 52 45  4d 7c 0a 52 45 4d 7c 0a  |Dir").REM|.REM|.|
00000790  4c 4f 43 41 4c 6c 65 6e  25 2c 72 65 73 75 6c 74  |LOCALlen%,result|
000007a0  25 2c 76 61 72 69 61 62  6c 65 25 0a 24 77 69 6d  |%,variable%.$wim|
000007b0  70 25 3d 56 61 72 69 61  62 6c 65 24 0a 53 59 53  |p%=Variable$.SYS|
000007c0  22 4f 53 5f 52 65 61 64  56 61 72 56 61 6c 22 2c  |"OS_ReadVarVal",|
000007d0  77 69 6d 70 25 2c 77 69  6d 70 25 2b 32 35 35 2c  |wimp%,wimp%+255,|
000007e0  32 35 35 2c 2c 33 54 4f  2c 2c 6c 65 6e 25 0a 77  |255,,3TO,,len%.w|
000007f0  69 6d 70 25 3f 28 6c 65  6e 25 2b 32 35 35 29 3d  |imp%?(len%+255)=|
00000800  31 33 0a 3d 24 28 77 69  6d 70 25 2b 32 35 35 29  |13.=$(wimp%+255)|
00000810