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

!AWaug92/Goodies/WimpGloss/!WimpGloss/Wimp/Files

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/Files
Read OK:
File size: 072B bytes
Load address: 0000
Exec address: 0000
File contents
DEF FNWimp_FileType(type%)
REM|This returns a string containing the name
REM|of some of the standard file types. e.g.
REM|"Basic","text","Sprite", etc.
REM|
REM|
CASEtype%OF
WHEN&FFF:="Text"
WHEN&FFD:="Data"
WHEN&FFB:="Basic"
WHEN&FF9:="Sprite"
WHEN&FED:="Palette"
WHEN&FEC:="Template"
WHEN&AFF:="Draw"
WHEN&1000:="Folder"
WHEN&2000:="Application"
OTHERWISE=STR$~(type%)
ENDCASE
:
DEF FNWimp_GetFilePathName
REM|Used during an Event_Load procedure, gives the
REM|name of the file to be loaded.
REM|
REM|
REM|
=FNWimp_GetStringAtAddress(wimp%+44)
:
DEF FNWimp_FileLoad(pathname$)
REM|Causes the file given by pathname$ to be
REM|loaded into memory. E.g.
REM|
REM|      file%=FNWimp_FileLoad("$.File")
REM|loads the file into byte array file%.
LOCALS%,T%,file%
S%=OPENINpathname$
T%=EXT#S%+16
CLOSE#S%
DIMfile%T%
OSCLI("LOAD"+pathname$+""+STR$~file%)
=file%
;
DEF FNWimp_GetStringAtAddress(array%)
REM|If the byte array array% contains a string 
REM|terminated by CHR$0 or CHR$13 (RETURN) this
REM|function returns the value of the string.
REM|
REM|
LOCALs$:s$=""
WHILE(?array%<>13)AND(?array%<>0):s$+=CHR$(?array%):array%+=1:ENDWHILE:
=s$
:
DEF FNWimp_GetFileFromPathname(f$)
REM|This function returns the leaf name of a
REM|file from its pathname. E.g.
REM|  FNWimp_GetFileFromPathname("$.FRED.JIM")
REM|has the value "JIM".
REM|
IFINSTR(f$,".")=0THEN
=f$
ELSE
=FNWimp_GetStringFromPathname(RIGHT$(f$,LEN(f$)-INSTR(f$,".")))
ENDIF
:
DEF PROCWimp_SendToEdit(file$)
REM|If !Edit or !DeskEdit are running, this
REM|procedure opens an Edit  window and places 
REM|the file in this window.
REM|
REM|
LOCAL n%
wimp%!4=&6CC01C0C
wimp%!16=5
wimp%!36=0
wimp%!40=&FFF
$(wimp%+44)=file$+CHR$0
n%=LENfile$+45
IF n%MOD4 THEN !wimp%=4+(n%>>2)<<2 ELSE !wimp%=n%
SYS "Wimp_SendMessage",17,wimp%,0
ENDPROC
:
REM|                        variables wimp%
00000000  44 45 46 20 46 4e 57 69  6d 70 5f 46 69 6c 65 54  |DEF FNWimp_FileT|
00000010  79 70 65 28 74 79 70 65  25 29 0a 52 45 4d 7c 54  |ype(type%).REM|T|
00000020  68 69 73 20 72 65 74 75  72 6e 73 20 61 20 73 74  |his returns a st|
00000030  72 69 6e 67 20 63 6f 6e  74 61 69 6e 69 6e 67 20  |ring containing |
00000040  74 68 65 20 6e 61 6d 65  0a 52 45 4d 7c 6f 66 20  |the name.REM|of |
00000050  73 6f 6d 65 20 6f 66 20  74 68 65 20 73 74 61 6e  |some of the stan|
00000060  64 61 72 64 20 66 69 6c  65 20 74 79 70 65 73 2e  |dard file types.|
00000070  20 65 2e 67 2e 0a 52 45  4d 7c 22 42 61 73 69 63  | e.g..REM|"Basic|
00000080  22 2c 22 74 65 78 74 22  2c 22 53 70 72 69 74 65  |","text","Sprite|
00000090  22 2c 20 65 74 63 2e 0a  52 45 4d 7c 0a 52 45 4d  |", etc..REM|.REM|
000000a0  7c 0a 43 41 53 45 74 79  70 65 25 4f 46 0a 57 48  ||.CASEtype%OF.WH|
000000b0  45 4e 26 46 46 46 3a 3d  22 54 65 78 74 22 0a 57  |EN&FFF:="Text".W|
000000c0  48 45 4e 26 46 46 44 3a  3d 22 44 61 74 61 22 0a  |HEN&FFD:="Data".|
000000d0  57 48 45 4e 26 46 46 42  3a 3d 22 42 61 73 69 63  |WHEN&FFB:="Basic|
000000e0  22 0a 57 48 45 4e 26 46  46 39 3a 3d 22 53 70 72  |".WHEN&FF9:="Spr|
000000f0  69 74 65 22 0a 57 48 45  4e 26 46 45 44 3a 3d 22  |ite".WHEN&FED:="|
00000100  50 61 6c 65 74 74 65 22  0a 57 48 45 4e 26 46 45  |Palette".WHEN&FE|
00000110  43 3a 3d 22 54 65 6d 70  6c 61 74 65 22 0a 57 48  |C:="Template".WH|
00000120  45 4e 26 41 46 46 3a 3d  22 44 72 61 77 22 0a 57  |EN&AFF:="Draw".W|
00000130  48 45 4e 26 31 30 30 30  3a 3d 22 46 6f 6c 64 65  |HEN&1000:="Folde|
00000140  72 22 0a 57 48 45 4e 26  32 30 30 30 3a 3d 22 41  |r".WHEN&2000:="A|
00000150  70 70 6c 69 63 61 74 69  6f 6e 22 0a 4f 54 48 45  |pplication".OTHE|
00000160  52 57 49 53 45 3d 53 54  52 24 7e 28 74 79 70 65  |RWISE=STR$~(type|
00000170  25 29 0a 45 4e 44 43 41  53 45 0a 3a 0a 44 45 46  |%).ENDCASE.:.DEF|
00000180  20 46 4e 57 69 6d 70 5f  47 65 74 46 69 6c 65 50  | FNWimp_GetFileP|
00000190  61 74 68 4e 61 6d 65 0a  52 45 4d 7c 55 73 65 64  |athName.REM|Used|
000001a0  20 64 75 72 69 6e 67 20  61 6e 20 45 76 65 6e 74  | during an Event|
000001b0  5f 4c 6f 61 64 20 70 72  6f 63 65 64 75 72 65 2c  |_Load procedure,|
000001c0  20 67 69 76 65 73 20 74  68 65 0a 52 45 4d 7c 6e  | gives the.REM|n|
000001d0  61 6d 65 20 6f 66 20 74  68 65 20 66 69 6c 65 20  |ame of the file |
000001e0  74 6f 20 62 65 20 6c 6f  61 64 65 64 2e 0a 52 45  |to be loaded..RE|
000001f0  4d 7c 0a 52 45 4d 7c 0a  52 45 4d 7c 0a 3d 46 4e  |M|.REM|.REM|.=FN|
00000200  57 69 6d 70 5f 47 65 74  53 74 72 69 6e 67 41 74  |Wimp_GetStringAt|
00000210  41 64 64 72 65 73 73 28  77 69 6d 70 25 2b 34 34  |Address(wimp%+44|
00000220  29 0a 3a 0a 44 45 46 20  46 4e 57 69 6d 70 5f 46  |).:.DEF FNWimp_F|
00000230  69 6c 65 4c 6f 61 64 28  70 61 74 68 6e 61 6d 65  |ileLoad(pathname|
00000240  24 29 0a 52 45 4d 7c 43  61 75 73 65 73 20 74 68  |$).REM|Causes th|
00000250  65 20 66 69 6c 65 20 67  69 76 65 6e 20 62 79 20  |e file given by |
00000260  70 61 74 68 6e 61 6d 65  24 20 74 6f 20 62 65 0a  |pathname$ to be.|
00000270  52 45 4d 7c 6c 6f 61 64  65 64 20 69 6e 74 6f 20  |REM|loaded into |
00000280  6d 65 6d 6f 72 79 2e 20  45 2e 67 2e 0a 52 45 4d  |memory. E.g..REM|
00000290  7c 0a 52 45 4d 7c 20 20  20 20 20 20 66 69 6c 65  ||.REM|      file|
000002a0  25 3d 46 4e 57 69 6d 70  5f 46 69 6c 65 4c 6f 61  |%=FNWimp_FileLoa|
000002b0  64 28 22 24 2e 46 69 6c  65 22 29 0a 52 45 4d 7c  |d("$.File").REM||
000002c0  6c 6f 61 64 73 20 74 68  65 20 66 69 6c 65 20 69  |loads the file i|
000002d0  6e 74 6f 20 62 79 74 65  20 61 72 72 61 79 20 66  |nto byte array f|
000002e0  69 6c 65 25 2e 0a 4c 4f  43 41 4c 53 25 2c 54 25  |ile%..LOCALS%,T%|
000002f0  2c 66 69 6c 65 25 0a 53  25 3d 4f 50 45 4e 49 4e  |,file%.S%=OPENIN|
00000300  70 61 74 68 6e 61 6d 65  24 0a 54 25 3d 45 58 54  |pathname$.T%=EXT|
00000310  23 53 25 2b 31 36 0a 43  4c 4f 53 45 23 53 25 0a  |#S%+16.CLOSE#S%.|
00000320  44 49 4d 66 69 6c 65 25  54 25 0a 4f 53 43 4c 49  |DIMfile%T%.OSCLI|
00000330  28 22 4c 4f 41 44 22 2b  70 61 74 68 6e 61 6d 65  |("LOAD"+pathname|
00000340  24 2b 22 22 2b 53 54 52  24 7e 66 69 6c 65 25 29  |$+""+STR$~file%)|
00000350  0a 3d 66 69 6c 65 25 0a  3b 0a 44 45 46 20 46 4e  |.=file%.;.DEF FN|
00000360  57 69 6d 70 5f 47 65 74  53 74 72 69 6e 67 41 74  |Wimp_GetStringAt|
00000370  41 64 64 72 65 73 73 28  61 72 72 61 79 25 29 0a  |Address(array%).|
00000380  52 45 4d 7c 49 66 20 74  68 65 20 62 79 74 65 20  |REM|If the byte |
00000390  61 72 72 61 79 20 61 72  72 61 79 25 20 63 6f 6e  |array array% con|
000003a0  74 61 69 6e 73 20 61 20  73 74 72 69 6e 67 20 0a  |tains a string .|
000003b0  52 45 4d 7c 74 65 72 6d  69 6e 61 74 65 64 20 62  |REM|terminated b|
000003c0  79 20 43 48 52 24 30 20  6f 72 20 43 48 52 24 31  |y CHR$0 or CHR$1|
000003d0  33 20 28 52 45 54 55 52  4e 29 20 74 68 69 73 0a  |3 (RETURN) this.|
000003e0  52 45 4d 7c 66 75 6e 63  74 69 6f 6e 20 72 65 74  |REM|function ret|
000003f0  75 72 6e 73 20 74 68 65  20 76 61 6c 75 65 20 6f  |urns the value o|
00000400  66 20 74 68 65 20 73 74  72 69 6e 67 2e 0a 52 45  |f the string..RE|
00000410  4d 7c 0a 52 45 4d 7c 0a  4c 4f 43 41 4c 73 24 3a  |M|.REM|.LOCALs$:|
00000420  73 24 3d 22 22 0a 57 48  49 4c 45 28 3f 61 72 72  |s$="".WHILE(?arr|
00000430  61 79 25 3c 3e 31 33 29  41 4e 44 28 3f 61 72 72  |ay%<>13)AND(?arr|
00000440  61 79 25 3c 3e 30 29 3a  73 24 2b 3d 43 48 52 24  |ay%<>0):s$+=CHR$|
00000450  28 3f 61 72 72 61 79 25  29 3a 61 72 72 61 79 25  |(?array%):array%|
00000460  2b 3d 31 3a 45 4e 44 57  48 49 4c 45 3a 0a 3d 73  |+=1:ENDWHILE:.=s|
00000470  24 0a 3a 0a 44 45 46 20  46 4e 57 69 6d 70 5f 47  |$.:.DEF FNWimp_G|
00000480  65 74 46 69 6c 65 46 72  6f 6d 50 61 74 68 6e 61  |etFileFromPathna|
00000490  6d 65 28 66 24 29 0a 52  45 4d 7c 54 68 69 73 20  |me(f$).REM|This |
000004a0  66 75 6e 63 74 69 6f 6e  20 72 65 74 75 72 6e 73  |function returns|
000004b0  20 74 68 65 20 6c 65 61  66 20 6e 61 6d 65 20 6f  | the leaf name o|
000004c0  66 20 61 0a 52 45 4d 7c  66 69 6c 65 20 66 72 6f  |f a.REM|file fro|
000004d0  6d 20 69 74 73 20 70 61  74 68 6e 61 6d 65 2e 20  |m its pathname. |
000004e0  45 2e 67 2e 0a 52 45 4d  7c 20 20 46 4e 57 69 6d  |E.g..REM|  FNWim|
000004f0  70 5f 47 65 74 46 69 6c  65 46 72 6f 6d 50 61 74  |p_GetFileFromPat|
00000500  68 6e 61 6d 65 28 22 24  2e 46 52 45 44 2e 4a 49  |hname("$.FRED.JI|
00000510  4d 22 29 0a 52 45 4d 7c  68 61 73 20 74 68 65 20  |M").REM|has the |
00000520  76 61 6c 75 65 20 22 4a  49 4d 22 2e 0a 52 45 4d  |value "JIM"..REM|
00000530  7c 0a 49 46 49 4e 53 54  52 28 66 24 2c 22 2e 22  ||.IFINSTR(f$,"."|
00000540  29 3d 30 54 48 45 4e 0a  3d 66 24 0a 45 4c 53 45  |)=0THEN.=f$.ELSE|
00000550  0a 3d 46 4e 57 69 6d 70  5f 47 65 74 53 74 72 69  |.=FNWimp_GetStri|
00000560  6e 67 46 72 6f 6d 50 61  74 68 6e 61 6d 65 28 52  |ngFromPathname(R|
00000570  49 47 48 54 24 28 66 24  2c 4c 45 4e 28 66 24 29  |IGHT$(f$,LEN(f$)|
00000580  2d 49 4e 53 54 52 28 66  24 2c 22 2e 22 29 29 29  |-INSTR(f$,".")))|
00000590  0a 45 4e 44 49 46 0a 3a  0a 44 45 46 20 50 52 4f  |.ENDIF.:.DEF PRO|
000005a0  43 57 69 6d 70 5f 53 65  6e 64 54 6f 45 64 69 74  |CWimp_SendToEdit|
000005b0  28 66 69 6c 65 24 29 0a  52 45 4d 7c 49 66 20 21  |(file$).REM|If !|
000005c0  45 64 69 74 20 6f 72 20  21 44 65 73 6b 45 64 69  |Edit or !DeskEdi|
000005d0  74 20 61 72 65 20 72 75  6e 6e 69 6e 67 2c 20 74  |t are running, t|
000005e0  68 69 73 0a 52 45 4d 7c  70 72 6f 63 65 64 75 72  |his.REM|procedur|
000005f0  65 20 6f 70 65 6e 73 20  61 6e 20 45 64 69 74 20  |e opens an Edit |
00000600  20 77 69 6e 64 6f 77 20  61 6e 64 20 70 6c 61 63  | window and plac|
00000610  65 73 20 0a 52 45 4d 7c  74 68 65 20 66 69 6c 65  |es .REM|the file|
00000620  20 69 6e 20 74 68 69 73  20 77 69 6e 64 6f 77 2e  | in this window.|
00000630  0a 52 45 4d 7c 0a 52 45  4d 7c 0a 4c 4f 43 41 4c  |.REM|.REM|.LOCAL|
00000640  20 6e 25 0a 77 69 6d 70  25 21 34 3d 26 36 43 43  | n%.wimp%!4=&6CC|
00000650  30 31 43 30 43 0a 77 69  6d 70 25 21 31 36 3d 35  |01C0C.wimp%!16=5|
00000660  0a 77 69 6d 70 25 21 33  36 3d 30 0a 77 69 6d 70  |.wimp%!36=0.wimp|
00000670  25 21 34 30 3d 26 46 46  46 0a 24 28 77 69 6d 70  |%!40=&FFF.$(wimp|
00000680  25 2b 34 34 29 3d 66 69  6c 65 24 2b 43 48 52 24  |%+44)=file$+CHR$|
00000690  30 0a 6e 25 3d 4c 45 4e  66 69 6c 65 24 2b 34 35  |0.n%=LENfile$+45|
000006a0  0a 49 46 20 6e 25 4d 4f  44 34 20 54 48 45 4e 20  |.IF n%MOD4 THEN |
000006b0  21 77 69 6d 70 25 3d 34  2b 28 6e 25 3e 3e 32 29  |!wimp%=4+(n%>>2)|
000006c0  3c 3c 32 20 45 4c 53 45  20 21 77 69 6d 70 25 3d  |<<2 ELSE !wimp%=|
000006d0  6e 25 0a 53 59 53 20 22  57 69 6d 70 5f 53 65 6e  |n%.SYS "Wimp_Sen|
000006e0  64 4d 65 73 73 61 67 65  22 2c 31 37 2c 77 69 6d  |dMessage",17,wim|
000006f0  70 25 2c 30 0a 45 4e 44  50 52 4f 43 0a 3a 0a 52  |p%,0.ENDPROC.:.R|
00000700  45 4d 7c 20 20 20 20 20  20 20 20 20 20 20 20 20  |EM|             |
00000710  20 20 20 20 20 20 20 20  20 20 20 76 61 72 69 61  |           varia|
00000720  62 6c 65 73 20 77 69 6d  70 25 0a                 |bles wimp%.|
0000072b