Home » Archimedes archive » Acorn User » AU 1993-10.adf » !Bio_Bio » !Bio/Library/SprMerge

!Bio/Library/SprMerge

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

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

Tape/disk: Home » Archimedes archive » Acorn User » AU 1993-10.adf » !Bio_Bio
Filename: !Bio/Library/SprMerge
Read OK:
File size: 0520 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM     >SprMerge (BIO module)
   20REM By  Jim Daniels
   30REM For 32-bit machines
   40REM (c) BAU September 1993
   50END
   60:
   70DEF FNsprmerge_name="Collect sprites"
   80:
   90DEF FNsprmerge_args="-directory -out Sprite"
  100:
  110DEF FNsprmerge_init
  120=0
  130:
  140DEF FNsprmerge(in$,out$)
  150LOCAL out%,sprites%,length%,get%
  160LOCAL spr_block%,spr_inout%,spr_space%
  170IF FNclaim_memory(spr_inout%,spr_space%)=0 PROCwarn("Out of memory"):=TRUE
  180spr_space%-=32
  190spr_block%=spr_inout%+spr_space%
  200out%=OPENOUT(out$)
  210PTR#out%=12
  220sprites%=0
  230PROCsprite_scan(in$)
  240PTR#out%=0
  250PROCwput(out%,sprites%)
  260PROCwput(out%,16)
  270PROCwput(out%,EXT#out%+4)
  280CLOSE #out%
  290=0
  300:
  310DEF PROCsprite_scan(dir$)
  320LOCAL file%,read%,load%,type%,length%,in%
  330REPEAT
  340 SYS "OS_GBPB",10,dir$,spr_block%,1,file%,32 TO ,,,read%,file%
  350 IF read%=1 THEN
  360  file$=FNget_str(spr_block%+20)
  370  SYS "OS_File",5,dir$+"."+file$ TO type%,,load%,,length%
  380  IF type%=1 THEN
  390   IF ((load% AND &FFF00) DIV &100)=&FF9 THEN
  400    in%=OPENIN(dir$+"."+file$)
  410    sprites%+=FNwget(in%)
  420    PTR#in%=12
  430    length%-=12
  440    REPEAT
  450     IF length%>spr_space% get%=spr_space% ELSE get%=length%
  460     SYS "OS_GBPB",4,in%,spr_inout%,get%
  470     SYS "OS_GBPB",2,out%,spr_inout%,get%
  480     length%-=get%
  490    UNTIL length%=0
  500    CLOSE #in%
  510   ENDIF
  520  ELSE
  530   PROCsprite_scan(dir$+"."+file$)
  540  ENDIF
  550 ENDIF
  560UNTIL file%=-1
  570ENDPROC

 �     >SprMerge (BIO module)
� By  Jim Daniels
� For 32-bit machines
(� (c) BAU September 1993
2�
<:
F&� �sprmerge_name="Collect sprites"
P:
Z-� �sprmerge_args="-directory -out Sprite"
d:
n� �sprmerge_init
x=0
�:
�� �sprmerge(in$,out$)
� � out%,sprites%,length%,get%
�&� spr_block%,spr_inout%,spr_space%
�F� �claim_memory(spr_inout%,spr_space%)=0 �warn("Out of memory"):=�
�spr_space%-=32
�$spr_block%=spr_inout%+spr_space%
�out%=�(out$)
�
�#out%=12
�sprites%=0
��sprite_scan(in$)
��#out%=0
��wput(out%,sprites%)
�wput(out%,16)
�wput(out%,�#out%+4)
� #out%
"=0
,:
6� �sprite_scan(dir$)
@)� file%,read%,load%,type%,length%,in%
J�
T@ ș "OS_GBPB",10,dir$,spr_block%,1,file%,32 � ,,,read%,file%
^ � read%=1 �
h#  file$=�get_str(spr_block%+20)
r;  ș "OS_File",5,dir$+"."+file$ � type%,,load%,,length%
|  � type%=1 �
�)   � ((load% � &FFF00) � &100)=&FF9 �
�    in%=�(dir$+"."+file$)
�    sprites%+=�wget(in%)
�    �#in%=12
�    length%-=12
�	    �
�<     � length%>spr_space% get%=spr_space% � get%=length%
�+     ș "OS_GBPB",4,in%,spr_inout%,get%
�,     ș "OS_GBPB",2,out%,spr_inout%,get%
�     length%-=get%
�    � length%=0
�    � #in%
�   �
  �
#   �sprite_scan(dir$+"."+file$)
  �
& �
0� file%=-1
:�
�
00000000  0d 00 0a 20 f4 20 20 20  20 20 3e 53 70 72 4d 65  |... .     >SprMe|
00000010  72 67 65 20 28 42 49 4f  20 6d 6f 64 75 6c 65 29  |rge (BIO module)|
00000020  0d 00 14 15 f4 20 42 79  20 20 4a 69 6d 20 44 61  |..... By  Jim Da|
00000030  6e 69 65 6c 73 0d 00 1e  19 f4 20 46 6f 72 20 33  |niels..... For 3|
00000040  32 2d 62 69 74 20 6d 61  63 68 69 6e 65 73 0d 00  |2-bit machines..|
00000050  28 1c f4 20 28 63 29 20  42 41 55 20 53 65 70 74  |(.. (c) BAU Sept|
00000060  65 6d 62 65 72 20 31 39  39 33 0d 00 32 05 e0 0d  |ember 1993..2...|
00000070  00 3c 05 3a 0d 00 46 26  dd 20 a4 73 70 72 6d 65  |.<.:..F&. .sprme|
00000080  72 67 65 5f 6e 61 6d 65  3d 22 43 6f 6c 6c 65 63  |rge_name="Collec|
00000090  74 20 73 70 72 69 74 65  73 22 0d 00 50 05 3a 0d  |t sprites"..P.:.|
000000a0  00 5a 2d dd 20 a4 73 70  72 6d 65 72 67 65 5f 61  |.Z-. .sprmerge_a|
000000b0  72 67 73 3d 22 2d 64 69  72 65 63 74 6f 72 79 20  |rgs="-directory |
000000c0  2d 6f 75 74 20 53 70 72  69 74 65 22 0d 00 64 05  |-out Sprite"..d.|
000000d0  3a 0d 00 6e 14 dd 20 a4  73 70 72 6d 65 72 67 65  |:..n.. .sprmerge|
000000e0  5f 69 6e 69 74 0d 00 78  06 3d 30 0d 00 82 05 3a  |_init..x.=0....:|
000000f0  0d 00 8c 19 dd 20 a4 73  70 72 6d 65 72 67 65 28  |..... .sprmerge(|
00000100  69 6e 24 2c 6f 75 74 24  29 0d 00 96 20 ea 20 6f  |in$,out$)... . o|
00000110  75 74 25 2c 73 70 72 69  74 65 73 25 2c 6c 65 6e  |ut%,sprites%,len|
00000120  67 74 68 25 2c 67 65 74  25 0d 00 a0 26 ea 20 73  |gth%,get%...&. s|
00000130  70 72 5f 62 6c 6f 63 6b  25 2c 73 70 72 5f 69 6e  |pr_block%,spr_in|
00000140  6f 75 74 25 2c 73 70 72  5f 73 70 61 63 65 25 0d  |out%,spr_space%.|
00000150  00 aa 46 e7 20 a4 63 6c  61 69 6d 5f 6d 65 6d 6f  |..F. .claim_memo|
00000160  72 79 28 73 70 72 5f 69  6e 6f 75 74 25 2c 73 70  |ry(spr_inout%,sp|
00000170  72 5f 73 70 61 63 65 25  29 3d 30 20 f2 77 61 72  |r_space%)=0 .war|
00000180  6e 28 22 4f 75 74 20 6f  66 20 6d 65 6d 6f 72 79  |n("Out of memory|
00000190  22 29 3a 3d b9 0d 00 b4  12 73 70 72 5f 73 70 61  |"):=.....spr_spa|
000001a0  63 65 25 2d 3d 33 32 0d  00 be 24 73 70 72 5f 62  |ce%-=32...$spr_b|
000001b0  6c 6f 63 6b 25 3d 73 70  72 5f 69 6e 6f 75 74 25  |lock%=spr_inout%|
000001c0  2b 73 70 72 5f 73 70 61  63 65 25 0d 00 c8 10 6f  |+spr_space%....o|
000001d0  75 74 25 3d ae 28 6f 75  74 24 29 0d 00 d2 0d cf  |ut%=.(out$).....|
000001e0  23 6f 75 74 25 3d 31 32  0d 00 dc 0e 73 70 72 69  |#out%=12....spri|
000001f0  74 65 73 25 3d 30 0d 00  e6 15 f2 73 70 72 69 74  |tes%=0.....sprit|
00000200  65 5f 73 63 61 6e 28 69  6e 24 29 0d 00 f0 0c cf  |e_scan(in$).....|
00000210  23 6f 75 74 25 3d 30 0d  00 fa 18 f2 77 70 75 74  |#out%=0.....wput|
00000220  28 6f 75 74 25 2c 73 70  72 69 74 65 73 25 29 0d  |(out%,sprites%).|
00000230  01 04 12 f2 77 70 75 74  28 6f 75 74 25 2c 31 36  |....wput(out%,16|
00000240  29 0d 01 0e 18 f2 77 70  75 74 28 6f 75 74 25 2c  |).....wput(out%,|
00000250  a2 23 6f 75 74 25 2b 34  29 0d 01 18 0b d9 20 23  |.#out%+4)..... #|
00000260  6f 75 74 25 0d 01 22 06  3d 30 0d 01 2c 05 3a 0d  |out%..".=0..,.:.|
00000270  01 36 18 dd 20 f2 73 70  72 69 74 65 5f 73 63 61  |.6.. .sprite_sca|
00000280  6e 28 64 69 72 24 29 0d  01 40 29 ea 20 66 69 6c  |n(dir$)..@). fil|
00000290  65 25 2c 72 65 61 64 25  2c 6c 6f 61 64 25 2c 74  |e%,read%,load%,t|
000002a0  79 70 65 25 2c 6c 65 6e  67 74 68 25 2c 69 6e 25  |ype%,length%,in%|
000002b0  0d 01 4a 05 f5 0d 01 54  40 20 c8 99 20 22 4f 53  |..J....T@ .. "OS|
000002c0  5f 47 42 50 42 22 2c 31  30 2c 64 69 72 24 2c 73  |_GBPB",10,dir$,s|
000002d0  70 72 5f 62 6c 6f 63 6b  25 2c 31 2c 66 69 6c 65  |pr_block%,1,file|
000002e0  25 2c 33 32 20 b8 20 2c  2c 2c 72 65 61 64 25 2c  |%,32 . ,,,read%,|
000002f0  66 69 6c 65 25 0d 01 5e  10 20 e7 20 72 65 61 64  |file%..^. . read|
00000300  25 3d 31 20 8c 0d 01 68  23 20 20 66 69 6c 65 24  |%=1 ...h#  file$|
00000310  3d a4 67 65 74 5f 73 74  72 28 73 70 72 5f 62 6c  |=.get_str(spr_bl|
00000320  6f 63 6b 25 2b 32 30 29  0d 01 72 3b 20 20 c8 99  |ock%+20)..r;  ..|
00000330  20 22 4f 53 5f 46 69 6c  65 22 2c 35 2c 64 69 72  | "OS_File",5,dir|
00000340  24 2b 22 2e 22 2b 66 69  6c 65 24 20 b8 20 74 79  |$+"."+file$ . ty|
00000350  70 65 25 2c 2c 6c 6f 61  64 25 2c 2c 6c 65 6e 67  |pe%,,load%,,leng|
00000360  74 68 25 0d 01 7c 11 20  20 e7 20 74 79 70 65 25  |th%..|.  . type%|
00000370  3d 31 20 8c 0d 01 86 29  20 20 20 e7 20 28 28 6c  |=1 ....)   . ((l|
00000380  6f 61 64 25 20 80 20 26  46 46 46 30 30 29 20 81  |oad% . &FFF00) .|
00000390  20 26 31 30 30 29 3d 26  46 46 39 20 8c 0d 01 90  | &100)=&FF9 ....|
000003a0  1d 20 20 20 20 69 6e 25  3d 8e 28 64 69 72 24 2b  |.    in%=.(dir$+|
000003b0  22 2e 22 2b 66 69 6c 65  24 29 0d 01 9a 1c 20 20  |"."+file$)....  |
000003c0  20 20 73 70 72 69 74 65  73 25 2b 3d a4 77 67 65  |  sprites%+=.wge|
000003d0  74 28 69 6e 25 29 0d 01  a4 10 20 20 20 20 cf 23  |t(in%)....    .#|
000003e0  69 6e 25 3d 31 32 0d 01  ae 13 20 20 20 20 6c 65  |in%=12....    le|
000003f0  6e 67 74 68 25 2d 3d 31  32 0d 01 b8 09 20 20 20  |ngth%-=12....   |
00000400  20 f5 0d 01 c2 3c 20 20  20 20 20 e7 20 6c 65 6e  | ....<     . len|
00000410  67 74 68 25 3e 73 70 72  5f 73 70 61 63 65 25 20  |gth%>spr_space% |
00000420  67 65 74 25 3d 73 70 72  5f 73 70 61 63 65 25 20  |get%=spr_space% |
00000430  8b 20 67 65 74 25 3d 6c  65 6e 67 74 68 25 0d 01  |. get%=length%..|
00000440  cc 2b 20 20 20 20 20 c8  99 20 22 4f 53 5f 47 42  |.+     .. "OS_GB|
00000450  50 42 22 2c 34 2c 69 6e  25 2c 73 70 72 5f 69 6e  |PB",4,in%,spr_in|
00000460  6f 75 74 25 2c 67 65 74  25 0d 01 d6 2c 20 20 20  |out%,get%...,   |
00000470  20 20 c8 99 20 22 4f 53  5f 47 42 50 42 22 2c 32  |  .. "OS_GBPB",2|
00000480  2c 6f 75 74 25 2c 73 70  72 5f 69 6e 6f 75 74 25  |,out%,spr_inout%|
00000490  2c 67 65 74 25 0d 01 e0  16 20 20 20 20 20 6c 65  |,get%....     le|
000004a0  6e 67 74 68 25 2d 3d 67  65 74 25 0d 01 ea 13 20  |ngth%-=get%.... |
000004b0  20 20 20 fd 20 6c 65 6e  67 74 68 25 3d 30 0d 01  |   . length%=0..|
000004c0  f4 0e 20 20 20 20 d9 20  23 69 6e 25 0d 01 fe 08  |..    . #in%....|
000004d0  20 20 20 cd 0d 02 08 07  20 20 cc 0d 02 12 23 20  |   .....  ....# |
000004e0  20 20 f2 73 70 72 69 74  65 5f 73 63 61 6e 28 64  |  .sprite_scan(d|
000004f0  69 72 24 2b 22 2e 22 2b  66 69 6c 65 24 29 0d 02  |ir$+"."+file$)..|
00000500  1c 07 20 20 cd 0d 02 26  06 20 cd 0d 02 30 0e fd  |..  ...&. ...0..|
00000510  20 66 69 6c 65 25 3d 2d  31 0d 02 3a 05 e1 0d ff  | file%=-1..:....|
00000520