Home » Archimedes archive » Acorn User » AU 1995-11.adf » !Regulars » Regulars/StarInfo/Ord/!OrdFSI/FSI

Regulars/StarInfo/Ord/!OrdFSI/FSI

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 1995-11.adf » !Regulars
Filename: Regulars/StarInfo/Ord/!OrdFSI/FSI
Read OK:
File size: 05C7 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM Development program
   20REM By Andrew Ord
   21
   22REM set the width and height variables
   23width%=200:height%=140
   30PRINT "Width = ";width%; " Height = ";height%
   40INPUT "24 bit source file : "image$
   50INPUT "Palette file       : "pal$
   60INPUT "8pp output file    : "output$
   70IF output$="" output$="Output"
   80
   90REM Load the image data, 24-bit data
  100image%=FNloaddata(image$)
  110
  120REM Load the palette defintion
  130pal%=FNloaddata(pal$):lut%=pal%+1024
  170
  180REM Create a sprite to hold the picture
  190len%=width%*height%+60+2048
  200DIM soutput% len%
  210!soutput%=len%:soutput%!8=16:SYS"OS_SpriteOp",256+9,soutput%
  220SYS"OS_SpriteOp",256+15,soutput%,"image",0,width%,height%,21
  230
  240REM Create sprite palette with 256 entries
  250SYS"OS_SpriteOp",256+37,soutput%,"image",1<<31
  260SYS"OS_SpriteOp",256+37,soutput%,"image",-1 TO ,,,,palptr%
  270
  280REM copy the palette from the palette definition file to the sprites palette
  290FOR I%=0 TO 255
  300palout%=palptr%+(I%*8)
  310palout%!0=pal%!(I%*4) AND NOT &FF
  320palout%!4=pal%!(I%*4) AND NOT &FF
  330NEXT I%
  340
  350REM Calculate where the image data goes
  360offset%=!(soutput%+soutput%!8+32):output%=soutput%+offset%+soutput%!8
  370
  380REM Create and clear the table
  390DIM t% 2*12*width%:half%=12*width%
  400FOR I%=0 TO 2*half% STEP 4:t%!I%=0:NEXT I%
  410
  420REM Call the dither routines
  430SYS"IPC_Dither",image%,output%,width%,height%,pal%,lut%,t%
  440
  450SYS"OS_SpriteOp",256+12,soutput%,output$
  460END
  470
  480
  490DEFFNloaddata(f$)
  500X%=OPENIN f$:s%=EXT#X%:CLOSE#X%:DIM a% s%:OSCLI"Load "+f$+" "+STR$~a%
  510=a%

� Development program
� By Andrew Ord

(� set the width and height variables
width%=200:height%=140
-� "Width = ";width%; " Height = ";height%
(#� "24 bit source file : "image$
2!� "Palette file       : "pal$
<$� "8pp output file    : "output$
F!� output$="" output$="Output"
P
Z&� Load the image data, 24-bit data
dimage%=�loaddata(image$)
n
x � Load the palette defintion
�'pal%=�loaddata(pal$):lut%=pal%+1024
�
�)� Create a sprite to hold the picture
�len%=width%*height%+60+2048
�� soutput% len%
�?!soutput%=len%:soutput%!8=16:ș"OS_SpriteOp",256+9,soutput%
�?ș"OS_SpriteOp",256+15,soutput%,"image",0,width%,height%,21
�
�,� Create sprite palette with 256 entries
�1ș"OS_SpriteOp",256+37,soutput%,"image",1<<31
<ș"OS_SpriteOp",256+37,soutput%,"image",-1 � ,,,,palptr%

N� copy the palette from the palette definition file to the sprites palette
"� I%=0 � 255
,palout%=palptr%+(I%*8)
6!palout%!0=pal%!(I%*4) � � &FF
@!palout%!4=pal%!(I%*4) � � &FF
J� I%
T
^)� Calculate where the image data goes
hIoffset%=!(soutput%+soutput%!8+32):output%=soutput%+offset%+soutput%!8
r
| � Create and clear the table
�$� t% 2*12*width%:half%=12*width%
�%� I%=0 � 2*half% � 4:t%!I%=0:� I%
�
�� Call the dither routines
�=ș"IPC_Dither",image%,output%,width%,height%,pal%,lut%,t%
�
�+ș"OS_SpriteOp",256+12,soutput%,output$
��
�
�
�ݤloaddata(f$)
�5X%=� f$:s%=�#X%:�#X%:� a% s%:�"Load "+f$+" "+�~a%
�=a%
�
00000000  0d 00 0a 19 f4 20 44 65  76 65 6c 6f 70 6d 65 6e  |..... Developmen|
00000010  74 20 70 72 6f 67 72 61  6d 0d 00 14 13 f4 20 42  |t program..... B|
00000020  79 20 41 6e 64 72 65 77  20 4f 72 64 0d 00 15 04  |y Andrew Ord....|
00000030  0d 00 16 28 f4 20 73 65  74 20 74 68 65 20 77 69  |...(. set the wi|
00000040  64 74 68 20 61 6e 64 20  68 65 69 67 68 74 20 76  |dth and height v|
00000050  61 72 69 61 62 6c 65 73  0d 00 17 1a 77 69 64 74  |ariables....widt|
00000060  68 25 3d 32 30 30 3a 68  65 69 67 68 74 25 3d 31  |h%=200:height%=1|
00000070  34 30 0d 00 1e 2d f1 20  22 57 69 64 74 68 20 3d  |40...-. "Width =|
00000080  20 22 3b 77 69 64 74 68  25 3b 20 22 20 48 65 69  | ";width%; " Hei|
00000090  67 68 74 20 3d 20 22 3b  68 65 69 67 68 74 25 0d  |ght = ";height%.|
000000a0  00 28 23 e8 20 22 32 34  20 62 69 74 20 73 6f 75  |.(#. "24 bit sou|
000000b0  72 63 65 20 66 69 6c 65  20 3a 20 22 69 6d 61 67  |rce file : "imag|
000000c0  65 24 0d 00 32 21 e8 20  22 50 61 6c 65 74 74 65  |e$..2!. "Palette|
000000d0  20 66 69 6c 65 20 20 20  20 20 20 20 3a 20 22 70  | file       : "p|
000000e0  61 6c 24 0d 00 3c 24 e8  20 22 38 70 70 20 6f 75  |al$..<$. "8pp ou|
000000f0  74 70 75 74 20 66 69 6c  65 20 20 20 20 3a 20 22  |tput file    : "|
00000100  6f 75 74 70 75 74 24 0d  00 46 21 e7 20 6f 75 74  |output$..F!. out|
00000110  70 75 74 24 3d 22 22 20  6f 75 74 70 75 74 24 3d  |put$="" output$=|
00000120  22 4f 75 74 70 75 74 22  0d 00 50 04 0d 00 5a 26  |"Output"..P...Z&|
00000130  f4 20 4c 6f 61 64 20 74  68 65 20 69 6d 61 67 65  |. Load the image|
00000140  20 64 61 74 61 2c 20 32  34 2d 62 69 74 20 64 61  | data, 24-bit da|
00000150  74 61 0d 00 64 1c 69 6d  61 67 65 25 3d a4 6c 6f  |ta..d.image%=.lo|
00000160  61 64 64 61 74 61 28 69  6d 61 67 65 24 29 0d 00  |addata(image$)..|
00000170  6e 04 0d 00 78 20 f4 20  4c 6f 61 64 20 74 68 65  |n...x . Load the|
00000180  20 70 61 6c 65 74 74 65  20 64 65 66 69 6e 74 69  | palette definti|
00000190  6f 6e 0d 00 82 27 70 61  6c 25 3d a4 6c 6f 61 64  |on...'pal%=.load|
000001a0  64 61 74 61 28 70 61 6c  24 29 3a 6c 75 74 25 3d  |data(pal$):lut%=|
000001b0  70 61 6c 25 2b 31 30 32  34 0d 00 aa 04 0d 00 b4  |pal%+1024.......|
000001c0  29 f4 20 43 72 65 61 74  65 20 61 20 73 70 72 69  |). Create a spri|
000001d0  74 65 20 74 6f 20 68 6f  6c 64 20 74 68 65 20 70  |te to hold the p|
000001e0  69 63 74 75 72 65 0d 00  be 1f 6c 65 6e 25 3d 77  |icture....len%=w|
000001f0  69 64 74 68 25 2a 68 65  69 67 68 74 25 2b 36 30  |idth%*height%+60|
00000200  2b 32 30 34 38 0d 00 c8  13 de 20 73 6f 75 74 70  |+2048..... soutp|
00000210  75 74 25 20 6c 65 6e 25  0d 00 d2 3f 21 73 6f 75  |ut% len%...?!sou|
00000220  74 70 75 74 25 3d 6c 65  6e 25 3a 73 6f 75 74 70  |tput%=len%:soutp|
00000230  75 74 25 21 38 3d 31 36  3a c8 99 22 4f 53 5f 53  |ut%!8=16:.."OS_S|
00000240  70 72 69 74 65 4f 70 22  2c 32 35 36 2b 39 2c 73  |priteOp",256+9,s|
00000250  6f 75 74 70 75 74 25 0d  00 dc 3f c8 99 22 4f 53  |output%...?.."OS|
00000260  5f 53 70 72 69 74 65 4f  70 22 2c 32 35 36 2b 31  |_SpriteOp",256+1|
00000270  35 2c 73 6f 75 74 70 75  74 25 2c 22 69 6d 61 67  |5,soutput%,"imag|
00000280  65 22 2c 30 2c 77 69 64  74 68 25 2c 68 65 69 67  |e",0,width%,heig|
00000290  68 74 25 2c 32 31 0d 00  e6 04 0d 00 f0 2c f4 20  |ht%,21.......,. |
000002a0  43 72 65 61 74 65 20 73  70 72 69 74 65 20 70 61  |Create sprite pa|
000002b0  6c 65 74 74 65 20 77 69  74 68 20 32 35 36 20 65  |lette with 256 e|
000002c0  6e 74 72 69 65 73 0d 00  fa 31 c8 99 22 4f 53 5f  |ntries...1.."OS_|
000002d0  53 70 72 69 74 65 4f 70  22 2c 32 35 36 2b 33 37  |SpriteOp",256+37|
000002e0  2c 73 6f 75 74 70 75 74  25 2c 22 69 6d 61 67 65  |,soutput%,"image|
000002f0  22 2c 31 3c 3c 33 31 0d  01 04 3c c8 99 22 4f 53  |",1<<31...<.."OS|
00000300  5f 53 70 72 69 74 65 4f  70 22 2c 32 35 36 2b 33  |_SpriteOp",256+3|
00000310  37 2c 73 6f 75 74 70 75  74 25 2c 22 69 6d 61 67  |7,soutput%,"imag|
00000320  65 22 2c 2d 31 20 b8 20  2c 2c 2c 2c 70 61 6c 70  |e",-1 . ,,,,palp|
00000330  74 72 25 0d 01 0e 04 0d  01 18 4e f4 20 63 6f 70  |tr%.......N. cop|
00000340  79 20 74 68 65 20 70 61  6c 65 74 74 65 20 66 72  |y the palette fr|
00000350  6f 6d 20 74 68 65 20 70  61 6c 65 74 74 65 20 64  |om the palette d|
00000360  65 66 69 6e 69 74 69 6f  6e 20 66 69 6c 65 20 74  |efinition file t|
00000370  6f 20 74 68 65 20 73 70  72 69 74 65 73 20 70 61  |o the sprites pa|
00000380  6c 65 74 74 65 0d 01 22  10 e3 20 49 25 3d 30 20  |lette..".. I%=0 |
00000390  b8 20 32 35 35 0d 01 2c  1a 70 61 6c 6f 75 74 25  |. 255..,.palout%|
000003a0  3d 70 61 6c 70 74 72 25  2b 28 49 25 2a 38 29 0d  |=palptr%+(I%*8).|
000003b0  01 36 21 70 61 6c 6f 75  74 25 21 30 3d 70 61 6c  |.6!palout%!0=pal|
000003c0  25 21 28 49 25 2a 34 29  20 80 20 ac 20 26 46 46  |%!(I%*4) . . &FF|
000003d0  0d 01 40 21 70 61 6c 6f  75 74 25 21 34 3d 70 61  |..@!palout%!4=pa|
000003e0  6c 25 21 28 49 25 2a 34  29 20 80 20 ac 20 26 46  |l%!(I%*4) . . &F|
000003f0  46 0d 01 4a 08 ed 20 49  25 0d 01 54 04 0d 01 5e  |F..J.. I%..T...^|
00000400  29 f4 20 43 61 6c 63 75  6c 61 74 65 20 77 68 65  |). Calculate whe|
00000410  72 65 20 74 68 65 20 69  6d 61 67 65 20 64 61 74  |re the image dat|
00000420  61 20 67 6f 65 73 0d 01  68 49 6f 66 66 73 65 74  |a goes..hIoffset|
00000430  25 3d 21 28 73 6f 75 74  70 75 74 25 2b 73 6f 75  |%=!(soutput%+sou|
00000440  74 70 75 74 25 21 38 2b  33 32 29 3a 6f 75 74 70  |tput%!8+32):outp|
00000450  75 74 25 3d 73 6f 75 74  70 75 74 25 2b 6f 66 66  |ut%=soutput%+off|
00000460  73 65 74 25 2b 73 6f 75  74 70 75 74 25 21 38 0d  |set%+soutput%!8.|
00000470  01 72 04 0d 01 7c 20 f4  20 43 72 65 61 74 65 20  |.r...| . Create |
00000480  61 6e 64 20 63 6c 65 61  72 20 74 68 65 20 74 61  |and clear the ta|
00000490  62 6c 65 0d 01 86 24 de  20 74 25 20 32 2a 31 32  |ble...$. t% 2*12|
000004a0  2a 77 69 64 74 68 25 3a  68 61 6c 66 25 3d 31 32  |*width%:half%=12|
000004b0  2a 77 69 64 74 68 25 0d  01 90 25 e3 20 49 25 3d  |*width%...%. I%=|
000004c0  30 20 b8 20 32 2a 68 61  6c 66 25 20 88 20 34 3a  |0 . 2*half% . 4:|
000004d0  74 25 21 49 25 3d 30 3a  ed 20 49 25 0d 01 9a 04  |t%!I%=0:. I%....|
000004e0  0d 01 a4 1e f4 20 43 61  6c 6c 20 74 68 65 20 64  |..... Call the d|
000004f0  69 74 68 65 72 20 72 6f  75 74 69 6e 65 73 0d 01  |ither routines..|
00000500  ae 3d c8 99 22 49 50 43  5f 44 69 74 68 65 72 22  |.=.."IPC_Dither"|
00000510  2c 69 6d 61 67 65 25 2c  6f 75 74 70 75 74 25 2c  |,image%,output%,|
00000520  77 69 64 74 68 25 2c 68  65 69 67 68 74 25 2c 70  |width%,height%,p|
00000530  61 6c 25 2c 6c 75 74 25  2c 74 25 0d 01 b8 04 0d  |al%,lut%,t%.....|
00000540  01 c2 2b c8 99 22 4f 53  5f 53 70 72 69 74 65 4f  |..+.."OS_SpriteO|
00000550  70 22 2c 32 35 36 2b 31  32 2c 73 6f 75 74 70 75  |p",256+12,soutpu|
00000560  74 25 2c 6f 75 74 70 75  74 24 0d 01 cc 05 e0 0d  |t%,output$......|
00000570  01 d6 04 0d 01 e0 04 0d  01 ea 12 dd a4 6c 6f 61  |.............loa|
00000580  64 64 61 74 61 28 66 24  29 0d 01 f4 35 58 25 3d  |ddata(f$)...5X%=|
00000590  8e 20 66 24 3a 73 25 3d  a2 23 58 25 3a d9 23 58  |. f$:s%=.#X%:.#X|
000005a0  25 3a de 20 61 25 20 73  25 3a ff 22 4c 6f 61 64  |%:. a% s%:."Load|
000005b0  20 22 2b 66 24 2b 22 20  22 2b c3 7e 61 25 0d 01  | "+f$+" "+.~a%..|
000005c0  fe 07 3d 61 25 0d ff                              |..=a%..|
000005c7