Home » Archimedes archive » Archimedes World » AW Readers Services Special FebMar 92.adf » !ArcWorld/Goodies/ChangeFSI/Library/ChangeFSI

!ArcWorld/Goodies/ChangeFSI/Library/ChangeFSI

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 Readers Services Special FebMar 92.adf
Filename: !ArcWorld/Goodies/ChangeFSI/Library/ChangeFSI
Read OK:
File size: 12643 bytes
Load address: FFFFFB42
Exec address: 178A4E3B
File contents
   10REM > %.ChangeFSI
   20REM
   30REM This program written by Roger Wilson at Acorn Computers April-Dec 1989
   40REM - please send bugs back!
   50REM Subject to change without notice
   60REM
   70REM all information is held in 32 bit fixed point with the . at bit 28
   80REM this gives an integer range of 0-15 (OR negative numbers!)
   90REM
  100REM ChangeFSI is written so as to allow use from CLI and from other BASIC
  110REM programs such as WIMP front ends
  120REM
  130SYS"OS_GetEnv" TO A$:REM Read CLI string
  140mem=HIMEM:REM Remember memory size
  150END=&4000000:REM Grab all the memory
  160foo%=0:A%=FNChangeFSI(A$,-1,-1,0,-1,-1,foo%,TRUE):REM Call program
  170END=mem:REM Release memory
  180END
  190REM A$ Command String
  200REM spritearea% address or -1
  210REM
  220REM workspace%<0 and worklimit%=0       - Use BASIC variable space
  230REM
  240REM workspace%<0                        - ChangeFSI's slot handling
  250REM worklimit%=current end of wimp slot   will be used.
  260REM
  270REM workspace%>=0                       - Use memory at workspace%
  280REM worklimit%=end of workspace%
  290REM
  300REM save%   TRUE  = save to output file given in command string
  310REM output% TRUE  = print messages (and histograms if appropriate)
  320REM                 during processing
  330REM ram% receives address of sprite area
  340REM fast%   TRUE  = switch to mode 0 for processing
  350REM
  360REM Returned values
  370REM 0  =Image processed as requested
  380REM 1  =Information messages printed
  390REM 100=Error - image may not be complete
  400REM
  410DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,save%,output%,RETURN ram%,fast%)
  420LOCAL A$(),r%(),g%(),b%(),rpal%(),gpal%(),bpal%(),table%(),cl%(),xl%(),xp%()
  430LOCAL rm%(),rm1%(),rm2%(),vals%(),nl%(),z2%(),A%(),B%(),new%(),st%()
  440WHILELEFT$(A$,1)<>" "ANDLENA$<>0 A$=MID$(A$,2):ENDWHILE
  450WHILELEFT$(A$,1)=" " A$=MID$(A$,2):ENDWHILE
  460WHILERIGHT$(A$,1)=" " A$=LEFT$(A$):ENDWHILE
  470IFFNuc(LEFT$(A$,5))="-QUIT" THEN
  480 A$=MID$(A$,7):WHILELEFT$(A$,1)<>" "ANDLENA$<>0 A$=MID$(A$,2):ENDWHILE
  490 WHILELEFT$(A$,1)=" " A$=MID$(A$,2):ENDWHILE
  500ENDIF
  510DIM A$(100):ARG%=0:B%=INSTR(A$," ")
  520WHILE B%<>0
  530 ARG%+=1:A$(ARG%)=LEFT$(A$,B%-1):A$=MID$(A$,B%+1)
  540 WHILE LEFT$(A$,1)=" ":A$=MID$(A$,2):ENDWHILE
  550 B%=INSTR(A$," ")
  560ENDWHILE
  570IFA$<>"" ARG%+=1:A$(ARG%)=A$
  580IFFNuc(A$(1))="-HELP" THEN
  590PRINT"Change picture Floyd Steinberg Integer  version 0.69 (12 Dec 89): -help"'
  600PRINT"Use: ChangeFSI <in file> <out file> <mode>[cdt] [<n>:<n> [<n>:<n>]] [options]"
  610PRINT"Changes source multi-colour picture to output sprite 1, 2, 4 or 8 bit per pixel"
  620PRINT"in specified mode, with suffix:"
  630PRINT"   c suffix for 2 or 4 bit colour in 2 or 4 bit per pixel modes"
  640PRINT"     for clustered pixel output in 1 bit per pixel modes"
  650PRINT"   d for digital rgb with 4 bit per pixel modes"
  660PRINT"   t for no tint in 8 bit modes and 16 level grey scale in 4 bit modes"
  670PRINT"The pixel size is corrected for and the default is output of the same size as"
  680PRINT"the input. Size ratios are output:input or = for scale to output size."'
  690PRINT"Mode 'aim' writes an aim format output file."'
  700PRINT"The -equal option performs histogram equalisation on monochrome output."
  710PRINT"The -hflip option presents the picture left/right reversed."
  720PRINT"The -info option gives details of the source image."
  730PRINT"The -invert option inverts the colour range of the input image."
  740PRINT"The -noscale option disables automatic pixel size correction."
  750PRINT"The -range option expands the input's dynamic range to full scale."
  760PRINT"The -sharpen option digitally sharpens the picture, -sharpen<n> overrides the"
  770PRINT"    default of 24: range 8(harsh)-31(soft)."
  780PRINT"The -vflip option presents the picture up side down."
  790PRINT"Example: changefsi input output 21t 1:2 = -sharpen12 -range"'
  800PRINT"ChangeFSI -formats gives details of input formats."
  810=1
  820ENDIF
  830IFFNuc(A$(1))="-FORMATS" THEN
  840PRINT"Input formats understood are:                 Recognised by:"'
  850PRINT"RISC OS 1, 2, 4 and 8 bit per pixel sprites   [file type FF9]"
  860PRINT"Watford digitiser pictures 512x256y64g        [file type DFA]"
  870PRINT"   and triple red, green, blue seperations    [directory of r,g,b DFA]"
  880PRINT"ProArtisan compressed pictures 640x256y256c   [file type DE2]"
  890PRINT"TimeStep satellite image 800x800y256g         [file type 7A0]"
  900PRINT"TimeStep satellite image 128x256y256g         [file type 300]"
  910PRINT"   and triple red, green, blue seperations    [directory of r,g,b 300]"
  920PRINT"AIM/Wild Vision Hawk V10 files 256x256y256g   [file type 004]"
  930PRINT"TIFF pictures                                 [II* or MM* in file]"
  940PRINT"Electronic Art's IFF ILBM pictures            [ILBM in file]"
  950PRINT"Sun 1 bit per pixel files                     [&956AA659 in file]"
  960PRINT".PIC 8 bit per pixel files                    [AV_VO in file]"
  970PRINT"MILLIPEDE PRISMA 768x576y 8 bit colour images [MILLIPEDE in file]"
  980PRINT"Compuserve's GIF files up to 8 bit per pixel  [GIF87a in file]"
  990PRINT"ArVis 15 bit HIP.+LOP. sprites                [file type FF9, HIP. name]"
 1000PRINT"GEM IMG. images                [&00010008 in file or name includes img.]"
 1010PRINT"PC EGA .DSP images 640x350y16c                [name includes dsp.]"
 1020PRINT"MTV 24 bit pic. images                        [name includes pic.]"
 1030PRINT"QRT 24 bit .raw images                        [name ends in .raw]"
 1040PRINT"RT 24 bit run length coded image. files       [name includes image.]"
 1050=1
 1060ENDIF
 1070invert%=FALSE:range%=FALSE:sharpen%=FALSE:info%=FALSE
 1080hist%=FALSE:equal%=FALSE:vflip%=FALSE:hflip%=FALSE:scale%=TRUE
 1090IFARG%<3 THEN
 1100 PRINT"ChangeFSI interactive input [try 'ChangeFSI -help' for command line]"
 1110 INPUT"Source file: "s$,"Destination file: "f$,"Output mode: "m$
 1120 INPUT"(X)Scale (e.g. 2:1): "xs$:INPUT"Y Scale: "ys$
 1130 INPUT"Info on input picture?"a$:IFFNuc(LEFT$(a$,1))="Y" info%=TRUE
 1140 INPUT"Invert picture colours?"a$:IFFNuc(LEFT$(a$,1))="Y" invert%=TRUE
 1150 INPUT"Compute histogram of input?"a$:IFFNuc(LEFT$(a$,1))="Y" hist%=TRUE
 1160 INPUT"Apply histogram equalisation?"a$:IFFNuc(LEFT$(a$,1))="Y" equal%=TRUE
 1170 INPUT"Expand input dynamic range?"a$:IFFNuc(LEFT$(a$,1))="Y" range%=TRUE:equal%=FALSE
 1180 INPUT"Sharpen picture by (e.g. 12 for harsh, 24 for soft) "a$
 1190 IFa$<>"" sharpen%=VALa$
 1200ELSE
 1210 REPEAT A%=ARG%
 1220  IFFNuc(A$(ARG%))="-INFO" info%=TRUE:A$(ARG%)="":ARG%-=1
 1230  IFFNuc(A$(ARG%))="-HIST" hist%=TRUE:A$(ARG%)="":ARG%-=1
 1240  IFFNuc(A$(ARG%))="-EQUAL" equal%=TRUE:range%=FALSE:A$(ARG%)="":ARG%-=1
 1250  IFFNuc(A$(ARG%))="-RANGE" range%=TRUE:equal%=FALSE:A$(ARG%)="":ARG%-=1
 1260  IFFNuc(A$(ARG%))="-INVERT" invert%=TRUE:A$(ARG%)="":ARG%-=1
 1270  IFFNuc(A$(ARG%))="-NOSCALE" scale%=FALSE:A$(ARG%)="":ARG%-=1
 1280  IFFNuc(A$(ARG%))="-VFLIP" vflip%=TRUE:A$(ARG%)="":ARG%-=1
 1290  IFFNuc(A$(ARG%))="-HFLIP" hflip%=TRUE:A$(ARG%)="":ARG%-=1
 1300  IFFNuc(LEFT$(A$(ARG%),8))="-SHARPEN" THEN
 1310   sharpen%=TRUE:IFLENA$(ARG%)>8 sharpen%=VALMID$(A$(ARG%),9)
 1320   A$(ARG%)="":ARG%-=1
 1330  ENDIF
 1340 UNTILA%=ARG%
 1350 s$=A$(1):f$=A$(2):m$=A$(3):xs$=A$(4):ys$=A$(5)
 1360ENDIF
 1370IFoutput% ELSEinfo%=FALSE:REM if no output, then no info!
 1380IFworkspace%>=0 THEN
 1390 flex%=FALSE
 1400ELSE
 1410 IFworklimit%=0 THEN flex%=FALSE ELSE flex%=TRUE:nextlocation%=worklimit%
 1420ENDIF
 1430CASE FNuc(m$) OF
 1440 WHEN"AIM":m=-1:m$=""
 1450 OTHERWISE:m=VALm$:m$=FNuc(RIGHT$(m$,1)):IFINSTR("CDT",m$)=0 m$=""
 1460ENDCASE
 1470IFxs$="" OR LEFT$(xs$,1)="-" THEN
 1480 xmul%=1:xdiv%=1:ymul%=1:ydiv%=1
 1490ELSE
 1500 IFys$="" ys$=xs$
 1510 xmul%=VALxs$:xdiv%=VALMID$(xs$,INSTR(xs$,":")+1)
 1520 ymul%=VALys$:ydiv%=VALMID$(ys$,INSTR(ys$,":")+1)
 1530ENDIF
 1540flag=-1:SYS8,5,s$ TO r0,,r2:dir=r0=2
 1550IFdir THEN
 1560 panic=TRUE:SYS8,5,s$+".raw" TO r0,,r2:IFr0=1 s$+=".raw":dir=FALSE:panic=FALSE
 1570 IFpanic SYS8,5,s$+".red" TO r0,,r2:IFr0=1 panic=FALSE
 1580 IFpanic ERROR 42,"Directory given"
 1590ENDIF
 1600ftype=r2>>8 AND &FFF:bits=28:F=2^bits:c%=0:cc%=0:ccc%=0
 1610IFdir THEN
 1620 c%=OPENIN(s$+".red"):IFc%=0 ERROR 42,"Red file "+s$+".red not found"
 1630 cc%=OPENIN(s$+".green"):IFcc%=0 ERROR42,"Green file "+s$+".green not found"
 1640 ccc%=OPENIN(s$+".blue"):IFccc%=0 ERROR42,"Blue file "+s$+".blue not found"
 1650ELSE
 1660 c%=OPENINs$:IFc%=0 ERROR 42,"File "+s$+" not found"
 1670ENDIF
 1680rwt=.30:gwt=.59:bwt=.11:REM CIE Y weightings for R, G, B
 1690DIM r%(255):REM monochrome colour map
 1700DIM g%(255),b%(255):REM colour maps: in 0-255 out 0-1 fixed point
 1710CASE ftype OF
 1720WHEN &FF9:flag=0
 1730 IFINSTR("."+FNuc(s$),".HIP.")ORINSTR(FNuc(s$),":HIP.") THEN
 1740  flag=300:I%=INSTR(FNuc(s$),"HIP.")
 1750  MID$(s$,I%)="LOP.":cc%=OPENINs$:IFcc%=0 ERROR42,"Can't find Lop file "+s$
 1760 ENDIF
 1770WHEN &DFA:flag=800:IFdir flag=801
 1780WHEN &DE2:flag=1000
 1790WHEN &7A0:flag=1200
 1800WHEN &300:flag=1300:IFdir flag=1301
 1810WHEN 4:flag=900:IFdir flag=901
 1820OTHERWISE
 1830 PTR#c%=0:S$="":FORI%=1TO6:S$+=CHR$BGET#c%:NEXT
 1840 IFS$="GIF87a" flag=500
 1850 IFflag=-1 IFLEFT$(S$,5)="AV_VO" flag=600
 1860 IFflag=-1 IFLEFT$(S$,4)=CHR$&59+CHR$&A6+CHR$&6A+CHR$&95 flag=1100
 1870 IFflag=-1 IFLEFT$(S$,4)=CHR$0+CHR$1+CHR$0+CHR$8 flag=1400
 1880 IFflag=-1 IFLEFT$(S$,4)="II*"+CHR$0 flag=1500:bigendian=FALSE
 1890 IFflag=-1 IFLEFT$(S$,4)="MM"+CHR$0+"*" flag=1500:bigendian=TRUE
 1900 IFflag=-1 IFLEFT$(S$,4)="RIX3" flag=2000
 1910 IFflag=-1 IFLEFT$(S$,4)="FORM" THEN
 1920  PTR#c%=8:S$=CHR$BGET#c%+CHR$BGET#c%+CHR$BGET#c%+CHR$BGET#c%
 1930  IFS$="ILBM" flag=1600
 1940 ENDIF
 1950 IFflag=-1 THEN
 1960  PTR#c%=&10:S$="":FORI%=1TO9:S$+=CHR$BGET#c%:NEXT
 1970  IFS$="MILLIPEDE" flag=200
 1980 ENDIF
 1990 IFflag=-1 IFINSTR("."+FNuc(s$),".IMAGE.")ORINSTR(FNuc(s$),":IMAGE.") flag=400
 2000 IFflag=-1 IFFNuc(RIGHT$(s$,4))=".RAW" flag=100
 2010 IFflag=-1 IFINSTR("."+FNuc(s$),".PIC.")ORINSTR(FNuc(s$),":PIC.") flag=700
 2020 IFflag=-1 IFINSTR("."+FNuc(s$),".IMG.")ORINSTR(FNuc(s$),":IMG.") flag=1400
 2030 IFflag=-1 IFINSTR("."+FNuc(s$),".DSP.")ORINSTR(FNuc(s$),":DSP.") flag=1700
 2040ENDCASE
 2050IFflag=-1:ERROR 42,"Sorry: format not recognised - please try again or contact your supplier"
 2060IFfast% IFMODE<>0 MODE0
 2070input=8:ham=0:planar=0:bigendianbits=FALSE:compression=0:CASE flag OF
 2080WHEN 0:REM Archimedes Sprite file
 2090 quant%=4:PTR#c%=&2c:st%=FNW+(&38-&2c):PTR#c%=&34:sm=FNW:SYS53,sm,3 TO ,,I%
 2100 CASE I% OF
 2110 WHEN 1:flag=9:IFst%=&38 PROCdefpal2 ELSE PROCipal(2)
 2120  PTR#c%=&1c:sx%=(FNW+1)*32:buff%=FNdim(sx%>>3):input=1
 2130 WHEN 3:flag=6:IFst%=&38 PROCdefpal4 ELSE PROCipal(4)
 2140  PTR#c%=&1c:sx%=(FNW+1)*16:buff%=FNdim(sx%>>2):input=2
 2150 WHEN 15:flag=3:IFst%=&38 PROCdefpal16 ELSE PROCipal(16)
 2160  PTR#c%=&1c:sx%=(FNW+1)*8:buff%=FNdim(sx%>>1):input=4
 2170 WHEN 63:IFst%=&38 PROCdefpal ELSE PROCipal63
 2180  PTR#c%=&1c:sx%=(FNW+1)*4:buff%=FNdim(sx%)
 2190 OTHERWISE ERROR42,"Not understood RISC OS sprite"
 2200 ENDCASE
 2210 sy%=FNW+1:PTR#c%=st%
 2220 SYS53,sm,4 TO ,,nx:SYS53,sm,5 TO ,,ny:nx=1<<nx:ny=1<<ny
 2230 IFscale% xmul%=xmul%*nx/2:ymul%=ymul%*ny/2
 2240 info$="RISC OS sprite, mode "+STR$sm+" "+STR$sx%+" by "+STR$sy%+" pixels, "+STR$input+" bits per pixel"
 2250WHEN 100:REM QRT ".raw" image
 2260 quant%=8:PTR#c%=0:sx%=FNHW:sy%=FNHW:PROCnopal:input=24:step24=1
 2270 buff%=FNdim(sx%*3):rb%=buff%:gb%=buff%+sx%:bb%=buff%+2*sx%:PROCsize
 2280 info$="QRT .raw image, "+STR$sx%+" by "+STR$sy%+" pixels, 24 bits per pixel"
 2290WHEN 200:REM CadSoft Image
 2300 quant%=8:PTR#c%=9:sx%=(FNHW+2)/2:sy%=(FNHW+2)/2:REM round and convert to pixels
 2310 PTR#c%=&1a:cadsofttype%=BGET#c%:PTR#c%=&200
 2320 FORC%=0TO255:r%(C%)=BGET#c%/255*F:NEXT
 2330 FORC%=0TO255:g%(C%)=BGET#c%/255*F:NEXT
 2340 FORC%=0TO255:b%(C%)=BGET#c%/255*F:NEXT
 2350 PTR#c%=&600:IFcadsofttype%=2 capix%=0:flag=201
 2360 buff%=FNdim(sx%):casx%=buff%+sx%:PROCsize
 2370 info$="Cadsoft type "+STR$cadsofttype%+" image, "+STR$sx%+" by "+STR$sy%+" pixels, 8 bits per pixel"
 2380WHEN 300:REM Arvis Video
 2390 quant%=5:PTR#c%=&2c:st%=FNW+(&38-&2c):PTR#cc%=&2c:stcc%=FNW1(cc%)+(&38-&2c)
 2400 PTR#c%=&1c:sx%=(FNW+1)*4:sy%=FNW+1:PTR#c%=st%:PTR#cc%=stcc%
 2410 DIM rpal%(255),gpal%(255),bpal%(255)
 2420 FORC%=0TO255
 2430  rpal%(C%)=(C%AND7)/31*F
 2440  gpal%(C%)=((C%AND64)>>6)/31*F
 2450  bpal%(C%)=(C%>>3AND7)/31*F
 2460  r%(C%)=(C%AND16 OR (C%AND4)<<1)/31*F
 2470  g%(C%)=((C%AND&60)>>2 OR (C%AND3)<<1)/31*F
 2480  b%(C%)=((C%AND128)>>3 OR C%AND8)/31*F
 2490 NEXT
 2500 buff%=FNdim(sx%*2):ab%=buff%-1:bb%=buff%+sx%-1:IFscale% ymul%=ymul%*2
 2510 info$="ArVis image, "+STR$sx%+" by "+STR$sy%+" pixels, 15 bits per pixel"
 2520WHEN 400:REM RT "image."
 2530 quant%=8:PTR#c%=0:sx%=FNbeHW:sy%=FNbeHW:X%=FNbeHW:PTR#c%=PTR#c%+X%
 2540 buff%=FNdim(sx%*3):rb%=buff%:gb%=buff%+sx%:bb%=buff%+2*sx%
 2550 PROCnopal:input=24:step24=1:rtpix%=0:PROCsize
 2560 info$="RT image. run length encoded image, "+STR$sx%+" by "+STR$sy%+" pixels, 24 bits per pixel"
 2570WHEN 500:REM GIF file
 2580 compression=5:PTR#c%=6:sx%=FNHW:sy%=FNHW:PROCsize
 2590 GIF=BGET#c%:GIFback=BGET#c%:GIFext=BGET#c%:quant%=(GIF AND 7)+1
 2600 IFGIF AND &80 THEN
 2610  FORC%=0TO(1<<quant%)-1
 2620   r%(C%)=BGET#c%/255*F:g%(C%)=BGET#c%/255*F:b%(C%)=BGET#c%/255*F
 2630  NEXT
 2640 ENDIF
 2650 I%=BGET#c%:IFI%<>ASC"," ERROR 42,"GIF file without , in right place"
 2660 GIFleft=FNHW:GIFright=FNHW:GIFsx=FNHW:GIFsy=FNHW
 2670 IFGIFsx>sx% OR GIFsy>sy% ERROR 42,"GIF file with bigger image inside"
 2680 GIF=BGET#c%:IFGIF AND &40 flag=501
 2690 setcodes%=BGET#c%:clearcode%=1<<setcodes%:st%=PTR#c%
 2700 DIM table%(1<<12,1):stk%=FNdim(1<<13):buf%=FNdim(280):buff%=FNdim(sx%)
 2710 table%()=0:FORI%=0TOclearcode%-1:table%(I%,1)=I%:NEXT
 2720 info$="GIF file, "+STR$sx%+" by "+STR$sy%+" pixels, "+STR$quant%+" bits per pixel"
 2730WHEN 600:REM funny AV_VO stuff
 2740 quant%=8:PTR#c%=&5c:FORC%=0TO255
 2750  r%(C%)=BGET#c%/255*F:g%(C%)=BGET#c%/255*F:b%(C%)=BGET#c%/255*F
 2760 NEXT
 2770 PTR#c%=&36e:sy%=FNHW:sx%=FNHW:PROCsize
 2780 PTR#c%=&380:buff%=FNdim(sx%)
 2790 info$=".PIC image, "+STR$sx%+" by "+STR$sy%+" pixels, 8 bits per pixel"
 2800WHEN 700:REM MTV ".pic" image
 2810 quant%=8:PTR#c%=0:a$=GET$#c%:sx%=VALa$:sy%=VAL(MID$(a$,INSTR(a$," ")))
 2820 PROCsize:PROCnopal:input=24:step24=3
 2830 buff%=FNdim(sx%*3):rb%=buff%:gb%=buff%+1:bb%=buff%+2
 2840 info$="MTV .pic image, "+STR$sx%+" by "+STR$sy%+" pixels, 24 bits per pixel"
 2850WHEN 800:REM Watford picture
 2860 sx%=512:sy%=256:IFscale% ymul%=ymul%*2
 2870 buff%=FNdim(sx%):wtpix%=0:wt%=0:wtsx%=buff%+sx%
 2880 FORC%=0TO255:r%(C%)=(C%AND63)/63*F:NEXT:g%()=r%():b%()=r%():quant%=6
 2890 info$="Watford digitiser picture, 512 by 256 pixels, 6 bits per pixel"
 2900WHEN 801:REM Triple Watford picture
 2910 sx%=512:sy%=256:input=24:step24=1:quant%=6:IFscale% ymul%=ymul%*2
 2920 wtpix1%=0:wt1%=0:wtpix2%=0:wt2%=0:wtpix3%=0:wt3%=0
 2930 buff%=FNdim(sx%*3):rb%=buff%:gb%=buff%+sx%:bb%=buff%+2*sx%
 2940 wtsx1%=buff%+sx%:wtsx2%=buff%+2*sx%:wtsx3%=buff%+3*sx%
 2950 FORC%=0TO255:r%(C%)=(C%AND63)/63*F:NEXT:g%()=r%():b%()=r%()
 2960 info$="Triple Watford digitiser picture, 512 by 256 pixels, 18 bits per pixel"
 2970WHEN 900:REM AIM/Wild Vision
 2980 quant%=8:sx%=256:sy%=256:buff%=FNdim(sx%):IFscale% ymul%=ymul%*2:xmul%=xmul%*2
 2990 FORC%=0TO255:r%(C%)=C%/255*F:NEXT:g%()=r%():b%()=r%()
 3000 info$="AIM .raw image, 256 by 256 pixels, 8 bits per pixel"
 3010WHEN 901:REM AIM/Wild Vision: Temporary while V9 gets its act together
 3020 quant%=4:sx%=256:sy%=256:IFscale% ymul%=ymul%*2:xmul%=xmul%*2
 3030 buff%=FNdim(sx%*3):rb%=buff%:gb%=buff%+sx%:bb%=buff%+sx%*2
 3040 FORC%=0TO255:r%(C%)=(C%AND&F0)/&F0*F:NEXT:g%()=r%():b%()=r%()
 3050 input=24:step24=1
 3060 info$="Hawk V9 Triple image, 256 by 256 pixels, 12 bits per pixel"
 3070WHEN 1000:REM ProArtisan
 3080 quant%=4:sx%=640:sy%=256:PROCdefpal:st%=FNW:flag+=FNW:IFscale% ymul%=ymul%*2
 3090 REM read compression type and add to flag. 0/1 known!
 3100 buff%=FNdim(sx%):ctable%=FNdim(st%)
 3110 SYS12,4,c%,ctable%,st%:REM read in colour table
 3120 pa%=ctable%:papix%=0:papix2%=0:pasx%=buff%+sx%
 3130 info$="ProArtisan image, 640 by 256 pixels, 8 bits per pixel"
 3140WHEN 1100:REM Monochrome? Images from Sun
 3150 quant%=1:PTR#c%=4:sx%=FNbeW:sy%=FNbeW:input=FNbeW
 3160 IFinput<>1 ERROR42,"Only know how to deal with 1bpp"
 3170 PTR#c%=32:buff%=FNdim(sx%+7>>3):PROCsize
 3180 r%(0)=F:g%(0)=F:b%(0)=F:bigendianbits=TRUE
 3190 info$="Sun image, "+STR$sx%+" by "+STR$sy%+" pixels, 1 bit per pixel"
 3200WHEN 1200:REM unknown TimeStep satellite format
 3210 quant%=8:sx%=800:sy%=800:buff%=FNdim(sx%):PTR#c%=1600:vflip%=NOT vflip%
 3220 FORC%=0TO255:r%(C%)=C%/255*F:NEXT:g%()=r%():b%()=r%()
 3230 info$="TimeStep satellite image, 800 by 800 pixels, 8 bits per pixel"
 3240WHEN 1300:REM another unknown TimeStep satellite format
 3250 quant%=8:sx%=128:sy%=256:buff%=FNdim(sx%):IFscale% xmul%=xmul%*4:ymul%=ymul%*2
 3260 FORC%=0TO255:r%(C%)=C%/255*F:NEXT:g%()=r%():b%()=r%()
 3270 info$="satellite image, 128 by 256 pixels, 8 bits per pixel"
 3280WHEN 1301:REM "colour" unknown TimeStep satellite format
 3290 input=24:step24=1:quant%=8:sx%=128:sy%=256:IFscale% xmul%=xmul%*4:ymul%=ymul%*2
 3300 buff%=FNdim(sx%*3):rb%=buff%:gb%=buff%+sx%:bb%=buff%+2*sx%
 3310 FORC%=0TO255:r%(C%)=C%/255*F:NEXT:g%()=r%():b%()=r%()
 3320 info$="Triple satellite image, 128 by 256 pixels, 24 bits per pixel"
 3330WHEN 1400:REM GEM IMG. format
 3340 planar=TRUE:PTR#c%=0:Z%=FNHW:IFZ%>255 THEN
 3350  st%=FNbeHW*2:quant%=FNbeHW:patlen%=FNbeHW
 3360  pw%=FNbeHW:ph%=FNbeHW:sx%=FNbeHW:sy%=FNbeHW
 3370 ELSE
 3380  st%=FNHW*2:input=FNHW:patlen%=FNHW:pw%=FNHW:ph%=FNHW:sx%=FNHW:sy%=FNHW
 3390 ENDIF
 3400 IFscale% THEN
 3410  xmul%=xmul%*pw%:xdiv%=xdiv%*282
 3420  ymul%=ymul%*ph%:ydiv%=ydiv%*282
 3430 ENDIF
 3440 rsx%=sx%+7>>3:DIM st%(quant%):buff%=FNdim(sx%)
 3450 FORX%=1TOquant%:st%(X%)=FNdim(rsx%*sy%):NEXT:PTR#c%=st%:vrep%=0
 3460 FORC%=0TO(1<<quant%)-1:r%(C%)=F-C%/((1<<quant%)-1)*F:NEXT:g%()=r%():b%()=r%()
 3470 info$="IMG file, "+STR$sx%+" by "+STR$sy%+" pixels, "+STR$quant%+" bits per pixel"
 3480WHEN 1500:REM TIFF
 3490 PTR#c%=4:dir%=FNtiff(4):PTR#c%=dir%
 3500 rgb=FALSE:rowsperstrip=-1:greyunit=100:planar=1:fillorder=1:resunit=2
 3510 E%=FNtiff(3):FORZ%=1TOE%
 3520  T%=FNtiff(3):D%=FNtiff(3):C%=FNtiff(4)
 3530  IFD%=2 PTR#c%=dir%+2+Z%*12 ELSE IFD%<4 V%=FNtiff(D%):PTR#c%=dir%+2+Z%*12 ELSE V%=FNtiff(4)
 3540  REM PRINT"Read tag ";T%" datatype "D%" count "C%" value/pointer "V%
 3550  CASE T% OF
 3560  WHEN 256:sx%=V%
 3570  WHEN 257:sy%=V%
 3580  WHEN 258:quant%=V%:input=quant%:FORI%=0TO(1<<quant%)-1:r%(I%)=I%/((1<<quant%)-1)*F:NEXT
 3590   g%()=r%():b%()=r%()
 3600  WHEN 259:compression=V%
 3610  WHEN 262:photometric=V%
 3620  WHEN 266:fillorder=V%
 3630  WHEN 273:stc%=C%:stv%=V%
 3640  WHEN 277:input=quant%*V%:rgb=V%=3
 3650  WHEN 278:rowsperstrip=V%
 3660  WHEN 282:PTR#c%=V%:xnum%=FNtiff(4):xdenom%=FNtiff(4)
 3670   PTR#c%=dir%+2+Z%*12
 3680  WHEN 283:PTR#c%=V%:ynum%=FNtiff(4):ydenom%=FNtiff(4)
 3690   PTR#c%=dir%+2+Z%*12
 3700  WHEN 284:planar=V%
 3710  WHEN 290:greyunit=10^V%
 3720  WHEN 291:PTR#c%=V%:FORI%=0TOC%-1:r%(I%)=FNtiff(D%)/greyunit/2*F:NEXT
 3730   g%()=r%():b%()=r%()
 3740   PTR#c%=dir%+2+Z%*12
 3750  WHEN 296:resunit=V%
 3760REM  WHEN 320:
 3770REM   PTR#c%=dir%+2+Z%*12
 3780  OTHERWISE
 3790  IFinfo% PRINT"Ignoring tag ";T%" datatype "D%" count "C%" value/pointer "V%
 3800  ENDCASE
 3810 NEXT
 3820 DIM st%(stc%):IFstc%>1 THEN
 3830  PTR#c%=stv%:FORI%=0TOC%-1:st%(I%)=FNtiff(D%):NEXT
 3840 ELSE
 3850  st%(0)=stv%
 3860 ENDIF
 3870 IFcompression<>1 info$="Compressed " ELSE info$=""
 3880 info$+="TIFF file, "+STR$sx%+" by "+STR$sy%+" pixels, "+STR$input+" bits per pixel"
 3890 IFplanar<>1 OR compression<>1 ERROR42,"Can't do this style of TIFF yet"
 3900 bigendianbits=fillorder=1
 3910 CASE quant% OF
 3920 WHEN 1:nsx%=sx%+7>>3
 3930 WHEN 2:nsx%=sx%+3>>2
 3940 WHEN 4:nsx%=sx%+1>>1
 3950 WHEN 8:nsx%=sx%
 3960 OTHERWISE ERROR 42,"Can't do ";quant%" bits per pixel TIFF"
 3970 ENDCASE
 3980 buff%=FNdim(nsx%):TIFFread%=rowsperstrip:PTR#c%=st%(0):TIFFptr=0
 3990 IFscale% THEN
 4000  S%=resunit:IFS%=2 S%=90
 4010  IFS%=3 S%=35
 4020  xdiv%=xdiv%*xnum%:xmul%=xmul%*xdenom%*S%
 4030  ydiv%=ydiv%*ynum%:ymul%=ymul%*ydenom%*S%
 4040 ENDIF
 4050WHEN 1600:REM Electronic Arts ILBM inside IFF
 4060 PTR#c%=12:camg=0:planar=TRUE:REPEAT
 4070 S$=CHR$BGET#c%+CHR$BGET#c%+CHR$BGET#c%+CHR$BGET#c%:S%=FNbeW
 4080 CASE S$ OF
 4090 WHEN "BMHD":sx%=FNbeHW:sy%=FNbeHW:S%=FNW:quant%=BGET#c%:masking%=BGET#c%=1
 4100  compression=BGET#c%:S%=BGET#c%+FNHW:U%=BGET#c%:V%=BGET#c%:S%=FNW
 4110  IFscale% ymul%=ymul%*V%:ydiv%=ydiv%*U%
 4120  FORI%=0TO(1<<quant%)-1:r%(I%)=I%/((1<<quant%)-1)*F:NEXT:g%()=r%():b%()=r%()
 4130 WHEN "CMAP":S%=PTR#c%+S%:FORI%=0TO(1<<quant%)-1:r%(I%)=(BGET#c%>>4)/15*F
 4140  g%(I%)=(BGET#c%>>4)/15*F:b%(I%)=(BGET#c%>>4)/15*F:NEXT
 4150  PTR#c%=S%:IFinfo% PRINT"Warning: truncated IFF CMAP information to 4 bits"
 4160 WHEN "CAMG":camg=FNbeW:IFinfo% PRINT"Amiga viewport mode ";~camg
 4170 WHEN "BODY":st%=PTR#c%
 4180 OTHERWISE IF info% PRINT"Ignoring IFF property "S$" size ";S%
 4190  PTR#c%=PTR#c%+S%
 4200 ENDCASE
 4210 UNTILS$="BODY":IFcompression info$="Compressed " ELSE info$=""
 4220 info$="IFF file, "+STR$sx%+" by "+STR$sy%+" pixels, "+STR$quant%+" bits per pixel"
 4230 ham=(camg AND &800)<>0:IFham info$="HAM "+info$
 4240 IFmasking% info$+=" with mask (unused)"
 4250 DIM st%(quant%):rsx%=(sx%+15>>4)<<1:FORI%=1TOquant%:st%(I%)=FNdim(sx%):NEXT
 4260 buff%=FNdim(sx%):flag+=compression:PTR#c%=st%
 4270WHEN 1700:REM EGA image in DSP.<foo>
 4280 sx%=640:rsx%=80:sy%=350:quant%=4:planar=TRUE:DIM st%(4)
 4290 FORX%=1TO4:st%(X%)=FNdim(80):NEXT:buff%=FNdim(640):G=F/3:H=F*2/3
 4300 r%()=0,0,0,0,F,F,F,H,G,G,G,G,F,F,F,F
 4310 g%()=0,0,F,F,0,0,F,H,G,G,F,F,G,G,F,F
 4320 b%()=0,F,0,F,0,F,0,H,G,F,G,F,G,F,G,F
 4330 masking%=FALSE:flag=1600:st%=16:PTR#c%=16
 4340 info$="PC EGA '.dsp' file, 640 by 350 pixels, 4 bits per pixel (fixed palette)"
 4350WHEN 2000:REM Unknown "SCF"
 4360 st%=&300:PTR#c%=4:sx%=FNHW:sy%=FNHW
 4370 PRINTBGET#c% BGET#c%
 4380 buff%=FNdim(sx%)
 4390ENDCASE
 4400IFinfo% PRINTinfo$
 4410SYS"Hourglass_On",1:IFinvert% r%()=F-r%():g%()=F-g%():b%()=F-b%()
 4420CASE m OF
 4430 WHEN -1:x%=256:y%=256:ncol=255:IFscale% xdiv%=xdiv%*2:ydiv%=ydiv%*2
 4440 OTHERWISE
 4450  SYS53,m,4 TO ,,nx:SYS53,m,5 TO ,,ny:nx=1<<nx:ny=1<<ny
 4460  SYS53,m,11 TO ,,x%:SYS53,m,12 TO ,,y%:x%+=1:y%+=1
 4470  SYS53,m,3 TO ,,ncol:IFscale% xdiv%=xdiv%*nx/2:ydiv%=ydiv%*ny/2
 4480ENDCASE
 4490IFxs$="=" xmul%=x%:xdiv%=sx%
 4500IFys$="=" ymul%=y%:ydiv%=sy%
 4510IFncol=1 IFm$="C" xdiv%=xdiv%*4:ydiv%=ydiv%*4
 4520PROCreduce(xmul%,xdiv%):PROCreduce(ymul%,ydiv%)
 4530IFinfo% THEN
 4540 PRINT"Size ratios are x ";xmul%":"xdiv%" y "ymul%":"ydiv%;
 4550 IFxdiv%>10 ORydiv%>10 ORxmul%>20 ORymul%>20 PRINT" which may take a while..." ELSE PRINT
 4560ENDIF
 4570x%=sx%*xmul%/xdiv%+.9999:y%=sy%*ymul%/ydiv%+.9999:rows%=sy%
 4580order%=x%*y%>sx%*sy%:REM TRUE if scaling up
 4590REM test for as many colours as possible
 4600CASE m OF
 4610 WHEN -1:col=0:REM aim format is monochrome
 4620 OTHERWISE
 4630 IFm$="D" IFncol<>15 m$=""
 4640 col=0:IFncol>15 OR m$="C" OR m$="D" col=2:REM depth of colour arrays
 4650ENDCASE
 4660IFncol=1 IFm$="C" col=0:x%=x%+1ANDNOT1
 4670IFcol=0 IFinput<9 FORC%=0TO255:r%(C%)=r%(C%)*rwt+g%(C%)*gwt+b%(C%)*bwt:NEXT
 4680IFcol=0 IFinput=24 rb%-=1:gb%-=1:bb%-=1
 4690IFsharpen%=TRUE sharpen%=24
 4700DIM cl%(x%+7,col):REM current line additive errors
 4710DIM xl%(x%+7,col),xp%(sx%+7,col):REM extra input line for scaling vertically
 4720IFsharpen% THEN
 4730 IForder% THEN
 4740  DIM rm%(sx%+7,col),rm1%(sx%+7,col),rm2%(sx%+7,col)
 4750 ELSE
 4760  DIM rm%(x%+7,col),rm1%(x%+7,col),rm2%(x%+7,col)
 4770 ENDIF
 4780ENDIF
 4790IFhist%ORequal% DIM vals%(256,col)
 4800DIM nl%(x%+7,col):REM next line additive errors
 4810totalvals%=x%*(col+1):REM total number of elements in a scaled line
 4820totalvals2%=sx%*(col+1):REM total number of elements in an input line
 4830IFflag=300 DIM z2%(sx%+7,col):REM extra array for ArVis
 4840IFncol=1 AND m$="C" THEN
 4850DIM A%(16),B%(16)
 4860A%()=0,&00000001,&08000001,&08000101,&08080101,&08080103,&0C080103,&0C080303,&0C0C0303,&0C0E0303,&0C0E0703,&0E0E0703,&0E0E0707,&0E0F0707,&0E0F0F07,&0F0F0F07,&0F0F0F0F
 4870B%()=0,&00000008,&01000008,&01000808,&01010808,&0101080C,&0301080C,&03010C0C,&03030C0C,&03070C0C,&03070E0C,&07070E0C,&07070E0E,&070F0E0E,&070F0F0E,&0F0F0F0E,&0F0F0F0F
 4880even_gard=FNdim(17*32*4):odd_gard=FNdim(17*32*4)
 4890FORI%=0TO16:FORJ%=0TO16:even_gard!(J%*32*4+I%*4)=A%(I%)ORB%(J%)<<4:NEXT:NEXT
 4900FORI%=0TO16:FORJ%=0TO16: odd_gard!(J%*32*4+I%*4)=B%(I%)ORA%(J%)<<4:NEXT:NEXT
 4910ENDIF
 4920code%=FNdim(4096):SP=13
 4930FORZ=0TO2STEP2:P%=code%
 4940CASE ncol OF
 4950WHEN 255:
 4960[OPT Z
 4970; CALL fs%,current%(),next%(),pixel address%,increment%,count%
 4980.fs%
 4990 STMFD SP !,{R14}
 5000 LDR R10,[R9,#4*8] ;addr current
 5010 LDR R11,[R9,#3*8] ;addr next
 5020 LDR R12,[R9,#2*8] ;addr pixel address
 5030 LDR R12,[R12] ;pixel address
 5040 LDR R8,[R9,#8] ;addr step
 5050 LDR R8,[R8] ;step
 5060 LDR R9,[R9] ;addr count
 5070 LDR R9,[R9] ;count
 5080 LDR R4,[R10],R8 ;mono value
 5090 TEQ R8,#0:MOVPL R1,#1:MVNMI R1,#0 ;+/- 1 for sprite output
 5100.fsloop
 5110 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
 5120 MOV R0,R4,LSR #bits-8
 5130 CMP R0,#256:MOVCS R0,#255:STRB R0,[R12],R1
 5140 MOV R2,R0,LSL #bits-8
 5150 SUB R4,R4,R2 ;subtract converted value
 5160 MOVCS R4,#0
 5170 ADD R2,R4,R4,LSL #1 ;*3
 5180 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 5190 STR R3,[R11,-R8]
 5200 ADD R2,R4,R4,LSL #2 ;*5
 5210 LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
 5220 STR R3,[R11]
 5230 MOV R3,R4,ASR #4 ;/16
 5240 STR R3,[R11,R8]! ;not seen so far inc nl ptr
 5250 RSB R2,R4,R4,LSL #3 ;*7
 5260 LDR R4,[R10],R8 ;next light value
 5270 ADD R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
 5280 SUBS R9,R9,#1:BNE fsloop
 5290 LDMFD SP !,{PC}^
 5300 ]
 5310WHEN 63:
 5320[OPT Z
 5330.slashfifteen EQUD 0
 5340 EQUD 4/15*F
 5350 EQUD 8/15*F
 5360 EQUD 12/15*F
 5370.fs%
 5380 STMFD SP !,{R14}
 5390 LDR R10,[R9,#4*8] ;addr current
 5400 LDR R11,[R9,#3*8] ;addr next
 5410 LDR R12,[R9,#2*8] ;addr pixel address
 5420 LDR R12,[R12] ;pixel address
 5430 LDR R8,[R9,#8] ;addr step
 5440 LDR R8,[R8] ;step
 5450 LDR R9,[R9] ;addr count
 5460 LDR R9,[R9] ;count
 5470 LDR R4,[R10] ;r
 5480 LDR R5,[R10,#4] ;g
 5490 LDR R6,[R10,#8] ;b
 5500 ADR R7,slashfifteen
 5510 TEQ R8,#0:MOVPL R1,#1:MVNMI R1,#0 ;+/- 1 for sprite output
 5520.fsloop
 5530 ADD R10,R10,R8 ;+step
 5540 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=r<=1
 5550 RSB R3,R4,R4,LSL #4 ;*15
 5560 MOVS R3,R3,LSR #2+bits ;final int0, 1, 2, 3
 5570 LDRNE R2,[R7,R3,LSL #2] ;divide by 15 from table
 5580 SUBNE R4,R4,R2 ;subtract converted value
 5590 AND R2,R3,#1:MOV R0,R2,LSL #2 ;bit 2 of r
 5600 AND R2,R3,#2:ORR R0,R0,R2,LSL #3 ;bit 3 of r
 5610 TEQ R5,#0:MOVMI R5,#0:CMP R5,#F:MOVCS R5,#F ;0<=g<=1
 5620 RSB R3,R5,R5,LSL #4 ;*15
 5630 MOVS R3,R3,LSR #2+bits ;final int0, 1, 2, 3
 5640 LDRNE R2,[R7,R3,LSL #2] ;divide by 15 from table
 5650 SUBNE R5,R5,R2 ;subtract converted value
 5660 ORR R0,R0,R3,LSL #5 ;bits 3 and 2 of g
 5670 TEQ R6,#0:MOVMI R6,#0:CMP R6,#F:MOVCS R6,#F ;0<=b<=1
 5680 RSB R3,R6,R6,LSL #4 ;*15
 5690 MOVS R3,R3,LSR #2+bits ;final int0, 1, 2, 3
 5700 LDRNE R2,[R7,R3,LSL #2] ;divide by 15 from table
 5710 SUBNE R6,R6,R2 ;subtract converted value
 5720 AND R2,R3,#1:ORR R0,R0,R2,LSL #3 ;bit 2 of b
 5730 AND R2,R3,#2:ORR R0,R0,R2,LSL #6 ;bit 3 of b
 5740 ]
 5750IFm$<>"T" THEN
 5760[OPT Z
 5770 ADD R2,R4,R5:ADD R2,R2,R6 ;r+g+b remainders
 5780 ADD R2,R2,R2,LSL #2 ;average *15/3
 5790 MOV R2,R2,LSR #bits
 5800 CMP R2,#3:MOVCS R2,#3
 5810 ORR R0,R0,R2
 5820 LDR R2,[R7,R2,LSL #2] ;*1/15
 5830 SUB R4,R4,R2,LSR #2 ;subtract t
 5840 SUB R5,R5,R2,LSR #2 ;note table 4* too large
 5850 SUB R6,R6,R2,LSR #2
 5860 ]
 5870ENDIF
 5880[OPT Z
 5890 STRB R0,[R12],R1
 5900 ADD R0,R11,#4 ;nl g%(S%)
 5910 ADD R2,R4,R4,LSL #1 ;r*3
 5920 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 5930 STR R3,[R11,-R8]
 5940 ADD R2,R4,R4,LSL #2 ;r*5
 5950 LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
 5960 STR R3,[R11]
 5970 MOV R3,R4,ASR #4 ;r/16
 5980 STR R3,[R11,R8]! ;not seen so far inc nl ptr
 5990 RSB R2,R4,R4,LSL #3 ;r*7
 6000 LDR R4,[R10] ;next r light value
 6010 ADD R4,R4,R2,ASR #4 ;next value +7/16 of r error -> new r
 6020 ADD R2,R5,R5,LSL #1 ;g*3
 6030 LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 6040 STR R3,[R0,-R8]
 6050 MOV R3,R5,ASR #4 ;g/16
 6060 STR R3,[R0,R8] ;not seen so far
 6070 ADD R2,R5,R5,LSL #2 ;g*5
 6080 LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
 6090 STR R3,[R0],#4 ;computes nl b into the bargain
 6100 RSB R2,R5,R5,LSL #3 ;g*7
 6110 LDR R5,[R10,#4] ;next g light value
 6120 ADD R5,R5,R2,ASR #4 ;next value +7/16 of g error -> new g
 6130 ADD R2,R6,R6,LSL #1 ;b*3
 6140 LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 6150 STR R3,[R0,-R8]
 6160 ADD R2,R6,R6,LSL #2 ;b*5
 6170 LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
 6180 STR R3,[R0]
 6190 MOV R3,R6,ASR #4 ;b/16
 6200 STR R3,[R0,R8] ;not seen so far
 6210 RSB R2,R6,R6,LSL #3 ;b*7
 6220 LDR R6,[R10,#8] ;next b light value
 6230 ADD R6,R6,R2,ASR #4 ;next value +7/16 of b error -> new b
 6240 SUBS R9,R9,#1:BNE fsloop
 6250 LDMFD SP !,{PC}^
 6260 ]
 6270WHEN 15:
 6280CASE m$ OF
 6290WHEN "D":REM No table needed
 6300WHEN "C"
 6310[OPT Z
 6320.divtable EQUD 0
 6330 EQUD 1/3*F
 6340 EQUD 2/3*F
 6350 EQUD F
 6360 ]
 6370WHEN "T"
 6380[OPT Z
 6390.divtable EQUD 0
 6400 EQUD 1/15*F
 6410 EQUD 2/15*F
 6420 EQUD 3/15*F
 6430 EQUD 4/15*F
 6440 EQUD 5/15*F
 6450 EQUD 6/15*F
 6460 EQUD 7/15*F
 6470 EQUD 8/15*F
 6480 EQUD 9/15*F
 6490 EQUD 10/15*F
 6500 EQUD 11/15*F
 6510 EQUD 12/15*F
 6520 EQUD 13/15*F
 6530 EQUD 14/15*F
 6540 EQUD F
 6550 ]
 6560WHEN ""
 6570[OPT Z
 6580.divtable EQUD 0
 6590 EQUD 1/7*F
 6600 EQUD 2/7*F
 6610 EQUD 3/7*F
 6620 EQUD 4/7*F
 6630 EQUD 5/7*F
 6640 EQUD 6/7*F
 6650 EQUD F
 6660 ]
 6670ENDCASE
 6680[OPT Z
 6690.fs%
 6700 STMFD SP !,{R14}
 6710 LDR R10,[R9,#4*8] ;addr current
 6720 LDR R11,[R9,#3*8] ;addr next
 6730 LDR R12,[R9,#2*8] ;addr pixel address
 6740 LDR R12,[R12] ;pixel address
 6750 LDR R8,[R9,#8] ;addr step
 6760 LDR R8,[R8] ;step
 6770 LDR R9,[R9] ;addr count
 6780 LDR R9,[R9] ;count
 6790 ]
 6800IFm$="C" OR m$="D" THEN
 6810[OPT Z
 6820 LDR R4,[R10] ;r
 6830 LDR R5,[R10,#4] ;g
 6840 LDR R6,[R10,#8] ;b
 6850 ]
 6860ELSE
 6870[OPT Z
 6880 LDR R4,[R10],R8 ;mono value
 6890 ]
 6900ENDIF
 6910IFm$<>"D" THEN
 6920[OPT Z
 6930 ADR R7,divtable
 6940 ]
 6950ENDIF
 6960[OPT Z
 6970 TEQ R8,#0:MOVPL R1,#1:MVNMI R1,#0 ;+/- 1 for sprite output
 6980.fsloop
 6990 ]
 7000CASE m$ OF
 7010WHEN "D"
 7020[OPT Z
 7030 ADD R10,R10,R8 ;+step
 7040 MOV R3,#0
 7050 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=r<=1
 7060 CMP R4,#F>>1 ;>1/2?
 7070 SUBCS R4,R4,#F:ORRCS R3,R3,#1
 7080 TEQ R5,#0:MOVMI R5,#0:CMP R5,#F:MOVCS R5,#F ;0<=g<=1
 7090 CMP R5,#F>>1 ;>1?
 7100 SUBCS R5,R5,#F:ORRCS R3,R3,#2
 7110 TEQ R6,#0:MOVMI R6,#0:CMP R6,#F:MOVCS R6,#F ;0<=b<=1
 7120 CMP R6,#F>>1 ;>1?
 7130 SUBCS R6,R6,#F:ORRCS R3,R3,#4
 7140 ]
 7150WHEN "C"
 7160[OPT Z
 7170 ADD R10,R10,R8 ;+step
 7180 TEQ R5,#0:MOVMI R5,#0:CMP R5,#F:MOVCS R5,#F ;0<=g<=1
 7190 ADD R3,R5,R5,LSL #1 ;*3
 7200 ADD R3,R3,#F>>1 ;round up
 7210 MOVS R3,R3,LSR #bits ;final int0-3
 7220 LDRNE R2,[R7,R3,LSL #2] ;divide by 3 from table
 7230 SUBNE R5,R5,R2 ;subtract converted value
 7240 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=r<=1
 7250 CMP R4,#F>>1 ;>1/2?
 7260 SUBCS R4,R4,#F:ORRCS R3,R3,#4
 7270 TEQ R6,#0:MOVMI R6,#0:CMP R6,#F:MOVCS R6,#F ;0<=b<=1
 7280 CMP R6,#F>>1 ;>1/2?
 7290 SUBCS R6,R6,#F:ORRCS R3,R3,#8
 7300 ]
 7310WHEN "T"
 7320[OPT Z
 7330 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
 7340 RSB R3,R4,R4,LSL #4 ;*15
 7350 ADD R3,R3,#F>>1 ;round up
 7360 MOVS R3,R3,LSR #bits ;final int0-15
 7370 LDRNE R2,[R7,R3,LSL #2] ;divide by 15 from table
 7380 SUBNE R4,R4,R2 ;subtract converted value
 7390 ]
 7400WHEN ""
 7410[OPT Z
 7420 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
 7430 RSB R3,R4,R4,LSL #3 ;*7
 7440 ADD R3,R3,#F>>1 ;round up
 7450 MOVS R3,R3,LSR #bits ;final int0-7
 7460 LDRNE R2,[R7,R3,LSL #2] ;divide by 7 from table
 7470 SUBNE R4,R4,R2 ;subtract converted value
 7480 ]
 7490ENDCASE
 7500[OPT Z
 7510 MOV R2,R12,LSR #1
 7520 TST R12,#1
 7530 LDRB R0,[R2]
 7540 ANDEQ R0,R0,#&F0:ORREQ R0,R0,R3
 7550 ANDNE R0,R0,#&0F:ORRNE R0,R0,R3,LSL #4
 7560 STRB R0,[R2]
 7570 ADD R12,R12,R1
 7580 ]
 7590IFm$="C" OR m$="D" THEN
 7600[OPT Z
 7610 ADD R0,R11,#4 ;nl g%(S%)
 7620 ADD R2,R4,R4,LSL #1 ;r*3
 7630 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 7640 STR R3,[R11,-R8]
 7650 ADD R2,R4,R4,LSL #2 ;r*5
 7660 LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
 7670 STR R3,[R11]
 7680 MOV R3,R4,ASR #4 ;r/16
 7690 STR R3,[R11,R8]! ;not seen so far inc nl ptr
 7700 RSB R2,R4,R4,LSL #3 ;r*7
 7710 LDR R4,[R10] ;next r light value
 7720 ADD R4,R4,R2,ASR #4 ;next value +7/16 of r error -> new r
 7730 ADD R2,R5,R5,LSL #1 ;g*3
 7740 LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 7750 STR R3,[R0,-R8]
 7760 MOV R3,R5,ASR #4 ;g/16
 7770 STR R3,[R0,R8] ;not seen so far
 7780 ADD R2,R5,R5,LSL #2 ;g*5
 7790 LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
 7800 STR R3,[R0],#4 ;computes nl b into the bargain
 7810 RSB R2,R5,R5,LSL #3 ;g*7
 7820 LDR R5,[R10,#4] ;next g light value
 7830 ADD R5,R5,R2,ASR #4 ;next value +7/16 of g error -> new g
 7840 ADD R2,R6,R6,LSL #1 ;b*3
 7850 LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 7860 STR R3,[R0,-R8]
 7870 ADD R2,R6,R6,LSL #2 ;b*5
 7880 LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
 7890 STR R3,[R0]
 7900 MOV R3,R6,ASR #4 ;b/16
 7910 STR R3,[R0,R8] ;not seen so far
 7920 RSB R2,R6,R6,LSL #3 ;b*7
 7930 LDR R6,[R10,#8] ;next b light value
 7940 ADD R6,R6,R2,ASR #4 ;next value +7/16 of b error -> new b
 7950 ]
 7960ELSE
 7970[OPT Z
 7980 ADD R2,R4,R4,LSL #1 ;*3
 7990 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 8000 STR R3,[R11,-R8]
 8010 ADD R2,R4,R4,LSL #2 ;*5
 8020 LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
 8030 STR R3,[R11]
 8040 MOV R3,R4,ASR #4 ;/16
 8050 STR R3,[R11,R8]! ;not seen so far inc nl ptr
 8060 RSB R2,R4,R4,LSL #3 ;*7
 8070 LDR R4,[R10],R8 ;next light value
 8080 ADD R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
 8090 ]
 8100ENDIF
 8110[OPT Z
 8120 SUBS R9,R9,#1:BNE fsloop
 8130 LDMFD SP !,{PC}^
 8140 ]
 8150WHEN 3:
 8160IFm$="" THEN
 8170[OPT Z
 8180.slashthree EQUD 0
 8190 EQUD 1/3*F
 8200 EQUD 2/3*F
 8210 EQUD F
 8220 ]
 8230ENDIF
 8240[OPT Z
 8250.fs%
 8260 STMFD SP !,{R14}
 8270 LDR R10,[R9,#4*8] ;addr current
 8280 LDR R11,[R9,#3*8] ;addr next
 8290 LDR R12,[R9,#2*8] ;addr pixel address
 8300 LDR R12,[R12] ;pixel address
 8310 LDR R8,[R9,#8] ;addr step
 8320 LDR R8,[R8] ;step
 8330 LDR R9,[R9] ;addr count
 8340 LDR R9,[R9] ;count
 8350 ]
 8360IFm$="C" THEN
 8370[OPT Z
 8380 LDR R4,[R10] ;r
 8390 LDR R5,[R10,#4] ;g
 8400 LDR R6,[R10,#8] ;b
 8410 ]
 8420ELSE
 8430[OPT Z
 8440 LDR R4,[R10],R8 ;mono value
 8450 ADR R7,slashthree
 8460 ]
 8470ENDIF
 8480[OPT Z
 8490 TEQ R8,#0:MOVPL R1,#1:MVNMI R1,#0 ;+/- 1 for sprite output
 8500.fsloop
 8510 ]
 8520IFm$="C" THEN
 8530[OPT Z
 8540 ADD R10,R10,R8 ;+step
 8550 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=r<=1
 8560 TEQ R5,#0:MOVMI R5,#0:CMP R5,#F:MOVCS R5,#F ;0<=g<=1
 8570 TEQ R6,#0:MOVMI R6,#0:CMP R6,#F:MOVCS R6,#F ;0<=b<=1
 8580 MOV R3,#0 ;black octant
 8590 CMP R4,#F>>1:ORRCS R3,R3,#1
 8600 CMP R5,#F>>1:ORRCS R3,R3,#2
 8610 CMP R6,#F>>1:ORRCS R3,R3,#4
 8620 CMP R3,#6:MOVEQ R3,#1:BEQ octcyan
 8630 BCS octwhite
 8640 CMP R3,#4:BEQ octblue
 8650 MOVCS R3,#2:BCS octmagenta
 8660 CMP R3,#2:BEQ octgreen
 8670 BCS octyellow
 8680 CMP R3,#0:BEQ octblack
 8690.octred
 8700 RSB R0,R4,#F ;1-r
 8710 CMP R5,R0 ;g>1-r?
 8720 BLT octred1
 8730 CMP R5,R6 ;yes- g>b?
 8740 MOVGE R3,#3 ;if g>b then g is largest
 8750 MOVLT R3,#2 ;else b is
 8760 B octconvert
 8770.octred1
 8780 CMP R0,R6 ;no- 1-r>b?
 8790 MOVGE R3,#0 ;if 1-r>b then 1-r is largest
 8800 MOVLT R3,#2 ;else b is
 8810 B octconvert
 8820.octgreen
 8830 RSB R0,R5,#F ;1-g
 8840 CMP R0,R4 ;1-g>r?
 8850 BLT octgreen1
 8860 CMP R0,R6 ;yes- 1-g>b?
 8870 MOVGE R3,#0 ;if 1-g>b then 1-g is largest
 8880 MOVLT R3,#1 ;else b is
 8890 B octconvert
 8900.octgreen1
 8910 CMP R4,R6 ;no- r>b?
 8920 MOVGE R3,#3 ;if r>b then r is largest
 8930 MOVLT R3,#1 ;else b is
 8940 B octconvert
 8950.octblue
 8960 RSB R0,R6,#F ;1-b
 8970 CMP R0,R4 ;1-b>r?
 8980 BLT octblue1
 8990 CMP R0,R5 ;yes- 1-b>g?
 9000 MOVGE R3,#0 ;if 1-b>g then 1-b is largest
 9010 MOVLT R3,#1 ;else g is
 9020 B octconvert
 9030.octblue1
 9040 CMP R4,R5 ;no- r>g?
 9050 MOVGE R3,#2 ;if r>g then r is largest
 9060 MOVLT R3,#1 ;else g is
 9070 B octconvert
 9080.octwhite
 9090 CMP R4,R5 ;if r>g
 9100 BLT octwhite1
 9110 CMP R5,R6 ;yes - g>b?
 9120 MOVGE R3,#3 ;if g>b b is smallest
 9130 MOVLT R3,#2 ;else g is
 9140 B octconvert
 9150.octwhite1
 9160 CMP R4,R6 ;no - r>b?
 9170 MOVGE R3,#3 ;if r>b b is smallest
 9180 MOVLT R3,#1 ;else r is
 9190.octconvert
 9200 CMP R3,#1 ;not red=cyan
 9210.octcyan
 9220 SUBEQ R5,R5,#F
 9230 SUBEQ R6,R6,#F
 9240.octmagenta
 9250 CMP R3,#2 ;not green=magenta
 9260 SUBEQ R4,R4,#F
 9270 SUBEQ R6,R6,#F
 9280.octyellow
 9290 CMP R3,#3 ;not blue=yellow
 9300 SUBEQ R4,R4,#F
 9310 SUBEQ R5,R5,#F
 9320.octblack
 9330 MOV R2,R12,LSR #2
 9340 AND R7,R12,#3:MOV R7,R7,LSL #1
 9350 MOV R14,#3
 9360 MOV R14,R14,LSL R7
 9370 LDRB R0,[R2]:BIC R0,R0,R14:ORR R0,R0,R3,LSL R7:STRB R0,[R2]
 9380 ADD R12,R12,R1
 9390 ADD R0,R11,#4 ;nl g%(S%)
 9400 ADD R2,R4,R4,LSL #1 ;r*3
 9410 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 9420 STR R3,[R11,-R8]
 9430 ADD R2,R4,R4,LSL #2 ;r*5
 9440 LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
 9450 STR R3,[R11]
 9460 MOV R3,R4,ASR #4 ;r/16
 9470 STR R3,[R11,R8]! ;not seen so far inc nl ptr
 9480 RSB R2,R4,R4,LSL #3 ;r*7
 9490 LDR R4,[R10] ;next r light value
 9500 ADD R4,R4,R2,ASR #4 ;next value +7/16 of r error -> new r
 9510 ADD R2,R5,R5,LSL #1 ;g*3
 9520 LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 9530 STR R3,[R0,-R8]
 9540 MOV R3,R5,ASR #4 ;g/16
 9550 STR R3,[R0,R8] ;not seen so far
 9560 ADD R2,R5,R5,LSL #2 ;g*5
 9570 LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
 9580 STR R3,[R0],#4 ;computes nl b into the bargain
 9590 RSB R2,R5,R5,LSL #3 ;g*7
 9600 LDR R5,[R10,#4] ;next g light value
 9610 ADD R5,R5,R2,ASR #4 ;next value +7/16 of g error -> new g
 9620 ADD R2,R6,R6,LSL #1 ;b*3
 9630 LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 9640 STR R3,[R0,-R8]
 9650 ADD R2,R6,R6,LSL #2 ;b*5
 9660 LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
 9670 STR R3,[R0]
 9680 MOV R3,R6,ASR #4 ;b/16
 9690 STR R3,[R0,R8] ;not seen so far
 9700 RSB R2,R6,R6,LSL #3 ;b*7
 9710 LDR R6,[R10,#8] ;next b light value
 9720 ADD R6,R6,R2,ASR #4 ;next value +7/16 of b error -> new b
 9730 ]
 9740ELSE
 9750[OPT Z
 9760 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
 9770 ADD R3,R4,R4,LSL #1 ;*3
 9780 ADD R3,R3,#F>>1 ;round up
 9790 MOVS R3,R3,LSR #bits ;final int0-3
 9800 LDRNE R2,[R7,R3,LSL #2] ;divide by 3 from table
 9810 SUBNE R4,R4,R2 ;subtract converted value
 9820 MOV R2,R12,LSR #2
 9830 AND R5,R12,#3:MOV R5,R5,LSL #1
 9840 MOV R6,#3:MOV R6,R6,LSL R5
 9850 LDRB R0,[R2]:BIC R0,R0,R6:ORR R0,R0,R3,LSL R5:STRB R0,[R2]
 9860 ADD R12,R12,R1
 9870 ADD R2,R4,R4,LSL #1 ;*3
 9880 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 9890 STR R3,[R11,-R8]
 9900 ADD R2,R4,R4,LSL #2 ;*5
 9910 LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
 9920 STR R3,[R11]
 9930 MOV R3,R4,ASR #4 ;/16
 9940 STR R3,[R11,R8]! ;not seen so far inc nl ptr
 9950 RSB R2,R4,R4,LSL #3 ;*7
 9960 LDR R4,[R10],R8 ;next light value
 9970 ADD R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
 9980 ]
 9990ENDIF
10000[OPT Z
10010 SUBS R9,R9,#1:BNE fsloop
10020 LDMFD SP !,{PC}^
10030 ]
10040WHEN 1:
10050IFm$="C" THEN
10060[OPT Z
10070.evenrow_gard DCD even_gard
10080.oddrow_gard DCD odd_gard
10090.quarterrowinc DCD 0
10100.fs%
10110 STMFD SP !,{R14}
10120 LDR R10,[R9,#4*8] ;addr current
10130 LDR R11,[R9,#3*8] ;addr next
10140 LDR R12,[R9,#2*8] ;addr pixel address
10150 LDR R12,[R12] ;pixel address
10160 LDR R8,[R9,#8] ;addr step
10170 LDR R8,[R8] ;step
10180 LDR R9,[R9] ;addr count
10190 LDR R9,[R9] ;count
10200 LDR R4,[R10],R8 ;mono value
10210 TEQ R8,#0
10220 MOVPL R1,#2
10230 LDRPL R6,evenrow_gard
10240 MVNMI R1,#1 ;+/- 2 for sprite output
10250 LDRMI R6,oddrow_gard
10260 LDR R7,quarterrowinc
10270.fsloop
10280 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
10290 ADD R5,R4,#F>>5 ;round up
10300 MOVS R5,R5,LSR #bits-4 ;final int 0-16
10310 SUBNE R4,R4,R5,LSL #bits-4 ;subtract converted value
10320 ADD R2,R4,R4,LSL #1 ;*3
10330 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
10340 STR R3,[R11,-R8]
10350 ADD R2,R4,R4,LSL #2 ;*5
10360 LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
10370 STR R3,[R11]
10380 MOV R3,R4,ASR #4 ;/16
10390 STR R3,[R11,R8]! ;not seen so far inc nl ptr
10400 RSB R2,R4,R4,LSL #3 ;*7
10410 LDR R4,[R10],R8 ;next light value
10420 ADDS R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
10430 MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
10440 ADD R3,R4,#F>>5 ;round up
10450 MOVS R3,R3,LSR #bits-4 ;final int 0-16
10460 SUBNE R4,R4,R3,LSL #bits-4 ;subtract converted value
10470 TEQ R1,#0:ORRPL R5,R5,R3,LSL #5:ORRMI R5,R3,R5,LSL #5
10480 LDR R3,[R6,R5,LSL #2] ;get 4 patterns
10490 MOV R2,R12,LSR #1:STRB R3,[R2],R7:MOV R3,R3,LSR #8:STRB R3,[R2],R7
10500 MOV R3,R3,LSR #8:STRB R3,[R2],R7:MOV R3,R3,LSR #8:STRB R3,[R2]
10510 ADD R12,R12,R1
10520 ADD R2,R4,R4,LSL #1 ;*3
10530 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
10540 STR R3,[R11,-R8]
10550 ADD R2,R4,R4,LSL #2 ;*5
10560 LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
10570 STR R3,[R11]
10580 MOV R3,R4,ASR #4 ;/16
10590 STR R3,[R11,R8]! ;not seen so far inc nl ptr
10600 RSB R2,R4,R4,LSL #3 ;*7
10610 LDR R4,[R10],R8 ;next light value
10620 ADD R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
10630 SUBS R9,R9,#2:BNE fsloop
10640 LDMFD SP !,{PC}^
10650 ]
10660ELSE
10670[OPT Z
10680.fs%
10690 STMFD SP !,{R14}
10700 LDR R10,[R9,#4*8] ;addr current
10710 LDR R11,[R9,#3*8] ;addr next
10720 LDR R12,[R9,#2*8] ;addr pixel address
10730 LDR R12,[R12] ;pixel address
10740 LDR R8,[R9,#8] ;addr step
10750 LDR R8,[R8] ;step
10760 LDR R9,[R9] ;addr count
10770 LDR R9,[R9] ;count
10780 LDR R4,[R10],R8 ;mono value
10790 TEQ R8,#0:MOVPL R1,#1:MVNMI R1,#0 ;+/- 1 for sprite output
10800.fsloop
10810 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
10820 MOV R3,#0
10830 CMP R4,#F>>1 ;>1/2?
10840 SUBCS R4,R4,#F:MOVCS R3,#1 ;final int 0-1
10850 MOV R2,R12,LSR #3
10860 AND R5,R12,#7:MOV R6,#1:MOV R6,R6,LSL R5
10870 LDRB R0,[R2]:BIC R0,R0,R6:ORR R0,R0,R3,LSL R5 ;invert r3 value in process
10880 STRB R0,[R2]
10890 ADD R12,R12,R1
10900 ADD R2,R4,R4,LSL #1 ;*3
10910 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
10920 STR R3,[R11,-R8]
10930 ADD R2,R4,R4,LSL #2 ;*5
10940 LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
10950 STR R3,[R11]
10960 MOV R3,R4,ASR #4 ;/16
10970 STR R3,[R11,R8]! ;not seen so far inc nl ptr
10980 RSB R2,R4,R4,LSL #3 ;*7
10990 LDR R4,[R10],R8 ;next light value
11000 ADD R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
11010 SUBS R9,R9,#1:BNE fsloop
11020 LDMFD SP !,{PC}^
11030 ]
11040ENDIF
11050ENDCASE
11060CASE col OF
11070WHEN 0:
11080[OPT Z
11090.mappix% ; CALL mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
11100 LDR R0,[R9]:LDR R0,[R0] ;count
11110 LDR R1,[R9,#8]:LDR R1,[R1] ;base of byte array
11120 LDR R2,[R9,#4*8] ;base of r array
11130 LDR R5,[R9,#5*8] ;base of z array
11140.mappixlp
11150 LDRB R6,[R1],#1
11160 ]
11170CASE input OF
11180WHEN 8:
11190[OPT Z
11200 LDR R7,[R2,R6,LSL #2]:STR R7,[R5],#4
11210 SUBS R0,R0,#1:BNE mappixlp
11220 MOVS PC,R14
11230 ]
11240WHEN 4:
11250IFbigendianbits THEN
11260[OPT Z
11270 MOV R10,R6,LSR #4
11280 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
11290 AND R10,R6,#&F
11300 ]
11310ELSE
11320[OPT Z
11330 AND R10,R6,#&F
11340 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
11350 MOV R10,R6,LSR #4
11360 ]
11370ENDIF
11380[OPT Z
11390 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
11400 SUBS R0,R0,#2:BHI mappixlp
11410 MOVS PC,R14
11420 ]
11430WHEN 2:
11440IFbigendianbits THEN
11450[OPT Z
11460 MOV R10,R6,LSR #6
11470 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
11480 AND R10,R6,#&30
11490 LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
11500 AND R10,R6,#&C
11510 LDR R7,[R2,R10]:STR R7,[R5],#4
11520 AND R10,R6,#&3
11530 ]
11540ELSE
11550[OPT Z
11560 AND R10,R6,#&3
11570 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
11580 AND R10,R6,#&C
11590 LDR R7,[R2,R10]:STR R7,[R5],#4
11600 AND R10,R6,#&30
11610 LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
11620 MOV R10,R6,LSR #6
11630 ]
11640ENDIF
11650[OPT Z
11660 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
11670 SUBS R0,R0,#4:BHI mappixlp
11680 MOVS PC,R14
11690 ]
11700WHEN 1:
11710IFbigendianbits THEN
11720[OPT Z
11730 AND R10,R6,#&80
11740 LDR R7,[R2,R10,LSR #5]:STR R7,[R5],#4
11750 AND R10,R6,#&40
11760 LDR R7,[R2,R10,LSR #4]:STR R7,[R5],#4
11770 AND R10,R6,#&20
11780 LDR R7,[R2,R10,LSR #3]:STR R7,[R5],#4
11790 AND R10,R6,#&10
11800 LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
11810 AND R10,R6,#&8
11820 LDR R7,[R2,R10,LSR #1]:STR R7,[R5],#4
11830 AND R10,R6,#&4
11840 LDR R7,[R2,R10]:STR R7,[R5],#4
11850 AND R10,R6,#&2
11860 LDR R7,[R2,R10,LSL #1]:STR R7,[R5],#4
11870 AND R10,R6,#&1
11880 ]
11890ELSE
11900[OPT Z
11910 AND R10,R6,#&1
11920 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
11930 AND R10,R6,#&2
11940 LDR R7,[R2,R10,LSL #1]:STR R7,[R5],#4
11950 AND R10,R6,#&4
11960 LDR R7,[R2,R10]:STR R7,[R5],#4
11970 AND R10,R6,#&8
11980 LDR R7,[R2,R10,LSR #1]:STR R7,[R5],#4
11990 AND R10,R6,#&10
12000 LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
12010 AND R10,R6,#&20
12020 LDR R7,[R2,R10,LSR #3]:STR R7,[R5],#4
12030 AND R10,R6,#&40
12040 LDR R7,[R2,R10,LSR #4]:STR R7,[R5],#4
12050 MOV R10,R6,LSR #7
12060 ]
12070ENDIF
12080[OPT Z
12090 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
12100 SUBS R0,R0,#8:BHI mappixlp
12110 MOVS PC,R14
12120 ]
12130ENDCASE
12140[OPT Z
12150; routine to add two arrays and halve output of fixed point numbers for scaling
12160.addhalf%
12170 LDR R0,[R9]:LDR R0,[R0]
12180 LDR R1,[R9,#8] ;output
12190 LDR R2,[R9,#2*8] ;input
12200.addhalflp
12210 LDR R3,[R1]:LDR R4,[R2],#4:ADD R3,R3,R4:MOV R3,R3,LSR #1:STR R3,[R1],#4
12220 SUBS R0,R0,#1:BPL addhalflp
12230 MOVS PC,R14
12240; change size in x CALLxsample%,xmul%,xdiv%,z%(1,0),xp%(1,0),x%
12250.xsample%
12260 LDR R0,[R9]:LDR R0,[R0] ;x%
12270 LDR R1,[R9,#8] ;xp (in)
12280 LDR R2,[R9,#2*8] ;z
12290 LDR R3,[R9,#3*8]:LDR R3,[R3] ;xdiv%
12300 LDR R4,[R9,#4*8]:LDR R4,[R4] ;xmul%
12310 MOV R11,R4
12320.xsamplelp
12330 LDMIA R1,{R5}
12340 SUBS R11,R11,#1:MOVEQ R11,R4:ADDEQ R1,R1,#4
12350 SUBS R12,R3,#1 ;(in range 1..)
12360 BEQ xdonediv
12370.xdivlp
12380 LDMIA R1,{R8}
12390 SUBS R11,R11,#1:MOVEQ R11,R4:ADDEQ R1,R1,#4
12400 ADD R5,R5,R8:MOV R5,R5,LSR #1
12410 SUBS R12,R12,#1:BNE xdivlp
12420.xdonediv
12430 STMIA R2!,{R5}
12440 SUBS R0,R0,#1:BPL xsamplelp
12450 MOVS PC,R14
12460]
12470WHEN 2:REM when col=2
12480[OPT Z
12490.mappix% ; CALL mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
12500 LDR R0,[R9]:LDR R0,[R0] ;count
12510 LDR R1,[R9,#8]:LDR R1,[R1] ;base of byte array
12520 LDR R2,[R9,#4*8] ;base of r array
12530 LDR R3,[R9,#3*8] ;base of g array
12540 LDR R4,[R9,#2*8] ;base of b array
12550 LDR R5,[R9,#5*8] ;base of z array
12560.mappixlp
12570 LDRB R6,[R1],#1
12580 ]
12590CASE input OF
12600WHEN 8:
12610IFflag=1600 OR flag=1601 AND ham THEN
12620[OPT Z
12630 ADR R9,ltable
12640 MOVS R7,R6,LSR #4:AND R6,R6,#15
12650 LDREQ R10,[R2,R6,LSL #2]:LDREQ R11,[R3,R6,LSL #2]:LDREQ R12,[R4,R6,LSL #2]
12660 CMP R7,#1:LDREQ R12,[R9,R6,LSL #2]
12670 CMP R7,#2:LDREQ R10,[R9,R6,LSL #2]
12680 CMP R7,#3:LDREQ R11,[R9,R6,LSL #2]
12690 STMIA R5!,{R10,R11,R12}
12700 SUBS R0,R0,#1:BNE mappixlp
12710 MOVS PC,R14
12720.ltable EQUD 0
12730 EQUD 1/15*F
12740 EQUD 2/15*F
12750 EQUD 3/15*F
12760 EQUD 4/15*F
12770 EQUD 5/15*F
12780 EQUD 6/15*F
12790 EQUD 7/15*F
12800 EQUD 8/15*F
12810 EQUD 9/15*F
12820 EQUD 10/15*F
12830 EQUD 11/15*F
12840 EQUD 12/15*F
12850 EQUD 13/15*F
12860 EQUD 14/15*F
12870 EQUD F
12880 ]
12890ELSE
12900[OPT Z
12910 LDR R7,[R2,R6,LSL #2]:STR R7,[R5],#4
12920 LDR R7,[R3,R6,LSL #2]:STR R7,[R5],#4
12930 LDR R7,[R4,R6,LSL #2]:STR R7,[R5],#4
12940 SUBS R0,R0,#1:BNE mappixlp
12950 MOVS PC,R14
12960 ]
12970ENDIF
12980WHEN 4:
12990IFbigendianbits THEN
13000[OPT Z
13010 MOV R10,R6,LSR #4
13020 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
13030 LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
13040 LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
13050 AND R10,R6,#&F
13060 ]
13070ELSE
13080[OPT Z
13090 AND R10,R6,#&F
13100 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
13110 LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
13120 LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
13130 MOV R10,R6,LSR #4
13140 ]
13150ENDIF
13160[OPT Z
13170 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
13180 LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
13190 LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
13200 SUBS R0,R0,#2:BHI mappixlp
13210 MOVS PC,R14
13220 ]
13230WHEN 2:
13240IFbigendianbits THEN
13250[OPT Z
13260 MOV R10,R6,LSR #6
13270 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
13280 LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
13290 LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
13300 AND R10,R6,#&30
13310 LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
13320 LDR R7,[R3,R10,LSR #2]:STR R7,[R5],#4
13330 LDR R7,[R4,R10,LSR #2]:STR R7,[R5],#4
13340 AND R10,R6,#&C
13350 LDR R7,[R2,R10]:STR R7,[R5],#4
13360 LDR R7,[R3,R10]:STR R7,[R5],#4
13370 LDR R7,[R4,R10]:STR R7,[R5],#4
13380 AND R10,R6,#&3
13390 ]
13400ELSE
13410[OPT Z
13420 AND R10,R6,#&3
13430 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
13440 LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
13450 LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
13460 AND R10,R6,#&C
13470 LDR R7,[R2,R10]:STR R7,[R5],#4
13480 LDR R7,[R3,R10]:STR R7,[R5],#4
13490 LDR R7,[R4,R10]:STR R7,[R5],#4
13500 AND R10,R6,#&30
13510 LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
13520 LDR R7,[R3,R10,LSR #2]:STR R7,[R5],#4
13530 LDR R7,[R4,R10,LSR #2]:STR R7,[R5],#4
13540 MOV R10,R6,LSR #6
13550 ]
13560ENDIF
13570[OPT Z
13580 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
13590 LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
13600 LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
13610 SUBS R0,R0,#4:BHI mappixlp
13620 MOVS PC,R14
13630 ]
13640WHEN 1:
13650IFbigendianbits THEN
13660[OPT Z
13670 AND R10,R6,#&80
13680 LDR R7,[R2,R10,LSR #5]:STR R7,[R5],#4
13690 LDR R7,[R3,R10,LSR #5]:STR R7,[R5],#4
13700 LDR R7,[R4,R10,LSR #5]:STR R7,[R5],#4
13710 AND R10,R6,#&40
13720 LDR R7,[R2,R10,LSR #4]:STR R7,[R5],#4
13730 LDR R7,[R3,R10,LSR #4]:STR R7,[R5],#4
13740 LDR R7,[R4,R10,LSR #4]:STR R7,[R5],#4
13750 AND R10,R6,#&20
13760 LDR R7,[R2,R10,LSR #3]:STR R7,[R5],#4
13770 LDR R7,[R3,R10,LSR #3]:STR R7,[R5],#4
13780 LDR R7,[R4,R10,LSR #3]:STR R7,[R5],#4
13790 AND R10,R6,#&10
13800 LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
13810 LDR R7,[R3,R10,LSR #2]:STR R7,[R5],#4
13820 LDR R7,[R4,R10,LSR #2]:STR R7,[R5],#4
13830 AND R10,R6,#&8
13840 LDR R7,[R2,R10,LSR #1]:STR R7,[R5],#4
13850 LDR R7,[R3,R10,LSR #1]:STR R7,[R5],#4
13860 LDR R7,[R4,R10,LSR #1]:STR R7,[R5],#4
13870 AND R10,R6,#&4
13880 LDR R7,[R2,R10]:STR R7,[R5],#4
13890 LDR R7,[R3,R10]:STR R7,[R5],#4
13900 LDR R7,[R4,R10]:STR R7,[R5],#4
13910 AND R10,R6,#&2
13920 LDR R7,[R2,R10,LSL #1]:STR R7,[R5],#4
13930 LDR R7,[R3,R10,LSL #1]:STR R7,[R5],#4
13940 LDR R7,[R4,R10,LSL #1]:STR R7,[R5],#4
13950 AND R10,R6,#&1
13960 ]
13970ELSE
13980[OPT Z
13990 AND R10,R6,#&1
14000 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
14010 LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
14020 LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
14030 AND R10,R6,#&2
14040 LDR R7,[R2,R10,LSL #1]:STR R7,[R5],#4
14050 LDR R7,[R3,R10,LSL #1]:STR R7,[R5],#4
14060 LDR R7,[R4,R10,LSL #1]:STR R7,[R5],#4
14070 AND R10,R6,#&4
14080 LDR R7,[R2,R10]:STR R7,[R5],#4
14090 LDR R7,[R3,R10]:STR R7,[R5],#4
14100 LDR R7,[R4,R10]:STR R7,[R5],#4
14110 AND R10,R6,#&8
14120 LDR R7,[R2,R10,LSR #1]:STR R7,[R5],#4
14130 LDR R7,[R3,R10,LSR #1]:STR R7,[R5],#4
14140 LDR R7,[R4,R10,LSR #1]:STR R7,[R5],#4
14150 AND R10,R6,#&10
14160 LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
14170 LDR R7,[R3,R10,LSR #2]:STR R7,[R5],#4
14180 LDR R7,[R4,R10,LSR #2]:STR R7,[R5],#4
14190 AND R10,R6,#&20
14200 LDR R7,[R2,R10,LSR #3]:STR R7,[R5],#4
14210 LDR R7,[R3,R10,LSR #3]:STR R7,[R5],#4
14220 LDR R7,[R4,R10,LSR #3]:STR R7,[R5],#4
14230 AND R10,R6,#&40
14240 LDR R7,[R2,R10,LSR #4]:STR R7,[R5],#4
14250 LDR R7,[R3,R10,LSR #4]:STR R7,[R5],#4
14260 LDR R7,[R4,R10,LSR #4]:STR R7,[R5],#4
14270 MOV R10,R6,LSR #7
14280 ]
14290ENDIF
14300[OPT Z
14310 LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
14320 LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
14330 LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
14340 SUBS R0,R0,#8:BHI mappixlp
14350 MOVS PC,R14
14360 ]
14370WHEN 24:
14380[OPT Z
14390.mappix% ; CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
14400 LDR R0,[R9]:LDR R0,[R0] ;count
14410 LDR R1,[R9,#3*8]:LDR R1,[R1] ;base of r byte array
14420 LDR R2,[R9,#2*8]:LDR R2,[R2] ;base of g byte array
14430 LDR R3,[R9,#8]:LDR R3,[R3] ;base of b byte array
14440 LDR R4,[R9,#6*8] ;base of r array
14450 LDR R5,[R9,#5*8] ;base of g array
14460 LDR R6,[R9,#4*8] ;base of b array
14470 LDR R7,[R9,#7*8] ;base of z array
14480.mappixlp
14490 LDRB R8,[R1],#step24:LDR R8,[R4,R8,LSL #2]:STR R8,[R7],#4
14500 LDRB R8,[R2],#step24:LDR R8,[R5,R8,LSL #2]:STR R8,[R7],#4
14510 LDRB R8,[R3],#step24:LDR R8,[R6,R8,LSL #2]:STR R8,[R7],#4
14520 SUBS R0,R0,#1:BNE mappixlp
14530 MOVS PC,R14
14540 ]
14550ENDCASE
14560 [OPT Z
14570; routine to add two arrays and halve output of fixed point numbers for scaling
14580.addhalf%
14590 LDR R0,[R9]:LDR R0,[R0]
14600 LDR R1,[R9,#8] ;output
14610 LDR R2,[R9,#2*8] ;input
14620.addhalflp
14630 LDR R3,[R1]:LDR R4,[R2],#4:ADD R3,R3,R4:MOV R3,R3,LSR #1:STR R3,[R1],#4
14640 LDR R3,[R1]:LDR R4,[R2],#4:ADD R3,R3,R4:MOV R3,R3,LSR #1:STR R3,[R1],#4
14650 LDR R3,[R1]:LDR R4,[R2],#4:ADD R3,R3,R4:MOV R3,R3,LSR #1:STR R3,[R1],#4
14660 SUBS R0,R0,#1:BPL addhalflp
14670 MOVS PC,R14
14680; change size in x CALLxsample%,xmul%,xdiv%,z%(1,0),xp%(1,0),x%
14690.xsample%
14700 LDR R0,[R9]:LDR R0,[R0] ;x%
14710 LDR R1,[R9,#8] ;xp (in)
14720 LDR R2,[R9,#2*8] ;z
14730 LDR R3,[R9,#3*8]:LDR R3,[R3] ;xdiv%
14740 LDR R4,[R9,#4*8]:LDR R4,[R4] ;xmul%
14750 MOV R11,R4
14760.xsamplelp
14770 LDMIA R1,{R5,R6,R7}
14780 SUBS R11,R11,#1:MOVEQ R11,R4:ADDEQ R1,R1,#12
14790 SUBS R12,R3,#1 ;(in range 1..)
14800 BEQ xdonediv
14810.xdivlp
14820 LDMIA R1,{R8,R9,R10}
14830 SUBS R11,R11,#1:MOVEQ R11,R4:ADDEQ R1,R1,#12
14840 ADD R5,R5,R8:MOV R5,R5,LSR #1
14850 ADD R6,R6,R9:MOV R6,R6,LSR #1
14860 ADD R7,R7,R10:MOV R7,R7,LSR #1
14870 SUBS R12,R12,#1:BNE xdivlp
14880.xdonediv
14890 STMIA R2!,{R5,R6,R7}
14900 SUBS R0,R0,#1:BPL xsamplelp
14910 MOVS PC,R14
14920 ]
14930ENDCASE
14940IFcompression=5 THEN
14950[OPT Z
14960; CALL LZWdecode%,table%(0,0),c%,buff%,sx%
14970.firstcode DCD 0
14980.oldcode DCD 0
14990.codesize DCD setcodes%+1
15000.stack DCD stk%
15010.sp DCD stk%
15020.maxcode DCD clearcode%+2
15030.maxcodesize DCD 2*clearcode%
15040.LZWdecode%
15050 LDR R2,firstcode
15060 LDR R3,oldcode
15070 LDR R4,stack
15080 LDR R5,codesize
15090 LDR R6,sp
15100 LDR R7,maxcode
15110 LDR R8,maxcodesize
15120 LDR R10,[R9]
15130 LDR R10,[R10] ;sx%
15140 LDR R11,[R9,#8]
15150 LDR R11,[R11] ;buff%
15160 LDR R12,[R9,#24] ;table%()
15170 STMFD SP !,{R14}
15180.lzwloop
15190 CMP R6,R4
15200 BHI lzwunstack
15210.lzwengine
15220 BL getcode
15230 CMP R0,#clearcode%
15240 BEQ lzwclear
15250;really ought to check for endcode=clearcode+1, but it only happens once and then you don't need the answer!
15260 MOV R1,R0 ;incode=code
15270 CMP R0,R7 ;if code>=maxcode
15280 STRCSB R2,[R6],#1 ;*sp++=firstcode
15290 MOVCS R0,R3 ;code=oldcode
15300 ADD R2,R12,#4 ;r2(temp)=addr table%(x,1)
15310 CMP R0,#clearcode%
15320 BCC lzwdonepush
15330.lzwpushtable
15340 LDR R14,[R2,R0,LSL #3] ;table%(code%,1)
15350 STRB R14,[R6],#1 ;*sp++=
15360 LDR R0,[R12,R0,LSL #3] ;code=table%(code%,0)
15370 CMP R0,#clearcode%
15380 BCS lzwpushtable
15390.lzwdonepush
15400 LDR R2,[R2,R0,LSL #3] ;firstcode=table%(code%,1)
15410 STRB R2,[R6],#1 ;*sp++=firstcode
15420 MOV R0,R7 ;code=maxcode
15430 CMP R0,#4096
15440 BCS lzwnocode
15450 STR R3,[R12,R0,LSL #3] ;table%(code%,0)=oldcode
15460 ADD R14,R12,#4
15470 STR R2,[R14,R0,LSL #3] ;table%(code%,1)=firstcode
15480 ADD R7,R7,#1 ;maxcode++
15490 CMP R7,R8
15500 BCC lzwnocode ;if maxcode>=maxcodesize
15510 CMP R8,#4096 ;and maxcodesize<4096
15520 ADDCC R5,R5,#1 ;codesize++
15530 MOVCC R8,R8,LSL #1 ;double maxcodesize
15540.lzwnocode
15550 MOV R3,R1 ;oldcode=incode
15560 CMP R6,R4 ;until sp>stk
15570 BLS lzwengine
15580.lzwunstack
15590 LDRB R0,[R6,#-1]! ;*--sp
15600.lzwloopend
15610 STRB R0,[R11],#1
15620 SUBS R10,R10,#1
15630 BNE lzwloop
15640 STR R2,firstcode
15650 STR R3,oldcode
15660 STR R5,codesize
15670 STR R6,sp
15680 STR R7,maxcode
15690 STR R8,maxcodesize
15700 LDMFD SP !,{PC}^
15710.lzwclear
15720 MOV R0,#0:MOV R1,#0
15730 MOV R2,#1<<12
15740 MOV R3,R12
15750.lzwzerotable
15760 STMIA R3 !,{R0,R1}
15770 SUBS R2,R2,#1
15780 BNE lzwzerotable
15790 ADD R3,R12,#4
15800.lzwdefaulttable
15810 STR R0,[R3],#8
15820 ADD R0,R0,#1
15830 CMP R0,#clearcode%
15840 BCC lzwdefaulttable
15850 MOV R5,#setcodes%+1
15860 MOV R7,#clearcode%
15870 MOV R8,R7,LSL #1 ;maxcodesize=clearcode*2
15880 ADD R7,R7,#2 ;maxcode=clearcode+2
15890 BL getcode
15900 MOV R2,R0 ;firstcode
15910 MOV R3,R0 ;oldcode
15920 MOV R6,R4 ;sp=stk
15930 B lzwloopend
15940;enter with codesize in R5. Result in R0. Kills R1
15950.getcode
15960 STMFD SP !,{R6,R7,R8}
15970 ADR R6,curbit
15980 LDMIA R6,{R6,R7,R8}
15990 ADD R1,R5,R6 ;curbit+codesize
16000 CMP R1,R7
16010 BCS needmoredata
16020.simplecode
16030 ADD R7,R8,R6,LSR #3
16040 BIC R7,R7,#3
16050 LDMIA R7,{R0,R7}
16060 ANDS R1,R6,#31:MOVNE R0,R0,LSR R1:RSBNE R1,R1,#32:ORRNE R0,R0,R7,LSL R1
16070 MVN R1,#0:BIC R0,R0,R1,LSL R5
16080 ADD R6,R6,R5
16090 STR R6,curbit
16100 LDMFD SP !,{R6,R7,R8}
16110 MOV PC,R14
16120.needmoredata
16130 STMFD SP !,{R2,R3,R4}
16140 MOV R3,R7,LSR #3
16150 SUB R0,R3,#2 ;lastbyte-2
16160 LDRB R0,[R8,R0]
16170 STRB R0,[R8]
16180 SUB R0,R3,#1 ;lastbyte-1
16190 LDRB R0,[R8,R0]
16200 STRB R0,[R8,#1]
16210 LDR R1,[R9,#16]
16220 LDR R1,[R1] ;c%
16230 SWI "OS_BGet"
16240 MOVS R3,R0 ;count
16250 BEQ simplecode1
16260 SUB R6,R6,R7 ;curbit-lastbit
16270 ADD R6,R6,#16
16280 ADD R0,R0,#2 ;lastbyte=2+count
16290 MOV R7,R0,LSL #3
16300 STR R7,lastbit
16310 MOV R0,#4
16320 ADD R2,R8,#2 ;buf+2
16330 SWI "OS_GBPB"
16340.simplecode1
16350 LDMFD SP !,{R2,R3,R4}
16360 B simplecode
16370.curbit DCD 0
16380.lastbit DCD 0
16390.buf DCD buf%
16400 ]
16410ENDIF
16420IFrange% THEN
16430[OPT Z
16440;CALL maxmin%,a%(1,0),totalvals%
16450.maxmin%
16460 LDR R0,[R9]:LDR R0,[R0] ;totalvals%
16470 LDR R1,[R9,#8] ;a%()
16480 LDR R2,min
16490 LDR R3,max
16500.maxminlp
16510 LDR R4,[R1],#4
16520 CMP R4,R3:MOVCS R3,R4 ;if r4>max max=r4
16530 CMP R4,R2:MOVCC R2,R4 ;if r4<min min=r4
16540 SUBS R0,R0,#1:BNE maxminlp
16550 STR R2,min
16560 STR R3,max
16570 MOVS PC,R14
16580.min DCD F
16590.max DCD 0
16600.fitmulloc DCD 0
16610;CALL ranger%,a%(1,0),totalvals%
16620.ranger%
16630 LDR R0,[R9]
16640 LDR R0,[R0] ;totalvals%
16650 LDR R1,[R9,#8] ;a%()
16660 LDR R2,min
16670 LDR R3,fitmulloc
16680 MOV R4,R3,LSR #16
16690 EOR R3,R3,R4,LSL #16
16700.rangelp
16710 LDR R5,[R1]
16720 SUB R5,R5,R2
16730 MOV R6,R5,LSR #16
16740 EOR R5,R5,R6,LSL #16
16750 MUL R7,R3,R5
16760 MUL R5,R4,R5
16770 MUL R8,R6,R3
16780 MUL R6,R4,R6
16790 ADDS R8,R5,R8
16800 ADDCS R6,R6,#&10000
16810 ADDS R7,R7,R8,LSL #16
16820 ADC R6,R6,R8,LSR #16
16830 MOV R6,R6,LSL #(32-28)
16840 ORRS R6,R6,R7,LSR #28
16850 ADDCS R6,R6,#1 ;carry is shifted out bit
16860 CMP R6,#F
16870 MOVCS R6,#F
16880 STR R6,[R1],#4
16890 SUBS R0,R0,#1
16900 BNE rangelp
16910 MOVS PC,R14
16920 ]
16930ENDIF
16940IFsharpen% THEN
16950sharp=(col+1)*4:IFsharpen%<>8 sharpmul%=F/(sharpen%-8)
16960[OPT Z
16970;CALL sharp%,z%(1,0),rm%(1,0),rm1%(1,0),rm2%(1,0),totalvals%
16980.sharp%
16990 LDR R0,[R9]
17000 LDR R0,[R0] ;sx%
17010 LDR R1,[R9,#8] ;rm2%()
17020 LDR R2,[R9,#16] ;rm1%()
17030 LDR R3,[R9,#24] ;rm%()
17040 LDR R4,[R9,#32] ;z%()
17050 ]
17060CASE sharpen% OF
17070WHEN 8,9,12,16,24
17080OTHERWISE
17090[OPT Z
17100 MOV R8,#sharpmul% AND &FF
17110 ORR R8,R8,#sharpmul% AND &FF00
17120 MOV R9,#(sharpmul% >> 16) AND &FF
17130 ORR R9,R9,#(sharpmul% >> 16) AND &FF00
17140 ]
17150ENDCASE
17160[OPT Z
17170.sharplp
17180 LDR R5,[R1,#-sharp]
17190 LDR R6,[R1,#sharp]
17200 ADD R5,R5,R6
17210 LDR R6,[R1],#4
17220 ADD R5,R5,R6
17230 LDR R6,[R3,#-sharp]
17240 ADD R5,R5,R6
17250 LDR R6,[R3,#sharp]
17260 ADD R5,R5,R6
17270 LDR R6,[R3],#4
17280 ADD R5,R5,R6
17290 LDR R6,[R2,#-sharp]
17300 ADD R5,R5,R6
17310 LDR R6,[R2,#sharp]
17320 ADD R5,R5,R6 ;unsigned total to subtract
17330 LDR R6,[R2],#4 ;centre
17340 MOV R6,R6,LSR #1
17350 MOV R7,#sharpen%
17360 MUL R7,R6,R7 ;avoid duplicate register while keeping Rs small
17370 SUBS R5,R7,R5,LSR #1
17380 MOVCC R5,#0 ;underflow to 0 now!
17390 ]
17400CASE sharpen% OF
17410WHEN 8,9
17420[OPT Z
17430 MOV R6,R5,LSL #1
17440 ]
17450WHEN 10
17460[OPT Z
17470 MOV R6,R5
17480 ]
17490WHEN 12
17500[OPT Z
17510 MOV R6,R5,LSR #1
17520 ]
17530WHEN 16
17540[OPT Z
17550 MOV R6,R5,LSR #2
17560 ]
17570WHEN 24
17580[OPT Z
17590 MOV R6,R5,LSR #3
17600 ]
17610OTHERWISE
17620[OPT Z
17630 MOV R6,R5,LSR #16
17640 EOR R5,R5,R6,LSL #16
17650 MUL R7,R8,R5
17660 MUL R5,R9,R5
17670 MUL R10,R6,R8
17680 MUL R6,R9,R6
17690 ADDS R10,R5,R10
17700 ADDCS R6,R6,#&10000
17710 ADDS R7,R7,R10,LSL #16
17720 ADC R6,R6,R10,LSR #16
17730 MOV R6,R6,LSL #(32-27)
17740 ORRS R6,R6,R7,LSR #27
17750 ADDCS R6,R6,#1 ;carry is shifted out bit
17760 ]
17770ENDCASE
17780[OPT Z
17790 CMP R6,#F
17800 MOVCS R6,#F
17810 STR R6,[R4],#4
17820 SUBS R0,R0,#1
17830 BNE sharplp
17840 MOVS PC,R14
17850 ]
17860ENDIF
17870IFhist%ORequal% THEN
17880[OPT Z
17890;CALLhisto%,z%(1,0),vals%(0,0),sx%
17900.histo%
17910 LDR R0,[R9]
17920 LDR R0,[R0] ;sx%
17930 LDR R1,[R9,#8] ;vals%()
17940 LDR R2,[R9,#16]
17950.histlp
17960 ]
17970IFcol=0 THEN
17980[OPT Z
17990 LDR R3,[R2],#4
18000 CMP R3,#F
18010 MOVCS R3,#F
18020 MOV R3,R3,LSR #bits-8
18030 LDR R4,[R1,R3,LSL #2]
18040 ADD R4,R4,#1
18050 STR R4,[R1,R3,LSL #2]
18060 ]
18070ELSE
18080[OPT Z
18090 LDR R3,[R2],#4
18100 CMP R3,#F
18110 MOVCS R3,#F
18120 MOV R3,R3,LSR #bits-8
18130 ADD R3,R3,R3,LSL #1
18140 LDR R4,[R1,R3,LSL #2]
18150 ADD R4,R4,#1
18160 STR R4,[R1,R3,LSL #2]
18170 LDR R3,[R2],#4
18180 CMP R3,#F
18190 MOVCS R3,#F
18200 MOV R3,R3,LSR #bits-8
18210 ADD R3,R3,R3,LSL #1
18220 ADD R3,R3,#1
18230 LDR R4,[R1,R3,LSL #2]
18240 ADD R4,R4,#1
18250 STR R4,[R1,R3,LSL #2]
18260 LDR R3,[R2],#4
18270 CMP R3,#F
18280 MOVCS R3,#F
18290 MOV R3,R3,LSR #bits-8
18300 ADD R3,R3,R3,LSL #1
18310 ADD R3,R3,#2
18320 LDR R4,[R1,R3,LSL #2]
18330 ADD R4,R4,#1
18340 STR R4,[R1,R3,LSL #2]
18350 ]
18360ENDIF
18370[OPT Z
18380 SUBS R0,R0,#1
18390 BNE histlp
18400 MOVS PC,R14
18410 ]
18420ENDIF
18430IFequal% THEN
18440[OPT Z
18450;CALLhistequal%,z%(1,0),new%(0),sx%
18460.histequal%
18470 LDR R0,[R9]
18480 LDR R0,[R0] ;sx%
18490 LDR R1,[R9,#8] ;new%()
18500 LDR R2,[R9,#16] ;z%()
18510.equallp
18520 ]
18530IFcol=0 THEN
18540[OPT Z
18550 LDR R3,[R2]
18560 CMP R3,#F
18570 MOVCS R3,#F
18580 MOV R3,R3,LSR #bits-8
18590 LDR R4,[R1,R3,LSL #2]
18600 STR R4,[R2],#4
18610 ]
18620ELSE
18630[OPT Z
18640 LDR R3,[R2]
18650 CMP R3,#F
18660 MOVCS R3,#F
18670 MOV R3,R3,LSR #bits-8
18680 ADD R3,R3,R3,LSL #1
18690 LDR R4,[R1,R3,LSL #2]
18700 STR R4,[R2],#4
18710 LDR R3,[R2]
18720 CMP R3,#F
18730 MOVCS R3,#F
18740 MOV R3,R3,LSR #bits-8
18750 ADD R3,R3,R3,LSL #1
18760 ADD R3,R3,#1
18770 LDR R4,[R1,R3,LSL #2]
18780 STR R4,[R2],#4
18790 LDR R3,[R2]
18800 CMP R3,#F
18810 MOVCS R3,#F
18820 MOV R3,R3,LSR #bits-8
18830 ADD R3,R3,R3,LSL #1
18840 ADD R3,R3,#2
18850 LDR R4,[R1,R3,LSL #2]
18860 STR R4,[R2],#4
18870 ]
18880ENDIF
18890[OPT Z
18900 SUBS R0,R0,#1
18910 BNE equallp
18920 MOVS PC,R14
18930 ]
18940ENDIF
18950[OPT Z
18960;CALL rlexpand%,limit%,decr%,colour%,address%
18970;IFdecr%>1 REPEAT?address%++=colour%;decr%--;UNTILdecr%<1 OR address%=limit%
18980.rlexpand%
18990 LDR R0,[R9] ;adr of address%
19000 LDR R1,[R0] ;address%
19010 LDR R2,[R9,#8]
19020 LDR R2,[R2] ;colour%
19030 LDR R3,[R9,#16] ;adr of decr%
19040 LDR R4,[R3] ;decr%
19050 CMP R4,#1
19060 MOVLTS PC,R14
19070 LDR R5,[R9,#24]
19080 LDR R5,[R5] ;limit%
19090.rle STRB R2,[R1],#1
19100 SUB R4,R4,#1
19110 CMP R1,R5
19120 TEQNE R4,#0
19130 BNE rle
19140.rlexit STR R1,[R0] ;update address%
19150 STR R4,[R3] ;update decr%
19160 MOVS PC,R14
19170 ]
19180IFplanar<0 THEN
19190[OPT Z
19200.plancnv% ;CALLplancnv%,st%(1),quant%,buff%,sx%
19210 LDR R0,[R9]:LDR R0,[R0] ;sx%
19220 LDR R1,[R9,#8]:LDR R1,[R1] ;buff%
19230 LDR R2,[R9,#16]:LDR R2,[R2] ;quant%
19240 LDR R3,[R9,#24] ;adr of st%()
19250 MOV R4,#7
19260 MOV R5,#0
19270 MOV R6,#0
19280.planelp
19290 MOV R7,#0
19300 SUB R8,R2,#1
19310.planepixlp
19320 LDR R9,[R3,R8,LSL #2]
19330 LDRB R9,[R9,R5]
19340 MOV R9,R9,LSR R4
19350 AND R9,R9,#1
19360 ORR R7,R7,R9,LSL R8
19370 SUBS R8,R8,#1:BPL planepixlp
19380 STRB R7,[R1],#1
19390 SUBS R4,R4,#1:MOVMI R4,#7:ADDMI R5,R5,#1
19400 SUBS R0,R0,#1:BNE planelp
19410 MOVS PC,R14
19420 ]
19430ENDIF
19440NEXT
19450hour%=&406c4
19460CASE ncol OF
19470WHEN 255:size%=1
19480WHEN 63:size%=1
19490WHEN 15:size%=2
19500WHEN 3:size%=4
19510WHEN 1:size%=8:IFm$="C" size%=2
19520ENDCASE
19530REM fixup images that can't be read in row order
19540CASE flag OF
19550WHEN 501
19560IFinfo% PRINT"Reading interlaced GIF"
19570sz%=sx%*sy%:tbuff%=FNdim(sz%+100):otbuff%=tbuff%
19580FORY%=0TOsy%-1STEP8:X%=tbuff%+Y%*sx%:CALL LZWdecode%,table%(0,0),c%,X%,sx%:NEXT
19590FORY%=4TOsy%-1STEP8:X%=tbuff%+Y%*sx%:CALL LZWdecode%,table%(0,0),c%,X%,sx%:NEXT
19600FORY%=2TOsy%-1STEP4:X%=tbuff%+Y%*sx%:CALL LZWdecode%,table%(0,0),c%,X%,sx%:NEXT
19610FORY%=1TOsy%-1STEP2:X%=tbuff%+Y%*sx%:CALL LZWdecode%,table%(0,0),c%,X%,sx%:NEXT
19620FORY%=0TOsy%-1:SYShour%,Y%*100DIVsy%
19630 IFvrep% THEN
19640  vrep%-=1:FORX%=1TOquant%
19650   F%=st%(X%)+Y%*rsx%:C%=F%-rsx%:FORE%=0TOrsx%-1:F%?E%=C%?E%:NEXT
19660  NEXT
19670 ELSE
19680  FORX%=1TOquant%
19690   F%=st%(X%)+Y%*rsx%:G%=F%+rsx%:REPEAT C%=BGET#c%:IFC%=0 THEN
19700    C%=BGET#c%:IFC%=0 THEN
19710     C%=BGET#c%:vrep%=BGET#c%-1
19720    ELSE
19730     D%=F%:FORE%=0TOpatlen%-1:F%?E%=BGET#c%:NEXT:F%+=patlen%
19740     IFC%>1 FORI%=2TOC%:FORE%=0TOpatlen%-1:F%?E%=D%?E%:NEXT:F%+=patlen%:NEXT
19750    ENDIF
19760   ELSE
19770    IFC%=128 THEN
19780     C%=BGET#c%:FORE%=0TOC%-1:F%?E%=BGET#c%:NEXT:F%+=C%
19790    ELSE
19800     ?F%=(C%AND&80)<>0:FORE%=1TOC%AND&7F:F%?E%=?F%:NEXT:F%+=C%AND&7F
19810    ENDIF
19820   ENDIF
19830   UNTILF%>=G%
19840  NEXT
19850 ENDIF
19860NEXT
19870ENDCASE
19880REM if image processing the input stream to maximise luminance
19890IFrange% THEN
19900 IFinfo% PRINT"Scanning data to compute parameters for '-range'"
19910 IForder% THEN
19920  Y%=0:REPEAT SYShour%,Y%*100DIVsy%
19930   PROCiprow(xp%()):CALLmaxmin%,xp%(1,0),totalvals2%:Y%+=1
19940  UNTILY%=sy% OR !min<255 AND !max+255>=F
19950 ELSE
19960  Y%=0:ysamp%=1:REPEAT SYShour%,Y%*100DIVy%
19970   PROCscaledpixelrow(cl%()):CALLmaxmin%,cl%(1,0),totalvals%:Y%+=1
19980  UNTILY%=y% OR !min<255 AND !max+255>=F
19990 ENDIF
20000 !fitmulloc=F/(!max-!min)*F:PROCrewind
20010 IF!max+255>=F AND!min<255 range%=FALSE:range$="No point in '-range' on this image"
20020 IFrange% range$="Input image maximum "+STR$(!max/F*100)+"% minimum "+STR$(!min/F*100)+"%"
20030 IFinfo% PRINTrange$
20040ENDIF
20050IFhist%ORequal% THEN
20060 IFequal% IFinfo% PRINT"Scanning data to compute parameters for '-equal'"
20070 IForder% THEN
20080  FORyr%=0TOsy%-1:SYShour%,yr%*100DIVsy%
20090   PROCiprow(xp%()):CALLhisto%,xp%(1,0),vals%(0,0),sx%
20100  NEXT
20110 ELSE
20120  ysamp%=1:FORyr%=0 TO y%-1:SYShour%,yr%*100DIVy%
20130   PROCscaledpixelrow(cl%()):CALLhisto%,cl%(1,0),vals%(0,0),x%
20140  NEXT
20150 ENDIF
20160 IFinfo% PRINT"Done. Now processing the picture"
20170ENDIF
20180IFhist% THEN
20190 M%=0:ZM%=-1:FORC%=0TOcol
20200  FORZ%=0TO256:IFvals%(Z%,C%)>M% M%=vals%(Z%,C%):ZM%=Z%
20210 NEXT:NEXT
20220 IFZM%=-1 OR output%=0 THEN=100
20230 IF col>0 MODE66:ht=500:LINE0,6,2000,6 ELSE MODE18:ht=400:LINE0,6,1024,6
20240 M=M%/(ht*2-8):FORC%=0TOcol:CASE C% OF
20250  WHEN 0:GCOL1
20260  WHEN 1:GCOL2
20270  WHEN 2:GCOL4
20280  ENDCASE
20290  IF col>0 THEN
20300   FORZ%=0TO256:IFvals%(Z%,C%) X%=Z%*3+C%<<1:LINEX%,8,X%,vals%(Z%,C%)/M+8
20310   NEXT
20320  ELSE
20330   FORZ%=0TO256:IFvals%(Z%,C%) X%=Z%<<2:RECTANGLE FILLX%,8,2,vals%(Z%,C%)/M
20340   NEXT
20350  ENDIF
20360 NEXT
20370 IFc% CLOSE#c%:c%=0
20380 IFcc% CLOSE#cc%:cc%=0
20390 IFccc% CLOSE#ccc%:ccc%=0
20400 SYS"Hourglass_Off"
20410 =100
20420ENDIF
20430oname$="pic"+STR$m+"_":IFrange% oname$+="r_"
20440IFequal% oname$+="e_"
20450IFsharpen% oname$+="s"+STR$sharpen%+"_"
20460oname$=LEFT$(oname$)
20470CASE m OF
20480WHEN -1:xwords%=x%:sz%=xwords%*y%
20490 IFspritearea%<0 THEN ram%=FNdim(sz%) ELSE ram%=spritearea%
20500 base%=ram%
20510OTHERWISE:xwords%=x%/size%+3.9999ANDNOT3:sz%=xwords%*y%
20520 IFncol=1 IFm$="C" !quarterrowinc=xwords%:xwords%=xwords%*4:sz%=xwords%*y%
20530 IFspritearea%<0 THEN ram%=FNdim(sz%+1024) ELSE ram%=spritearea%
20540 !ram%=sz%+1024:ram%!4=0:ram%!8=16:ram%!12=16:SYS&2e,&109,ram%
20550 IFncol=1 ANDm$="C" SYS&2e,&10f,ram%,oname$,1,x%*4,y%*4,m ELSE SYS&2e,&10f,ram%,oname$,(ncol<63)AND1,x%,y%,m
20560 base%=ram%+ram%!&30+&10:pal%=ram%+&3c
20570 CASE ncol OF
20580 WHEN 15:
20590 CASE m$ OF
20600  WHEN "D"
20610   FORZ%=0TO7:Y%=0:IFZ%AND1 Y%+=&F0
20620   IFZ%AND2 Y%+=&F000
20630   IFZ%AND4 Y%+=&F00000
20640   PROCcol(Z%,Y%):NEXT
20650  WHEN "C"
20660   FORZ%=0TO15:Y%=0:IFZ%AND4 Y%+=&F0
20670   IFZ%AND3 Y%+=(Z%AND3)*5<<12:IF(Z%AND3)=1 Y%+=&1000:REM Gamma correct g low
20680   IFZ%AND8 Y%+=&F00000
20690   PROCcol(Z%,Y%):NEXT
20700  WHEN "T"
20710   FORZ%=0TO15:Y%=Z%<<4:PROCcol(Z%,Y%ORY%<<8ORY%<<16):NEXT
20720  WHEN ""
20730   FORZ%=0TO15:Y%=(Z%AND7)/7*15+.2<<4:PROCcol(Z%,Y%ORY%<<8ORY%<<16):NEXT
20740  ENDCASE
20750 WHEN 3
20760  IFm$="C" THEN
20770   PROCcol(0,0):PROCcol(1,&F0F000):PROCcol(2,&F000F0):PROCcol(3,&F0F0)
20780  ELSE
20790   FORZ%=0TO3:Y%=Z%*5<<4:PROCcol(Z%,Y%ORY%<<8ORY%<<16):NEXT
20800  ENDIF
20810 WHEN 1:PROCcol(0,0):PROCcol(1,&F0F0F0)
20820 ENDCASE
20830ENDCASE
20840LOCAL ERROR
20850ON ERROR LOCAL:RESTORE ERROR:PROCSave:ERROR ERR,REPORT$+" internal ("+STR$ERL+")":REM Error Return
20860SYS"Hourglass_LEDs",3:ysamp%=1:nl%()=0:step%=12:IFcol=0 step%=4
20870IFsy%=y% AND sx%=x% AND range%=FALSE AND sharpen%=FALSE AND equal%=FALSE THEN
20880FORyr%=0 TO y%-1
20890 SYShour%,yr%*100DIVy%:PROCiprow(cl%())
20900 cl%()=cl%()+nl%():nl%()=0:B%=x%:A%=(base%+yr%*xwords%)*size%
20910 IFyr%AND1 THEN
20920  I%=step%:CALLfs%,cl%(1,0),nl%(1,0),A%,I%,B%
20930 ELSE
20940  I%=-step%:A%+=x%-1:CALLfs%,cl%(x%,0),nl%(x%,0),A%,I%,B%
20950 ENDIF
20960NEXT
20970ELSE
20980IFequal% THEN
20990 PROCrewind:range%=TRUE:Havg%=SUM(vals%())/256/(col+1):DIM new%(256,col)
21000 FORB%=0TOcol:R%=0:Hint%=0:FORZ%=0TO256:L%=R%:Hint%+=vals%(Z%,B%)
21010  WHILEHint%>Havg%:Hint%-=Havg%:R%+=1:ENDWHILE
21020  new%(Z%,B%)=(L%+R%)/2*F/256
21030 NEXT:NEXT
21040ENDIF
21050IFsharpen% THEN
21060 IForder% THEN
21070  yread%=sy%-1:PROCiprow(rm1%()):IFrange% PROCfit2(rm1%())
21080  FORB%=0TOcol:rm1%(0,B%)=rm1%(1,B%):rm1%(sx%+1,B%)=rm1%(sx%,B%):NEXT
21090 ELSE
21100  yread%=y%-1:PROCscaledpixelrow(rm1%()):IFrange% PROCfit(rm1%())
21110  FORB%=0TOcol:rm1%(0,B%)=rm1%(1,B%):rm1%(x%+1,B%)=rm1%(x%,B%):NEXT
21120 ENDIF
21130 rm2%()=rm1%()
21140ENDIF
21150IForder% THEN
21160FORyr%=0 TO y%-1
21170 SYShour%,yr%*100DIVy%
21180 IFsy%=y% THEN
21190  PROCsharppixelrow(cl%())
21200 ELSE
21210  ysamp%-=1:IFysamp%=0 PROCsharppixelrow(xl%()):ysamp%=ymul%
21220  cl%()=xl%():IFydiv%>1 THEN
21230   FORY%=2TOydiv%:ysamp%-=1:IFysamp%=0 PROCsharppixelrow(xl%()):ysamp%=ymul%
21240    CALLaddhalf%,xl%(0,0),cl%(0,0),x%:NEXT
21250  ENDIF
21260 ENDIF
21270 cl%()=cl%()+nl%():nl%()=0:B%=x%:A%=(base%+yr%*xwords%)*size%
21280 IFyr%AND1 THEN
21290  I%=step%:CALLfs%,cl%(1,0),nl%(1,0),A%,I%,B%
21300 ELSE
21310  I%=-step%:A%+=x%-1:CALLfs%,cl%(x%,0),nl%(x%,0),A%,I%,B%
21320 ENDIF
21330NEXT
21340ELSE
21350FORyr%=0 TO y%-1
21360 SYShour%,yr%*100DIVy%
21370 IFsharpen% THEN
21380  IFyread% yread%-=1:PROCscaledpixelrow(rm%()):IFrange% PROCfit(rm%())
21390  FORB%=0TOcol:rm%(0,B%)=rm%(1,B%):rm%(x%+1,B%)=rm%(x%,B%):NEXT
21400  CALL sharp%,cl%(1,0),rm%(1,0),rm1%(1,0),rm2%(1,0),totalvals%
21410  SWAP rm2%(),rm1%():rm1%()=rm%()
21420 ELSE
21430  PROCscaledpixelrow(cl%()):IFrange% PROCfit(cl%())
21440 ENDIF
21450 cl%()=cl%()+nl%():nl%()=0:B%=x%:A%=(base%+yr%*xwords%)*size%
21460 IFyr%AND1 THEN
21470  I%=step%:CALLfs%,cl%(1,0),nl%(1,0),A%,I%,B%
21480 ELSE
21490  I%=-step%:A%+=x%-1:CALLfs%,cl%(x%,0),nl%(x%,0),A%,I%,B%
21500 ENDIF
21510NEXT
21520ENDIF
21530ENDIF
21540PROCSave
21550=0:REM Success!
21560DEF PROCSave
21570IFc% CLOSE#c%:c%=0
21580IFcc% CLOSE#cc%:cc%=0
21590IFccc% CLOSE#ccc%:ccc%=0
21600CASE m OF
21610 WHEN -1:IFspritearea%<0 IFsave% SYS"OS_File",10,f$,&004,,ram%,ram%+sz%
21620 OTHERWISE
21630 IFvflip% SYS&2e,256+33,ram%,oname$
21640 IFhflip% SYS&2e,256+47,ram%,oname$
21650 IFspritearea%<0 IFsave% SYS&2e,&10c,ram%,f$
21660ENDCASE
21670SYS"Hourglass_Off"
21680ENDPROC
21690DEFPROCdefpal
21700FORC%=0TO255
21710 r%(C%)=(C%AND7 OR (C%AND16)>>1)/15*F
21720 g%(C%)=(C%AND3 OR (C%AND&60)>>3)/15*F
21730 b%(C%)=(C%AND3 OR (C%AND8)>>1 OR (C%AND128)>>4)/15*F
21740NEXT
21750ENDPROC
21760DEFPROCdefpal2
21770r%(0)=F:g%(0)=F:b%(0)=F
21780ENDPROC
21790DEFPROCdefpal4
21800r%()=15,10,5,0:FORC%=0TO3:r%(C%)=r%(C%)/15*F:NEXT
21810g%()=r%():b%()=r%()
21820ENDPROC
21830DEFPROCdefpal16
21840r%()=15,13,11,9,7,5,3,0,0,14, 0,13,14,5,15, 0
21850g%()=15,13,11,9,7,5,3,0,4,14,12, 0,14,8,11,10
21860b%()=15,13,11,9,7,5,3,0,9, 0, 0, 0,11,0, 0,15
21870FORC%=0TO15:r%(C%)=r%(C%)/15*F:g%(C%)=g%(C%)/15*F:b%(C%)=b%(C%)/15*F:NEXT
21880ENDPROC
21890DEFPROCipal63
21900PTR#c%=&38:DIM rpal%(15),gpal%(15),bpal%(15)
21910FORC%=0TO15:D%=BGET#c%
21920 rpal%(C%)=BGET#c%>>4 AND 7
21930 gpal%(C%)=BGET#c%>>4 AND 3
21940 bpal%(C%)=BGET#c%>>4 AND 7
21950D%=FNW:NEXT
21960FORC%=0TO255
21970 r%(C%)=(rpal%(C%AND15)OR(C%AND16)>>1)/15*F
21980 g%(C%)=(gpal%(C%AND15)OR(C%AND&60)>>3)/15*F
21990 b%(C%)=(bpal%(C%AND15)OR(C%AND128)>>4)/15*F
22000NEXT
22010ENDPROC
22020DEFPROCipal(D%)
22030PTR#c%=&38
22040FORC%=0TOD%-1:D%=BGET#c%
22050 r%(C%)=(BGET#c%>>4)/15*F
22060 g%(C%)=(BGET#c%>>4)/15*F
22070 b%(C%)=(BGET#c%>>4)/15*F
22080D%=FNW:NEXT
22090ENDPROC
22100DEF PROCnopal
22110FORC%=0TO255:r%(C%)=C%/255*F:NEXT:g%()=r%():b%()=r%()
22120ENDPROC
22130DEF PROCcol(A%,B%)
22140B%=B%<<8ORB%<<4OR&10:pal%!(A%*8)=B%:pal%!(A%*8+4)=B%
22150ENDPROC
22160DEF FNuc(a$)
22170LOCALZ%,z$,b$
22180FORZ%=1TOLENa$
22190z$=MID$(a$,Z%,1)
22200IFz$>="a"IFz$<="z" z$=CHR$(ASCz$-32)
22210b$+=z$:NEXT
22220=b$
22230DEF FNdim(A%)
22240LOCAL B%
22250IFflex% THEN
22260 B%=nextlocation%:A%=A%+3ANDNOT3:nextlocation%+=A%+16
22270 SYS"Wimp_SlotSize",-1,-1 TO currentslot%,nextslot%,freeslot%
22280 IFnextslot%+freeslot%<A% ERROR 42,"Cannot claim enough memory to process image"
22290 currentslot%+=A%:SYS "Wimp_SlotSize",currentslot%,-1
22300ELSE
22310 IFworkspace%<0 THEN
22320  DIM B% A%
22330 ELSE
22340  B%=workspace%:workspace%+=A%+3ANDNOT3:IFworkspace%>worklimit% ERROR42,"Not enough workspace"
22350 ENDIF
22360ENDIF
22370=B%
22380REM read little endian 32 bit word
22390DEF FNW=FNW1(c%)
22400DEF FNW1(c%)=BGET#c% OR BGET#c%<<8 OR BGET#c%<<16 OR BGET#c%<<24
22410REM read little endian 16 bit word
22420DEF FNHW=BGET#c% OR BGET#c%<<8
22430REM read big endian 16 bit word
22440DEF FNbeHW=BGET#c%<<8 OR BGET#c%
22450REM read big endian 32 bit word
22460DEF FNbeW=BGET#c%<<24 OR BGET#c%<<16 OR BGET#c%<<8 OR BGET#c%
22470REM read a TIFF type
22480DEF FNtiff(T%)
22490CASE T% OF
22500WHEN 1:=BGET#c%
22510WHEN 2:LOCALs$,t$:REPEATs$+=t$:t$=CHR$BGET#c%:UNTILt$=CHR$0:=s$
22520WHEN 3:IFbigendian THEN=BGET#c%<<8 OR BGET#c% ELSE=BGET#c% OR BGET#c%<<8
22530WHEN 4:IFbigendian THEN=FNbeW ELSE=FNW1(c%)
22540ENDCASE
22550ERROR 42,"Silly TIFF tag:"+STR$T%
22560DEF PROCTIFFnextstrip
22570TIFFread%=rowsperstrip
22580TIFFptr+=1:PTR#c%=st%(TIFFptr)
22590ENDPROC
22600DEF PROCiff(A%)
22610I%=0:REPEAT
22620 C%=BGET#c%:IFC%>127 THEN
22630  IFC%>128 A%?I%=BGET#c%:FORJ%=A%+I%+1TOA%+I%+256-C%:?J%=A%?I%:NEXT:I%+=257-C%
22640 ELSE
22650  FORJ%=A%+I%TOA%+I%+C%:?J%=BGET#c%:NEXT:I%+=C%+1
22660 ENDIF
22670UNTILI%>=rsx%-1
22680ENDPROC
22690REM standard size corrector for unknown images
22700DEF PROCsize
22710IFscale% THEN
22720 REM small images get enlarged
22730 IFsx%<=320 IF sy%<=256 xmul%=xmul%*2:ymul%=ymul%*2
22740 REM hopefully a non-square original pixel
22750 IFsy%<=sx%/2 ymul%=ymul%*2
22760ENDIF
22770ENDPROC
22780DEF PROCreduce(RETURN A%,RETURN B%)
22790LOCAL C%,D%:C%=A%:D%=B%
22800REPEAT IFC%<D% SWAP C%,D%
22810 C%=C%MODD%
22820UNTILC%=0
22830A%=A%DIVD%:B%=B%DIVD%
22840ENDPROC
22850DEF PROCreadpixelrow(z%())
22860IFrows% THEN
22870 rows%-=1:IFsx%=x% THEN
22880  PROCiprow(z%())
22890 ELSE
22900  PROCiprow(xp%()):CALLxsample%,xmul%,xdiv%,z%(1,0),xp%(1,0),x%
22910 ENDIF
22920ELSE
22930 z%()=0
22940ENDIF
22950ENDPROC
22960DEF PROCsharppixelrow(z%())
22970IFrows% THEN
22980 rows%-=1:IFsx%=x% THEN
22990  IFsharpen% PROCsharp(z%()) ELSE PROCiprow(z%()):IFrange% PROCfit2(z%())
23000 ELSE
23010  IFsharpen% PROCsharp(xp%()) ELSE PROCiprow(xp%()):IFrange% PROCfit2(xp%())
23020  CALLxsample%,xmul%,xdiv%,z%(1,0),xp%(1,0),x%
23030 ENDIF
23040ELSE
23050 z%()=0
23060ENDIF
23070ENDPROC
23080DEF PROCsharp(z%())
23090yread%-=1:IFyread% PROCiprow(rm%()):IFrange% PROCfit2(rm%())
23100FORB%=0TOcol:rm%(0,B%)=rm%(1,B%):rm%(sx%+1,B%)=rm%(sx%,B%):NEXT
23110CALL sharp%,z%(1,0),rm%(1,0),rm1%(1,0),rm2%(1,0),totalvals2%
23120SWAP rm2%(),rm1%():rm1%()=rm%()
23130ENDPROC
23140DEF PROCscaledpixelrow(z%())
23150IFsy%=y% THEN
23160 PROCreadpixelrow(z%())
23170ELSE
23180 ysamp%-=1:IFysamp%=0 PROCreadpixelrow(xl%()):ysamp%=ymul%
23190 z%()=xl%():IFydiv%>1 THEN
23200  LOCALY%:FORY%=2TOydiv%
23210   ysamp%-=1:IFysamp%=0 PROCreadpixelrow(xl%()):ysamp%=ymul%
23220  CALLaddhalf%,xl%(0,0),z%(0,0),x%:NEXT
23230 ENDIF
23240ENDIF
23250ENDPROC
23260DEF PROCfit(z%())
23270IFequal% THEN
23280 CALLhistequal%,z%(1,0),new%(0,0),x%
23290ELSE
23300 CALLranger%,z%(1,0),totalvals%
23310ENDIF
23320ENDPROC
23330DEF PROCfit2(z%())
23340IFequal% THEN
23350 CALLhistequal%,z%(1,0),new%(0,0),sx%
23360ELSE
23370 CALLranger%,z%(1,0),totalvals2%
23380ENDIF
23390ENDPROC
23400DEF PROCiprow(z%())
23410CASE flag OF
23420WHEN 0:SYS12,4,c%,buff%,sx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
23430WHEN 3:SYS12,4,c%,buff%,sx%+1>>1:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
23440WHEN 6:SYS12,4,c%,buff%,sx%+3>>2:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
23450WHEN 9:SYS12,4,c%,buff%,sx%+7>>3:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
23460WHEN 100:l%=BGET#c%+BGET#c%*256:SYS12,4,c%,buff%,sx%*3
23470 IF col=2 THEN
23480  CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
23490 ELSE
23500  FORX%=1TOsx%:z%(X%,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:NEXT
23510 ENDIF
23520WHEN 200:SYS12,4,c%,buff%,sx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
23530WHEN 201:X%=buff%:REPEAT
23540  CALLrlexpand%,casx%,capix%,J%,X%:IFcapix%=0 capix%=BGET#c%+1:J%=BGET#c%
23550 UNTILX%=casx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
23560WHEN 300:SYS12,4,c%,buff%,sx%:X%=buff%+sx%:SYS12,4,cc%,X%,sx%
23570 IF col=2 THEN
23580  CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
23590  CALLmappix%,z2%(1,0),rpal%(0),gpal%(0),bpal%(0),X%,sx%:z%()=z%()+z2%()
23600 ELSE
23610  FORX%=1TOsx%:z%(X%,0)=(r%(ab%?X%)+rpal%(bb%?X%))*rwt+(g%(ab%?X%)+gpal%(bb%?X%))*gwt+(b%(ab%?X%)+bpal%(bb%?X%))*bwt:NEXT
23620 ENDIF
23630WHEN 400:X%=0:REPEAT
23640  IFrtpix%>0 REPEATX%?rb%=rJ%:X%?gb%=gJ%:X%?bb%=bJ%:X%+=1:rtpix%-=1:UNTILrtpix%=0ORX%=sx%
23650  IFrtpix%=0 rJ%=BGET#c%:gJ%=BGET#c%:bJ%=BGET#c%:rtpix%=BGET#c%+1
23660 UNTILX%=sx%
23670 IF col=2 THEN
23680  CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
23690 ELSE
23700  FORX%=1TOsx%:z%(X%,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:NEXT
23710 ENDIF
23720WHEN 500:CALL LZWdecode%,table%(0,0),c%,buff%,sx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
23730WHEN 501:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),tbuff%,sx%:tbuff%+=sx%
23740WHEN 600:SYS12,4,c%,buff%,sx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
23750WHEN 700:SYS12,4,c%,buff%,sx%*3
23760 IF col=2 THEN
23770  CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
23780 ELSE
23790  FORX%=1TOsx%*3STEP3:z%(X%DIV3,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:NEXT
23800 ENDIF
23810WHEN 800:X%=buff%:CALLrlexpand%,wtsx%,wtpix%,wt%,X%
23820 REPEAT C%=BGET#c%:CASE C%>>6 OF
23830   WHEN 0:?X%=C%:X%+=1:wt%=C%
23840   WHEN 1:wt%-=1:wtpix%=C%AND63:CALLrlexpand%,wtsx%,wtpix%,wt%,X%
23850   WHEN 2:wtpix%=C%AND63:CALLrlexpand%,wtsx%,wtpix%,wt%,X%
23860   WHEN 3:wt%+=1:wtpix%=C%AND63:CALLrlexpand%,wtsx%,wtpix%,wt%,X%
23870  ENDCASE
23880 UNTILX%=wtsx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
23890WHEN 801:X%=buff%:CALLrlexpand%,wtsx1%,wtpix1%,wt1%,X%
23900 REPEAT C%=BGET#c%:CASE C%>>6 OF
23910   WHEN 0:?X%=C%:X%+=1:wt1%=C%
23920   WHEN 1:wt1%-=1:wtpix1%=C%AND63:CALLrlexpand%,wtsx1%,wtpix1%,wt1%,X%
23930   WHEN 2:wtpix1%=C%AND63:CALLrlexpand%,wtsx1%,wtpix1%,wt1%,X%
23940   WHEN 3:wt1%+=1:wtpix1%=C%AND63:CALLrlexpand%,wtsx1%,wtpix1%,wt1%,X%
23950  ENDCASE
23960 UNTILX%=wtsx1%
23970 CALLrlexpand%,wtsx2%,wtpix2%,wt2%,X%
23980 REPEAT C%=BGET#cc%:CASE C%>>6 OF
23990   WHEN 0:?X%=C%:X%+=1:wt2%=C%
24000   WHEN 1:wt2%-=1:wtpix2%=C%AND63:CALLrlexpand%,wtsx2%,wtpix2%,wt2%,X%
24010   WHEN 2:wtpix2%=C%AND63:CALLrlexpand%,wtsx2%,wtpix2%,wt2%,X%
24020   WHEN 3:wt2%+=1:wtpix2%=C%AND63:CALLrlexpand%,wtsx2%,wtpix2%,wt2%,X%
24030  ENDCASE
24040 UNTILX%=wtsx2%
24050 CALLrlexpand%,wtsx3%,wtpix3%,wt3%,X%
24060 REPEAT C%=BGET#ccc%:CASE C%>>6 OF
24070   WHEN 0:?X%=C%:X%+=1:wt3%=C%
24080   WHEN 1:wt3%-=1:wtpix3%=C%AND63:CALLrlexpand%,wtsx3%,wtpix3%,wt3%,X%
24090   WHEN 2:wtpix3%=C%AND63:CALLrlexpand%,wtsx3%,wtpix3%,wt3%,X%
24100   WHEN 3:wt3%+=1:wtpix3%=C%AND63:CALLrlexpand%,wtsx3%,wtpix3%,wt3%,X%
24110  ENDCASE
24120 UNTILX%=wtsx3%
24130 IF col=2 THEN
24140  CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
24150 ELSE
24160  FORX%=1TOsx%:z%(X%,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:NEXT
24170 ENDIF
24180WHEN 900:SYS12,4,c%,buff%,sx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
24190WHEN 901:SYS12,4,c%,buff%,sx%:SYS12,4,cc%,buff%+sx%,sx%:SYS12,4,ccc%,buff%+sx%*2,sx%
24200 IF col=2 THEN
24210  CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
24220 ELSE
24230  FORX%=1TOsx%:z%(X%,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:NEXT
24240 ENDIF
24250WHEN 1000:X%=buff%:IFpapix%>0 C%=?pa%:CALLrlexpand%,pasx%,papix%,C%,X%:pa%+=1
24260 IFpapix2%>0 C%=?pa%:CALLrlexpand%,pasx%,papix2%,C%,X%:pa%+=1
24270 REPEAT C%=BGET#c%:IFC%=0 THEN
24280   papix%=BGET#c%:C%=?pa%:CALLrlexpand%,pasx%,papix%,C%,X%:IFpapix%=0 pa%+=1
24290  ELSE
24300   papix2%=C%AND15:papix%=C%>>4:IFpapix%>0 C%=?pa%:CALLrlexpand%,pasx%,papix%,C%,X%:IFpapix%=0 pa%+=1
24310   IFX%<pasx% IFpapix2%>0 C%=?pa%:CALLrlexpand%,pasx%,papix2%,C%,X%:IFpapix2%=0 pa%+=1
24320  ENDIF
24330 UNTILX%=pasx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
24340WHEN 1001:X%=buff%:IFpapix%>0 C%=?pa%:CALLrlexpand%,pasx%,papix%,C%,X%:pa%+=1
24350 REPEAT papix%=BGET#c%:C%=?pa%:CALLrlexpand%,pasx%,papix%,C%,X%:IFpapix%=0 pa%+=1
24360 UNTILX%=pasx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
24370WHEN 1100:SYS12,4,c%,buff%,sx%+7>>3:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
24380WHEN 1200:SYS12,4,c%,buff%,sx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
24390WHEN 1300:SYS12,4,c%,buff%,sx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
24400WHEN 1301:SYS12,4,c%,buff%,sx%:SYS12,4,cc%,buff%+sx%,sx%:SYS12,4,ccc%,buff%+sx%+sx%,sx%
24410 IF col=2 THEN
24420  CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
24430 ELSE
24440  FORX%=1TOsx%:z%(X%,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:NEXT
24450 ENDIF
24460WHEN 1400:IFvrep% THEN
24470  vrep%-=1
24480 ELSE
24490  FORX%=1TOquant%
24500   F%=st%(X%):G%=F%+rsx%:REPEAT C%=BGET#c%:IFC%=0 THEN
24510    C%=BGET#c%:IFC%=0 THEN
24520     C%=BGET#c%:vrep%=BGET#c%-1
24530    ELSE
24540     D%=F%:FORE%=0TOpatlen%-1:F%?E%=BGET#c%:NEXT:F%+=patlen%
24550     IFC%>1 FORI%=2TOC%:FORE%=0TOpatlen%-1:F%?E%=D%?E%:NEXT:F%+=patlen%:NEXT
24560    ENDIF
24570   ELSE
24580    IFC%=128 THEN
24590     C%=BGET#c%:FORE%=0TOC%-1:F%?E%=BGET#c%:NEXT:F%+=C%
24600    ELSE
24610     ?F%=(C%AND&80)<>0:FORE%=1TOC%AND&7F:F%?E%=?F%:NEXT:F%+=C%AND&7F
24620    ENDIF
24630   ENDIF
24640   UNTILF%>=G%
24650  NEXT
24660  CALLplancnv%,st%(1),quant%,buff%,sx%
24670 ENDIF
24680 CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
24690WHEN 1500:SYS12,4,c%,buff%,nsx%:CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
24700 TIFFread%-=1:IFTIFFread%=0 PROCTIFFnextstrip
24710WHEN 1600:FORX%=1TOquant%:SYS12,4,c%,st%(X%),rsx%:NEXT:IFmasking% PTR#c%=PTR#c%+rsx%
24720 CALLplancnv%,st%(1),quant%,buff%,sx%
24730 CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
24740WHEN 1601:FORX%=1TOquant%:PROCiff(st%(X%)):NEXT:IFmasking% PROCiff(buff%)
24750 J%=7:K%=0:FORI%=0TOsx%-1:E%=0:FORX%=1TOquant%:E%+=(K%?st%(X%)>>J%AND1)<<X%:NEXT:buff%?I%=E%>>1:J%-=1:IFJ%<0 J%=7:K%+=1
24760 NEXT
24770 CALLmappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
24780ENDCASE
24790ENDPROC
24800DEF PROCrewind
24810rows%=sy%:CASE flag OF
24820WHEN 0,3,6,9:PTR#c%=st%
24830WHEN 100:PTR#c%=0
24840WHEN 200:PTR#c%=&600
24850WHEN 201:PTR#c%=&600:capix%=0
24860WHEN 300:PTR#c%=st%:PTR#cc%=stcc%
24870WHEN 400:PTR#c%=0:rtpix%=0
24880WHEN 500:table%()=0:FORI%=0TOclearcode%-1:table%(I%,1)=I%:NEXT:PTR#c%=st%
24890 !firstcode=0:!oldcode=0:!codesize=setcodes%+1:!stack=stk%:!sp=stk%
24900 !maxcode=clearcode%+2:!maxcodesize=2*clearcode%:!curbit=0:!lastbit=0
24910WHEN 501:tbuff%=otbuff%
24920WHEN 600:PTR#c%=&380
24930WHEN 700:PTR#c%=0:IFGET$#c%=""
24940WHEN 800:PTR#c%=0:wtpix%=0:wt%=0
24950WHEN 801:PTR#c%=0:PTR#cc%=0:PTR#ccc%=0:wtpix1%=0:wt1%=0:wtpix2%=0:wt2%=0:wtpix3%=0:wt3%=0
24960WHEN 900:PTR#c%=0
24970WHEN 901:PTR#c%=0:PTR#cc%=0:PTR#ccc%=0
24980WHEN 1000,1001:PTR#c%=st%:pa%=ctable%:papix%=0:papix2%=0
24990WHEN 1100:PTR#c%=32
25000WHEN 1200:PTR#c%=1600
25010WHEN 1300:PTR#c%=0
25020WHEN 1301:PTR#c%=0:PTR#cc%=0:PTR#ccc%=0
25030WHEN 1400:PTR#c%=st%:vrep%=0
25040WHEN 1500:PTR#c%=st%(0):TIFFread%=rowsperstrip:TIFFptr=0
25050WHEN 1600,1601:PTR#c%=st%
25060ENDCASE
25070ENDPROC

� > %.ChangeFSI
�
L� This program written by Roger Wilson at Acorn Computers April-Dec 1989
(� - please send bugs back!
2&� Subject to change without notice
<�
FH� all information is held in 32 bit fixed point with the . at bit 28
P@� this gives an integer range of 0-15 (OR negative numbers!)
Z�
dK� ChangeFSI is written so as to allow use from CLI and from other BASIC
n&� programs such as WIMP front ends
x�
�(ș"OS_GetEnv" � A$:� Read CLI string
� mem=�:� Remember memory size
�$�=&4000000:� Grab all the memory
�@foo%=0:A%=�ChangeFSI(A$,-1,-1,0,-1,-1,foo%,�):� Call program
��=mem:� Release memory
��
�� A$ Command String
�� spritearea% address or -1
��
�D� workspace%<0 and worklimit%=0       - Use BASIC variable space
��
�E� workspace%<0                        - ChangeFSI's slot handling
�9� worklimit%=current end of wimp slot   will be used.
�
D� workspace%>=0                       - Use memory at workspace%
"� worklimit%=end of workspace%
"�
,A� save%   TRUE  = save to output file given in command string
6D� output% TRUE  = print messages (and histograms if appropriate)
@'�                 during processing
J*� ram% receives address of sprite area
T5� fast%   TRUE  = switch to mode 0 for processing
^�
h� Returned values
r&� 0  =Image processed as requested
|&� 1  =Information messages printed
�+� 100=Error - image may not be complete
��
�Q� �ChangeFSI(A$,spritearea%,workspace%,worklimit%,save%,output%,� ram%,fast%)
�L� A$(),r%(),g%(),b%(),rpal%(),gpal%(),bpal%(),table%(),cl%(),xl%(),xp%()
�D� rm%(),rm1%(),rm2%(),vals%(),nl%(),z2%(),A%(),B%(),new%(),st%()
�$ȕ�A$,1)<>" "��A$<>0 A$=�A$,2):�
�ȕ�A$,1)=" " A$=�A$,2):�
�ȕ�A$,1)=" " A$=�A$):�
��uc(�A$,5))="-QUIT" �
�/ A$=�A$,7):ȕ�A$,1)<>" "��A$<>0 A$=�A$,2):�
� ȕ�A$,1)=" " A$=�A$,2):�
��
� � A$(100):ARG%=0:B%=�A$," ")
ȕ B%<>0
, ARG%+=1:A$(ARG%)=�A$,B%-1):A$=�A$,B%+1)
 ȕ �A$,1)=" ":A$=�A$,2):�
& B%=�A$," ")
0�
:�A$<>"" ARG%+=1:A$(ARG%)=A$
D�uc(A$(1))="-HELP" �
NO�"Change picture Floyd Steinberg Integer  version 0.69 (12 Dec 89): -help"'
XT�"Use: ChangeFSI <in file> <out file> <mode>[cdt] [<n>:<n> [<n>:<n>]] [options]"
bV�"Changes source multi-colour picture to output sprite 1, 2, 4 or 8 bit per pixel"
l&�"in specified mode, with suffix:"
vF�"   c suffix for 2 or 4 bit colour in 2 or 4 bit per pixel modes"
�?�"     for clustered pixel output in 1 bit per pixel modes"
�6�"   d for digital rgb with 4 bit per pixel modes"
�M�"   t for no tint in 8 bit modes and 16 level grey scale in 4 bit modes"
�T�"The pixel size is corrected for and the default is output of the same size as"
�N�"the input. Size ratios are output:input or = for scale to output size."'
�4�"Mode 'aim' writes an aim format output file."'
�N�"The -equal option performs histogram equalisation on monochrome output."
�B�"The -hflip option presents the picture left/right reversed."
�:�"The -info option gives details of the source image."
�F�"The -invert option inverts the colour range of the input image."
�D�"The -noscale option disables automatic pixel size correction."
�I�"The -range option expands the input's dynamic range to full scale."
�T�"The -sharpen option digitally sharpens the picture, -sharpen<n> overrides the"
2�"    default of 24: range 8(harsh)-31(soft)."
;�"The -vflip option presents the picture up side down."
C�"Example: changefsi input output 21t 1:2 = -sharpen12 -range"'
 9�"ChangeFSI -formats gives details of input formats."
*=1
4�
>�uc(A$(1))="-FORMATS" �
HD�"Input formats understood are:                 Recognised by:"'
RD�"RISC OS 1, 2, 4 and 8 bit per pixel sprites   [file type FF9]"
\D�"Watford digitiser pictures 512x256y64g        [file type DFA]"
fM�"   and triple red, green, blue seperations    [directory of r,g,b DFA]"
pD�"ProArtisan compressed pictures 640x256y256c   [file type DE2]"
zD�"TimeStep satellite image 800x800y256g         [file type 7A0]"
�D�"TimeStep satellite image 128x256y256g         [file type 300]"
�M�"   and triple red, green, blue seperations    [directory of r,g,b 300]"
�D�"AIM/Wild Vision Hawk V10 files 256x256y256g   [file type 004]"
�I�"TIFF pictures                                 [II* or MM* in file]"
�C�"Electronic Art's IFF ILBM pictures            [ILBM in file]"
�H�"Sun 1 bit per pixel files                     [&956AA659 in file]"
�D�".PIC 8 bit per pixel files                    [AV_VO in file]"
�H�"MILLIPEDE PRISMA 768x576y 8 bit colour images [MILLIPEDE in file]"
�E�"Compuserve's GIF files up to 8 bit per pixel  [GIF87a in file]"
�O�"ArVis 15 bit HIP.+LOP. sprites                [file type FF9, HIP. name]"
�O�"GEM IMG. images                [&00010008 in file or name includes img.]"
�I�"PC EGA .DSP images 640x350y16c                [name includes dsp.]"
�I�"MTV 24 bit pic. images                        [name includes pic.]"
H�"QRT 24 bit .raw images                        [name ends in .raw]"
K�"RT 24 bit run length coded image. files       [name includes image.]"
=1
$�
.)invert%=�:range%=�:sharpen%=�:info%=�
8/hist%=�:equal%=�:vflip%=�:hflip%=�:scale%=�
B
�ARG%<3 �
LL �"ChangeFSI interactive input [try 'ChangeFSI -help' for command line]"
V@ �"Source file: "s$,"Destination file: "f$,"Output mode: "m$
`0 �"(X)Scale (e.g. 2:1): "xs$:�"Y Scale: "ys$
j9 �"Info on input picture?"a$:�uc(�a$,1))="Y" info%=�
t< �"Invert picture colours?"a$:�uc(�a$,1))="Y" invert%=�
~> �"Compute histogram of input?"a$:�uc(�a$,1))="Y" hist%=�
�A �"Apply histogram equalisation?"a$:�uc(�a$,1))="Y" equal%=�
�H �"Expand input dynamic range?"a$:�uc(�a$,1))="Y" range%=�:equal%=�
�> �"Sharpen picture by (e.g. 12 for harsh, 24 for soft) "a$
� �a$<>"" sharpen%=�a$
��
� � A%=ARG%
�8  �uc(A$(ARG%))="-INFO" info%=�:A$(ARG%)="":ARG%-=1
�8  �uc(A$(ARG%))="-HIST" hist%=�:A$(ARG%)="":ARG%-=1
�C  �uc(A$(ARG%))="-EQUAL" equal%=�:range%=�:A$(ARG%)="":ARG%-=1
�C  �uc(A$(ARG%))="-RANGE" range%=�:equal%=�:A$(ARG%)="":ARG%-=1
�<  �uc(A$(ARG%))="-INVERT" invert%=�:A$(ARG%)="":ARG%-=1
�<  �uc(A$(ARG%))="-NOSCALE" scale%=�:A$(ARG%)="":ARG%-=1
:  �uc(A$(ARG%))="-VFLIP" vflip%=�:A$(ARG%)="":ARG%-=1

:  �uc(A$(ARG%))="-HFLIP" hflip%=�:A$(ARG%)="":ARG%-=1
%  �uc(�A$(ARG%),8))="-SHARPEN" �
5   sharpen%=�:�A$(ARG%)>8 sharpen%=��A$(ARG%),9)
(   A$(ARG%)="":ARG%-=1
2  �
<
 �A%=ARG%
F3 s$=A$(1):f$=A$(2):m$=A$(3):xs$=A$(4):ys$=A$(5)
P�
Z3�output% �info%=�:� if no output, then no info!
d�workspace%>=0 �
n flex%=�
x�
�? �worklimit%=0 � flex%=� � flex%=�:nextlocation%=worklimit%
��
�Ȏ �uc(m$) �
� �"AIM":m=-1:m$=""
�/ :m=�m$:m$=�uc(�m$,1)):�"CDT",m$)=0 m$=""
��
��xs$="" � �xs$,1)="-" �
�$ xmul%=1:xdiv%=1:ymul%=1:ydiv%=1
��
� �ys$="" ys$=xs$
�( xmul%=�xs$:xdiv%=��xs$,�xs$,":")+1)
�( ymul%=�ys$:ydiv%=��ys$,�ys$,":")+1)
��
&flag=-1:ș8,5,s$ � r0,,r2:dir=r0=2

�dir �
D panic=�:ș8,5,s$+".raw" � r0,,r2:�r0=1 s$+=".raw":dir=�:panic=�
"2 �panic ș8,5,s$+".red" � r0,,r2:�r0=1 panic=�
," �panic � 42,"Directory given"
6�
@9ftype=r2>>8 � &FFF:bits=28:F=2^bits:c%=0:cc%=0:ccc%=0
J
�dir �
T? c%=�(s$+".red"):�c%=0 � 42,"Red file "+s$+".red not found"
^F cc%=�(s$+".green"):�cc%=0 �42,"Green file "+s$+".green not found"
hE ccc%=�(s$+".blue"):�ccc%=0 �42,"Blue file "+s$+".blue not found"
r�
|. c%=�s$:�c%=0 � 42,"File "+s$+" not found"
��
�:rwt=.30:gwt=.59:bwt=.11:� CIE Y weightings for R, G, B
�%� r%(255):� monochrome colour map
�A� g%(255),b%(255):� colour maps: in 0-255 out 0-1 fixed point
�Ȏ ftype �
�� &FF9:flag=0
�/ �"."+�uc(s$),".HIP.")���uc(s$),":HIP.") �
�"  flag=300:I%=��uc(s$),"HIP.")
�A  �s$,I%)="LOP.":cc%=�s$:�cc%=0 �42,"Can't find Lop file "+s$
� �
�!� &DFA:flag=800:�dir flag=801
�� &DE2:flag=1000
�� &7A0:flag=1200
#� &300:flag=1300:�dir flag=1301
� 4:flag=900:�dir flag=901

&% �#c%=0:S$="":�I%=1�6:S$+=��#c%:�
0 �S$="GIF87a" flag=500
:& �flag=-1 �S$,5)="AV_VO" flag=600
D3 �flag=-1 �S$,4)=�&59+�&A6+�&6A+�&95 flag=1100
N+ �flag=-1 �S$,4)=�0+�1+�0+�8 flag=1400
X4 �flag=-1 �S$,4)="II*"+�0 flag=1500:bigendian=�
b7 �flag=-1 �S$,4)="MM"+�0+"*" flag=1500:bigendian=�
l& �flag=-1 �S$,4)="RIX3" flag=2000
v �flag=-1 �S$,4)="FORM" �
�'  �#c%=8:S$=��#c%+��#c%+��#c%+��#c%
�  �S$="ILBM" flag=1600
� �
� �flag=-1 �
�(  �#c%=&10:S$="":�I%=1�9:S$+=��#c%:�
�  �S$="MILLIPEDE" flag=200
� �
�C �flag=-1 �"."+�uc(s$),".IMAGE.")���uc(s$),":IMAGE.") flag=400
�* �flag=-1 �uc(�s$,4))=".RAW" flag=100
�? �flag=-1 �"."+�uc(s$),".PIC.")���uc(s$),":PIC.") flag=700
�@ �flag=-1 �"."+�uc(s$),".IMG.")���uc(s$),":IMG.") flag=1400
�@ �flag=-1 �"."+�uc(s$),".DSP.")���uc(s$),":DSP.") flag=1700
��
\�flag=-1:� 42,"Sorry: format not recognised - please try again or contact your supplier"
�fast% ��<>0 �0
Binput=8:ham=0:planar=0:bigendianbits=�:compression=0:Ȏ flag �
  � 0:� Archimedes Sprite file
*G quant%=4:�#c%=&2c:st%=�W+(&38-&2c):�#c%=&34:sm=�W:ș53,sm,3 � ,,I%
4 Ȏ I% �
>, � 1:flag=9:�st%=&38 �defpal2 � �ipal(2)
H7  �#c%=&1c:sx%=(�W+1)*32:buff%=�dim(sx%>>3):input=1
R, � 3:flag=6:�st%=&38 �defpal4 � �ipal(4)
\7  �#c%=&1c:sx%=(�W+1)*16:buff%=�dim(sx%>>2):input=2
f/ � 15:flag=3:�st%=&38 �defpal16 � �ipal(16)
p6  �#c%=&1c:sx%=(�W+1)*8:buff%=�dim(sx%>>1):input=4
z$ � 63:�st%=&38 �defpal � �ipal63
�+  �#c%=&1c:sx%=(�W+1)*4:buff%=�dim(sx%)
�*  �42,"Not understood RISC OS sprite"
� �
� sy%=�W+1:�#c%=st%
�8 ș53,sm,4 � ,,nx:ș53,sm,5 � ,,ny:nx=1<<nx:ny=1<<ny
�. �scale% xmul%=xmul%*nx/2:ymul%=ymul%*ny/2
�` info$="RISC OS sprite, mode "+�sm+" "+�sx%+" by "+�sy%+" pixels, "+�input+" bits per pixel"
�� 100:� QRT ".raw" image
�= quant%=8:�#c%=0:sx%=�HW:sy%=�HW:�nopal:input=24:step24=1
�D buff%=�dim(sx%*3):rb%=buff%:gb%=buff%+sx%:bb%=buff%+2*sx%:�size
�K info$="QRT .raw image, "+�sx%+" by "+�sy%+" pixels, 24 bits per pixel"
�� 200:� CadSoft Image
�N quant%=8:�#c%=9:sx%=(�HW+2)/2:sy%=(�HW+2)/2:� round and convert to pixels
	) �#c%=&1a:cadsofttype%=�#c%:�#c%=&200
	" �C%=0�255:r%(C%)=�#c%/255*F:�
	" �C%=0�255:g%(C%)=�#c%/255*F:�
	$" �C%=0�255:b%(C%)=�#c%/255*F:�
	.0 �#c%=&600:�cadsofttype%=2 capix%=0:flag=201
	8* buff%=�dim(sx%):casx%=buff%+sx%:�size
	B` info$="Cadsoft type "+�cadsofttype%+" image, "+�sx%+" by "+�sy%+" pixels, 8 bits per pixel"
	L� 300:� Arvis Video
	VJ quant%=5:�#c%=&2c:st%=�W+(&38-&2c):�#cc%=&2c:stcc%=�W1(cc%)+(&38-&2c)
	`8 �#c%=&1c:sx%=(�W+1)*4:sy%=�W+1:�#c%=st%:�#cc%=stcc%
	j' � rpal%(255),gpal%(255),bpal%(255)
	t �C%=0�255
	~  rpal%(C%)=(C%�7)/31*F
	�!  gpal%(C%)=((C%�64)>>6)/31*F
	�  bpal%(C%)=(C%>>3�7)/31*F
	�%  r%(C%)=(C%�16 � (C%�4)<<1)/31*F
	�+  g%(C%)=((C%�&60)>>2 � (C%�3)<<1)/31*F
	�&  b%(C%)=((C%�128)>>3 � C%�8)/31*F
	� �
	�H buff%=�dim(sx%*2):ab%=buff%-1:bb%=buff%+sx%-1:�scale% ymul%=ymul%*2
	�H info$="ArVis image, "+�sx%+" by "+�sy%+" pixels, 15 bits per pixel"
	�� 400:� RT "image."
	�> quant%=8:�#c%=0:sx%=�beHW:sy%=�beHW:X%=�beHW:�#c%=�#c%+X%
	�> buff%=�dim(sx%*3):rb%=buff%:gb%=buff%+sx%:bb%=buff%+2*sx%
	�, �nopal:input=24:step24=1:rtpix%=0:�size
_ info$="RT image. run length encoded image, "+�sx%+" by "+�sy%+" pixels, 24 bits per pixel"

� 500:� GIF file
/ compression=5:�#c%=6:sx%=�HW:sy%=�HW:�size
9 GIF=�#c%:GIFback=�#c%:GIFext=�#c%:quant%=(GIF � 7)+1
( �GIF � &80 �
2  �C%=0�(1<<quant%)-1
<<   r%(C%)=�#c%/255*F:g%(C%)=�#c%/255*F:b%(C%)=�#c%/255*F
F  �
P �
Z? I%=�#c%:�I%<>�"," � 42,"GIF file without , in right place"
d1 GIFleft=�HW:GIFright=�HW:GIFsx=�HW:GIFsy=�HW
nD �GIFsx>sx% � GIFsy>sy% � 42,"GIF file with bigger image inside"
x! GIF=�#c%:�GIF � &40 flag=501
�4 setcodes%=�#c%:clearcode%=1<<setcodes%:st%=�#c%
�F � table%(1<<12,1):stk%=�dim(1<<13):buf%=�dim(280):buff%=�dim(sx%)
�4 table%()=0:�I%=0�clearcode%-1:table%(I%,1)=I%:�
�N info$="GIF file, "+�sx%+" by "+�sy%+" pixels, "+�quant%+" bits per pixel"
�� 600:� funny AV_VO stuff
�  quant%=8:�#c%=&5c:�C%=0�255
�;  r%(C%)=�#c%/255*F:g%(C%)=�#c%/255*F:b%(C%)=�#c%/255*F
� �
�$ �#c%=&36e:sy%=�HW:sx%=�HW:�size
� �#c%=&380:buff%=�dim(sx%)
�F info$=".PIC image, "+�sx%+" by "+�sy%+" pixels, 8 bits per pixel"
�� 700:� MTV ".pic" image
�9 quant%=8:�#c%=0:a$=�#c%:sx%=�a$:sy%=�(�a$,�a$," ")))
# �size:�nopal:input=24:step24=3
8 buff%=�dim(sx%*3):rb%=buff%:gb%=buff%+1:bb%=buff%+2
K info$="MTV .pic image, "+�sx%+" by "+�sy%+" pixels, 24 bits per pixel"
"� 800:� Watford picture
,* sx%=512:sy%=256:�scale% ymul%=ymul%*2
63 buff%=�dim(sx%):wtpix%=0:wt%=0:wtsx%=buff%+sx%
@A �C%=0�255:r%(C%)=(C%�63)/63*F:�:g%()=r%():b%()=r%():quant%=6
JK info$="Watford digitiser picture, 512 by 256 pixels, 6 bits per pixel"
T"� 801:� Triple Watford picture
^E sx%=512:sy%=256:input=24:step24=1:quant%=6:�scale% ymul%=ymul%*2
h7 wtpix1%=0:wt1%=0:wtpix2%=0:wt2%=0:wtpix3%=0:wt3%=0
r> buff%=�dim(sx%*3):rb%=buff%:gb%=buff%+sx%:bb%=buff%+2*sx%
|; wtsx1%=buff%+sx%:wtsx2%=buff%+2*sx%:wtsx3%=buff%+3*sx%
�8 �C%=0�255:r%(C%)=(C%�63)/63*F:�:g%()=r%():b%()=r%()
�S info$="Triple Watford digitiser picture, 512 by 256 pixels, 18 bits per pixel"
�� 900:� AIM/Wild Vision
�Q quant%=8:sx%=256:sy%=256:buff%=�dim(sx%):�scale% ymul%=ymul%*2:xmul%=xmul%*2
�4 �C%=0�255:r%(C%)=C%/255*F:�:g%()=r%():b%()=r%()
�@ info$="AIM .raw image, 256 by 256 pixels, 8 bits per pixel"
�E� 901:� AIM/Wild Vision: Temporary while V9 gets its act together
�A quant%=4:sx%=256:sy%=256:�scale% ymul%=ymul%*2:xmul%=xmul%*2
�> buff%=�dim(sx%*3):rb%=buff%:gb%=buff%+sx%:bb%=buff%+sx%*2
�: �C%=0�255:r%(C%)=(C%�&F0)/&F0*F:�:g%()=r%():b%()=r%()
� input=24:step24=1
�G info$="Hawk V9 Triple image, 256 by 256 pixels, 12 bits per pixel"
�� 1000:� ProArtisan
K quant%=4:sx%=640:sy%=256:�defpal:st%=�W:flag+=�W:�scale% ymul%=ymul%*2
8 � read compression type and add to flag. 0/1 known!
& buff%=�dim(sx%):ctable%=�dim(st%)
&1 ș12,4,c%,ctable%,st%:� read in colour table
03 pa%=ctable%:papix%=0:papix2%=0:pasx%=buff%+sx%
:B info$="ProArtisan image, 640 by 256 pixels, 8 bits per pixel"
D(� 1100:� Monochrome? Images from Sun
N1 quant%=1:�#c%=4:sx%=�beW:sy%=�beW:input=�beW
X4 �input<>1 �42,"Only know how to deal with 1bpp"
b' �#c%=32:buff%=�dim(sx%+7>>3):�size
l, r%(0)=F:g%(0)=F:b%(0)=F:bigendianbits=�
vD info$="Sun image, "+�sx%+" by "+�sy%+" pixels, 1 bit per pixel"
�.� 1200:� unknown TimeStep satellite format
�G quant%=8:sx%=800:sy%=800:buff%=�dim(sx%):�#c%=1600:vflip%=� vflip%
�4 �C%=0�255:r%(C%)=C%/255*F:�:g%()=r%():b%()=r%()
�J info$="TimeStep satellite image, 800 by 800 pixels, 8 bits per pixel"
�6� 1300:� another unknown TimeStep satellite format
�Q quant%=8:sx%=128:sy%=256:buff%=�dim(sx%):�scale% xmul%=xmul%*4:ymul%=ymul%*2
�4 �C%=0�255:r%(C%)=C%/255*F:�:g%()=r%():b%()=r%()
�A info$="satellite image, 128 by 256 pixels, 8 bits per pixel"
�7� 1301:� "colour" unknown TimeStep satellite format
�S input=24:step24=1:quant%=8:sx%=128:sy%=256:�scale% xmul%=xmul%*4:ymul%=ymul%*2
�> buff%=�dim(sx%*3):rb%=buff%:gb%=buff%+sx%:bb%=buff%+2*sx%
�4 �C%=0�255:r%(C%)=C%/255*F:�:g%()=r%():b%()=r%()
�I info$="Triple satellite image, 128 by 256 pixels, 24 bits per pixel"

� 1400:� GEM IMG. format

% planar=�:�#c%=0:Z%=�HW:�Z%>255 �

,  st%=�beHW*2:quant%=�beHW:patlen%=�beHW

 -  pw%=�beHW:ph%=�beHW:sx%=�beHW:sy%=�beHW

* �

4E  st%=�HW*2:input=�HW:patlen%=�HW:pw%=�HW:ph%=�HW:sx%=�HW:sy%=�HW

> �

H �scale% �

R%  xmul%=xmul%*pw%:xdiv%=xdiv%*282

\%  ymul%=ymul%*ph%:ydiv%=ydiv%*282

f �

p0 rsx%=sx%+7>>3:� st%(quant%):buff%=�dim(sx%)

z; �X%=1�quant%:st%(X%)=�dim(rsx%*sy%):�:�#c%=st%:vrep%=0

�L �C%=0�(1<<quant%)-1:r%(C%)=F-C%/((1<<quant%)-1)*F:�:g%()=r%():b%()=r%()

�N info$="IMG file, "+�sx%+" by "+�sy%+" pixels, "+�quant%+" bits per pixel"

�� 1500:� TIFF

�# �#c%=4:dir%=�tiff(4):�#c%=dir%

�F rgb=�:rowsperstrip=-1:greyunit=100:planar=1:fillorder=1:resunit=2

� E%=�tiff(3):�Z%=1�E%

�)  T%=�tiff(3):D%=�tiff(3):C%=�tiff(4)

�R  �D%=2 �#c%=dir%+2+Z%*12 � �D%<4 V%=�tiff(D%):�#c%=dir%+2+Z%*12 � V%=�tiff(4)

�G  � PRINT"Read tag ";T%" datatype "D%" count "C%" value/pointer "V%

�
  Ȏ T% �

�  � 256:sx%=V%

�  � 257:sy%=V%

�T  � 258:quant%=V%:input=quant%:�I%=0�(1<<quant%)-1:r%(I%)=I%/((1<<quant%)-1)*F:�
   g%()=r%():b%()=r%()
  � 259:compression=V%
  � 262:photometric=V%
$  � 266:fillorder=V%
.  � 273:stc%=C%:stv%=V%
8$  � 277:input=quant%*V%:rgb=V%=3
B  � 278:rowsperstrip=V%
L3  � 282:�#c%=V%:xnum%=�tiff(4):xdenom%=�tiff(4)
V   �#c%=dir%+2+Z%*12
`3  � 283:�#c%=V%:ynum%=�tiff(4):ydenom%=�tiff(4)
j   �#c%=dir%+2+Z%*12
t  � 284:planar=V%
~  � 290:greyunit=10^V%
�>  � 291:�#c%=V%:�I%=0�C%-1:r%(I%)=�tiff(D%)/greyunit/2*F:�
�   g%()=r%():b%()=r%()
�   �#c%=dir%+2+Z%*12
�  � 296:resunit=V%
��  WHEN 320:
��   PTR#c%=dir%+2+Z%*12
�  
�L  �info% �"Ignoring tag ";T%" datatype "D%" count "C%" value/pointer "V%
�  �
� �
� � st%(stc%):�stc%>1 �
�.  �#c%=stv%:�I%=0�C%-1:st%(I%)=�tiff(D%):�
 �

  st%(0)=stv%
 �
3 �compression<>1 info$="Compressed " � info$=""
(O info$+="TIFF file, "+�sx%+" by "+�sy%+" pixels, "+�input+" bits per pixel"
2F �planar<>1 � compression<>1 �42,"Can't do this style of TIFF yet"
< bigendianbits=fillorder=1
F Ȏ quant% �
P � 1:nsx%=sx%+7>>3
Z � 2:nsx%=sx%+3>>2
d � 4:nsx%=sx%+1>>1
n � 8:nsx%=sx%
x4  � 42,"Can't do ";quant%" bits per pixel TIFF"
� �
�B buff%=�dim(nsx%):TIFFread%=rowsperstrip:�#c%=st%(0):TIFFptr=0
� �scale% �
�  S%=resunit:�S%=2 S%=90
�  �S%=3 S%=35
�.  xdiv%=xdiv%*xnum%:xmul%=xmul%*xdenom%*S%
�.  ydiv%=ydiv%*ynum%:ymul%=ymul%*ydenom%*S%
� �
�,� 1600:� Electronic Arts ILBM inside IFF
� �#c%=12:camg=0:planar=�:�
�' S$=��#c%+��#c%+��#c%+��#c%:S%=�beW
� Ȏ S$ �
�C � "BMHD":sx%=�beHW:sy%=�beHW:S%=�W:quant%=�#c%:masking%=�#c%=1
8  compression=�#c%:S%=�#c%+�HW:U%=�#c%:V%=�#c%:S%=�W
+  �scale% ymul%=ymul%*V%:ydiv%=ydiv%*U%
K  �I%=0�(1<<quant%)-1:r%(I%)=I%/((1<<quant%)-1)*F:�:g%()=r%():b%()=r%()
"B � "CMAP":S%=�#c%+S%:�I%=0�(1<<quant%)-1:r%(I%)=(�#c%>>4)/15*F
,3  g%(I%)=(�#c%>>4)/15*F:b%(I%)=(�#c%>>4)/15*F:�
6I  �#c%=S%:�info% �"Warning: truncated IFF CMAP information to 4 bits"
@< � "CAMG":camg=�beW:�info% �"Amiga viewport mode ";~camg
J � "BODY":st%=�#c%
T5  � info% �"Ignoring IFF property "S$" size ";S%
^  �#c%=�#c%+S%
h �
r; �S$="BODY":�compression info$="Compressed " � info$=""
|N info$="IFF file, "+�sx%+" by "+�sy%+" pixels, "+�quant%+" bits per pixel"
�1 ham=(camg � &800)<>0:�ham info$="HAM "+info$
�+ �masking% info$+=" with mask (unused)"
�G � st%(quant%):rsx%=(sx%+15>>4)<<1:�I%=1�quant%:st%(I%)=�dim(sx%):�
�/ buff%=�dim(sx%):flag+=compression:�#c%=st%
�#� 1700:� EGA image in DSP.<foo>
�7 sx%=640:rsx%=80:sy%=350:quant%=4:planar=�:� st%(4)
�= �X%=1�4:st%(X%)=�dim(80):�:buff%=�dim(640):G=F/3:H=F*2/3
�) r%()=0,0,0,0,F,F,F,H,G,G,G,G,F,F,F,F
�) g%()=0,0,F,F,0,0,F,H,G,G,F,F,G,G,F,F
�) b%()=0,F,0,F,0,F,0,H,G,F,G,F,G,F,G,F
�( masking%=�:flag=1600:st%=16:�#c%=16
�T info$="PC EGA '.dsp' file, 640 by 350 pixels, 4 bits per pixel (fixed palette)"
�� 2000:� Unknown "SCF"
$ st%=&300:�#c%=4:sx%=�HW:sy%=�HW
 �#c% �#c%
 buff%=�dim(sx%)
&�
0�info% �info$
:Cș"Hourglass_On",1:�invert% r%()=F-r%():g%()=F-g%():b%()=F-b%()
D
Ȏ m �
ND � -1:x%=256:y%=256:ncol=255:�scale% xdiv%=xdiv%*2:ydiv%=ydiv%*2
X 
b7  ș53,m,4 � ,,nx:ș53,m,5 � ,,ny:nx=1<<nx:ny=1<<ny
l3  ș53,m,11 � ,,x%:ș53,m,12 � ,,y%:x%+=1:y%+=1
vA  ș53,m,3 � ,,ncol:�scale% xdiv%=xdiv%*nx/2:ydiv%=ydiv%*ny/2
��
��xs$="=" xmul%=x%:xdiv%=sx%
��ys$="=" ymul%=y%:ydiv%=sy%
�/�ncol=1 �m$="C" xdiv%=xdiv%*4:ydiv%=ydiv%*4
�-�reduce(xmul%,xdiv%):�reduce(ymul%,ydiv%)
��info% �
�; �"Size ratios are x ";xmul%":"xdiv%" y "ymul%":"ydiv%;
�N �xdiv%>10 �ydiv%>10 �xmul%>20 �ymul%>20 �" which may take a while..." � �
��
�?x%=sx%*xmul%/xdiv%+.9999:y%=sy%*ymul%/ydiv%+.9999:rows%=sy%
�-order%=x%*y%>sx%*sy%:� TRUE if scaling up
�*� test for as many colours as possible
�
Ȏ m �
* � -1:col=0:� aim format is monochrome
 
 �m$="D" �ncol<>15 m$=""
 D col=0:�ncol>15 � m$="C" � m$="D" col=2:� depth of colour arrays
*�
4$�ncol=1 �m$="C" col=0:x%=x%+1��1
>G�col=0 �input<9 �C%=0�255:r%(C%)=r%(C%)*rwt+g%(C%)*gwt+b%(C%)*bwt:�
H)�col=0 �input=24 rb%-=1:gb%-=1:bb%-=1
R�sharpen%=� sharpen%=24
\2� cl%(x%+7,col):� current line additive errors
fL� xl%(x%+7,col),xp%(sx%+7,col):� extra input line for scaling vertically
p�sharpen% �
z �order% �
�6  � rm%(sx%+7,col),rm1%(sx%+7,col),rm2%(sx%+7,col)
� �
�3  � rm%(x%+7,col),rm1%(x%+7,col),rm2%(x%+7,col)
� �
��
�"�hist%�equal% � vals%(256,col)
�/� nl%(x%+7,col):� next line additive errors
�Etotalvals%=x%*(col+1):� total number of elements in a scaled line
�Gtotalvals2%=sx%*(col+1):� total number of elements in an input line
�6�flag=300 � z2%(sx%+7,col):� extra array for ArVis
��ncol=1 � m$="C" �
�� A%(16),B%(16)
��A%()=0,&00000001,&08000001,&08000101,&08080101,&08080103,&0C080103,&0C080303,&0C0C0303,&0C0E0303,&0C0E0703,&0E0E0703,&0E0E0707,&0E0F0707,&0E0F0F07,&0F0F0F07,&0F0F0F0F
�B%()=0,&00000008,&01000008,&01000808,&01010808,&0101080C,&0301080C,&03010C0C,&03030C0C,&03070C0C,&03070E0C,&07070E0C,&07070E0E,&070F0E0E,&070F0F0E,&0F0F0F0E,&0F0F0F0F
2even_gard=�dim(17*32*4):odd_gard=�dim(17*32*4)
C�I%=0�16:�J%=0�16:even_gard!(J%*32*4+I%*4)=A%(I%)�B%(J%)<<4:�:�
$C�I%=0�16:�J%=0�16: odd_gard!(J%*32*4+I%*4)=B%(I%)�A%(J%)<<4:�:�
.�
8code%=�dim(4096):SP=13
B�Z=0�2�2:P%=code%
L
Ȏ ncol �
V
� 255:
`
[OPT Z
j?; � fs%,current%(),next%(),pixel address%,increment%,count%
t.fs%
~ STMFD SP !,{R14}
�$ LDR R10,[R9,#4*8] ;addr current
�! LDR R11,[R9,#3*8] ;addr next
�* LDR R12,[R9,#2*8] ;addr pixel address
�! LDR R12,[R12] ;pixel address
� LDR R8,[R9,#8] ;addr step
� LDR R8,[R8] ;step
� LDR R9,[R9] ;addr count
� LDR R9,[R9] ;count
�  LDR R4,[R10],R8 ;mono value
�? TEQ R8,#0:MOVPL R1,#1:MVNMI R1,#0 ;+/- 1 for sprite output
�.fsloop
�; TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
 MOV R0,R4,LSR #bits-8

/ CMP R0,#256:MOVCS R0,#255:STRB R0,[R12],R1
 MOV R2,R0,LSL #bits-8
+ SUB R4,R4,R2 ;subtract converted value
( MOVCS R4,#0
2 ADD R2,R4,R4,LSL #1 ;*3
<0 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
F STR R3,[R11,-R8]
P ADD R2,R4,R4,LSL #2 ;*5
Z, LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
d STR R3,[R11]
n MOV R3,R4,ASR #4 ;/16
x1 STR R3,[R11,R8]! ;not seen so far inc nl ptr
� RSB R2,R4,R4,LSL #3 ;*7
�& LDR R4,[R10],R8 ;next light value
�@ ADD R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
� SUBS R9,R9,#1:BNE fsloop
� LDMFD SP !,{PC}^
� ]
�	� 63:
�
[OPT Z
�.slashfifteen EQUD 0
� EQUD 4/15*F
� EQUD 8/15*F
� EQUD 12/15*F
�.fs%
 STMFD SP !,{R14}
$ LDR R10,[R9,#4*8] ;addr current
! LDR R11,[R9,#3*8] ;addr next
"* LDR R12,[R9,#2*8] ;addr pixel address
,! LDR R12,[R12] ;pixel address
6 LDR R8,[R9,#8] ;addr step
@ LDR R8,[R8] ;step
J LDR R9,[R9] ;addr count
T LDR R9,[R9] ;count
^ LDR R4,[R10] ;r
h LDR R5,[R10,#4] ;g
r LDR R6,[R10,#8] ;b
| ADR R7,slashfifteen
�? TEQ R8,#0:MOVPL R1,#1:MVNMI R1,#0 ;+/- 1 for sprite output
�.fsloop
� ADD R10,R10,R8 ;+step
�9 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=r<=1
� RSB R3,R4,R4,LSL #4 ;*15
�0 MOVS R3,R3,LSR #2+bits ;final int0, 1, 2, 3
�5 LDRNE R2,[R7,R3,LSL #2] ;divide by 15 from table
�- SUBNE R4,R4,R2 ;subtract converted value
�, � R2,R3,#1:MOV R0,R2,LSL #2 ;bit 2 of r
�. � R2,R3,#2:�R R0,R0,R2,LSL #3 ;bit 3 of r
�9 TEQ R5,#0:MOVMI R5,#0:CMP R5,#F:MOVCS R5,#F ;0<=g<=1
� RSB R3,R5,R5,LSL #4 ;*15
�0 MOVS R3,R3,LSR #2+bits ;final int0, 1, 2, 3
5 LDRNE R2,[R7,R3,LSL #2] ;divide by 15 from table
- SUBNE R5,R5,R2 ;subtract converted value
* �R R0,R0,R3,LSL #5 ;bits 3 and 2 of g
&9 TEQ R6,#0:MOVMI R6,#0:CMP R6,#F:MOVCS R6,#F ;0<=b<=1
0 RSB R3,R6,R6,LSL #4 ;*15
:0 MOVS R3,R3,LSR #2+bits ;final int0, 1, 2, 3
D5 LDRNE R2,[R7,R3,LSL #2] ;divide by 15 from table
N- SUBNE R6,R6,R2 ;subtract converted value
X. � R2,R3,#1:�R R0,R0,R2,LSL #3 ;bit 2 of b
b. � R2,R3,#2:�R R0,R0,R2,LSL #6 ;bit 3 of b
l ]
v�m$<>"T" �
�
[OPT Z
�0 ADD R2,R4,R5:ADD R2,R2,R6 ;r+g+b remainders
�' ADD R2,R2,R2,LSL #2 ;average *15/3
� MOV R2,R2,LSR #bits
� CMP R2,#3:MOVCS R2,#3
� �R R0,R0,R2
�! LDR R2,[R7,R2,LSL #2] ;*1/15
�$ SUB R4,R4,R2,LSR #2 ;subtract t
�1 SUB R5,R5,R2,LSR #2 ;note table 4* too large
� SUB R6,R6,R2,LSR #2
� ]
��
�
[OPT Z
 STRB R0,[R12],R1
 ADD R0,R11,#4 ;nl g%(S%)
 ADD R2,R4,R4,LSL #1 ;r*3
 0 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
* STR R3,[R11,-R8]
4 ADD R2,R4,R4,LSL #2 ;r*5
>, LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
H STR R3,[R11]
R MOV R3,R4,ASR #4 ;r/16
\1 STR R3,[R11,R8]! ;not seen so far inc nl ptr
f RSB R2,R4,R4,LSL #3 ;r*7
p% LDR R4,[R10] ;next r light value
z> ADD R4,R4,R2,ASR #4 ;next value +7/16 of r error -> new r
� ADD R2,R5,R5,LSL #1 ;g*3
�/ LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
� STR R3,[R0,-R8]
� MOV R3,R5,ASR #4 ;g/16
�$ STR R3,[R0,R8] ;not seen so far
� ADD R2,R5,R5,LSL #2 ;g*5
�+ LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
�3 STR R3,[R0],#4 ;computes nl b into the bargain
� RSB R2,R5,R5,LSL #3 ;g*7
�( LDR R5,[R10,#4] ;next g light value
�> ADD R5,R5,R2,ASR #4 ;next value +7/16 of g error -> new g
� ADD R2,R6,R6,LSL #1 ;b*3
�/ LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
 STR R3,[R0,-R8]
 ADD R2,R6,R6,LSL #2 ;b*5
+ LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
$ STR R3,[R0]
. MOV R3,R6,ASR #4 ;b/16
8$ STR R3,[R0,R8] ;not seen so far
B RSB R2,R6,R6,LSL #3 ;b*7
L( LDR R6,[R10,#8] ;next b light value
V> ADD R6,R6,R2,ASR #4 ;next value +7/16 of b error -> new b
` SUBS R9,R9,#1:BNE fsloop
j LDMFD SP !,{PC}^
t ]
~	� 15:
�Ȏ m$ �
�� "D":� No table needed
�	� "C"
�
[OPT Z
�.divtable EQUD 0
� EQUD 1/3*F
� EQUD 2/3*F
� EQUD F
� ]
�	� "T"
�
[OPT Z
�.divtable EQUD 0
 EQUD 1/15*F

 EQUD 2/15*F
 EQUD 3/15*F
 EQUD 4/15*F
( EQUD 5/15*F
2 EQUD 6/15*F
< EQUD 7/15*F
F EQUD 8/15*F
P EQUD 9/15*F
Z EQUD 10/15*F
d EQUD 11/15*F
n EQUD 12/15*F
x EQUD 13/15*F
� EQUD 14/15*F
� EQUD F
� ]
�� ""
�
[OPT Z
�.divtable EQUD 0
� EQUD 1/7*F
� EQUD 2/7*F
� EQUD 3/7*F
� EQUD 4/7*F
� EQUD 5/7*F
� EQUD 6/7*F
� EQUD F
 ]
�

[OPT Z
".fs%
, STMFD SP !,{R14}
6$ LDR R10,[R9,#4*8] ;addr current
@! LDR R11,[R9,#3*8] ;addr next
J* LDR R12,[R9,#2*8] ;addr pixel address
T! LDR R12,[R12] ;pixel address
^ LDR R8,[R9,#8] ;addr step
h LDR R8,[R8] ;step
r LDR R9,[R9] ;addr count
| LDR R9,[R9] ;count
� ]
��m$="C" � m$="D" �
�
[OPT Z
� LDR R4,[R10] ;r
� LDR R5,[R10,#4] ;g
� LDR R6,[R10,#8] ;b
� ]
��
�
[OPT Z
�  LDR R4,[R10],R8 ;mono value
� ]
��
��m$<>"D" �

[OPT Z
 ADR R7,divtable
 ]
&�
0
[OPT Z
:? TEQ R8,#0:MOVPL R1,#1:MVNMI R1,#0 ;+/- 1 for sprite output
D.fsloop
N ]
XȎ m$ �
b	� "D"
l
[OPT Z
v ADD R10,R10,R8 ;+step
� MOV R3,#0
�9 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=r<=1
� CMP R4,#F>>1 ;>1/2?
�! SUBCS R4,R4,#F:�RCS R3,R3,#1
�9 TEQ R5,#0:MOVMI R5,#0:CMP R5,#F:MOVCS R5,#F ;0<=g<=1
� CMP R5,#F>>1 ;>1?
�! SUBCS R5,R5,#F:�RCS R3,R3,#2
�9 TEQ R6,#0:MOVMI R6,#0:CMP R6,#F:MOVCS R6,#F ;0<=b<=1
� CMP R6,#F>>1 ;>1?
�! SUBCS R6,R6,#F:�RCS R3,R3,#4
� ]
�	� "C"
�
[OPT Z
 ADD R10,R10,R8 ;+step
9 TEQ R5,#0:MOVMI R5,#0:CMP R5,#F:MOVCS R5,#F ;0<=g<=1
 ADD R3,R5,R5,LSL #1 ;*3
  ADD R3,R3,#F>>1 ;round up
*' MOVS R3,R3,LSR #bits ;final int0-3
44 LDRNE R2,[R7,R3,LSL #2] ;divide by 3 from table
>- SUBNE R5,R5,R2 ;subtract converted value
H9 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=r<=1
R CMP R4,#F>>1 ;>1/2?
\! SUBCS R4,R4,#F:�RCS R3,R3,#4
f9 TEQ R6,#0:MOVMI R6,#0:CMP R6,#F:MOVCS R6,#F ;0<=b<=1
p CMP R6,#F>>1 ;>1/2?
z! SUBCS R6,R6,#F:�RCS R3,R3,#8
� ]
�	� "T"
�
[OPT Z
�; TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
� RSB R3,R4,R4,LSL #4 ;*15
� ADD R3,R3,#F>>1 ;round up
�( MOVS R3,R3,LSR #bits ;final int0-15
�5 LDRNE R2,[R7,R3,LSL #2] ;divide by 15 from table
�- SUBNE R4,R4,R2 ;subtract converted value
� ]
�� ""
�
[OPT Z
�; TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
 RSB R3,R4,R4,LSL #3 ;*7
 ADD R3,R3,#F>>1 ;round up
' MOVS R3,R3,LSR #bits ;final int0-7
$4 LDRNE R2,[R7,R3,LSL #2] ;divide by 7 from table
.- SUBNE R4,R4,R2 ;subtract converted value
8 ]
B�
L
[OPT Z
V MOV R2,R12,LSR #1
` TST R12,#1
j LDRB R0,[R2]
t! �EQ R0,R0,#&F0:�REQ R0,R0,R3
~( �NE R0,R0,#&0F:�RNE R0,R0,R3,LSL #4
� STRB R0,[R2]
� ADD R12,R12,R1
� ]
��m$="C" � m$="D" �
�
[OPT Z
� ADD R0,R11,#4 ;nl g%(S%)
� ADD R2,R4,R4,LSL #1 ;r*3
�0 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
� STR R3,[R11,-R8]
� ADD R2,R4,R4,LSL #2 ;r*5
�, LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
� STR R3,[R11]
 MOV R3,R4,ASR #4 ;r/16

1 STR R3,[R11,R8]! ;not seen so far inc nl ptr
 RSB R2,R4,R4,LSL #3 ;r*7
% LDR R4,[R10] ;next r light value
(> ADD R4,R4,R2,ASR #4 ;next value +7/16 of r error -> new r
2 ADD R2,R5,R5,LSL #1 ;g*3
</ LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
F STR R3,[R0,-R8]
P MOV R3,R5,ASR #4 ;g/16
Z$ STR R3,[R0,R8] ;not seen so far
d ADD R2,R5,R5,LSL #2 ;g*5
n+ LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
x3 STR R3,[R0],#4 ;computes nl b into the bargain
� RSB R2,R5,R5,LSL #3 ;g*7
�( LDR R5,[R10,#4] ;next g light value
�> ADD R5,R5,R2,ASR #4 ;next value +7/16 of g error -> new g
� ADD R2,R6,R6,LSL #1 ;b*3
�/ LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
� STR R3,[R0,-R8]
� ADD R2,R6,R6,LSL #2 ;b*5
�+ LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
� STR R3,[R0]
� MOV R3,R6,ASR #4 ;b/16
�$ STR R3,[R0,R8] ;not seen so far
� RSB R2,R6,R6,LSL #3 ;b*7
�( LDR R6,[R10,#8] ;next b light value
> ADD R6,R6,R2,ASR #4 ;next value +7/16 of b error -> new b
 ]
�
"
[OPT Z
, ADD R2,R4,R4,LSL #1 ;*3
60 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
@ STR R3,[R11,-R8]
J ADD R2,R4,R4,LSL #2 ;*5
T, LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
^ STR R3,[R11]
h MOV R3,R4,ASR #4 ;/16
r1 STR R3,[R11,R8]! ;not seen so far inc nl ptr
| RSB R2,R4,R4,LSL #3 ;*7
�& LDR R4,[R10],R8 ;next light value
�@ ADD R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
� ]
��
�
[OPT Z
� SUBS R9,R9,#1:BNE fsloop
� LDMFD SP !,{PC}^
� ]
�� 3:
��m$="" �
�
[OPT Z
�.slashthree EQUD 0
� EQUD 1/3*F
  EQUD 2/3*F
  EQUD F
  ]
 &�
 0
[OPT Z
 :.fs%
 D STMFD SP !,{R14}
 N$ LDR R10,[R9,#4*8] ;addr current
 X! LDR R11,[R9,#3*8] ;addr next
 b* LDR R12,[R9,#2*8] ;addr pixel address
 l! LDR R12,[R12] ;pixel address
 v LDR R8,[R9,#8] ;addr step
 � LDR R8,[R8] ;step
 � LDR R9,[R9] ;addr count
 � LDR R9,[R9] ;count
 � ]
 �
�m$="C" �
 �
[OPT Z
 � LDR R4,[R10] ;r
 � LDR R5,[R10,#4] ;g
 � LDR R6,[R10,#8] ;b
 � ]
 ��
 �
[OPT Z
 �  LDR R4,[R10],R8 ;mono value
! ADR R7,slashthree
! ]
!�
! 
[OPT Z
!*? TEQ R8,#0:MOVPL R1,#1:MVNMI R1,#0 ;+/- 1 for sprite output
!4.fsloop
!> ]
!H
�m$="C" �
!R
[OPT Z
!\ ADD R10,R10,R8 ;+step
!f9 TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=r<=1
!p9 TEQ R5,#0:MOVMI R5,#0:CMP R5,#F:MOVCS R5,#F ;0<=g<=1
!z9 TEQ R6,#0:MOVMI R6,#0:CMP R6,#F:MOVCS R6,#F ;0<=b<=1
!� MOV R3,#0 ;black octant
!� CMP R4,#F>>1:�RCS R3,R3,#1
!� CMP R5,#F>>1:�RCS R3,R3,#2
!� CMP R6,#F>>1:�RCS R3,R3,#4
!�# CMP R3,#6:�Q R3,#1:BEQ octcyan
!� BCS octwhite
!� CMP R3,#4:BEQ octblue
!� MOVCS R3,#2:BCS octmagenta
!� CMP R3,#2:BEQ octgreen
!� BCS octyellow
!� CMP R3,#0:BEQ octblack
!�.octred
!� RSB R0,R4,#F ;1-r
" CMP R5,R0 ;g>1-r?
" BLT octred1
" CMP R5,R6 ;yes- g>b?
"$* MOVGE R3,#3 ;if g>b then g is largest
". MOVLT R3,#2 ;else b is
"8 B octconvert
"B.octred1
"L CMP R0,R6 ;no- 1-r>b?
"V. MOVGE R3,#0 ;if 1-r>b then 1-r is largest
"` MOVLT R3,#2 ;else b is
"j B octconvert
"t
.octgreen
"~ RSB R0,R5,#F ;1-g
"� CMP R0,R4 ;1-g>r?
"� BLT octgreen1
"� CMP R0,R6 ;yes- 1-g>b?
"�. MOVGE R3,#0 ;if 1-g>b then 1-g is largest
"� MOVLT R3,#1 ;else b is
"� B octconvert
"�.octgreen1
"� CMP R4,R6 ;no- r>b?
"�* MOVGE R3,#3 ;if r>b then r is largest
"� MOVLT R3,#1 ;else b is
"� B octconvert
"�.octblue
# RSB R0,R6,#F ;1-b
#
 CMP R0,R4 ;1-b>r?
# BLT octblue1
# CMP R0,R5 ;yes- 1-b>g?
#(. MOVGE R3,#0 ;if 1-b>g then 1-b is largest
#2 MOVLT R3,#1 ;else g is
#< B octconvert
#F
.octblue1
#P CMP R4,R5 ;no- r>g?
#Z* MOVGE R3,#2 ;if r>g then r is largest
#d MOVLT R3,#1 ;else g is
#n B octconvert
#x
.octwhite
#� CMP R4,R5 ;if r>g
#� BLT octwhite1
#� CMP R5,R6 ;yes - g>b?
#�& MOVGE R3,#3 ;if g>b b is smallest
#� MOVLT R3,#2 ;else g is
#� B octconvert
#�.octwhite1
#� CMP R4,R6 ;no - r>b?
#�& MOVGE R3,#3 ;if r>b b is smallest
#� MOVLT R3,#1 ;else r is
#�.octconvert
#� CMP R3,#1 ;not red=cyan
#�.octcyan
$ SUBEQ R5,R5,#F
$ SUBEQ R6,R6,#F
$.octmagenta
$"! CMP R3,#2 ;not green=magenta
$, SUBEQ R4,R4,#F
$6 SUBEQ R6,R6,#F
$@.octyellow
$J CMP R3,#3 ;not blue=yellow
$T SUBEQ R4,R4,#F
$^ SUBEQ R5,R5,#F
$h
.octblack
$r MOV R2,R12,LSR #2
$|! � R7,R12,#3:MOV R7,R7,LSL #1
$� MOV R14,#3
$� MOV R14,R14,LSL R7
$�? LDRB R0,[R2]:BIC R0,R0,R14:�R R0,R0,R3,LSL R7:STRB R0,[R2]
$� ADD R12,R12,R1
$� ADD R0,R11,#4 ;nl g%(S%)
$� ADD R2,R4,R4,LSL #1 ;r*3
$�0 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
$� STR R3,[R11,-R8]
$� ADD R2,R4,R4,LSL #2 ;r*5
$�, LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
$� STR R3,[R11]
$� MOV R3,R4,ASR #4 ;r/16
$�1 STR R3,[R11,R8]! ;not seen so far inc nl ptr
% RSB R2,R4,R4,LSL #3 ;r*7
%% LDR R4,[R10] ;next r light value
%> ADD R4,R4,R2,ASR #4 ;next value +7/16 of r error -> new r
%& ADD R2,R5,R5,LSL #1 ;g*3
%0/ LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
%: STR R3,[R0,-R8]
%D MOV R3,R5,ASR #4 ;g/16
%N$ STR R3,[R0,R8] ;not seen so far
%X ADD R2,R5,R5,LSL #2 ;g*5
%b+ LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
%l3 STR R3,[R0],#4 ;computes nl b into the bargain
%v RSB R2,R5,R5,LSL #3 ;g*7
%�( LDR R5,[R10,#4] ;next g light value
%�> ADD R5,R5,R2,ASR #4 ;next value +7/16 of g error -> new g
%� ADD R2,R6,R6,LSL #1 ;b*3
%�/ LDR R3,[R0,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
%� STR R3,[R0,-R8]
%� ADD R2,R6,R6,LSL #2 ;b*5
%�+ LDR R3,[R0]:ADD R3,R3,R2,ASR #4 ;+5/16
%� STR R3,[R0]
%� MOV R3,R6,ASR #4 ;b/16
%�$ STR R3,[R0,R8] ;not seen so far
%� RSB R2,R6,R6,LSL #3 ;b*7
%�( LDR R6,[R10,#8] ;next b light value
%�> ADD R6,R6,R2,ASR #4 ;next value +7/16 of b error -> new b
& ]
&�
&
[OPT Z
& ; TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
&* ADD R3,R4,R4,LSL #1 ;*3
&4 ADD R3,R3,#F>>1 ;round up
&>' MOVS R3,R3,LSR #bits ;final int0-3
&H4 LDRNE R2,[R7,R3,LSL #2] ;divide by 3 from table
&R- SUBNE R4,R4,R2 ;subtract converted value
&\ MOV R2,R12,LSR #2
&f! � R5,R12,#3:MOV R5,R5,LSL #1
&p MOV R6,#3:MOV R6,R6,LSL R5
&z> LDRB R0,[R2]:BIC R0,R0,R6:�R R0,R0,R3,LSL R5:STRB R0,[R2]
&� ADD R12,R12,R1
&� ADD R2,R4,R4,LSL #1 ;*3
&�0 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
&� STR R3,[R11,-R8]
&� ADD R2,R4,R4,LSL #2 ;*5
&�, LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
&� STR R3,[R11]
&� MOV R3,R4,ASR #4 ;/16
&�1 STR R3,[R11,R8]! ;not seen so far inc nl ptr
&� RSB R2,R4,R4,LSL #3 ;*7
&�& LDR R4,[R10],R8 ;next light value
&�@ ADD R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
&� ]
'�
'
[OPT Z
' SUBS R9,R9,#1:BNE fsloop
'$ LDMFD SP !,{PC}^
'. ]
'8� 1:
'B
�m$="C" �
'L
[OPT Z
'V.evenrow_gard DCD even_gard
'`.oddrow_gard DCD odd_gard
'j.quarterrowinc DCD 0
't.fs%
'~ STMFD SP !,{R14}
'�$ LDR R10,[R9,#4*8] ;addr current
'�! LDR R11,[R9,#3*8] ;addr next
'�* LDR R12,[R9,#2*8] ;addr pixel address
'�! LDR R12,[R12] ;pixel address
'� LDR R8,[R9,#8] ;addr step
'� LDR R8,[R8] ;step
'� LDR R9,[R9] ;addr count
'� LDR R9,[R9] ;count
'�  LDR R4,[R10],R8 ;mono value
'� TEQ R8,#0
'� MOVPL R1,#2
'� LDRPL R6,evenrow_gard
() MVNMI R1,#1 ;+/- 2 for sprite output
(
 LDRMI R6,oddrow_gard
( LDR R7,quarterrowinc
(.fsloop
((; TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
(2 ADD R5,R4,#F>>5 ;round up
(<+ MOVS R5,R5,LSR #bits-4 ;final int 0-16
(F9 SUBNE R4,R4,R5,LSL #bits-4 ;subtract converted value
(P ADD R2,R4,R4,LSL #1 ;*3
(Z0 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
(d STR R3,[R11,-R8]
(n ADD R2,R4,R4,LSL #2 ;*5
(x, LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
(� STR R3,[R11]
(� MOV R3,R4,ASR #4 ;/16
(�1 STR R3,[R11,R8]! ;not seen so far inc nl ptr
(� RSB R2,R4,R4,LSL #3 ;*7
(�& LDR R4,[R10],R8 ;next light value
(�A ADDS R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
(�1 MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
(� ADD R3,R4,#F>>5 ;round up
(�+ MOVS R3,R3,LSR #bits-4 ;final int 0-16
(�9 SUBNE R4,R4,R3,LSL #bits-4 ;subtract converted value
(�8 TEQ R1,#0:�RPL R5,R5,R3,LSL #5:�RMI R5,R3,R5,LSL #5
(�* LDR R3,[R6,R5,LSL #2] ;get 4 patterns
(�G MOV R2,R12,LSR #1:STRB R3,[R2],R7:MOV R3,R3,LSR #8:STRB R3,[R2],R7
)C MOV R3,R3,LSR #8:STRB R3,[R2],R7:MOV R3,R3,LSR #8:STRB R3,[R2]
) ADD R12,R12,R1
) ADD R2,R4,R4,LSL #1 ;*3
)"0 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
), STR R3,[R11,-R8]
)6 ADD R2,R4,R4,LSL #2 ;*5
)@, LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
)J STR R3,[R11]
)T MOV R3,R4,ASR #4 ;/16
)^1 STR R3,[R11,R8]! ;not seen so far inc nl ptr
)h RSB R2,R4,R4,LSL #3 ;*7
)r& LDR R4,[R10],R8 ;next light value
)|@ ADD R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
)� SUBS R9,R9,#2:BNE fsloop
)� LDMFD SP !,{PC}^
)� ]
)��
)�
[OPT Z
)�.fs%
)� STMFD SP !,{R14}
)�$ LDR R10,[R9,#4*8] ;addr current
)�! LDR R11,[R9,#3*8] ;addr next
)�* LDR R12,[R9,#2*8] ;addr pixel address
)�! LDR R12,[R12] ;pixel address
)� LDR R8,[R9,#8] ;addr step
)� LDR R8,[R8] ;step
* LDR R9,[R9] ;addr count
* LDR R9,[R9] ;count
*  LDR R4,[R10],R8 ;mono value
*&? TEQ R8,#0:MOVPL R1,#1:MVNMI R1,#0 ;+/- 1 for sprite output
*0.fsloop
*:; TEQ R4,#0:MOVMI R4,#0:CMP R4,#F:MOVCS R4,#F ;0<=val<=1
*D MOV R3,#0
*N CMP R4,#F>>1 ;>1/2?
*X. SUBCS R4,R4,#F:MOVCS R3,#1 ;final int 0-1
*b MOV R2,R12,LSR #3
*l+ � R5,R12,#7:MOV R6,#1:MOV R6,R6,LSL R5
*vM LDRB R0,[R2]:BIC R0,R0,R6:�R R0,R0,R3,LSL R5 ;invert r3 value in process
*� STRB R0,[R2]
*� ADD R12,R12,R1
*� ADD R2,R4,R4,LSL #1 ;*3
*�0 LDR R3,[R11,-R8]:ADD R3,R3,R2,ASR #4 ;+3/16
*� STR R3,[R11,-R8]
*� ADD R2,R4,R4,LSL #2 ;*5
*�, LDR R3,[R11]:ADD R3,R3,R2,ASR #4 ;+5/16
*� STR R3,[R11]
*� MOV R3,R4,ASR #4 ;/16
*�1 STR R3,[R11,R8]! ;not seen so far inc nl ptr
*� RSB R2,R4,R4,LSL #3 ;*7
*�& LDR R4,[R10],R8 ;next light value
*�@ ADD R4,R4,R2,ASR #4 ;next value +7/16 of error -> new value
+ SUBS R9,R9,#1:BNE fsloop
+ LDMFD SP !,{PC}^
+ ]
+ �
+*�
+4Ȏ col �
+>� 0:
+H
[OPT Z
+R<.mappix% ; � mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
+\# LDR R0,[R9]:LDR R0,[R0] ;count
+f3 LDR R1,[R9,#8]:LDR R1,[R1] ;base of byte array
+p& LDR R2,[R9,#4*8] ;base of r array
+z& LDR R5,[R9,#5*8] ;base of z array
+�
.mappixlp
+� LDRB R6,[R1],#1
+� ]
+�Ȏ input �
+�� 8:
+�
[OPT Z
+�) LDR R7,[R2,R6,LSL #2]:STR R7,[R5],#4
+� SUBS R0,R0,#1:BNE mappixlp
+� MOVS PC,R14
+� ]
+�� 4:
+��bigendianbits �
+�
[OPT Z
, MOV R10,R6,LSR #4
,* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
, � R10,R6,#&F
,$ ]
,.�
,8
[OPT Z
,B � R10,R6,#&F
,L* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
,V MOV R10,R6,LSR #4
,` ]
,j�
,t
[OPT Z
,~* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
,� SUBS R0,R0,#2:BHI mappixlp
,� MOVS PC,R14
,� ]
,�� 2:
,��bigendianbits �
,�
[OPT Z
,� MOV R10,R6,LSR #6
,�* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
,� � R10,R6,#&30
,�* LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
,� � R10,R6,#&C
,�# LDR R7,[R2,R10]:STR R7,[R5],#4
- � R10,R6,#&3
-
 ]
-�
-
[OPT Z
-( � R10,R6,#&3
-2* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
-< � R10,R6,#&C
-F# LDR R7,[R2,R10]:STR R7,[R5],#4
-P � R10,R6,#&30
-Z* LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
-d MOV R10,R6,LSR #6
-n ]
-x�
-�
[OPT Z
-�* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
-� SUBS R0,R0,#4:BHI mappixlp
-� MOVS PC,R14
-� ]
-�� 1:
-��bigendianbits �
-�
[OPT Z
-� � R10,R6,#&80
-�* LDR R7,[R2,R10,LSR #5]:STR R7,[R5],#4
-� � R10,R6,#&40
-�* LDR R7,[R2,R10,LSR #4]:STR R7,[R5],#4
-� � R10,R6,#&20
.* LDR R7,[R2,R10,LSR #3]:STR R7,[R5],#4
. � R10,R6,#&10
.* LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
." � R10,R6,#&8
.,* LDR R7,[R2,R10,LSR #1]:STR R7,[R5],#4
.6 � R10,R6,#&4
.@# LDR R7,[R2,R10]:STR R7,[R5],#4
.J � R10,R6,#&2
.T* LDR R7,[R2,R10,LSL #1]:STR R7,[R5],#4
.^ � R10,R6,#&1
.h ]
.r�
.|
[OPT Z
.� � R10,R6,#&1
.�* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
.� � R10,R6,#&2
.�* LDR R7,[R2,R10,LSL #1]:STR R7,[R5],#4
.� � R10,R6,#&4
.�# LDR R7,[R2,R10]:STR R7,[R5],#4
.� � R10,R6,#&8
.�* LDR R7,[R2,R10,LSR #1]:STR R7,[R5],#4
.� � R10,R6,#&10
.�* LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
.� � R10,R6,#&20
.�* LDR R7,[R2,R10,LSR #3]:STR R7,[R5],#4
.� � R10,R6,#&40
/* LDR R7,[R2,R10,LSR #4]:STR R7,[R5],#4
/ MOV R10,R6,LSR #7
/ ]
/&�
/0
[OPT Z
/:* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
/D SUBS R0,R0,#8:BHI mappixlp
/N MOVS PC,R14
/X ]
/b�
/l
[OPT Z
/vS; routine to add two arrays and halve output of fixed point numbers for scaling
/�
.addhalf%
/� LDR R0,[R9]:LDR R0,[R0]
/� LDR R1,[R9,#8] ;output
/� LDR R2,[R9,#2*8] ;input
/�.addhalflp
/�L LDR R3,[R1]:LDR R4,[R2],#4:ADD R3,R3,R4:MOV R3,R3,LSR #1:STR R3,[R1],#4
/�  SUBS R0,R0,#1:BPL addhalflp
/� MOVS PC,R14
/�@; change size in x �xsample%,xmul%,xdiv%,z%(1,0),xp%(1,0),x%
/�
.xsample%
/�  LDR R0,[R9]:LDR R0,[R0] ;x%
/� LDR R1,[R9,#8] ;xp (in)
/� LDR R2,[R9,#2*8] ;z
0( LDR R3,[R9,#3*8]:LDR R3,[R3] ;xdiv%
0( LDR R4,[R9,#4*8]:LDR R4,[R4] ;xmul%
0 MOV R11,R4
0 .xsamplelp
0* LDMIA R1,{R5}
04- SUBS R11,R11,#1:�Q R11,R4:ADDEQ R1,R1,#4
0># SUBS R12,R3,#1 ;(in range 1..)
0H BEQ xdonediv
0R.xdivlp
0\ LDMIA R1,{R8}
0f- SUBS R11,R11,#1:�Q R11,R4:ADDEQ R1,R1,#4
0p" ADD R5,R5,R8:MOV R5,R5,LSR #1
0z SUBS R12,R12,#1:BNE xdivlp
0�
.xdonediv
0� STMIA R2!,{R5}
0�  SUBS R0,R0,#1:BPL xsamplelp
0� MOVS PC,R14
0�]
0�� 2:� when col=2
0�
[OPT Z
0�<.mappix% ; � mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
0�# LDR R0,[R9]:LDR R0,[R0] ;count
0�3 LDR R1,[R9,#8]:LDR R1,[R1] ;base of byte array
0�& LDR R2,[R9,#4*8] ;base of r array
0�& LDR R3,[R9,#3*8] ;base of g array
0�& LDR R4,[R9,#2*8] ;base of b array
1& LDR R5,[R9,#5*8] ;base of z array
1
.mappixlp
1 LDRB R6,[R1],#1
1$ ]
1.Ȏ input �
18� 8:
1B"�flag=1600 � flag=1601 � ham �
1L
[OPT Z
1V ADR R9,ltable
1`" MOVS R7,R6,LSR #4:� R6,R6,#15
1jO LDREQ R10,[R2,R6,LSL #2]:LDREQ R11,[R3,R6,LSL #2]:LDREQ R12,[R4,R6,LSL #2]
1t' CMP R7,#1:LDREQ R12,[R9,R6,LSL #2]
1~' CMP R7,#2:LDREQ R10,[R9,R6,LSL #2]
1�' CMP R7,#3:LDREQ R11,[R9,R6,LSL #2]
1� STMIA R5!,{R10,R11,R12}
1� SUBS R0,R0,#1:BNE mappixlp
1� MOVS PC,R14
1�.ltable EQUD 0
1� EQUD 1/15*F
1� EQUD 2/15*F
1� EQUD 3/15*F
1� EQUD 4/15*F
1� EQUD 5/15*F
1� EQUD 6/15*F
1� EQUD 7/15*F
2 EQUD 8/15*F
2
 EQUD 9/15*F
2 EQUD 10/15*F
2 EQUD 11/15*F
2( EQUD 12/15*F
22 EQUD 13/15*F
2< EQUD 14/15*F
2F EQUD F
2P ]
2Z�
2d
[OPT Z
2n) LDR R7,[R2,R6,LSL #2]:STR R7,[R5],#4
2x) LDR R7,[R3,R6,LSL #2]:STR R7,[R5],#4
2�) LDR R7,[R4,R6,LSL #2]:STR R7,[R5],#4
2� SUBS R0,R0,#1:BNE mappixlp
2� MOVS PC,R14
2� ]
2��
2�� 4:
2��bigendianbits �
2�
[OPT Z
2� MOV R10,R6,LSR #4
2�* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
2�* LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
2�* LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
2� � R10,R6,#&F
3 ]
3�
3
[OPT Z
3" � R10,R6,#&F
3,* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
36* LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
3@* LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
3J MOV R10,R6,LSR #4
3T ]
3^�
3h
[OPT Z
3r* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
3|* LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
3�* LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
3� SUBS R0,R0,#2:BHI mappixlp
3� MOVS PC,R14
3� ]
3�� 2:
3��bigendianbits �
3�
[OPT Z
3� MOV R10,R6,LSR #6
3�* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
3�* LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
3�* LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
3� � R10,R6,#&30
3�* LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
4* LDR R7,[R3,R10,LSR #2]:STR R7,[R5],#4
4* LDR R7,[R4,R10,LSR #2]:STR R7,[R5],#4
4 � R10,R6,#&C
4&# LDR R7,[R2,R10]:STR R7,[R5],#4
40# LDR R7,[R3,R10]:STR R7,[R5],#4
4:# LDR R7,[R4,R10]:STR R7,[R5],#4
4D � R10,R6,#&3
4N ]
4X�
4b
[OPT Z
4l � R10,R6,#&3
4v* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
4�* LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
4�* LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
4� � R10,R6,#&C
4�# LDR R7,[R2,R10]:STR R7,[R5],#4
4�# LDR R7,[R3,R10]:STR R7,[R5],#4
4�# LDR R7,[R4,R10]:STR R7,[R5],#4
4� � R10,R6,#&30
4�* LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
4�* LDR R7,[R3,R10,LSR #2]:STR R7,[R5],#4
4�* LDR R7,[R4,R10,LSR #2]:STR R7,[R5],#4
4� MOV R10,R6,LSR #6
4� ]
4��
5
[OPT Z
5* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
5* LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
5 * LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
5* SUBS R0,R0,#4:BHI mappixlp
54 MOVS PC,R14
5> ]
5H� 1:
5R�bigendianbits �
5\
[OPT Z
5f � R10,R6,#&80
5p* LDR R7,[R2,R10,LSR #5]:STR R7,[R5],#4
5z* LDR R7,[R3,R10,LSR #5]:STR R7,[R5],#4
5�* LDR R7,[R4,R10,LSR #5]:STR R7,[R5],#4
5� � R10,R6,#&40
5�* LDR R7,[R2,R10,LSR #4]:STR R7,[R5],#4
5�* LDR R7,[R3,R10,LSR #4]:STR R7,[R5],#4
5�* LDR R7,[R4,R10,LSR #4]:STR R7,[R5],#4
5� � R10,R6,#&20
5�* LDR R7,[R2,R10,LSR #3]:STR R7,[R5],#4
5�* LDR R7,[R3,R10,LSR #3]:STR R7,[R5],#4
5�* LDR R7,[R4,R10,LSR #3]:STR R7,[R5],#4
5� � R10,R6,#&10
5�* LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
5�* LDR R7,[R3,R10,LSR #2]:STR R7,[R5],#4
5�* LDR R7,[R4,R10,LSR #2]:STR R7,[R5],#4
6 � R10,R6,#&8
6* LDR R7,[R2,R10,LSR #1]:STR R7,[R5],#4
6* LDR R7,[R3,R10,LSR #1]:STR R7,[R5],#4
6$* LDR R7,[R4,R10,LSR #1]:STR R7,[R5],#4
6. � R10,R6,#&4
68# LDR R7,[R2,R10]:STR R7,[R5],#4
6B# LDR R7,[R3,R10]:STR R7,[R5],#4
6L# LDR R7,[R4,R10]:STR R7,[R5],#4
6V � R10,R6,#&2
6`* LDR R7,[R2,R10,LSL #1]:STR R7,[R5],#4
6j* LDR R7,[R3,R10,LSL #1]:STR R7,[R5],#4
6t* LDR R7,[R4,R10,LSL #1]:STR R7,[R5],#4
6~ � R10,R6,#&1
6� ]
6��
6�
[OPT Z
6� � R10,R6,#&1
6�* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
6�* LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
6�* LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
6� � R10,R6,#&2
6�* LDR R7,[R2,R10,LSL #1]:STR R7,[R5],#4
6�* LDR R7,[R3,R10,LSL #1]:STR R7,[R5],#4
6�* LDR R7,[R4,R10,LSL #1]:STR R7,[R5],#4
6� � R10,R6,#&4
7# LDR R7,[R2,R10]:STR R7,[R5],#4
7
# LDR R7,[R3,R10]:STR R7,[R5],#4
7# LDR R7,[R4,R10]:STR R7,[R5],#4
7 � R10,R6,#&8
7(* LDR R7,[R2,R10,LSR #1]:STR R7,[R5],#4
72* LDR R7,[R3,R10,LSR #1]:STR R7,[R5],#4
7<* LDR R7,[R4,R10,LSR #1]:STR R7,[R5],#4
7F � R10,R6,#&10
7P* LDR R7,[R2,R10,LSR #2]:STR R7,[R5],#4
7Z* LDR R7,[R3,R10,LSR #2]:STR R7,[R5],#4
7d* LDR R7,[R4,R10,LSR #2]:STR R7,[R5],#4
7n � R10,R6,#&20
7x* LDR R7,[R2,R10,LSR #3]:STR R7,[R5],#4
7�* LDR R7,[R3,R10,LSR #3]:STR R7,[R5],#4
7�* LDR R7,[R4,R10,LSR #3]:STR R7,[R5],#4
7� � R10,R6,#&40
7�* LDR R7,[R2,R10,LSR #4]:STR R7,[R5],#4
7�* LDR R7,[R3,R10,LSR #4]:STR R7,[R5],#4
7�* LDR R7,[R4,R10,LSR #4]:STR R7,[R5],#4
7� MOV R10,R6,LSR #7
7� ]
7��
7�
[OPT Z
7�* LDR R7,[R2,R10,LSL #2]:STR R7,[R5],#4
7�* LDR R7,[R3,R10,LSL #2]:STR R7,[R5],#4
7�* LDR R7,[R4,R10,LSL #2]:STR R7,[R5],#4
8 SUBS R0,R0,#8:BHI mappixlp
8 MOVS PC,R14
8 ]
8"	� 24:
8,
[OPT Z
86A.mappix% ; �mappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
8@# LDR R0,[R9]:LDR R0,[R0] ;count
8J7 LDR R1,[R9,#3*8]:LDR R1,[R1] ;base of r byte array
8T7 LDR R2,[R9,#2*8]:LDR R2,[R2] ;base of g byte array
8^5 LDR R3,[R9,#8]:LDR R3,[R3] ;base of b byte array
8h& LDR R4,[R9,#6*8] ;base of r array
8r& LDR R5,[R9,#5*8] ;base of g array
8|& LDR R6,[R9,#4*8] ;base of b array
8�& LDR R7,[R9,#7*8] ;base of z array
8�
.mappixlp
8�> LDRB R8,[R1],#step24:LDR R8,[R4,R8,LSL #2]:STR R8,[R7],#4
8�> LDRB R8,[R2],#step24:LDR R8,[R5,R8,LSL #2]:STR R8,[R7],#4
8�> LDRB R8,[R3],#step24:LDR R8,[R6,R8,LSL #2]:STR R8,[R7],#4
8� SUBS R0,R0,#1:BNE mappixlp
8� MOVS PC,R14
8� ]
8��
8� [OPT Z
8�S; routine to add two arrays and halve output of fixed point numbers for scaling
8�
.addhalf%
8� LDR R0,[R9]:LDR R0,[R0]
9 LDR R1,[R9,#8] ;output
9 LDR R2,[R9,#2*8] ;input
9.addhalflp
9&L LDR R3,[R1]:LDR R4,[R2],#4:ADD R3,R3,R4:MOV R3,R3,LSR #1:STR R3,[R1],#4
90L LDR R3,[R1]:LDR R4,[R2],#4:ADD R3,R3,R4:MOV R3,R3,LSR #1:STR R3,[R1],#4
9:L LDR R3,[R1]:LDR R4,[R2],#4:ADD R3,R3,R4:MOV R3,R3,LSR #1:STR R3,[R1],#4
9D  SUBS R0,R0,#1:BPL addhalflp
9N MOVS PC,R14
9X@; change size in x �xsample%,xmul%,xdiv%,z%(1,0),xp%(1,0),x%
9b
.xsample%
9l  LDR R0,[R9]:LDR R0,[R0] ;x%
9v LDR R1,[R9,#8] ;xp (in)
9� LDR R2,[R9,#2*8] ;z
9�( LDR R3,[R9,#3*8]:LDR R3,[R3] ;xdiv%
9�( LDR R4,[R9,#4*8]:LDR R4,[R4] ;xmul%
9� MOV R11,R4
9�.xsamplelp
9� LDMIA R1,{R5,R6,R7}
9�. SUBS R11,R11,#1:�Q R11,R4:ADDEQ R1,R1,#12
9�# SUBS R12,R3,#1 ;(in range 1..)
9� BEQ xdonediv
9�.xdivlp
9� LDMIA R1,{R8,R9,R10}
9�. SUBS R11,R11,#1:�Q R11,R4:ADDEQ R1,R1,#12
9�" ADD R5,R5,R8:MOV R5,R5,LSR #1
:" ADD R6,R6,R9:MOV R6,R6,LSR #1
:# ADD R7,R7,R10:MOV R7,R7,LSR #1
: SUBS R12,R12,#1:BNE xdivlp
: 
.xdonediv
:* STMIA R2!,{R5,R6,R7}
:4  SUBS R0,R0,#1:BPL xsamplelp
:> MOVS PC,R14
:H ]
:R�
:\�compression=5 �
:f
[OPT Z
:p+; � LZWdecode%,table%(0,0),c%,buff%,sx%
:z.firstcode DCD 0
:�.oldcode DCD 0
:�.codesize DCD setcodes%+1
:�.stack DCD stk%
:�.sp DCD stk%
:�.maxcode DCD clearcode%+2
:�!.maxcodesize DCD 2*clearcode%
:�.LZWdecode%
:� LDR R2,firstcode
:� LDR R3,oldcode
:� LDR R4,stack
:� LDR R5,codesize
:� LDR R6,sp
:� LDR R7,maxcode
; LDR R8,maxcodesize
; LDR R10,[R9]
; LDR R10,[R10] ;sx%
;$ LDR R11,[R9,#8]
;. LDR R11,[R11] ;buff%
;8 LDR R12,[R9,#24] ;table%()
;B STMFD SP !,{R14}
;L.lzwloop
;V CMP R6,R4
;` BHI lzwunstack
;j.lzwengine
;t BL getcode
;~ CMP R0,#clearcode%
;� BEQ lzwclear
;�p;really ought to check for endcode=clearcode+1, but it only happens once and then you don't need the answer!
;� MOV R1,R0 ;incode=code
;�  CMP R0,R7 ;if code>=maxcode
;�' STRCSB R2,[R6],#1 ;*sp++=firstcode
;� MOVCS R0,R3 ;code=oldcode
;�- ADD R2,R12,#4 ;r2(temp)=addr table%(x,1)
;� CMP R0,#clearcode%
;� BCC lzwdonepush
;�.lzwpushtable
;�, LDR R14,[R2,R0,LSL #3] ;table%(code%,1)
;� STRB R14,[R6],#1 ;*sp++=
<1 LDR R0,[R12,R0,LSL #3] ;code=table%(code%,0)
<
 CMP R0,#clearcode%
< BCS lzwpushtable
<.lzwdonepush
<(5 LDR R2,[R2,R0,LSL #3] ;firstcode=table%(code%,1)
<2% STRB R2,[R6],#1 ;*sp++=firstcode
<< MOV R0,R7 ;code=maxcode
<F CMP R0,#4096
<P BCS lzwnocode
<Z4 STR R3,[R12,R0,LSL #3] ;table%(code%,0)=oldcode
<d ADD R14,R12,#4
<n6 STR R2,[R14,R0,LSL #3] ;table%(code%,1)=firstcode
<x ADD R7,R7,#1 ;maxcode++
<� CMP R7,R8
<�+ BCC lzwnocode ;if maxcode>=maxcodesize
<�' CMP R8,#4096 ;and maxcodesize<4096
<� ADDCC R5,R5,#1 ;codesize++
<�+ MOVCC R8,R8,LSL #1 ;double maxcodesize
<�.lzwnocode
<� MOV R3,R1 ;oldcode=incode
<� CMP R6,R4 ;until sp>stk
<� BLS lzwengine
<�.lzwunstack
<� LDRB R0,[R6,#-1]! ;*--sp
<�.lzwloopend
<� STRB R0,[R11],#1
= SUBS R10,R10,#1
= BNE lzwloop
= STR R2,firstcode
=" STR R3,oldcode
=, STR R5,codesize
=6 STR R6,sp
=@ STR R7,maxcode
=J STR R8,maxcodesize
=T LDMFD SP !,{PC}^
=^
.lzwclear
=h MOV R0,#0:MOV R1,#0
=r MOV R2,#1<<12
=| MOV R3,R12
=�.lzwzerotable
=� STMIA R3 !,{R0,R1}
=� SUBS R2,R2,#1
=� BNE lzwzerotable
=� ADD R3,R12,#4
=�.lzwdefaulttable
=� STR R0,[R3],#8
=� ADD R0,R0,#1
=� CMP R0,#clearcode%
=� BCC lzwdefaulttable
=� MOV R5,#setcodes%+1
=� MOV R7,#clearcode%
=�. MOV R8,R7,LSL #1 ;maxcodesize=clearcode*2
>& ADD R7,R7,#2 ;maxcode=clearcode+2
> BL getcode
> MOV R2,R0 ;firstcode
>& MOV R3,R0 ;oldcode
>0 MOV R6,R4 ;sp=stk
>: B lzwloopend
>D6;enter with codesize in R5. Result in R0. Kills R1
>N.getcode
>X STMFD SP !,{R6,R7,R8}
>b ADR R6,curbit
>l LDMIA R6,{R6,R7,R8}
>v" ADD R1,R5,R6 ;curbit+codesize
>� CMP R1,R7
>� BCS needmoredata
>�.simplecode
>� ADD R7,R8,R6,LSR #3
>� BIC R7,R7,#3
>� LDMIA R7,{R0,R7}
>�I �S R1,R6,#31:MOVNE R0,R0,LSR R1:RSBNE R1,R1,#32:�RNE R0,R0,R7,LSL R1
>�" MVN R1,#0:BIC R0,R0,R1,LSL R5
>� ADD R6,R6,R5
>� STR R6,curbit
>� LDMFD SP !,{R6,R7,R8}
>� MOV PC,R14
>�.needmoredata
? STMFD SP !,{R2,R3,R4}
? MOV R3,R7,LSR #3
? SUB R0,R3,#2 ;lastbyte-2
?  LDRB R0,[R8,R0]
?* STRB R0,[R8]
?4 SUB R0,R3,#1 ;lastbyte-1
?> LDRB R0,[R8,R0]
?H STRB R0,[R8,#1]
?R LDR R1,[R9,#16]
?\ LDR R1,[R1] ;c%
?f SWI "OS_BGet"
?p MOVS R3,R0 ;count
?z BEQ simplecode1
?�! SUB R6,R6,R7 ;curbit-lastbit
?� ADD R6,R6,#16
?�# ADD R0,R0,#2 ;lastbyte=2+count
?� MOV R7,R0,LSL #3
?� STR R7,lastbit
?� MOV R0,#4
?� ADD R2,R8,#2 ;buf+2
?� SWI "OS_GBPB"
?�.simplecode1
?� LDMFD SP !,{R2,R3,R4}
?� B simplecode
?�.curbit DCD 0
?�.lastbit DCD 0
@.buf DCD buf%
@ ]
@�
@$
�range% �
@.
[OPT Z
@8!;� maxmin%,a%(1,0),totalvals%
@B.maxmin%
@L( LDR R0,[R9]:LDR R0,[R0] ;totalvals%
@V LDR R1,[R9,#8] ;a%()
@` LDR R2,min
@j LDR R3,max
@t
.maxminlp
@~ LDR R4,[R1],#4
@�, CMP R4,R3:MOVCS R3,R4 ;if r4>max max=r4
@�, CMP R4,R2:MOVCC R2,R4 ;if r4<min min=r4
@� SUBS R0,R0,#1:BNE maxminlp
@� STR R2,min
@� STR R3,max
@� MOVS PC,R14
@�.min DCD F
@�.max DCD 0
@�.fitmulloc DCD 0
@�!;� ranger%,a%(1,0),totalvals%
@�.ranger%
@� LDR R0,[R9]
A LDR R0,[R0] ;totalvals%
A
 LDR R1,[R9,#8] ;a%()
A LDR R2,min
A LDR R3,fitmulloc
A( MOV R4,R3,LSR #16
A2 � R3,R3,R4,LSL #16
A<.rangelp
AF LDR R5,[R1]
AP SUB R5,R5,R2
AZ MOV R6,R5,LSR #16
Ad � R5,R5,R6,LSL #16
An MUL R7,R3,R5
Ax MUL R5,R4,R5
A� MUL R8,R6,R3
A� MUL R6,R4,R6
A� ADDS R8,R5,R8
A� ADDCS R6,R6,#&10000
A� ADDS R7,R7,R8,LSL #16
A� ADC R6,R6,R8,LSR #16
A� MOV R6,R6,LSL #(32-28)
A� �RS R6,R6,R7,LSR #28
A�- ADDCS R6,R6,#1 ;carry is shifted out bit
A� CMP R6,#F
A� MOVCS R6,#F
A� STR R6,[R1],#4
A� SUBS R0,R0,#1
B BNE rangelp
B MOVS PC,R14
B ]
B"�
B,�sharpen% �
B69sharp=(col+1)*4:�sharpen%<>8 sharpmul%=F/(sharpen%-8)
B@
[OPT Z
BJ=;� sharp%,z%(1,0),rm%(1,0),rm1%(1,0),rm2%(1,0),totalvals%
BT.sharp%
B^ LDR R0,[R9]
Bh LDR R0,[R0] ;sx%
Br LDR R1,[R9,#8] ;rm2%()
B| LDR R2,[R9,#16] ;rm1%()
B� LDR R3,[R9,#24] ;rm%()
B� LDR R4,[R9,#32] ;z%()
B� ]
B�Ȏ sharpen% �
B�� 8,9,12,16,24
B�
B�
[OPT Z
B� MOV R8,#sharpmul% � &FF
B�  �R R8,R8,#sharpmul% � &FF00
B�$ MOV R9,#(sharpmul% >> 16) � &FF
B�( �R R9,R9,#(sharpmul% >> 16) � &FF00
B� ]
B��
C
[OPT Z
C.sharplp
C LDR R5,[R1,#-sharp]
C& LDR R6,[R1,#sharp]
C0 ADD R5,R5,R6
C: LDR R6,[R1],#4
CD ADD R5,R5,R6
CN LDR R6,[R3,#-sharp]
CX ADD R5,R5,R6
Cb LDR R6,[R3,#sharp]
Cl ADD R5,R5,R6
Cv LDR R6,[R3],#4
C� ADD R5,R5,R6
C� LDR R6,[R2,#-sharp]
C� ADD R5,R5,R6
C� LDR R6,[R2,#sharp]
C�- ADD R5,R5,R6 ;unsigned total to subtract
C� LDR R6,[R2],#4 ;centre
C� MOV R6,R6,LSR #1
C� MOV R7,#sharpen%
C�B MUL R7,R6,R7 ;avoid duplicate register while keeping Rs small
C� SUBS R5,R7,R5,LSR #1
C�% MOVCC R5,#0 ;underflow to 0 now!
C� ]
C�Ȏ sharpen% �
D	� 8,9
D
[OPT Z
D MOV R6,R5,LSL #1
D  ]
D*� 10
D4
[OPT Z
D> MOV R6,R5
DH ]
DR� 12
D\
[OPT Z
Df MOV R6,R5,LSR #1
Dp ]
Dz� 16
D�
[OPT Z
D� MOV R6,R5,LSR #2
D� ]
D�� 24
D�
[OPT Z
D� MOV R6,R5,LSR #3
D� ]
D�
D�
[OPT Z
D� MOV R6,R5,LSR #16
D� � R5,R5,R6,LSL #16
D� MUL R7,R8,R5
D� MUL R5,R9,R5
E MUL R10,R6,R8
E MUL R6,R9,R6
E ADDS R10,R5,R10
E$ ADDCS R6,R6,#&10000
E. ADDS R7,R7,R10,LSL #16
E8 ADC R6,R6,R10,LSR #16
EB MOV R6,R6,LSL #(32-27)
EL �RS R6,R6,R7,LSR #27
EV- ADDCS R6,R6,#1 ;carry is shifted out bit
E` ]
Ej�
Et
[OPT Z
E~ CMP R6,#F
E� MOVCS R6,#F
E� STR R6,[R4],#4
E� SUBS R0,R0,#1
E� BNE sharplp
E� MOVS PC,R14
E� ]
E��
E��hist%�equal% �
E�
[OPT Z
E�#;�histo%,z%(1,0),vals%(0,0),sx%
E�.histo%
E� LDR R0,[R9]
F LDR R0,[R0] ;sx%
F
 LDR R1,[R9,#8] ;vals%()
F LDR R2,[R9,#16]
F.histlp
F( ]
F2�col=0 �
F<
[OPT Z
FF LDR R3,[R2],#4
FP CMP R3,#F
FZ MOVCS R3,#F
Fd MOV R3,R3,LSR #bits-8
Fn LDR R4,[R1,R3,LSL #2]
Fx ADD R4,R4,#1
F� STR R4,[R1,R3,LSL #2]
F� ]
F��
F�
[OPT Z
F� LDR R3,[R2],#4
F� CMP R3,#F
F� MOVCS R3,#F
F� MOV R3,R3,LSR #bits-8
F� ADD R3,R3,R3,LSL #1
F� LDR R4,[R1,R3,LSL #2]
F� ADD R4,R4,#1
F� STR R4,[R1,R3,LSL #2]
F� LDR R3,[R2],#4
G CMP R3,#F
G MOVCS R3,#F
G MOV R3,R3,LSR #bits-8
G" ADD R3,R3,R3,LSL #1
G, ADD R3,R3,#1
G6 LDR R4,[R1,R3,LSL #2]
G@ ADD R4,R4,#1
GJ STR R4,[R1,R3,LSL #2]
GT LDR R3,[R2],#4
G^ CMP R3,#F
Gh MOVCS R3,#F
Gr MOV R3,R3,LSR #bits-8
G| ADD R3,R3,R3,LSL #1
G� ADD R3,R3,#2
G� LDR R4,[R1,R3,LSL #2]
G� ADD R4,R4,#1
G� STR R4,[R1,R3,LSL #2]
G� ]
G��
G�
[OPT Z
G� SUBS R0,R0,#1
G� BNE histlp
G� MOVS PC,R14
G� ]
G��
G�
�equal% �
H
[OPT Z
H$;�histequal%,z%(1,0),new%(0),sx%
H.histequal%
H& LDR R0,[R9]
H0 LDR R0,[R0] ;sx%
H: LDR R1,[R9,#8] ;new%()
HD LDR R2,[R9,#16] ;z%()
HN.equallp
HX ]
Hb�col=0 �
Hl
[OPT Z
Hv LDR R3,[R2]
H� CMP R3,#F
H� MOVCS R3,#F
H� MOV R3,R3,LSR #bits-8
H� LDR R4,[R1,R3,LSL #2]
H� STR R4,[R2],#4
H� ]
H��
H�
[OPT Z
H� LDR R3,[R2]
H� CMP R3,#F
H� MOVCS R3,#F
H� MOV R3,R3,LSR #bits-8
H� ADD R3,R3,R3,LSL #1
I LDR R4,[R1,R3,LSL #2]
I STR R4,[R2],#4
I LDR R3,[R2]
I  CMP R3,#F
I* MOVCS R3,#F
I4 MOV R3,R3,LSR #bits-8
I> ADD R3,R3,R3,LSL #1
IH ADD R3,R3,#1
IR LDR R4,[R1,R3,LSL #2]
I\ STR R4,[R2],#4
If LDR R3,[R2]
Ip CMP R3,#F
Iz MOVCS R3,#F
I� MOV R3,R3,LSR #bits-8
I� ADD R3,R3,R3,LSL #1
I� ADD R3,R3,#2
I� LDR R4,[R1,R3,LSL #2]
I� STR R4,[R2],#4
I� ]
I��
I�
[OPT Z
I� SUBS R0,R0,#1
I� BNE equallp
I� MOVS PC,R14
I� ]
I��
J
[OPT Z
J.;� rlexpand%,limit%,decr%,colour%,address%
JE;�decr%>1 �?address%++=colour%;decr%--;�decr%<1 � address%=limit%
J$.rlexpand%
J.! LDR R0,[R9] ;adr of address%
J8 LDR R1,[R0] ;address%
JB LDR R2,[R9,#8]
JL LDR R2,[R2] ;colour%
JV" LDR R3,[R9,#16] ;adr of decr%
J` LDR R4,[R3] ;decr%
Jj CMP R4,#1
Jt MOVLTS PC,R14
J~ LDR R5,[R9,#24]
J� LDR R5,[R5] ;limit%
J�.rle STRB R2,[R1],#1
J� SUB R4,R4,#1
J� CMP R1,R5
J� TEQNE R4,#0
J� BNE rle
J�(.rlexit STR R1,[R0] ;update address%
J� STR R4,[R3] ;update decr%
J� MOVS PC,R14
J� ]
J��planar<0 �
J�
[OPT Z
K0.plancnv% ;�plancnv%,st%(1),quant%,buff%,sx%
K
! LDR R0,[R9]:LDR R0,[R0] ;sx%
K& LDR R1,[R9,#8]:LDR R1,[R1] ;buff%
K( LDR R2,[R9,#16]:LDR R2,[R2] ;quant%
K(" LDR R3,[R9,#24] ;adr of st%()
K2 MOV R4,#7
K< MOV R5,#0
KF MOV R6,#0
KP.planelp
KZ MOV R7,#0
Kd SUB R8,R2,#1
Kn.planepixlp
Kx LDR R9,[R3,R8,LSL #2]
K� LDRB R9,[R9,R5]
K� MOV R9,R9,LSR R4
K� � R9,R9,#1
K� �R R7,R7,R9,LSL R8
K�! SUBS R8,R8,#1:BPL planepixlp
K� STRB R7,[R1],#1
K�- SUBS R4,R4,#1:MOVMI R4,#7:ADDMI R5,R5,#1
K� SUBS R0,R0,#1:BNE planelp
K� MOVS PC,R14
K� ]
K��
K��
K�hour%=&406c4
L
Ȏ ncol �
L� 255:size%=1
L� 63:size%=1
L"� 15:size%=2
L,� 3:size%=4
L6� 1:size%=8:�m$="C" size%=2
L@�
LJ2� fixup images that can't be read in row order
LT
Ȏ flag �
L^	� 501
Lh$�info% �"Reading interlaced GIF"
Lr3sz%=sx%*sy%:tbuff%=�dim(sz%+100):otbuff%=tbuff%
L|G�Y%=0�sy%-1�8:X%=tbuff%+Y%*sx%:� LZWdecode%,table%(0,0),c%,X%,sx%:�
L�G�Y%=4�sy%-1�8:X%=tbuff%+Y%*sx%:� LZWdecode%,table%(0,0),c%,X%,sx%:�
L�G�Y%=2�sy%-1�4:X%=tbuff%+Y%*sx%:� LZWdecode%,table%(0,0),c%,X%,sx%:�
L�G�Y%=1�sy%-1�2:X%=tbuff%+Y%*sx%:� LZWdecode%,table%(0,0),c%,X%,sx%:�
L�"�Y%=0�sy%-1:șhour%,Y%*100�sy%
L�
 �vrep% �
L�  vrep%-=1:�X%=1�quant%
L�?   F%=st%(X%)+Y%*rsx%:C%=F%-rsx%:�E%=0�rsx%-1:F%?E%=C%?E%:�
L�  �
L� �
L�  �X%=1�quant%
L�6   F%=st%(X%)+Y%*rsx%:G%=F%+rsx%:� C%=�#c%:�C%=0 �
L�    C%=�#c%:�C%=0 �
L�     C%=�#c%:vrep%=�#c%-1
M	    �
M7     D%=F%:�E%=0�patlen%-1:F%?E%=�#c%:�:F%+=patlen%
MC     �C%>1 �I%=2�C%:�E%=0�patlen%-1:F%?E%=D%?E%:�:F%+=patlen%:�
M&	    �
M0   �
M:    �C%=128 �
MD/     C%=�#c%:�E%=0�C%-1:F%?E%=�#c%:�:F%+=C%
MN	    �
MX<     ?F%=(C%�&80)<>0:�E%=1�C%�&7F:F%?E%=?F%:�:F%+=C%�&7F
Mb	    �
Ml   �
Mv   �F%>=G%
M�  �
M� �
M��
M��
M�@� if image processing the input stream to maximise luminance
M�
�range% �
M�? �info% �"Scanning data to compute parameters for '-range'"
M� �order% �
M�  Y%=0:� șhour%,Y%*100�sy%
M�8   �iprow(xp%()):�maxmin%,xp%(1,0),totalvals2%:Y%+=1
M�&  �Y%=sy% � !min<255 � !max+255>=F
M� �
M�'  Y%=0:ysamp%=1:� șhour%,Y%*100�y%
N@   �scaledpixelrow(cl%()):�maxmin%,cl%(1,0),totalvals%:Y%+=1
N%  �Y%=y% � !min<255 � !max+255>=F
N �
N ' !fitmulloc=F/(!max-!min)*F:�rewind
N*P �!max+255>=F �!min<255 range%=�:range$="No point in '-range' on this image"
N4W �range% range$="Input image maximum "+�(!max/F*100)+"% minimum "+�(!min/F*100)+"%"
N> �info% �range$
NH�
NR�hist%�equal% �
N\G �equal% �info% �"Scanning data to compute parameters for '-equal'"
Nf �order% �
Np&  �yr%=0�sy%-1:șhour%,yr%*100�sy%
Nz4   �iprow(xp%()):�histo%,xp%(1,0),vals%(0,0),sx%
N�  �
N� �
N�/  ysamp%=1:�yr%=0 � y%-1:șhour%,yr%*100�y%
N�<   �scaledpixelrow(cl%()):�histo%,cl%(1,0),vals%(0,0),x%
N�  �
N� �
N�/ �info% �"Done. Now processing the picture"
N��
N��hist% �
N� M%=0:ZM%=-1:�C%=0�col
N�7  �Z%=0�256:�vals%(Z%,C%)>M% M%=vals%(Z%,C%):ZM%=Z%
N� �:�
N� �ZM%=-1 � output%=0 �=100
O< � col>0 �66:ht=500:�0,6,2000,6 � �18:ht=400:�0,6,1024,6
O$ M=M%/(ht*2-8):�C%=0�col:Ȏ C% �
O  � 0:�1
O$  � 1:�2
O.  � 2:�4
O8  �
OB  � col>0 �
OLF   �Z%=0�256:�vals%(Z%,C%) X%=Z%*3+C%<<1:�X%,8,X%,vals%(Z%,C%)/M+8
OV   �
O`  �
OjB   �Z%=0�256:�vals%(Z%,C%) X%=Z%<<2:ȓ ȐX%,8,2,vals%(Z%,C%)/M
Ot   �
O~  �
O� �
O� �c% �#c%:c%=0
O� �cc% �#cc%:cc%=0
O� �ccc% �#ccc%:ccc%=0
O� ș"Hourglass_Off"
O�	 =100
O��
O�,oname$="pic"+�m+"_":�range% oname$+="r_"
O��equal% oname$+="e_"
O�'�sharpen% oname$+="s"+�sharpen%+"_"
O�oname$=�oname$)
O�
Ȏ m �
P"� -1:xwords%=x%:sz%=xwords%*y%
P
7 �spritearea%<0 � ram%=�dim(sz%) � ram%=spritearea%
P base%=ram%
P/:xwords%=x%/size%+3.9999��3:sz%=xwords%*y%
P(L �ncol=1 �m$="C" !quarterrowinc=xwords%:xwords%=xwords%*4:sz%=xwords%*y%
P2< �spritearea%<0 � ram%=�dim(sz%+1024) � ram%=spritearea%
P<A !ram%=sz%+1024:ram%!4=0:ram%!8=16:ram%!12=16:ș&2e,&109,ram%
PFf �ncol=1 �m$="C" ș&2e,&10f,ram%,oname$,1,x%*4,y%*4,m � ș&2e,&10f,ram%,oname$,(ncol<63)�1,x%,y%,m
PP* base%=ram%+ram%!&30+&10:pal%=ram%+&3c
PZ Ȏ ncol �
Pd
 � 15:
Pn Ȏ m$ �
Px  � "D"
P�!   �Z%=0�7:Y%=0:�Z%�1 Y%+=&F0
P�   �Z%�2 Y%+=&F000
P�   �Z%�4 Y%+=&F00000
P�   �col(Z%,Y%):�
P�  � "C"
P�"   �Z%=0�15:Y%=0:�Z%�4 Y%+=&F0
P�G   �Z%�3 Y%+=(Z%�3)*5<<12:�(Z%�3)=1 Y%+=&1000:� Gamma correct g low
P�   �Z%�8 Y%+=&F00000
P�   �col(Z%,Y%):�
P�  � "T"
P�3   �Z%=0�15:Y%=Z%<<4:�col(Z%,Y%�Y%<<8�Y%<<16):�
P�
  � ""
P�?   �Z%=0�15:Y%=(Z%�7)/7*15+.2<<4:�col(Z%,Y%�Y%<<8�Y%<<16):�
Q  �
Q � 3
Q  �m$="C" �
Q">   �col(0,0):�col(1,&F0F000):�col(2,&F000F0):�col(3,&F0F0)
Q,  �
Q64   �Z%=0�3:Y%=Z%*5<<4:�col(Z%,Y%�Y%<<8�Y%<<16):�
Q@  �
QJ" � 1:�col(0,0):�col(1,&F0F0F0)
QT �
Q^�
Qh� �
Qr>� � �:� �:�Save:� �,�$+" internal ("+Þ+")":� Error Return
Q|Aș"Hourglass_LEDs",3:ysamp%=1:nl%()=0:step%=12:�col=0 step%=4
Q�9�sy%=y% � sx%=x% � range%=� � sharpen%=� � equal%=� �
Q��yr%=0 � y%-1
Q�% șhour%,yr%*100�y%:�iprow(cl%())
Q�A cl%()=cl%()+nl%():nl%()=0:B%=x%:A%=(base%+yr%*xwords%)*size%
Q�
 �yr%�1 �
Q�.  I%=step%:�fs%,cl%(1,0),nl%(1,0),A%,I%,B%
Q� �
Q�:  I%=-step%:A%+=x%-1:�fs%,cl%(x%,0),nl%(x%,0),A%,I%,B%
Q� �
Q��
Q��
Q�
�equal% �
Q�C �rewind:range%=�:Havg%=Ǝ(vals%())/256/(col+1):� new%(256,col)
R? �B%=0�col:R%=0:Hint%=0:�Z%=0�256:L%=R%:Hint%+=vals%(Z%,B%)
R(  ȕHint%>Havg%:Hint%-=Havg%:R%+=1:�
R!  new%(Z%,B%)=(L%+R%)/2*F/256
R& �:�
R0�
R:�sharpen% �
RD �order% �
RN7  yread%=sy%-1:�iprow(rm1%()):�range% �fit2(rm1%())
RXC  �B%=0�col:rm1%(0,B%)=rm1%(1,B%):rm1%(sx%+1,B%)=rm1%(sx%,B%):�
Rb �
Rl>  yread%=y%-1:�scaledpixelrow(rm1%()):�range% �fit(rm1%())
RvA  �B%=0�col:rm1%(0,B%)=rm1%(1,B%):rm1%(x%+1,B%)=rm1%(x%,B%):�
R� �
R� rm2%()=rm1%()
R��
R�
�order% �
R��yr%=0 � y%-1
R� șhour%,yr%*100�y%
R� �sy%=y% �
R�  �sharppixelrow(cl%())
R� �
R�<  ysamp%-=1:�ysamp%=0 �sharppixelrow(xl%()):ysamp%=ymul%
R�  cl%()=xl%():�ydiv%>1 �
R�I   �Y%=2�ydiv%:ysamp%-=1:�ysamp%=0 �sharppixelrow(xl%()):ysamp%=ymul%
R�(    �addhalf%,xl%(0,0),cl%(0,0),x%:�
S  �
S �
SA cl%()=cl%()+nl%():nl%()=0:B%=x%:A%=(base%+yr%*xwords%)*size%
S 
 �yr%�1 �
S*.  I%=step%:�fs%,cl%(1,0),nl%(1,0),A%,I%,B%
S4 �
S>:  I%=-step%:A%+=x%-1:�fs%,cl%(x%,0),nl%(x%,0),A%,I%,B%
SH �
SR�
S\�
Sf�yr%=0 � y%-1
Sp șhour%,yr%*100�y%
Sz �sharpen% �
S�B  �yread% yread%-=1:�scaledpixelrow(rm%()):�range% �fit(rm%())
S�=  �B%=0�col:rm%(0,B%)=rm%(1,B%):rm%(x%+1,B%)=rm%(x%,B%):�
S�?  � sharp%,cl%(1,0),rm%(1,0),rm1%(1,0),rm2%(1,0),totalvals%
S�#  Ȕ rm2%(),rm1%():rm1%()=rm%()
S� �
S�0  �scaledpixelrow(cl%()):�range% �fit(cl%())
S� �
S�A cl%()=cl%()+nl%():nl%()=0:B%=x%:A%=(base%+yr%*xwords%)*size%
S�
 �yr%�1 �
S�.  I%=step%:�fs%,cl%(1,0),nl%(1,0),A%,I%,B%
S� �
S�:  I%=-step%:A%+=x%-1:�fs%,cl%(x%,0),nl%(x%,0),A%,I%,B%
S� �
T�
T�
T�
T$	�Save
T.=0:� Success!
T8� �Save
TB�c% �#c%:c%=0
TL�cc% �#cc%:cc%=0
TV�ccc% �#ccc%:ccc%=0
T`
Ȏ m �
TjE � -1:�spritearea%<0 �save% ș"OS_File",10,f$,&004,,ram%,ram%+sz%
Tt 
T~% �vflip% ș&2e,256+33,ram%,oname$
T�% �hflip% ș&2e,256+47,ram%,oname$
T�- �spritearea%<0 �save% ș&2e,&10c,ram%,f$
T��
T�ș"Hourglass_Off"
T��
T���defpal
T�
�C%=0�255
T�$ r%(C%)=(C%�7 � (C%�16)>>1)/15*F
T�% g%(C%)=(C%�3 � (C%�&60)>>3)/15*F
T�1 b%(C%)=(C%�3 � (C%�8)>>1 � (C%�128)>>4)/15*F
T��
T��
U
��defpal2
U
r%(0)=F:g%(0)=F:b%(0)=F
U�
U
��defpal4
U(/r%()=15,10,5,0:�C%=0�3:r%(C%)=r%(C%)/15*F:�
U2g%()=r%():b%()=r%()
U<�
UF��defpal16
UP1r%()=15,13,11,9,7,5,3,0,0,14, 0,13,14,5,15, 0
UZ1g%()=15,13,11,9,7,5,3,0,4,14,12, 0,14,8,11,10
Ud1b%()=15,13,11,9,7,5,3,0,9, 0, 0, 0,11,0, 0,15
UnG�C%=0�15:r%(C%)=r%(C%)/15*F:g%(C%)=g%(C%)/15*F:b%(C%)=b%(C%)/15*F:�
Ux�
U���ipal63
U�,�#c%=&38:� rpal%(15),gpal%(15),bpal%(15)
U��C%=0�15:D%=�#c%
U� rpal%(C%)=�#c%>>4 � 7
U� gpal%(C%)=�#c%>>4 � 3
U� bpal%(C%)=�#c%>>4 � 7
U�D%=�W:�
U�
�C%=0�255
U�* r%(C%)=(rpal%(C%�15)�(C%�16)>>1)/15*F
U�+ g%(C%)=(gpal%(C%�15)�(C%�&60)>>3)/15*F
U�+ b%(C%)=(bpal%(C%�15)�(C%�128)>>4)/15*F
U��
U��
V��ipal(D%)
V�#c%=&38
V�C%=0�D%-1:D%=�#c%
V" r%(C%)=(�#c%>>4)/15*F
V, g%(C%)=(�#c%>>4)/15*F
V6 b%(C%)=(�#c%>>4)/15*F
V@D%=�W:�
VJ�
VT� �nopal
V^3�C%=0�255:r%(C%)=C%/255*F:�:g%()=r%():b%()=r%()
Vh�
Vr� �col(A%,B%)
V|6B%=B%<<8�B%<<4�&10:pal%!(A%*8)=B%:pal%!(A%*8+4)=B%
V��
V�
� �uc(a$)
V�
�Z%,z$,b$
V�
�Z%=1��a$
V�z$=�a$,Z%,1)
V�!�z$>="a"�z$<="z" z$=�(�z$-32)
V�b$+=z$:�
V�=b$
V�� �dim(A%)
V�� B%
V��flex% �
V�5 B%=nextlocation%:A%=A%+3��3:nextlocation%+=A%+16
V�? ș"Wimp_SlotSize",-1,-1 � currentslot%,nextslot%,freeslot%
WO �nextslot%+freeslot%<A% � 42,"Cannot claim enough memory to process image"
W8 currentslot%+=A%:ș "Wimp_SlotSize",currentslot%,-1
W�
W& �workspace%<0 �
W0
  � B% A%
W: �
WDY  B%=workspace%:workspace%+=A%+3��3:�workspace%>worklimit% �42,"Not enough workspace"
WN �
WX�
Wb=B%
Wl$� read little endian 32 bit word
Wv� �W=�W1(c%)
W�2� �W1(c%)=�#c% � �#c%<<8 � �#c%<<16 � �#c%<<24
W�$� read little endian 16 bit word
W�� �HW=�#c% � �#c%<<8
W�!� read big endian 16 bit word
W�� �beHW=�#c%<<8 � �#c%
W�!� read big endian 32 bit word
W�/� �beW=�#c%<<24 � �#c%<<16 � �#c%<<8 � �#c%
W�� read a TIFF type
W�� �tiff(T%)
W�Ȏ T% �
W�
� 1:=�#c%
W�*� 2:�s$,t$:�s$+=t$:t$=��#c%:�t$=�0:=s$
W�4� 3:�bigendian �=�#c%<<8 � �#c% �=�#c% � �#c%<<8
X#� 4:�bigendian �=�beW �=�W1(c%)
X�
X� 42,"Silly TIFF tag:"+�T%
X � �TIFFnextstrip
X*TIFFread%=rowsperstrip
X4 TIFFptr+=1:�#c%=st%(TIFFptr)
X>�
XH� �iff(A%)
XR
I%=0:�
X\ C%=�#c%:�C%>127 �
XfH  �C%>128 A%?I%=�#c%:�J%=A%+I%+1�A%+I%+256-C%:?J%=A%?I%:�:I%+=257-C%
Xp �
Xz,  �J%=A%+I%�A%+I%+C%:?J%=�#c%:�:I%+=C%+1
X� �
X��I%>=rsx%-1
X��
X�0� standard size corrector for unknown images
X�� �size
X�
�scale% �
X�  � small images get enlarged
X�5 �sx%<=320 � sy%<=256 xmul%=xmul%*2:ymul%=ymul%*2
X�, � hopefully a non-square original pixel
X� �sy%<=sx%/2 ymul%=ymul%*2
X��
X��
X�� �reduce(� A%,� B%)
Y� C%,D%:C%=A%:D%=B%
Y� �C%<D% Ȕ C%,D%
Y
 C%=C%�D%
Y$	�C%=0
Y.A%=A%�D%:B%=B%�D%
Y8�
YB� �readpixelrow(z%())
YL�rows% �
YV rows%-=1:�sx%=x% �
Y`  �iprow(z%())
Yj �
Yt=  �iprow(xp%()):�xsample%,xmul%,xdiv%,z%(1,0),xp%(1,0),x%
Y~ �
Y��
Y� z%()=0
Y��
Y��
Y�� �sharppixelrow(z%())
Y��rows% �
Y� rows%-=1:�sx%=x% �
Y�?  �sharpen% �sharp(z%()) � �iprow(z%()):�range% �fit2(z%())
Y� �
Y�B  �sharpen% �sharp(xp%()) � �iprow(xp%()):�range% �fit2(xp%())
Y�/  �xsample%,xmul%,xdiv%,z%(1,0),xp%(1,0),x%
Y� �
Z�
Z
 z%()=0
Z�
Z�
Z(� �sharp(z%())
Z28yread%-=1:�yread% �iprow(rm%()):�range% �fit2(rm%())
Z<=�B%=0�col:rm%(0,B%)=rm%(1,B%):rm%(sx%+1,B%)=rm%(sx%,B%):�
ZF=� sharp%,z%(1,0),rm%(1,0),rm1%(1,0),rm2%(1,0),totalvals2%
ZP!Ȕ rm2%(),rm1%():rm1%()=rm%()
ZZ�
Zd� �scaledpixelrow(z%())
Zn
�sy%=y% �
Zx �readpixelrow(z%())
Z��
Z�: ysamp%-=1:�ysamp%=0 �readpixelrow(xl%()):ysamp%=ymul%
Z� z%()=xl%():�ydiv%>1 �
Z�  �Y%:�Y%=2�ydiv%
Z�<   ysamp%-=1:�ysamp%=0 �readpixelrow(xl%()):ysamp%=ymul%
Z�%  �addhalf%,xl%(0,0),z%(0,0),x%:�
Z� �
Z��
Z��
Z�� �fit(z%())
Z�
�equal% �
Z�% �histequal%,z%(1,0),new%(0,0),x%
Z��
[  �ranger%,z%(1,0),totalvals%
[�
[�
["� �fit2(z%())
[,
�equal% �
[6& �histequal%,z%(1,0),new%(0,0),sx%
[@�
[J! �ranger%,z%(1,0),totalvals2%
[T�
[^�
[h� �iprow(z%())
[r
Ȏ flag �
[|H� 0:ș12,4,c%,buff%,sx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
[�M� 3:ș12,4,c%,buff%,sx%+1>>1:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
[�M� 6:ș12,4,c%,buff%,sx%+3>>2:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
[�M� 9:ș12,4,c%,buff%,sx%+7>>3:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
[�0� 100:l%=�#c%+�#c%*256:ș12,4,c%,buff%,sx%*3
[� � col=2 �
[�8  �mappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
[� �
[�G  �X%=1�sx%:z%(X%,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:�
[� �
[�J� 200:ș12,4,c%,buff%,sx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
[�� 201:X%=buff%:�
[�C  �rlexpand%,casx%,capix%,J%,X%:�capix%=0 capix%=�#c%+1:J%=�#c%
[�; �X%=casx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
\<� 300:ș12,4,c%,buff%,sx%:X%=buff%+sx%:ș12,4,cc%,X%,sx%
\ � col=2 �
\2  �mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
\&I  �mappix%,z2%(1,0),rpal%(0),gpal%(0),bpal%(0),X%,sx%:z%()=z%()+z2%()
\0 �
\:w  �X%=1�sx%:z%(X%,0)=(r%(ab%?X%)+rpal%(bb%?X%))*rwt+(g%(ab%?X%)+gpal%(bb%?X%))*gwt+(b%(ab%?X%)+bpal%(bb%?X%))*bwt:�
\D �
\N� 400:X%=0:�
\XR  �rtpix%>0 �X%?rb%=rJ%:X%?gb%=gJ%:X%?bb%=bJ%:X%+=1:rtpix%-=1:�rtpix%=0�X%=sx%
\b8  �rtpix%=0 rJ%=�#c%:gJ%=�#c%:bJ%=�#c%:rtpix%=�#c%+1
\l �X%=sx%
\v � col=2 �
\�8  �mappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
\� �
\�G  �X%=1�sx%:z%(X%,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:�
\� �
\�\� 500:� LZWdecode%,table%(0,0),c%,buff%,sx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
\�C� 501:�mappix%,z%(1,0),r%(0),g%(0),b%(0),tbuff%,sx%:tbuff%+=sx%
\�J� 600:ș12,4,c%,buff%,sx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
\�� 700:ș12,4,c%,buff%,sx%*3
\� � col=2 �
\�8  �mappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
\� �
\�M  �X%=1�sx%*3�3:z%(X%�3,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:�
\� �
]1� 800:X%=buff%:�rlexpand%,wtsx%,wtpix%,wt%,X%
] � C%=�#c%:Ȏ C%>>6 �
]   � 0:?X%=C%:X%+=1:wt%=C%
] =   � 1:wt%-=1:wtpix%=C%�63:�rlexpand%,wtsx%,wtpix%,wt%,X%
]*6   � 2:wtpix%=C%�63:�rlexpand%,wtsx%,wtpix%,wt%,X%
]4=   � 3:wt%+=1:wtpix%=C%�63:�rlexpand%,wtsx%,wtpix%,wt%,X%
]>  �
]H; �X%=wtsx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
]R4� 801:X%=buff%:�rlexpand%,wtsx1%,wtpix1%,wt1%,X%
]\ � C%=�#c%:Ȏ C%>>6 �
]f   � 0:?X%=C%:X%+=1:wt1%=C%
]pB   � 1:wt1%-=1:wtpix1%=C%�63:�rlexpand%,wtsx1%,wtpix1%,wt1%,X%
]z:   � 2:wtpix1%=C%�63:�rlexpand%,wtsx1%,wtpix1%,wt1%,X%
]�B   � 3:wt1%+=1:wtpix1%=C%�63:�rlexpand%,wtsx1%,wtpix1%,wt1%,X%
]�  �
]� �X%=wtsx1%
]�& �rlexpand%,wtsx2%,wtpix2%,wt2%,X%
]� � C%=�#cc%:Ȏ C%>>6 �
]�   � 0:?X%=C%:X%+=1:wt2%=C%
]�B   � 1:wt2%-=1:wtpix2%=C%�63:�rlexpand%,wtsx2%,wtpix2%,wt2%,X%
]�:   � 2:wtpix2%=C%�63:�rlexpand%,wtsx2%,wtpix2%,wt2%,X%
]�B   � 3:wt2%+=1:wtpix2%=C%�63:�rlexpand%,wtsx2%,wtpix2%,wt2%,X%
]�  �
]� �X%=wtsx2%
]�& �rlexpand%,wtsx3%,wtpix3%,wt3%,X%
]� � C%=�#ccc%:Ȏ C%>>6 �
^   � 0:?X%=C%:X%+=1:wt3%=C%
^B   � 1:wt3%-=1:wtpix3%=C%�63:�rlexpand%,wtsx3%,wtpix3%,wt3%,X%
^:   � 2:wtpix3%=C%�63:�rlexpand%,wtsx3%,wtpix3%,wt3%,X%
^$B   � 3:wt3%+=1:wtpix3%=C%�63:�rlexpand%,wtsx3%,wtpix3%,wt3%,X%
^.  �
^8 �X%=wtsx3%
^B � col=2 �
^L8  �mappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
^V �
^`G  �X%=1�sx%:z%(X%,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:�
^j �
^tJ� 900:ș12,4,c%,buff%,sx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
^~R� 901:ș12,4,c%,buff%,sx%:ș12,4,cc%,buff%+sx%,sx%:ș12,4,ccc%,buff%+sx%*2,sx%
^� � col=2 �
^�8  �mappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
^� �
^�G  �X%=1�sx%:z%(X%,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:�
^� �
^�J� 1000:X%=buff%:�papix%>0 C%=?pa%:�rlexpand%,pasx%,papix%,C%,X%:pa%+=1
^�= �papix2%>0 C%=?pa%:�rlexpand%,pasx%,papix2%,C%,X%:pa%+=1
^� � C%=�#c%:�C%=0 �
^�I   papix%=�#c%:C%=?pa%:�rlexpand%,pasx%,papix%,C%,X%:�papix%=0 pa%+=1
^�  �
^�b   papix2%=C%�15:papix%=C%>>4:�papix%>0 C%=?pa%:�rlexpand%,pasx%,papix%,C%,X%:�papix%=0 pa%+=1
^�T   �X%<pasx% �papix2%>0 C%=?pa%:�rlexpand%,pasx%,papix2%,C%,X%:�papix2%=0 pa%+=1
_  �
_
; �X%=pasx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
_J� 1001:X%=buff%:�papix%>0 C%=?pa%:�rlexpand%,pasx%,papix%,C%,X%:pa%+=1
_I � papix%=�#c%:C%=?pa%:�rlexpand%,pasx%,papix%,C%,X%:�papix%=0 pa%+=1
_(; �X%=pasx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
_2P� 1100:ș12,4,c%,buff%,sx%+7>>3:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
_<K� 1200:ș12,4,c%,buff%,sx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
_FK� 1300:ș12,4,c%,buff%,sx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
_PU� 1301:ș12,4,c%,buff%,sx%:ș12,4,cc%,buff%+sx%,sx%:ș12,4,ccc%,buff%+sx%+sx%,sx%
_Z � col=2 �
_d8  �mappix%,z%(1,0),r%(0),g%(0),b%(0),rb%,gb%,bb%,sx%
_n �
_xG  �X%=1�sx%:z%(X%,0)=r%(rb%?X%)*rwt+g%(gb%?X%)*gwt+b%(bb%?X%)*bwt:�
_� �
_�� 1400:�vrep% �
_�  vrep%-=1
_� �
_�  �X%=1�quant%
_�.   F%=st%(X%):G%=F%+rsx%:� C%=�#c%:�C%=0 �
_�    C%=�#c%:�C%=0 �
_�     C%=�#c%:vrep%=�#c%-1
_�	    �
_�7     D%=F%:�E%=0�patlen%-1:F%?E%=�#c%:�:F%+=patlen%
_�C     �C%>1 �I%=2�C%:�E%=0�patlen%-1:F%?E%=D%?E%:�:F%+=patlen%:�
_�	    �
_�   �
`    �C%=128 �
`/     C%=�#c%:�E%=0�C%-1:F%?E%=�#c%:�:F%+=C%
`	    �
`"<     ?F%=(C%�&80)<>0:�E%=1�C%�&7F:F%?E%=?F%:�:F%+=C%�&7F
`,	    �
`6   �
`@   �F%>=G%
`J  �
`T'  �plancnv%,st%(1),quant%,buff%,sx%
`^ �
`h1 �mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
`rL� 1500:ș12,4,c%,buff%,nsx%:�mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
`|- TIFFread%-=1:�TIFFread%=0 �TIFFnextstrip
`�I� 1600:�X%=1�quant%:ș12,4,c%,st%(X%),rsx%:�:�masking% �#c%=�#c%+rsx%
`�& �plancnv%,st%(1),quant%,buff%,sx%
`�1 �mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
`�=� 1601:�X%=1�quant%:�iff(st%(X%)):�:�masking% �iff(buff%)
`�o J%=7:K%=0:�I%=0�sx%-1:E%=0:�X%=1�quant%:E%+=(K%?st%(X%)>>J%�1)<<X%:�:buff%?I%=E%>>1:J%-=1:�J%<0 J%=7:K%+=1
`� �
`�1 �mappix%,z%(1,0),r%(0),g%(0),b%(0),buff%,sx%
`��
`��
`�
� �rewind
`�rows%=sy%:Ȏ flag �
`�� 0,3,6,9:�#c%=st%
`�� 100:�#c%=0
a� 200:�#c%=&600
a� 201:�#c%=&600:capix%=0
a� 300:�#c%=st%:�#cc%=stcc%
a&� 400:�#c%=0:rtpix%=0
a0B� 500:table%()=0:�I%=0�clearcode%-1:table%(I%,1)=I%:�:�#c%=st%
a:G !firstcode=0:!oldcode=0:!codesize=setcodes%+1:!stack=stk%:!sp=stk%
aDI !maxcode=clearcode%+2:!maxcodesize=2*clearcode%:!curbit=0:!lastbit=0
aN� 501:tbuff%=otbuff%
aX� 600:�#c%=&380
ab� 700:�#c%=0:�#c%=""
al� 800:�#c%=0:wtpix%=0:wt%=0
avT� 801:�#c%=0:�#cc%=0:�#ccc%=0:wtpix1%=0:wt1%=0:wtpix2%=0:wt2%=0:wtpix3%=0:wt3%=0
a�� 900:�#c%=0
a�!� 901:�#c%=0:�#cc%=0:�#ccc%=0
a�7� 1000,1001:�#c%=st%:pa%=ctable%:papix%=0:papix2%=0
a�� 1100:�#c%=32
a�� 1200:�#c%=1600
a�� 1300:�#c%=0
a�"� 1301:�#c%=0:�#cc%=0:�#ccc%=0
a�� 1400:�#c%=st%:vrep%=0
a�7� 1500:�#c%=st%(0):TIFFread%=rowsperstrip:TIFFptr=0
a�� 1600,1601:�#c%=st%
a��
a��
�
00000000  0d 00 0a 13 f4 20 3e 20  25 2e 43 68 61 6e 67 65  |..... > %.Change|
00000010  46 53 49 0d 00 14 05 f4  0d 00 1e 4c f4 20 54 68  |FSI........L. Th|
00000020  69 73 20 70 72 6f 67 72  61 6d 20 77 72 69 74 74  |is program writt|
00000030  65 6e 20 62 79 20 52 6f  67 65 72 20 57 69 6c 73  |en by Roger Wils|
00000040  6f 6e 20 61 74 20 41 63  6f 72 6e 20 43 6f 6d 70  |on at Acorn Comp|
00000050  75 74 65 72 73 20 41 70  72 69 6c 2d 44 65 63 20  |uters April-Dec |
00000060  31 39 38 39 0d 00 28 1e  f4 20 2d 20 70 6c 65 61  |1989..(.. - plea|
00000070  73 65 20 73 65 6e 64 20  62 75 67 73 20 62 61 63  |se send bugs bac|
00000080  6b 21 0d 00 32 26 f4 20  53 75 62 6a 65 63 74 20  |k!..2&. Subject |
00000090  74 6f 20 63 68 61 6e 67  65 20 77 69 74 68 6f 75  |to change withou|
000000a0  74 20 6e 6f 74 69 63 65  0d 00 3c 05 f4 0d 00 46  |t notice..<....F|
000000b0  48 f4 20 61 6c 6c 20 69  6e 66 6f 72 6d 61 74 69  |H. all informati|
000000c0  6f 6e 20 69 73 20 68 65  6c 64 20 69 6e 20 33 32  |on is held in 32|
000000d0  20 62 69 74 20 66 69 78  65 64 20 70 6f 69 6e 74  | bit fixed point|
000000e0  20 77 69 74 68 20 74 68  65 20 2e 20 61 74 20 62  | with the . at b|
000000f0  69 74 20 32 38 0d 00 50  40 f4 20 74 68 69 73 20  |it 28..P@. this |
00000100  67 69 76 65 73 20 61 6e  20 69 6e 74 65 67 65 72  |gives an integer|
00000110  20 72 61 6e 67 65 20 6f  66 20 30 2d 31 35 20 28  | range of 0-15 (|
00000120  4f 52 20 6e 65 67 61 74  69 76 65 20 6e 75 6d 62  |OR negative numb|
00000130  65 72 73 21 29 0d 00 5a  05 f4 0d 00 64 4b f4 20  |ers!)..Z....dK. |
00000140  43 68 61 6e 67 65 46 53  49 20 69 73 20 77 72 69  |ChangeFSI is wri|
00000150  74 74 65 6e 20 73 6f 20  61 73 20 74 6f 20 61 6c  |tten so as to al|
00000160  6c 6f 77 20 75 73 65 20  66 72 6f 6d 20 43 4c 49  |low use from CLI|
00000170  20 61 6e 64 20 66 72 6f  6d 20 6f 74 68 65 72 20  | and from other |
00000180  42 41 53 49 43 0d 00 6e  26 f4 20 70 72 6f 67 72  |BASIC..n&. progr|
00000190  61 6d 73 20 73 75 63 68  20 61 73 20 57 49 4d 50  |ams such as WIMP|
000001a0  20 66 72 6f 6e 74 20 65  6e 64 73 0d 00 78 05 f4  | front ends..x..|
000001b0  0d 00 82 28 c8 99 22 4f  53 5f 47 65 74 45 6e 76  |...(.."OS_GetEnv|
000001c0  22 20 b8 20 41 24 3a f4  20 52 65 61 64 20 43 4c  |" . A$:. Read CL|
000001d0  49 20 73 74 72 69 6e 67  0d 00 8c 20 6d 65 6d 3d  |I string... mem=|
000001e0  93 3a f4 20 52 65 6d 65  6d 62 65 72 20 6d 65 6d  |.:. Remember mem|
000001f0  6f 72 79 20 73 69 7a 65  0d 00 96 24 e0 3d 26 34  |ory size...$.=&4|
00000200  30 30 30 30 30 30 3a f4  20 47 72 61 62 20 61 6c  |000000:. Grab al|
00000210  6c 20 74 68 65 20 6d 65  6d 6f 72 79 0d 00 a0 40  |l the memory...@|
00000220  66 6f 6f 25 3d 30 3a 41  25 3d a4 43 68 61 6e 67  |foo%=0:A%=.Chang|
00000230  65 46 53 49 28 41 24 2c  2d 31 2c 2d 31 2c 30 2c  |eFSI(A$,-1,-1,0,|
00000240  2d 31 2c 2d 31 2c 66 6f  6f 25 2c b9 29 3a f4 20  |-1,-1,foo%,.):. |
00000250  43 61 6c 6c 20 70 72 6f  67 72 61 6d 0d 00 aa 1a  |Call program....|
00000260  e0 3d 6d 65 6d 3a f4 20  52 65 6c 65 61 73 65 20  |.=mem:. Release |
00000270  6d 65 6d 6f 72 79 0d 00  b4 05 e0 0d 00 be 17 f4  |memory..........|
00000280  20 41 24 20 43 6f 6d 6d  61 6e 64 20 53 74 72 69  | A$ Command Stri|
00000290  6e 67 0d 00 c8 1f f4 20  73 70 72 69 74 65 61 72  |ng..... spritear|
000002a0  65 61 25 20 61 64 64 72  65 73 73 20 6f 72 20 2d  |ea% address or -|
000002b0  31 0d 00 d2 05 f4 0d 00  dc 44 f4 20 77 6f 72 6b  |1........D. work|
000002c0  73 70 61 63 65 25 3c 30  20 61 6e 64 20 77 6f 72  |space%<0 and wor|
000002d0  6b 6c 69 6d 69 74 25 3d  30 20 20 20 20 20 20 20  |klimit%=0       |
000002e0  2d 20 55 73 65 20 42 41  53 49 43 20 76 61 72 69  |- Use BASIC vari|
000002f0  61 62 6c 65 20 73 70 61  63 65 0d 00 e6 05 f4 0d  |able space......|
00000300  00 f0 45 f4 20 77 6f 72  6b 73 70 61 63 65 25 3c  |..E. workspace%<|
00000310  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00000320  20 20 20 20 20 20 20 20  20 2d 20 43 68 61 6e 67  |         - Chang|
00000330  65 46 53 49 27 73 20 73  6c 6f 74 20 68 61 6e 64  |eFSI's slot hand|
00000340  6c 69 6e 67 0d 00 fa 39  f4 20 77 6f 72 6b 6c 69  |ling...9. workli|
00000350  6d 69 74 25 3d 63 75 72  72 65 6e 74 20 65 6e 64  |mit%=current end|
00000360  20 6f 66 20 77 69 6d 70  20 73 6c 6f 74 20 20 20  | of wimp slot   |
00000370  77 69 6c 6c 20 62 65 20  75 73 65 64 2e 0d 01 04  |will be used....|
00000380  05 f4 0d 01 0e 44 f4 20  77 6f 72 6b 73 70 61 63  |.....D. workspac|
00000390  65 25 3e 3d 30 20 20 20  20 20 20 20 20 20 20 20  |e%>=0           |
000003a0  20 20 20 20 20 20 20 20  20 20 20 20 2d 20 55 73  |            - Us|
000003b0  65 20 6d 65 6d 6f 72 79  20 61 74 20 77 6f 72 6b  |e memory at work|
000003c0  73 70 61 63 65 25 0d 01  18 22 f4 20 77 6f 72 6b  |space%...". work|
000003d0  6c 69 6d 69 74 25 3d 65  6e 64 20 6f 66 20 77 6f  |limit%=end of wo|
000003e0  72 6b 73 70 61 63 65 25  0d 01 22 05 f4 0d 01 2c  |rkspace%.."....,|
000003f0  41 f4 20 73 61 76 65 25  20 20 20 54 52 55 45 20  |A. save%   TRUE |
00000400  20 3d 20 73 61 76 65 20  74 6f 20 6f 75 74 70 75  | = save to outpu|
00000410  74 20 66 69 6c 65 20 67  69 76 65 6e 20 69 6e 20  |t file given in |
00000420  63 6f 6d 6d 61 6e 64 20  73 74 72 69 6e 67 0d 01  |command string..|
00000430  36 44 f4 20 6f 75 74 70  75 74 25 20 54 52 55 45  |6D. output% TRUE|
00000440  20 20 3d 20 70 72 69 6e  74 20 6d 65 73 73 61 67  |  = print messag|
00000450  65 73 20 28 61 6e 64 20  68 69 73 74 6f 67 72 61  |es (and histogra|
00000460  6d 73 20 69 66 20 61 70  70 72 6f 70 72 69 61 74  |ms if appropriat|
00000470  65 29 0d 01 40 27 f4 20  20 20 20 20 20 20 20 20  |e)..@'.         |
00000480  20 20 20 20 20 20 20 20  64 75 72 69 6e 67 20 70  |        during p|
00000490  72 6f 63 65 73 73 69 6e  67 0d 01 4a 2a f4 20 72  |rocessing..J*. r|
000004a0  61 6d 25 20 72 65 63 65  69 76 65 73 20 61 64 64  |am% receives add|
000004b0  72 65 73 73 20 6f 66 20  73 70 72 69 74 65 20 61  |ress of sprite a|
000004c0  72 65 61 0d 01 54 35 f4  20 66 61 73 74 25 20 20  |rea..T5. fast%  |
000004d0  20 54 52 55 45 20 20 3d  20 73 77 69 74 63 68 20  | TRUE  = switch |
000004e0  74 6f 20 6d 6f 64 65 20  30 20 66 6f 72 20 70 72  |to mode 0 for pr|
000004f0  6f 63 65 73 73 69 6e 67  0d 01 5e 05 f4 0d 01 68  |ocessing..^....h|
00000500  15 f4 20 52 65 74 75 72  6e 65 64 20 76 61 6c 75  |.. Returned valu|
00000510  65 73 0d 01 72 26 f4 20  30 20 20 3d 49 6d 61 67  |es..r&. 0  =Imag|
00000520  65 20 70 72 6f 63 65 73  73 65 64 20 61 73 20 72  |e processed as r|
00000530  65 71 75 65 73 74 65 64  0d 01 7c 26 f4 20 31 20  |equested..|&. 1 |
00000540  20 3d 49 6e 66 6f 72 6d  61 74 69 6f 6e 20 6d 65  | =Information me|
00000550  73 73 61 67 65 73 20 70  72 69 6e 74 65 64 0d 01  |ssages printed..|
00000560  86 2b f4 20 31 30 30 3d  45 72 72 6f 72 20 2d 20  |.+. 100=Error - |
00000570  69 6d 61 67 65 20 6d 61  79 20 6e 6f 74 20 62 65  |image may not be|
00000580  20 63 6f 6d 70 6c 65 74  65 0d 01 90 05 f4 0d 01  | complete.......|
00000590  9a 51 dd 20 a4 43 68 61  6e 67 65 46 53 49 28 41  |.Q. .ChangeFSI(A|
000005a0  24 2c 73 70 72 69 74 65  61 72 65 61 25 2c 77 6f  |$,spritearea%,wo|
000005b0  72 6b 73 70 61 63 65 25  2c 77 6f 72 6b 6c 69 6d  |rkspace%,worklim|
000005c0  69 74 25 2c 73 61 76 65  25 2c 6f 75 74 70 75 74  |it%,save%,output|
000005d0  25 2c f8 20 72 61 6d 25  2c 66 61 73 74 25 29 0d  |%,. ram%,fast%).|
000005e0  01 a4 4c ea 20 41 24 28  29 2c 72 25 28 29 2c 67  |..L. A$(),r%(),g|
000005f0  25 28 29 2c 62 25 28 29  2c 72 70 61 6c 25 28 29  |%(),b%(),rpal%()|
00000600  2c 67 70 61 6c 25 28 29  2c 62 70 61 6c 25 28 29  |,gpal%(),bpal%()|
00000610  2c 74 61 62 6c 65 25 28  29 2c 63 6c 25 28 29 2c  |,table%(),cl%(),|
00000620  78 6c 25 28 29 2c 78 70  25 28 29 0d 01 ae 44 ea  |xl%(),xp%()...D.|
00000630  20 72 6d 25 28 29 2c 72  6d 31 25 28 29 2c 72 6d  | rm%(),rm1%(),rm|
00000640  32 25 28 29 2c 76 61 6c  73 25 28 29 2c 6e 6c 25  |2%(),vals%(),nl%|
00000650  28 29 2c 7a 32 25 28 29  2c 41 25 28 29 2c 42 25  |(),z2%(),A%(),B%|
00000660  28 29 2c 6e 65 77 25 28  29 2c 73 74 25 28 29 0d  |(),new%(),st%().|
00000670  01 b8 24 c8 95 c0 41 24  2c 31 29 3c 3e 22 20 22  |..$...A$,1)<>" "|
00000680  80 a9 41 24 3c 3e 30 20  41 24 3d c1 41 24 2c 32  |..A$<>0 A$=.A$,2|
00000690  29 3a ce 0d 01 c2 1c c8  95 c0 41 24 2c 31 29 3d  |):........A$,1)=|
000006a0  22 20 22 20 41 24 3d c1  41 24 2c 32 29 3a ce 0d  |" " A$=.A$,2):..|
000006b0  01 cc 1a c8 95 c2 41 24  2c 31 29 3d 22 20 22 20  |......A$,1)=" " |
000006c0  41 24 3d c0 41 24 29 3a  ce 0d 01 d6 1a e7 a4 75  |A$=.A$):.......u|
000006d0  63 28 c0 41 24 2c 35 29  29 3d 22 2d 51 55 49 54  |c(.A$,5))="-QUIT|
000006e0  22 20 8c 0d 01 e0 2f 20  41 24 3d c1 41 24 2c 37  |" ..../ A$=.A$,7|
000006f0  29 3a c8 95 c0 41 24 2c  31 29 3c 3e 22 20 22 80  |):...A$,1)<>" ".|
00000700  a9 41 24 3c 3e 30 20 41  24 3d c1 41 24 2c 32 29  |.A$<>0 A$=.A$,2)|
00000710  3a ce 0d 01 ea 1d 20 c8  95 c0 41 24 2c 31 29 3d  |:..... ...A$,1)=|
00000720  22 20 22 20 41 24 3d c1  41 24 2c 32 29 3a ce 0d  |" " A$=.A$,2):..|
00000730  01 f4 05 cd 0d 01 fe 20  de 20 41 24 28 31 30 30  |....... . A$(100|
00000740  29 3a 41 52 47 25 3d 30  3a 42 25 3d a7 41 24 2c  |):ARG%=0:B%=.A$,|
00000750  22 20 22 29 0d 02 08 0c  c8 95 20 42 25 3c 3e 30  |" ")...... B%<>0|
00000760  0d 02 12 2c 20 41 52 47  25 2b 3d 31 3a 41 24 28  |..., ARG%+=1:A$(|
00000770  41 52 47 25 29 3d c0 41  24 2c 42 25 2d 31 29 3a  |ARG%)=.A$,B%-1):|
00000780  41 24 3d c1 41 24 2c 42  25 2b 31 29 0d 02 1c 1e  |A$=.A$,B%+1)....|
00000790  20 c8 95 20 c0 41 24 2c  31 29 3d 22 20 22 3a 41  | .. .A$,1)=" ":A|
000007a0  24 3d c1 41 24 2c 32 29  3a ce 0d 02 26 10 20 42  |$=.A$,2):...&. B|
000007b0  25 3d a7 41 24 2c 22 20  22 29 0d 02 30 05 ce 0d  |%=.A$," ")..0...|
000007c0  02 3a 1f e7 41 24 3c 3e  22 22 20 41 52 47 25 2b  |.:..A$<>"" ARG%+|
000007d0  3d 31 3a 41 24 28 41 52  47 25 29 3d 41 24 0d 02  |=1:A$(ARG%)=A$..|
000007e0  44 19 e7 a4 75 63 28 41  24 28 31 29 29 3d 22 2d  |D...uc(A$(1))="-|
000007f0  48 45 4c 50 22 20 8c 0d  02 4e 4f f1 22 43 68 61  |HELP" ...NO."Cha|
00000800  6e 67 65 20 70 69 63 74  75 72 65 20 46 6c 6f 79  |nge picture Floy|
00000810  64 20 53 74 65 69 6e 62  65 72 67 20 49 6e 74 65  |d Steinberg Inte|
00000820  67 65 72 20 20 76 65 72  73 69 6f 6e 20 30 2e 36  |ger  version 0.6|
00000830  39 20 28 31 32 20 44 65  63 20 38 39 29 3a 20 2d  |9 (12 Dec 89): -|
00000840  68 65 6c 70 22 27 0d 02  58 54 f1 22 55 73 65 3a  |help"'..XT."Use:|
00000850  20 43 68 61 6e 67 65 46  53 49 20 3c 69 6e 20 66  | ChangeFSI <in f|
00000860  69 6c 65 3e 20 3c 6f 75  74 20 66 69 6c 65 3e 20  |ile> <out file> |
00000870  3c 6d 6f 64 65 3e 5b 63  64 74 5d 20 5b 3c 6e 3e  |<mode>[cdt] [<n>|
00000880  3a 3c 6e 3e 20 5b 3c 6e  3e 3a 3c 6e 3e 5d 5d 20  |:<n> [<n>:<n>]] |
00000890  5b 6f 70 74 69 6f 6e 73  5d 22 0d 02 62 56 f1 22  |[options]"..bV."|
000008a0  43 68 61 6e 67 65 73 20  73 6f 75 72 63 65 20 6d  |Changes source m|
000008b0  75 6c 74 69 2d 63 6f 6c  6f 75 72 20 70 69 63 74  |ulti-colour pict|
000008c0  75 72 65 20 74 6f 20 6f  75 74 70 75 74 20 73 70  |ure to output sp|
000008d0  72 69 74 65 20 31 2c 20  32 2c 20 34 20 6f 72 20  |rite 1, 2, 4 or |
000008e0  38 20 62 69 74 20 70 65  72 20 70 69 78 65 6c 22  |8 bit per pixel"|
000008f0  0d 02 6c 26 f1 22 69 6e  20 73 70 65 63 69 66 69  |..l&."in specifi|
00000900  65 64 20 6d 6f 64 65 2c  20 77 69 74 68 20 73 75  |ed mode, with su|
00000910  66 66 69 78 3a 22 0d 02  76 46 f1 22 20 20 20 63  |ffix:"..vF."   c|
00000920  20 73 75 66 66 69 78 20  66 6f 72 20 32 20 6f 72  | suffix for 2 or|
00000930  20 34 20 62 69 74 20 63  6f 6c 6f 75 72 20 69 6e  | 4 bit colour in|
00000940  20 32 20 6f 72 20 34 20  62 69 74 20 70 65 72 20  | 2 or 4 bit per |
00000950  70 69 78 65 6c 20 6d 6f  64 65 73 22 0d 02 80 3f  |pixel modes"...?|
00000960  f1 22 20 20 20 20 20 66  6f 72 20 63 6c 75 73 74  |."     for clust|
00000970  65 72 65 64 20 70 69 78  65 6c 20 6f 75 74 70 75  |ered pixel outpu|
00000980  74 20 69 6e 20 31 20 62  69 74 20 70 65 72 20 70  |t in 1 bit per p|
00000990  69 78 65 6c 20 6d 6f 64  65 73 22 0d 02 8a 36 f1  |ixel modes"...6.|
000009a0  22 20 20 20 64 20 66 6f  72 20 64 69 67 69 74 61  |"   d for digita|
000009b0  6c 20 72 67 62 20 77 69  74 68 20 34 20 62 69 74  |l rgb with 4 bit|
000009c0  20 70 65 72 20 70 69 78  65 6c 20 6d 6f 64 65 73  | per pixel modes|
000009d0  22 0d 02 94 4d f1 22 20  20 20 74 20 66 6f 72 20  |"...M."   t for |
000009e0  6e 6f 20 74 69 6e 74 20  69 6e 20 38 20 62 69 74  |no tint in 8 bit|
000009f0  20 6d 6f 64 65 73 20 61  6e 64 20 31 36 20 6c 65  | modes and 16 le|
00000a00  76 65 6c 20 67 72 65 79  20 73 63 61 6c 65 20 69  |vel grey scale i|
00000a10  6e 20 34 20 62 69 74 20  6d 6f 64 65 73 22 0d 02  |n 4 bit modes"..|
00000a20  9e 54 f1 22 54 68 65 20  70 69 78 65 6c 20 73 69  |.T."The pixel si|
00000a30  7a 65 20 69 73 20 63 6f  72 72 65 63 74 65 64 20  |ze is corrected |
00000a40  66 6f 72 20 61 6e 64 20  74 68 65 20 64 65 66 61  |for and the defa|
00000a50  75 6c 74 20 69 73 20 6f  75 74 70 75 74 20 6f 66  |ult is output of|
00000a60  20 74 68 65 20 73 61 6d  65 20 73 69 7a 65 20 61  | the same size a|
00000a70  73 22 0d 02 a8 4e f1 22  74 68 65 20 69 6e 70 75  |s"...N."the inpu|
00000a80  74 2e 20 53 69 7a 65 20  72 61 74 69 6f 73 20 61  |t. Size ratios a|
00000a90  72 65 20 6f 75 74 70 75  74 3a 69 6e 70 75 74 20  |re output:input |
00000aa0  6f 72 20 3d 20 66 6f 72  20 73 63 61 6c 65 20 74  |or = for scale t|
00000ab0  6f 20 6f 75 74 70 75 74  20 73 69 7a 65 2e 22 27  |o output size."'|
00000ac0  0d 02 b2 34 f1 22 4d 6f  64 65 20 27 61 69 6d 27  |...4."Mode 'aim'|
00000ad0  20 77 72 69 74 65 73 20  61 6e 20 61 69 6d 20 66  | writes an aim f|
00000ae0  6f 72 6d 61 74 20 6f 75  74 70 75 74 20 66 69 6c  |ormat output fil|
00000af0  65 2e 22 27 0d 02 bc 4e  f1 22 54 68 65 20 2d 65  |e."'...N."The -e|
00000b00  71 75 61 6c 20 6f 70 74  69 6f 6e 20 70 65 72 66  |qual option perf|
00000b10  6f 72 6d 73 20 68 69 73  74 6f 67 72 61 6d 20 65  |orms histogram e|
00000b20  71 75 61 6c 69 73 61 74  69 6f 6e 20 6f 6e 20 6d  |qualisation on m|
00000b30  6f 6e 6f 63 68 72 6f 6d  65 20 6f 75 74 70 75 74  |onochrome output|
00000b40  2e 22 0d 02 c6 42 f1 22  54 68 65 20 2d 68 66 6c  |."...B."The -hfl|
00000b50  69 70 20 6f 70 74 69 6f  6e 20 70 72 65 73 65 6e  |ip option presen|
00000b60  74 73 20 74 68 65 20 70  69 63 74 75 72 65 20 6c  |ts the picture l|
00000b70  65 66 74 2f 72 69 67 68  74 20 72 65 76 65 72 73  |eft/right revers|
00000b80  65 64 2e 22 0d 02 d0 3a  f1 22 54 68 65 20 2d 69  |ed."...:."The -i|
00000b90  6e 66 6f 20 6f 70 74 69  6f 6e 20 67 69 76 65 73  |nfo option gives|
00000ba0  20 64 65 74 61 69 6c 73  20 6f 66 20 74 68 65 20  | details of the |
00000bb0  73 6f 75 72 63 65 20 69  6d 61 67 65 2e 22 0d 02  |source image."..|
00000bc0  da 46 f1 22 54 68 65 20  2d 69 6e 76 65 72 74 20  |.F."The -invert |
00000bd0  6f 70 74 69 6f 6e 20 69  6e 76 65 72 74 73 20 74  |option inverts t|
00000be0  68 65 20 63 6f 6c 6f 75  72 20 72 61 6e 67 65 20  |he colour range |
00000bf0  6f 66 20 74 68 65 20 69  6e 70 75 74 20 69 6d 61  |of the input ima|
00000c00  67 65 2e 22 0d 02 e4 44  f1 22 54 68 65 20 2d 6e  |ge."...D."The -n|
00000c10  6f 73 63 61 6c 65 20 6f  70 74 69 6f 6e 20 64 69  |oscale option di|
00000c20  73 61 62 6c 65 73 20 61  75 74 6f 6d 61 74 69 63  |sables automatic|
00000c30  20 70 69 78 65 6c 20 73  69 7a 65 20 63 6f 72 72  | pixel size corr|
00000c40  65 63 74 69 6f 6e 2e 22  0d 02 ee 49 f1 22 54 68  |ection."...I."Th|
00000c50  65 20 2d 72 61 6e 67 65  20 6f 70 74 69 6f 6e 20  |e -range option |
00000c60  65 78 70 61 6e 64 73 20  74 68 65 20 69 6e 70 75  |expands the inpu|
00000c70  74 27 73 20 64 79 6e 61  6d 69 63 20 72 61 6e 67  |t's dynamic rang|
00000c80  65 20 74 6f 20 66 75 6c  6c 20 73 63 61 6c 65 2e  |e to full scale.|
00000c90  22 0d 02 f8 54 f1 22 54  68 65 20 2d 73 68 61 72  |"...T."The -shar|
00000ca0  70 65 6e 20 6f 70 74 69  6f 6e 20 64 69 67 69 74  |pen option digit|
00000cb0  61 6c 6c 79 20 73 68 61  72 70 65 6e 73 20 74 68  |ally sharpens th|
00000cc0  65 20 70 69 63 74 75 72  65 2c 20 2d 73 68 61 72  |e picture, -shar|
00000cd0  70 65 6e 3c 6e 3e 20 6f  76 65 72 72 69 64 65 73  |pen<n> overrides|
00000ce0  20 74 68 65 22 0d 03 02  32 f1 22 20 20 20 20 64  | the"...2."    d|
00000cf0  65 66 61 75 6c 74 20 6f  66 20 32 34 3a 20 72 61  |efault of 24: ra|
00000d00  6e 67 65 20 38 28 68 61  72 73 68 29 2d 33 31 28  |nge 8(harsh)-31(|
00000d10  73 6f 66 74 29 2e 22 0d  03 0c 3b f1 22 54 68 65  |soft)."...;."The|
00000d20  20 2d 76 66 6c 69 70 20  6f 70 74 69 6f 6e 20 70  | -vflip option p|
00000d30  72 65 73 65 6e 74 73 20  74 68 65 20 70 69 63 74  |resents the pict|
00000d40  75 72 65 20 75 70 20 73  69 64 65 20 64 6f 77 6e  |ure up side down|
00000d50  2e 22 0d 03 16 43 f1 22  45 78 61 6d 70 6c 65 3a  |."...C."Example:|
00000d60  20 63 68 61 6e 67 65 66  73 69 20 69 6e 70 75 74  | changefsi input|
00000d70  20 6f 75 74 70 75 74 20  32 31 74 20 31 3a 32 20  | output 21t 1:2 |
00000d80  3d 20 2d 73 68 61 72 70  65 6e 31 32 20 2d 72 61  |= -sharpen12 -ra|
00000d90  6e 67 65 22 27 0d 03 20  39 f1 22 43 68 61 6e 67  |nge"'.. 9."Chang|
00000da0  65 46 53 49 20 2d 66 6f  72 6d 61 74 73 20 67 69  |eFSI -formats gi|
00000db0  76 65 73 20 64 65 74 61  69 6c 73 20 6f 66 20 69  |ves details of i|
00000dc0  6e 70 75 74 20 66 6f 72  6d 61 74 73 2e 22 0d 03  |nput formats."..|
00000dd0  2a 06 3d 31 0d 03 34 05  cd 0d 03 3e 1c e7 a4 75  |*.=1..4....>...u|
00000de0  63 28 41 24 28 31 29 29  3d 22 2d 46 4f 52 4d 41  |c(A$(1))="-FORMA|
00000df0  54 53 22 20 8c 0d 03 48  44 f1 22 49 6e 70 75 74  |TS" ...HD."Input|
00000e00  20 66 6f 72 6d 61 74 73  20 75 6e 64 65 72 73 74  | formats underst|
00000e10  6f 6f 64 20 61 72 65 3a  20 20 20 20 20 20 20 20  |ood are:        |
00000e20  20 20 20 20 20 20 20 20  20 52 65 63 6f 67 6e 69  |         Recogni|
00000e30  73 65 64 20 62 79 3a 22  27 0d 03 52 44 f1 22 52  |sed by:"'..RD."R|
00000e40  49 53 43 20 4f 53 20 31  2c 20 32 2c 20 34 20 61  |ISC OS 1, 2, 4 a|
00000e50  6e 64 20 38 20 62 69 74  20 70 65 72 20 70 69 78  |nd 8 bit per pix|
00000e60  65 6c 20 73 70 72 69 74  65 73 20 20 20 5b 66 69  |el sprites   [fi|
00000e70  6c 65 20 74 79 70 65 20  46 46 39 5d 22 0d 03 5c  |le type FF9]"..\|
00000e80  44 f1 22 57 61 74 66 6f  72 64 20 64 69 67 69 74  |D."Watford digit|
00000e90  69 73 65 72 20 70 69 63  74 75 72 65 73 20 35 31  |iser pictures 51|
00000ea0  32 78 32 35 36 79 36 34  67 20 20 20 20 20 20 20  |2x256y64g       |
00000eb0  20 5b 66 69 6c 65 20 74  79 70 65 20 44 46 41 5d  | [file type DFA]|
00000ec0  22 0d 03 66 4d f1 22 20  20 20 61 6e 64 20 74 72  |"..fM."   and tr|
00000ed0  69 70 6c 65 20 72 65 64  2c 20 67 72 65 65 6e 2c  |iple red, green,|
00000ee0  20 62 6c 75 65 20 73 65  70 65 72 61 74 69 6f 6e  | blue seperation|
00000ef0  73 20 20 20 20 5b 64 69  72 65 63 74 6f 72 79 20  |s    [directory |
00000f00  6f 66 20 72 2c 67 2c 62  20 44 46 41 5d 22 0d 03  |of r,g,b DFA]"..|
00000f10  70 44 f1 22 50 72 6f 41  72 74 69 73 61 6e 20 63  |pD."ProArtisan c|
00000f20  6f 6d 70 72 65 73 73 65  64 20 70 69 63 74 75 72  |ompressed pictur|
00000f30  65 73 20 36 34 30 78 32  35 36 79 32 35 36 63 20  |es 640x256y256c |
00000f40  20 20 5b 66 69 6c 65 20  74 79 70 65 20 44 45 32  |  [file type DE2|
00000f50  5d 22 0d 03 7a 44 f1 22  54 69 6d 65 53 74 65 70  |]"..zD."TimeStep|
00000f60  20 73 61 74 65 6c 6c 69  74 65 20 69 6d 61 67 65  | satellite image|
00000f70  20 38 30 30 78 38 30 30  79 32 35 36 67 20 20 20  | 800x800y256g   |
00000f80  20 20 20 20 20 20 5b 66  69 6c 65 20 74 79 70 65  |      [file type|
00000f90  20 37 41 30 5d 22 0d 03  84 44 f1 22 54 69 6d 65  | 7A0]"...D."Time|
00000fa0  53 74 65 70 20 73 61 74  65 6c 6c 69 74 65 20 69  |Step satellite i|
00000fb0  6d 61 67 65 20 31 32 38  78 32 35 36 79 32 35 36  |mage 128x256y256|
00000fc0  67 20 20 20 20 20 20 20  20 20 5b 66 69 6c 65 20  |g         [file |
00000fd0  74 79 70 65 20 33 30 30  5d 22 0d 03 8e 4d f1 22  |type 300]"...M."|
00000fe0  20 20 20 61 6e 64 20 74  72 69 70 6c 65 20 72 65  |   and triple re|
00000ff0  64 2c 20 67 72 65 65 6e  2c 20 62 6c 75 65 20 73  |d, green, blue s|
00001000  65 70 65 72 61 74 69 6f  6e 73 20 20 20 20 5b 64  |eperations    [d|
00001010  69 72 65 63 74 6f 72 79  20 6f 66 20 72 2c 67 2c  |irectory of r,g,|
00001020  62 20 33 30 30 5d 22 0d  03 98 44 f1 22 41 49 4d  |b 300]"...D."AIM|
00001030  2f 57 69 6c 64 20 56 69  73 69 6f 6e 20 48 61 77  |/Wild Vision Haw|
00001040  6b 20 56 31 30 20 66 69  6c 65 73 20 32 35 36 78  |k V10 files 256x|
00001050  32 35 36 79 32 35 36 67  20 20 20 5b 66 69 6c 65  |256y256g   [file|
00001060  20 74 79 70 65 20 30 30  34 5d 22 0d 03 a2 49 f1  | type 004]"...I.|
00001070  22 54 49 46 46 20 70 69  63 74 75 72 65 73 20 20  |"TIFF pictures  |
00001080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001090  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5b  |               [|
000010a0  49 49 2a 20 6f 72 20 4d  4d 2a 20 69 6e 20 66 69  |II* or MM* in fi|
000010b0  6c 65 5d 22 0d 03 ac 43  f1 22 45 6c 65 63 74 72  |le]"...C."Electr|
000010c0  6f 6e 69 63 20 41 72 74  27 73 20 49 46 46 20 49  |onic Art's IFF I|
000010d0  4c 42 4d 20 70 69 63 74  75 72 65 73 20 20 20 20  |LBM pictures    |
000010e0  20 20 20 20 20 20 20 20  5b 49 4c 42 4d 20 69 6e  |        [ILBM in|
000010f0  20 66 69 6c 65 5d 22 0d  03 b6 48 f1 22 53 75 6e  | file]"...H."Sun|
00001100  20 31 20 62 69 74 20 70  65 72 20 70 69 78 65 6c  | 1 bit per pixel|
00001110  20 66 69 6c 65 73 20 20  20 20 20 20 20 20 20 20  | files          |
00001120  20 20 20 20 20 20 20 20  20 20 20 5b 26 39 35 36  |           [&956|
00001130  41 41 36 35 39 20 69 6e  20 66 69 6c 65 5d 22 0d  |AA659 in file]".|
00001140  03 c0 44 f1 22 2e 50 49  43 20 38 20 62 69 74 20  |..D.".PIC 8 bit |
00001150  70 65 72 20 70 69 78 65  6c 20 66 69 6c 65 73 20  |per pixel files |
00001160  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001170  20 20 20 5b 41 56 5f 56  4f 20 69 6e 20 66 69 6c  |   [AV_VO in fil|
00001180  65 5d 22 0d 03 ca 48 f1  22 4d 49 4c 4c 49 50 45  |e]"...H."MILLIPE|
00001190  44 45 20 50 52 49 53 4d  41 20 37 36 38 78 35 37  |DE PRISMA 768x57|
000011a0  36 79 20 38 20 62 69 74  20 63 6f 6c 6f 75 72 20  |6y 8 bit colour |
000011b0  69 6d 61 67 65 73 20 5b  4d 49 4c 4c 49 50 45 44  |images [MILLIPED|
000011c0  45 20 69 6e 20 66 69 6c  65 5d 22 0d 03 d4 45 f1  |E in file]"...E.|
000011d0  22 43 6f 6d 70 75 73 65  72 76 65 27 73 20 47 49  |"Compuserve's GI|
000011e0  46 20 66 69 6c 65 73 20  75 70 20 74 6f 20 38 20  |F files up to 8 |
000011f0  62 69 74 20 70 65 72 20  70 69 78 65 6c 20 20 5b  |bit per pixel  [|
00001200  47 49 46 38 37 61 20 69  6e 20 66 69 6c 65 5d 22  |GIF87a in file]"|
00001210  0d 03 de 4f f1 22 41 72  56 69 73 20 31 35 20 62  |...O."ArVis 15 b|
00001220  69 74 20 48 49 50 2e 2b  4c 4f 50 2e 20 73 70 72  |it HIP.+LOP. spr|
00001230  69 74 65 73 20 20 20 20  20 20 20 20 20 20 20 20  |ites            |
00001240  20 20 20 20 5b 66 69 6c  65 20 74 79 70 65 20 46  |    [file type F|
00001250  46 39 2c 20 48 49 50 2e  20 6e 61 6d 65 5d 22 0d  |F9, HIP. name]".|
00001260  03 e8 4f f1 22 47 45 4d  20 49 4d 47 2e 20 69 6d  |..O."GEM IMG. im|
00001270  61 67 65 73 20 20 20 20  20 20 20 20 20 20 20 20  |ages            |
00001280  20 20 20 20 5b 26 30 30  30 31 30 30 30 38 20 69  |    [&00010008 i|
00001290  6e 20 66 69 6c 65 20 6f  72 20 6e 61 6d 65 20 69  |n file or name i|
000012a0  6e 63 6c 75 64 65 73 20  69 6d 67 2e 5d 22 0d 03  |ncludes img.]"..|
000012b0  f2 49 f1 22 50 43 20 45  47 41 20 2e 44 53 50 20  |.I."PC EGA .DSP |
000012c0  69 6d 61 67 65 73 20 36  34 30 78 33 35 30 79 31  |images 640x350y1|
000012d0  36 63 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |6c              |
000012e0  20 20 5b 6e 61 6d 65 20  69 6e 63 6c 75 64 65 73  |  [name includes|
000012f0  20 64 73 70 2e 5d 22 0d  03 fc 49 f1 22 4d 54 56  | dsp.]"...I."MTV|
00001300  20 32 34 20 62 69 74 20  70 69 63 2e 20 69 6d 61  | 24 bit pic. ima|
00001310  67 65 73 20 20 20 20 20  20 20 20 20 20 20 20 20  |ges             |
00001320  20 20 20 20 20 20 20 20  20 20 20 5b 6e 61 6d 65  |           [name|
00001330  20 69 6e 63 6c 75 64 65  73 20 70 69 63 2e 5d 22  | includes pic.]"|
00001340  0d 04 06 48 f1 22 51 52  54 20 32 34 20 62 69 74  |...H."QRT 24 bit|
00001350  20 2e 72 61 77 20 69 6d  61 67 65 73 20 20 20 20  | .raw images    |
00001360  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001370  20 20 20 20 5b 6e 61 6d  65 20 65 6e 64 73 20 69  |    [name ends i|
00001380  6e 20 2e 72 61 77 5d 22  0d 04 10 4b f1 22 52 54  |n .raw]"...K."RT|
00001390  20 32 34 20 62 69 74 20  72 75 6e 20 6c 65 6e 67  | 24 bit run leng|
000013a0  74 68 20 63 6f 64 65 64  20 69 6d 61 67 65 2e 20  |th coded image. |
000013b0  66 69 6c 65 73 20 20 20  20 20 20 20 5b 6e 61 6d  |files       [nam|
000013c0  65 20 69 6e 63 6c 75 64  65 73 20 69 6d 61 67 65  |e includes image|
000013d0  2e 5d 22 0d 04 1a 06 3d  31 0d 04 24 05 cd 0d 04  |.]"....=1..$....|
000013e0  2e 29 69 6e 76 65 72 74  25 3d a3 3a 72 61 6e 67  |.)invert%=.:rang|
000013f0  65 25 3d a3 3a 73 68 61  72 70 65 6e 25 3d a3 3a  |e%=.:sharpen%=.:|
00001400  69 6e 66 6f 25 3d a3 0d  04 38 2f 68 69 73 74 25  |info%=...8/hist%|
00001410  3d a3 3a 65 71 75 61 6c  25 3d a3 3a 76 66 6c 69  |=.:equal%=.:vfli|
00001420  70 25 3d a3 3a 68 66 6c  69 70 25 3d a3 3a 73 63  |p%=.:hflip%=.:sc|
00001430  61 6c 65 25 3d b9 0d 04  42 0d e7 41 52 47 25 3c  |ale%=...B..ARG%<|
00001440  33 20 8c 0d 04 4c 4c 20  f1 22 43 68 61 6e 67 65  |3 ...LL ."Change|
00001450  46 53 49 20 69 6e 74 65  72 61 63 74 69 76 65 20  |FSI interactive |
00001460  69 6e 70 75 74 20 5b 74  72 79 20 27 43 68 61 6e  |input [try 'Chan|
00001470  67 65 46 53 49 20 2d 68  65 6c 70 27 20 66 6f 72  |geFSI -help' for|
00001480  20 63 6f 6d 6d 61 6e 64  20 6c 69 6e 65 5d 22 0d  | command line]".|
00001490  04 56 40 20 e8 22 53 6f  75 72 63 65 20 66 69 6c  |.V@ ."Source fil|
000014a0  65 3a 20 22 73 24 2c 22  44 65 73 74 69 6e 61 74  |e: "s$,"Destinat|
000014b0  69 6f 6e 20 66 69 6c 65  3a 20 22 66 24 2c 22 4f  |ion file: "f$,"O|
000014c0  75 74 70 75 74 20 6d 6f  64 65 3a 20 22 6d 24 0d  |utput mode: "m$.|
000014d0  04 60 30 20 e8 22 28 58  29 53 63 61 6c 65 20 28  |.`0 ."(X)Scale (|
000014e0  65 2e 67 2e 20 32 3a 31  29 3a 20 22 78 73 24 3a  |e.g. 2:1): "xs$:|
000014f0  e8 22 59 20 53 63 61 6c  65 3a 20 22 79 73 24 0d  |."Y Scale: "ys$.|
00001500  04 6a 39 20 e8 22 49 6e  66 6f 20 6f 6e 20 69 6e  |.j9 ."Info on in|
00001510  70 75 74 20 70 69 63 74  75 72 65 3f 22 61 24 3a  |put picture?"a$:|
00001520  e7 a4 75 63 28 c0 61 24  2c 31 29 29 3d 22 59 22  |..uc(.a$,1))="Y"|
00001530  20 69 6e 66 6f 25 3d b9  0d 04 74 3c 20 e8 22 49  | info%=...t< ."I|
00001540  6e 76 65 72 74 20 70 69  63 74 75 72 65 20 63 6f  |nvert picture co|
00001550  6c 6f 75 72 73 3f 22 61  24 3a e7 a4 75 63 28 c0  |lours?"a$:..uc(.|
00001560  61 24 2c 31 29 29 3d 22  59 22 20 69 6e 76 65 72  |a$,1))="Y" inver|
00001570  74 25 3d b9 0d 04 7e 3e  20 e8 22 43 6f 6d 70 75  |t%=...~> ."Compu|
00001580  74 65 20 68 69 73 74 6f  67 72 61 6d 20 6f 66 20  |te histogram of |
00001590  69 6e 70 75 74 3f 22 61  24 3a e7 a4 75 63 28 c0  |input?"a$:..uc(.|
000015a0  61 24 2c 31 29 29 3d 22  59 22 20 68 69 73 74 25  |a$,1))="Y" hist%|
000015b0  3d b9 0d 04 88 41 20 e8  22 41 70 70 6c 79 20 68  |=....A ."Apply h|
000015c0  69 73 74 6f 67 72 61 6d  20 65 71 75 61 6c 69 73  |istogram equalis|
000015d0  61 74 69 6f 6e 3f 22 61  24 3a e7 a4 75 63 28 c0  |ation?"a$:..uc(.|
000015e0  61 24 2c 31 29 29 3d 22  59 22 20 65 71 75 61 6c  |a$,1))="Y" equal|
000015f0  25 3d b9 0d 04 92 48 20  e8 22 45 78 70 61 6e 64  |%=....H ."Expand|
00001600  20 69 6e 70 75 74 20 64  79 6e 61 6d 69 63 20 72  | input dynamic r|
00001610  61 6e 67 65 3f 22 61 24  3a e7 a4 75 63 28 c0 61  |ange?"a$:..uc(.a|
00001620  24 2c 31 29 29 3d 22 59  22 20 72 61 6e 67 65 25  |$,1))="Y" range%|
00001630  3d b9 3a 65 71 75 61 6c  25 3d a3 0d 04 9c 3e 20  |=.:equal%=....> |
00001640  e8 22 53 68 61 72 70 65  6e 20 70 69 63 74 75 72  |."Sharpen pictur|
00001650  65 20 62 79 20 28 65 2e  67 2e 20 31 32 20 66 6f  |e by (e.g. 12 fo|
00001660  72 20 68 61 72 73 68 2c  20 32 34 20 66 6f 72 20  |r harsh, 24 for |
00001670  73 6f 66 74 29 20 22 61  24 0d 04 a6 19 20 e7 61  |soft) "a$.... .a|
00001680  24 3c 3e 22 22 20 73 68  61 72 70 65 6e 25 3d bb  |$<>"" sharpen%=.|
00001690  61 24 0d 04 b0 05 cc 0d  04 ba 0e 20 f5 20 41 25  |a$......... . A%|
000016a0  3d 41 52 47 25 0d 04 c4  38 20 20 e7 a4 75 63 28  |=ARG%...8  ..uc(|
000016b0  41 24 28 41 52 47 25 29  29 3d 22 2d 49 4e 46 4f  |A$(ARG%))="-INFO|
000016c0  22 20 69 6e 66 6f 25 3d  b9 3a 41 24 28 41 52 47  |" info%=.:A$(ARG|
000016d0  25 29 3d 22 22 3a 41 52  47 25 2d 3d 31 0d 04 ce  |%)="":ARG%-=1...|
000016e0  38 20 20 e7 a4 75 63 28  41 24 28 41 52 47 25 29  |8  ..uc(A$(ARG%)|
000016f0  29 3d 22 2d 48 49 53 54  22 20 68 69 73 74 25 3d  |)="-HIST" hist%=|
00001700  b9 3a 41 24 28 41 52 47  25 29 3d 22 22 3a 41 52  |.:A$(ARG%)="":AR|
00001710  47 25 2d 3d 31 0d 04 d8  43 20 20 e7 a4 75 63 28  |G%-=1...C  ..uc(|
00001720  41 24 28 41 52 47 25 29  29 3d 22 2d 45 51 55 41  |A$(ARG%))="-EQUA|
00001730  4c 22 20 65 71 75 61 6c  25 3d b9 3a 72 61 6e 67  |L" equal%=.:rang|
00001740  65 25 3d a3 3a 41 24 28  41 52 47 25 29 3d 22 22  |e%=.:A$(ARG%)=""|
00001750  3a 41 52 47 25 2d 3d 31  0d 04 e2 43 20 20 e7 a4  |:ARG%-=1...C  ..|
00001760  75 63 28 41 24 28 41 52  47 25 29 29 3d 22 2d 52  |uc(A$(ARG%))="-R|
00001770  41 4e 47 45 22 20 72 61  6e 67 65 25 3d b9 3a 65  |ANGE" range%=.:e|
00001780  71 75 61 6c 25 3d a3 3a  41 24 28 41 52 47 25 29  |qual%=.:A$(ARG%)|
00001790  3d 22 22 3a 41 52 47 25  2d 3d 31 0d 04 ec 3c 20  |="":ARG%-=1...< |
000017a0  20 e7 a4 75 63 28 41 24  28 41 52 47 25 29 29 3d  | ..uc(A$(ARG%))=|
000017b0  22 2d 49 4e 56 45 52 54  22 20 69 6e 76 65 72 74  |"-INVERT" invert|
000017c0  25 3d b9 3a 41 24 28 41  52 47 25 29 3d 22 22 3a  |%=.:A$(ARG%)="":|
000017d0  41 52 47 25 2d 3d 31 0d  04 f6 3c 20 20 e7 a4 75  |ARG%-=1...<  ..u|
000017e0  63 28 41 24 28 41 52 47  25 29 29 3d 22 2d 4e 4f  |c(A$(ARG%))="-NO|
000017f0  53 43 41 4c 45 22 20 73  63 61 6c 65 25 3d a3 3a  |SCALE" scale%=.:|
00001800  41 24 28 41 52 47 25 29  3d 22 22 3a 41 52 47 25  |A$(ARG%)="":ARG%|
00001810  2d 3d 31 0d 05 00 3a 20  20 e7 a4 75 63 28 41 24  |-=1...:  ..uc(A$|
00001820  28 41 52 47 25 29 29 3d  22 2d 56 46 4c 49 50 22  |(ARG%))="-VFLIP"|
00001830  20 76 66 6c 69 70 25 3d  b9 3a 41 24 28 41 52 47  | vflip%=.:A$(ARG|
00001840  25 29 3d 22 22 3a 41 52  47 25 2d 3d 31 0d 05 0a  |%)="":ARG%-=1...|
00001850  3a 20 20 e7 a4 75 63 28  41 24 28 41 52 47 25 29  |:  ..uc(A$(ARG%)|
00001860  29 3d 22 2d 48 46 4c 49  50 22 20 68 66 6c 69 70  |)="-HFLIP" hflip|
00001870  25 3d b9 3a 41 24 28 41  52 47 25 29 3d 22 22 3a  |%=.:A$(ARG%)="":|
00001880  41 52 47 25 2d 3d 31 0d  05 14 25 20 20 e7 a4 75  |ARG%-=1...%  ..u|
00001890  63 28 c0 41 24 28 41 52  47 25 29 2c 38 29 29 3d  |c(.A$(ARG%),8))=|
000018a0  22 2d 53 48 41 52 50 45  4e 22 20 8c 0d 05 1e 35  |"-SHARPEN" ....5|
000018b0  20 20 20 73 68 61 72 70  65 6e 25 3d b9 3a e7 a9  |   sharpen%=.:..|
000018c0  41 24 28 41 52 47 25 29  3e 38 20 73 68 61 72 70  |A$(ARG%)>8 sharp|
000018d0  65 6e 25 3d bb c1 41 24  28 41 52 47 25 29 2c 39  |en%=..A$(ARG%),9|
000018e0  29 0d 05 28 1a 20 20 20  41 24 28 41 52 47 25 29  |)..(.   A$(ARG%)|
000018f0  3d 22 22 3a 41 52 47 25  2d 3d 31 0d 05 32 07 20  |="":ARG%-=1..2. |
00001900  20 cd 0d 05 3c 0d 20 fd  41 25 3d 41 52 47 25 0d  | ...<. .A%=ARG%.|
00001910  05 46 33 20 73 24 3d 41  24 28 31 29 3a 66 24 3d  |.F3 s$=A$(1):f$=|
00001920  41 24 28 32 29 3a 6d 24  3d 41 24 28 33 29 3a 78  |A$(2):m$=A$(3):x|
00001930  73 24 3d 41 24 28 34 29  3a 79 73 24 3d 41 24 28  |s$=A$(4):ys$=A$(|
00001940  35 29 0d 05 50 05 cd 0d  05 5a 33 e7 6f 75 74 70  |5)..P....Z3.outp|
00001950  75 74 25 20 8b 69 6e 66  6f 25 3d a3 3a f4 20 69  |ut% .info%=.:. i|
00001960  66 20 6e 6f 20 6f 75 74  70 75 74 2c 20 74 68 65  |f no output, the|
00001970  6e 20 6e 6f 20 69 6e 66  6f 21 0d 05 64 14 e7 77  |n no info!..d..w|
00001980  6f 72 6b 73 70 61 63 65  25 3e 3d 30 20 8c 0d 05  |orkspace%>=0 ...|
00001990  6e 0c 20 66 6c 65 78 25  3d a3 0d 05 78 05 cc 0d  |n. flex%=...x...|
000019a0  05 82 3f 20 e7 77 6f 72  6b 6c 69 6d 69 74 25 3d  |..? .worklimit%=|
000019b0  30 20 8c 20 66 6c 65 78  25 3d a3 20 8b 20 66 6c  |0 . flex%=. . fl|
000019c0  65 78 25 3d b9 3a 6e 65  78 74 6c 6f 63 61 74 69  |ex%=.:nextlocati|
000019d0  6f 6e 25 3d 77 6f 72 6b  6c 69 6d 69 74 25 0d 05  |on%=worklimit%..|
000019e0  8c 05 cd 0d 05 96 10 c8  8e 20 a4 75 63 28 6d 24  |......... .uc(m$|
000019f0  29 20 ca 0d 05 a0 16 20  c9 22 41 49 4d 22 3a 6d  |) ..... ."AIM":m|
00001a00  3d 2d 31 3a 6d 24 3d 22  22 0d 05 aa 2f 20 7f 3a  |=-1:m$="".../ .:|
00001a10  6d 3d bb 6d 24 3a 6d 24  3d a4 75 63 28 c2 6d 24  |m=.m$:m$=.uc(.m$|
00001a20  2c 31 29 29 3a e7 a7 22  43 44 54 22 2c 6d 24 29  |,1)):.."CDT",m$)|
00001a30  3d 30 20 6d 24 3d 22 22  0d 05 b4 05 cb 0d 05 be  |=0 m$=""........|
00001a40  1b e7 78 73 24 3d 22 22  20 84 20 c0 78 73 24 2c  |..xs$="" . .xs$,|
00001a50  31 29 3d 22 2d 22 20 8c  0d 05 c8 24 20 78 6d 75  |1)="-" ....$ xmu|
00001a60  6c 25 3d 31 3a 78 64 69  76 25 3d 31 3a 79 6d 75  |l%=1:xdiv%=1:ymu|
00001a70  6c 25 3d 31 3a 79 64 69  76 25 3d 31 0d 05 d2 05  |l%=1:ydiv%=1....|
00001a80  cc 0d 05 dc 14 20 e7 79  73 24 3d 22 22 20 79 73  |..... .ys$="" ys|
00001a90  24 3d 78 73 24 0d 05 e6  28 20 78 6d 75 6c 25 3d  |$=xs$...( xmul%=|
00001aa0  bb 78 73 24 3a 78 64 69  76 25 3d bb c1 78 73 24  |.xs$:xdiv%=..xs$|
00001ab0  2c a7 78 73 24 2c 22 3a  22 29 2b 31 29 0d 05 f0  |,.xs$,":")+1)...|
00001ac0  28 20 79 6d 75 6c 25 3d  bb 79 73 24 3a 79 64 69  |( ymul%=.ys$:ydi|
00001ad0  76 25 3d bb c1 79 73 24  2c a7 79 73 24 2c 22 3a  |v%=..ys$,.ys$,":|
00001ae0  22 29 2b 31 29 0d 05 fa  05 cd 0d 06 04 26 66 6c  |")+1)........&fl|
00001af0  61 67 3d 2d 31 3a c8 99  38 2c 35 2c 73 24 20 b8  |ag=-1:..8,5,s$ .|
00001b00  20 72 30 2c 2c 72 32 3a  64 69 72 3d 72 30 3d 32  | r0,,r2:dir=r0=2|
00001b10  0d 06 0e 0a e7 64 69 72  20 8c 0d 06 18 44 20 70  |.....dir ....D p|
00001b20  61 6e 69 63 3d b9 3a c8  99 38 2c 35 2c 73 24 2b  |anic=.:..8,5,s$+|
00001b30  22 2e 72 61 77 22 20 b8  20 72 30 2c 2c 72 32 3a  |".raw" . r0,,r2:|
00001b40  e7 72 30 3d 31 20 73 24  2b 3d 22 2e 72 61 77 22  |.r0=1 s$+=".raw"|
00001b50  3a 64 69 72 3d a3 3a 70  61 6e 69 63 3d a3 0d 06  |:dir=.:panic=...|
00001b60  22 32 20 e7 70 61 6e 69  63 20 c8 99 38 2c 35 2c  |"2 .panic ..8,5,|
00001b70  73 24 2b 22 2e 72 65 64  22 20 b8 20 72 30 2c 2c  |s$+".red" . r0,,|
00001b80  72 32 3a e7 72 30 3d 31  20 70 61 6e 69 63 3d a3  |r2:.r0=1 panic=.|
00001b90  0d 06 2c 22 20 e7 70 61  6e 69 63 20 85 20 34 32  |..," .panic . 42|
00001ba0  2c 22 44 69 72 65 63 74  6f 72 79 20 67 69 76 65  |,"Directory give|
00001bb0  6e 22 0d 06 36 05 cd 0d  06 40 39 66 74 79 70 65  |n"..6....@9ftype|
00001bc0  3d 72 32 3e 3e 38 20 80  20 26 46 46 46 3a 62 69  |=r2>>8 . &FFF:bi|
00001bd0  74 73 3d 32 38 3a 46 3d  32 5e 62 69 74 73 3a 63  |ts=28:F=2^bits:c|
00001be0  25 3d 30 3a 63 63 25 3d  30 3a 63 63 63 25 3d 30  |%=0:cc%=0:ccc%=0|
00001bf0  0d 06 4a 0a e7 64 69 72  20 8c 0d 06 54 3f 20 63  |..J..dir ...T? c|
00001c00  25 3d 8e 28 73 24 2b 22  2e 72 65 64 22 29 3a e7  |%=.(s$+".red"):.|
00001c10  63 25 3d 30 20 85 20 34  32 2c 22 52 65 64 20 66  |c%=0 . 42,"Red f|
00001c20  69 6c 65 20 22 2b 73 24  2b 22 2e 72 65 64 20 6e  |ile "+s$+".red n|
00001c30  6f 74 20 66 6f 75 6e 64  22 0d 06 5e 46 20 63 63  |ot found"..^F cc|
00001c40  25 3d 8e 28 73 24 2b 22  2e 67 72 65 65 6e 22 29  |%=.(s$+".green")|
00001c50  3a e7 63 63 25 3d 30 20  85 34 32 2c 22 47 72 65  |:.cc%=0 .42,"Gre|
00001c60  65 6e 20 66 69 6c 65 20  22 2b 73 24 2b 22 2e 67  |en file "+s$+".g|
00001c70  72 65 65 6e 20 6e 6f 74  20 66 6f 75 6e 64 22 0d  |reen not found".|
00001c80  06 68 45 20 63 63 63 25  3d 8e 28 73 24 2b 22 2e  |.hE ccc%=.(s$+".|
00001c90  62 6c 75 65 22 29 3a e7  63 63 63 25 3d 30 20 85  |blue"):.ccc%=0 .|
00001ca0  34 32 2c 22 42 6c 75 65  20 66 69 6c 65 20 22 2b  |42,"Blue file "+|
00001cb0  73 24 2b 22 2e 62 6c 75  65 20 6e 6f 74 20 66 6f  |s$+".blue not fo|
00001cc0  75 6e 64 22 0d 06 72 05  cc 0d 06 7c 2e 20 63 25  |und"..r....|. c%|
00001cd0  3d 8e 73 24 3a e7 63 25  3d 30 20 85 20 34 32 2c  |=.s$:.c%=0 . 42,|
00001ce0  22 46 69 6c 65 20 22 2b  73 24 2b 22 20 6e 6f 74  |"File "+s$+" not|
00001cf0  20 66 6f 75 6e 64 22 0d  06 86 05 cd 0d 06 90 3a  | found"........:|
00001d00  72 77 74 3d 2e 33 30 3a  67 77 74 3d 2e 35 39 3a  |rwt=.30:gwt=.59:|
00001d10  62 77 74 3d 2e 31 31 3a  f4 20 43 49 45 20 59 20  |bwt=.11:. CIE Y |
00001d20  77 65 69 67 68 74 69 6e  67 73 20 66 6f 72 20 52  |weightings for R|
00001d30  2c 20 47 2c 20 42 0d 06  9a 25 de 20 72 25 28 32  |, G, B...%. r%(2|
00001d40  35 35 29 3a f4 20 6d 6f  6e 6f 63 68 72 6f 6d 65  |55):. monochrome|
00001d50  20 63 6f 6c 6f 75 72 20  6d 61 70 0d 06 a4 41 de  | colour map...A.|
00001d60  20 67 25 28 32 35 35 29  2c 62 25 28 32 35 35 29  | g%(255),b%(255)|
00001d70  3a f4 20 63 6f 6c 6f 75  72 20 6d 61 70 73 3a 20  |:. colour maps: |
00001d80  69 6e 20 30 2d 32 35 35  20 6f 75 74 20 30 2d 31  |in 0-255 out 0-1|
00001d90  20 66 69 78 65 64 20 70  6f 69 6e 74 0d 06 ae 0e  | fixed point....|
00001da0  c8 8e 20 66 74 79 70 65  20 ca 0d 06 b8 11 c9 20  |.. ftype ...... |
00001db0  26 46 46 39 3a 66 6c 61  67 3d 30 0d 06 c2 2f 20  |&FF9:flag=0.../ |
00001dc0  e7 a7 22 2e 22 2b a4 75  63 28 73 24 29 2c 22 2e  |.."."+.uc(s$),".|
00001dd0  48 49 50 2e 22 29 84 a7  a4 75 63 28 73 24 29 2c  |HIP.")...uc(s$),|
00001de0  22 3a 48 49 50 2e 22 29  20 8c 0d 06 cc 22 20 20  |":HIP.") ...."  |
00001df0  66 6c 61 67 3d 33 30 30  3a 49 25 3d a7 a4 75 63  |flag=300:I%=..uc|
00001e00  28 73 24 29 2c 22 48 49  50 2e 22 29 0d 06 d6 41  |(s$),"HIP.")...A|
00001e10  20 20 c1 73 24 2c 49 25  29 3d 22 4c 4f 50 2e 22  |  .s$,I%)="LOP."|
00001e20  3a 63 63 25 3d 8e 73 24  3a e7 63 63 25 3d 30 20  |:cc%=.s$:.cc%=0 |
00001e30  85 34 32 2c 22 43 61 6e  27 74 20 66 69 6e 64 20  |.42,"Can't find |
00001e40  4c 6f 70 20 66 69 6c 65  20 22 2b 73 24 0d 06 e0  |Lop file "+s$...|
00001e50  06 20 cd 0d 06 ea 21 c9  20 26 44 46 41 3a 66 6c  |. ....!. &DFA:fl|
00001e60  61 67 3d 38 30 30 3a e7  64 69 72 20 66 6c 61 67  |ag=800:.dir flag|
00001e70  3d 38 30 31 0d 06 f4 14  c9 20 26 44 45 32 3a 66  |=801..... &DE2:f|
00001e80  6c 61 67 3d 31 30 30 30  0d 06 fe 14 c9 20 26 37  |lag=1000..... &7|
00001e90  41 30 3a 66 6c 61 67 3d  31 32 30 30 0d 07 08 23  |A0:flag=1200...#|
00001ea0  c9 20 26 33 30 30 3a 66  6c 61 67 3d 31 33 30 30  |. &300:flag=1300|
00001eb0  3a e7 64 69 72 20 66 6c  61 67 3d 31 33 30 31 0d  |:.dir flag=1301.|
00001ec0  07 12 1e c9 20 34 3a 66  6c 61 67 3d 39 30 30 3a  |.... 4:flag=900:|
00001ed0  e7 64 69 72 20 66 6c 61  67 3d 39 30 31 0d 07 1c  |.dir flag=901...|
00001ee0  05 7f 0d 07 26 25 20 cf  23 63 25 3d 30 3a 53 24  |....&% .#c%=0:S$|
00001ef0  3d 22 22 3a e3 49 25 3d  31 b8 36 3a 53 24 2b 3d  |="":.I%=1.6:S$+=|
00001f00  bd 9a 23 63 25 3a ed 0d  07 30 1a 20 e7 53 24 3d  |..#c%:...0. .S$=|
00001f10  22 47 49 46 38 37 61 22  20 66 6c 61 67 3d 35 30  |"GIF87a" flag=50|
00001f20  30 0d 07 3a 26 20 e7 66  6c 61 67 3d 2d 31 20 e7  |0..:& .flag=-1 .|
00001f30  c0 53 24 2c 35 29 3d 22  41 56 5f 56 4f 22 20 66  |.S$,5)="AV_VO" f|
00001f40  6c 61 67 3d 36 30 30 0d  07 44 33 20 e7 66 6c 61  |lag=600..D3 .fla|
00001f50  67 3d 2d 31 20 e7 c0 53  24 2c 34 29 3d bd 26 35  |g=-1 ..S$,4)=.&5|
00001f60  39 2b bd 26 41 36 2b bd  26 36 41 2b bd 26 39 35  |9+.&A6+.&6A+.&95|
00001f70  20 66 6c 61 67 3d 31 31  30 30 0d 07 4e 2b 20 e7  | flag=1100..N+ .|
00001f80  66 6c 61 67 3d 2d 31 20  e7 c0 53 24 2c 34 29 3d  |flag=-1 ..S$,4)=|
00001f90  bd 30 2b bd 31 2b bd 30  2b bd 38 20 66 6c 61 67  |.0+.1+.0+.8 flag|
00001fa0  3d 31 34 30 30 0d 07 58  34 20 e7 66 6c 61 67 3d  |=1400..X4 .flag=|
00001fb0  2d 31 20 e7 c0 53 24 2c  34 29 3d 22 49 49 2a 22  |-1 ..S$,4)="II*"|
00001fc0  2b bd 30 20 66 6c 61 67  3d 31 35 30 30 3a 62 69  |+.0 flag=1500:bi|
00001fd0  67 65 6e 64 69 61 6e 3d  a3 0d 07 62 37 20 e7 66  |gendian=...b7 .f|
00001fe0  6c 61 67 3d 2d 31 20 e7  c0 53 24 2c 34 29 3d 22  |lag=-1 ..S$,4)="|
00001ff0  4d 4d 22 2b bd 30 2b 22  2a 22 20 66 6c 61 67 3d  |MM"+.0+"*" flag=|
00002000  31 35 30 30 3a 62 69 67  65 6e 64 69 61 6e 3d b9  |1500:bigendian=.|
00002010  0d 07 6c 26 20 e7 66 6c  61 67 3d 2d 31 20 e7 c0  |..l& .flag=-1 ..|
00002020  53 24 2c 34 29 3d 22 52  49 58 33 22 20 66 6c 61  |S$,4)="RIX3" fla|
00002030  67 3d 32 30 30 30 0d 07  76 1e 20 e7 66 6c 61 67  |g=2000..v. .flag|
00002040  3d 2d 31 20 e7 c0 53 24  2c 34 29 3d 22 46 4f 52  |=-1 ..S$,4)="FOR|
00002050  4d 22 20 8c 0d 07 80 27  20 20 cf 23 63 25 3d 38  |M" ....'  .#c%=8|
00002060  3a 53 24 3d bd 9a 23 63  25 2b bd 9a 23 63 25 2b  |:S$=..#c%+..#c%+|
00002070  bd 9a 23 63 25 2b bd 9a  23 63 25 0d 07 8a 1a 20  |..#c%+..#c%.... |
00002080  20 e7 53 24 3d 22 49 4c  42 4d 22 20 66 6c 61 67  | .S$="ILBM" flag|
00002090  3d 31 36 30 30 0d 07 94  06 20 cd 0d 07 9e 0f 20  |=1600.... ..... |
000020a0  e7 66 6c 61 67 3d 2d 31  20 8c 0d 07 a8 28 20 20  |.flag=-1 ....(  |
000020b0  cf 23 63 25 3d 26 31 30  3a 53 24 3d 22 22 3a e3  |.#c%=&10:S$="":.|
000020c0  49 25 3d 31 b8 39 3a 53  24 2b 3d bd 9a 23 63 25  |I%=1.9:S$+=..#c%|
000020d0  3a ed 0d 07 b2 1e 20 20  e7 53 24 3d 22 4d 49 4c  |:.....  .S$="MIL|
000020e0  4c 49 50 45 44 45 22 20  66 6c 61 67 3d 32 30 30  |LIPEDE" flag=200|
000020f0  0d 07 bc 06 20 cd 0d 07  c6 43 20 e7 66 6c 61 67  |.... ....C .flag|
00002100  3d 2d 31 20 e7 a7 22 2e  22 2b a4 75 63 28 73 24  |=-1 .."."+.uc(s$|
00002110  29 2c 22 2e 49 4d 41 47  45 2e 22 29 84 a7 a4 75  |),".IMAGE.")...u|
00002120  63 28 73 24 29 2c 22 3a  49 4d 41 47 45 2e 22 29  |c(s$),":IMAGE.")|
00002130  20 66 6c 61 67 3d 34 30  30 0d 07 d0 2a 20 e7 66  | flag=400...* .f|
00002140  6c 61 67 3d 2d 31 20 e7  a4 75 63 28 c2 73 24 2c  |lag=-1 ..uc(.s$,|
00002150  34 29 29 3d 22 2e 52 41  57 22 20 66 6c 61 67 3d  |4))=".RAW" flag=|
00002160  31 30 30 0d 07 da 3f 20  e7 66 6c 61 67 3d 2d 31  |100...? .flag=-1|
00002170  20 e7 a7 22 2e 22 2b a4  75 63 28 73 24 29 2c 22  | .."."+.uc(s$),"|
00002180  2e 50 49 43 2e 22 29 84  a7 a4 75 63 28 73 24 29  |.PIC.")...uc(s$)|
00002190  2c 22 3a 50 49 43 2e 22  29 20 66 6c 61 67 3d 37  |,":PIC.") flag=7|
000021a0  30 30 0d 07 e4 40 20 e7  66 6c 61 67 3d 2d 31 20  |00...@ .flag=-1 |
000021b0  e7 a7 22 2e 22 2b a4 75  63 28 73 24 29 2c 22 2e  |.."."+.uc(s$),".|
000021c0  49 4d 47 2e 22 29 84 a7  a4 75 63 28 73 24 29 2c  |IMG.")...uc(s$),|
000021d0  22 3a 49 4d 47 2e 22 29  20 66 6c 61 67 3d 31 34  |":IMG.") flag=14|
000021e0  30 30 0d 07 ee 40 20 e7  66 6c 61 67 3d 2d 31 20  |00...@ .flag=-1 |
000021f0  e7 a7 22 2e 22 2b a4 75  63 28 73 24 29 2c 22 2e  |.."."+.uc(s$),".|
00002200  44 53 50 2e 22 29 84 a7  a4 75 63 28 73 24 29 2c  |DSP.")...uc(s$),|
00002210  22 3a 44 53 50 2e 22 29  20 66 6c 61 67 3d 31 37  |":DSP.") flag=17|
00002220  30 30 0d 07 f8 05 cb 0d  08 02 5c e7 66 6c 61 67  |00........\.flag|
00002230  3d 2d 31 3a 85 20 34 32  2c 22 53 6f 72 72 79 3a  |=-1:. 42,"Sorry:|
00002240  20 66 6f 72 6d 61 74 20  6e 6f 74 20 72 65 63 6f  | format not reco|
00002250  67 6e 69 73 65 64 20 2d  20 70 6c 65 61 73 65 20  |gnised - please |
00002260  74 72 79 20 61 67 61 69  6e 20 6f 72 20 63 6f 6e  |try again or con|
00002270  74 61 63 74 20 79 6f 75  72 20 73 75 70 70 6c 69  |tact your suppli|
00002280  65 72 22 0d 08 0c 13 e7  66 61 73 74 25 20 e7 eb  |er".....fast% ..|
00002290  3c 3e 30 20 eb 30 0d 08  16 42 69 6e 70 75 74 3d  |<>0 .0...Binput=|
000022a0  38 3a 68 61 6d 3d 30 3a  70 6c 61 6e 61 72 3d 30  |8:ham=0:planar=0|
000022b0  3a 62 69 67 65 6e 64 69  61 6e 62 69 74 73 3d a3  |:bigendianbits=.|
000022c0  3a 63 6f 6d 70 72 65 73  73 69 6f 6e 3d 30 3a c8  |:compression=0:.|
000022d0  8e 20 66 6c 61 67 20 ca  0d 08 20 20 c9 20 30 3a  |. flag ...  . 0:|
000022e0  f4 20 41 72 63 68 69 6d  65 64 65 73 20 53 70 72  |. Archimedes Spr|
000022f0  69 74 65 20 66 69 6c 65  0d 08 2a 47 20 71 75 61  |ite file..*G qua|
00002300  6e 74 25 3d 34 3a cf 23  63 25 3d 26 32 63 3a 73  |nt%=4:.#c%=&2c:s|
00002310  74 25 3d a4 57 2b 28 26  33 38 2d 26 32 63 29 3a  |t%=.W+(&38-&2c):|
00002320  cf 23 63 25 3d 26 33 34  3a 73 6d 3d a4 57 3a c8  |.#c%=&34:sm=.W:.|
00002330  99 35 33 2c 73 6d 2c 33  20 b8 20 2c 2c 49 25 0d  |.53,sm,3 . ,,I%.|
00002340  08 34 0c 20 c8 8e 20 49  25 20 ca 0d 08 3e 2c 20  |.4. .. I% ...>, |
00002350  c9 20 31 3a 66 6c 61 67  3d 39 3a e7 73 74 25 3d  |. 1:flag=9:.st%=|
00002360  26 33 38 20 f2 64 65 66  70 61 6c 32 20 8b 20 f2  |&38 .defpal2 . .|
00002370  69 70 61 6c 28 32 29 0d  08 48 37 20 20 cf 23 63  |ipal(2)..H7  .#c|
00002380  25 3d 26 31 63 3a 73 78  25 3d 28 a4 57 2b 31 29  |%=&1c:sx%=(.W+1)|
00002390  2a 33 32 3a 62 75 66 66  25 3d a4 64 69 6d 28 73  |*32:buff%=.dim(s|
000023a0  78 25 3e 3e 33 29 3a 69  6e 70 75 74 3d 31 0d 08  |x%>>3):input=1..|
000023b0  52 2c 20 c9 20 33 3a 66  6c 61 67 3d 36 3a e7 73  |R, . 3:flag=6:.s|
000023c0  74 25 3d 26 33 38 20 f2  64 65 66 70 61 6c 34 20  |t%=&38 .defpal4 |
000023d0  8b 20 f2 69 70 61 6c 28  34 29 0d 08 5c 37 20 20  |. .ipal(4)..\7  |
000023e0  cf 23 63 25 3d 26 31 63  3a 73 78 25 3d 28 a4 57  |.#c%=&1c:sx%=(.W|
000023f0  2b 31 29 2a 31 36 3a 62  75 66 66 25 3d a4 64 69  |+1)*16:buff%=.di|
00002400  6d 28 73 78 25 3e 3e 32  29 3a 69 6e 70 75 74 3d  |m(sx%>>2):input=|
00002410  32 0d 08 66 2f 20 c9 20  31 35 3a 66 6c 61 67 3d  |2..f/ . 15:flag=|
00002420  33 3a e7 73 74 25 3d 26  33 38 20 f2 64 65 66 70  |3:.st%=&38 .defp|
00002430  61 6c 31 36 20 8b 20 f2  69 70 61 6c 28 31 36 29  |al16 . .ipal(16)|
00002440  0d 08 70 36 20 20 cf 23  63 25 3d 26 31 63 3a 73  |..p6  .#c%=&1c:s|
00002450  78 25 3d 28 a4 57 2b 31  29 2a 38 3a 62 75 66 66  |x%=(.W+1)*8:buff|
00002460  25 3d a4 64 69 6d 28 73  78 25 3e 3e 31 29 3a 69  |%=.dim(sx%>>1):i|
00002470  6e 70 75 74 3d 34 0d 08  7a 24 20 c9 20 36 33 3a  |nput=4..z$ . 63:|
00002480  e7 73 74 25 3d 26 33 38  20 f2 64 65 66 70 61 6c  |.st%=&38 .defpal|
00002490  20 8b 20 f2 69 70 61 6c  36 33 0d 08 84 2b 20 20  | . .ipal63...+  |
000024a0  cf 23 63 25 3d 26 31 63  3a 73 78 25 3d 28 a4 57  |.#c%=&1c:sx%=(.W|
000024b0  2b 31 29 2a 34 3a 62 75  66 66 25 3d a4 64 69 6d  |+1)*4:buff%=.dim|
000024c0  28 73 78 25 29 0d 08 8e  2a 20 7f 20 85 34 32 2c  |(sx%)...* . .42,|
000024d0  22 4e 6f 74 20 75 6e 64  65 72 73 74 6f 6f 64 20  |"Not understood |
000024e0  52 49 53 43 20 4f 53 20  73 70 72 69 74 65 22 0d  |RISC OS sprite".|
000024f0  08 98 06 20 cb 0d 08 a2  16 20 73 79 25 3d a4 57  |... ..... sy%=.W|
00002500  2b 31 3a cf 23 63 25 3d  73 74 25 0d 08 ac 38 20  |+1:.#c%=st%...8 |
00002510  c8 99 35 33 2c 73 6d 2c  34 20 b8 20 2c 2c 6e 78  |..53,sm,4 . ,,nx|
00002520  3a c8 99 35 33 2c 73 6d  2c 35 20 b8 20 2c 2c 6e  |:..53,sm,5 . ,,n|
00002530  79 3a 6e 78 3d 31 3c 3c  6e 78 3a 6e 79 3d 31 3c  |y:nx=1<<nx:ny=1<|
00002540  3c 6e 79 0d 08 b6 2e 20  e7 73 63 61 6c 65 25 20  |<ny.... .scale% |
00002550  78 6d 75 6c 25 3d 78 6d  75 6c 25 2a 6e 78 2f 32  |xmul%=xmul%*nx/2|
00002560  3a 79 6d 75 6c 25 3d 79  6d 75 6c 25 2a 6e 79 2f  |:ymul%=ymul%*ny/|
00002570  32 0d 08 c0 60 20 69 6e  66 6f 24 3d 22 52 49 53  |2...` info$="RIS|
00002580  43 20 4f 53 20 73 70 72  69 74 65 2c 20 6d 6f 64  |C OS sprite, mod|
00002590  65 20 22 2b c3 73 6d 2b  22 20 22 2b c3 73 78 25  |e "+.sm+" "+.sx%|
000025a0  2b 22 20 62 79 20 22 2b  c3 73 79 25 2b 22 20 70  |+" by "+.sy%+" p|
000025b0  69 78 65 6c 73 2c 20 22  2b c3 69 6e 70 75 74 2b  |ixels, "+.input+|
000025c0  22 20 62 69 74 73 20 70  65 72 20 70 69 78 65 6c  |" bits per pixel|
000025d0  22 0d 08 ca 1c c9 20 31  30 30 3a f4 20 51 52 54  |"..... 100:. QRT|
000025e0  20 22 2e 72 61 77 22 20  69 6d 61 67 65 0d 08 d4  | ".raw" image...|
000025f0  3d 20 71 75 61 6e 74 25  3d 38 3a cf 23 63 25 3d  |= quant%=8:.#c%=|
00002600  30 3a 73 78 25 3d a4 48  57 3a 73 79 25 3d a4 48  |0:sx%=.HW:sy%=.H|
00002610  57 3a f2 6e 6f 70 61 6c  3a 69 6e 70 75 74 3d 32  |W:.nopal:input=2|
00002620  34 3a 73 74 65 70 32 34  3d 31 0d 08 de 44 20 62  |4:step24=1...D b|
00002630  75 66 66 25 3d a4 64 69  6d 28 73 78 25 2a 33 29  |uff%=.dim(sx%*3)|
00002640  3a 72 62 25 3d 62 75 66  66 25 3a 67 62 25 3d 62  |:rb%=buff%:gb%=b|
00002650  75 66 66 25 2b 73 78 25  3a 62 62 25 3d 62 75 66  |uff%+sx%:bb%=buf|
00002660  66 25 2b 32 2a 73 78 25  3a f2 73 69 7a 65 0d 08  |f%+2*sx%:.size..|
00002670  e8 4b 20 69 6e 66 6f 24  3d 22 51 52 54 20 2e 72  |.K info$="QRT .r|
00002680  61 77 20 69 6d 61 67 65  2c 20 22 2b c3 73 78 25  |aw image, "+.sx%|
00002690  2b 22 20 62 79 20 22 2b  c3 73 79 25 2b 22 20 70  |+" by "+.sy%+" p|
000026a0  69 78 65 6c 73 2c 20 32  34 20 62 69 74 73 20 70  |ixels, 24 bits p|
000026b0  65 72 20 70 69 78 65 6c  22 0d 08 f2 19 c9 20 32  |er pixel"..... 2|
000026c0  30 30 3a f4 20 43 61 64  53 6f 66 74 20 49 6d 61  |00:. CadSoft Ima|
000026d0  67 65 0d 08 fc 4e 20 71  75 61 6e 74 25 3d 38 3a  |ge...N quant%=8:|
000026e0  cf 23 63 25 3d 39 3a 73  78 25 3d 28 a4 48 57 2b  |.#c%=9:sx%=(.HW+|
000026f0  32 29 2f 32 3a 73 79 25  3d 28 a4 48 57 2b 32 29  |2)/2:sy%=(.HW+2)|
00002700  2f 32 3a f4 20 72 6f 75  6e 64 20 61 6e 64 20 63  |/2:. round and c|
00002710  6f 6e 76 65 72 74 20 74  6f 20 70 69 78 65 6c 73  |onvert to pixels|
00002720  0d 09 06 29 20 cf 23 63  25 3d 26 31 61 3a 63 61  |...) .#c%=&1a:ca|
00002730  64 73 6f 66 74 74 79 70  65 25 3d 9a 23 63 25 3a  |dsofttype%=.#c%:|
00002740  cf 23 63 25 3d 26 32 30  30 0d 09 10 22 20 e3 43  |.#c%=&200..." .C|
00002750  25 3d 30 b8 32 35 35 3a  72 25 28 43 25 29 3d 9a  |%=0.255:r%(C%)=.|
00002760  23 63 25 2f 32 35 35 2a  46 3a ed 0d 09 1a 22 20  |#c%/255*F:...." |
00002770  e3 43 25 3d 30 b8 32 35  35 3a 67 25 28 43 25 29  |.C%=0.255:g%(C%)|
00002780  3d 9a 23 63 25 2f 32 35  35 2a 46 3a ed 0d 09 24  |=.#c%/255*F:...$|
00002790  22 20 e3 43 25 3d 30 b8  32 35 35 3a 62 25 28 43  |" .C%=0.255:b%(C|
000027a0  25 29 3d 9a 23 63 25 2f  32 35 35 2a 46 3a ed 0d  |%)=.#c%/255*F:..|
000027b0  09 2e 30 20 cf 23 63 25  3d 26 36 30 30 3a e7 63  |..0 .#c%=&600:.c|
000027c0  61 64 73 6f 66 74 74 79  70 65 25 3d 32 20 63 61  |adsofttype%=2 ca|
000027d0  70 69 78 25 3d 30 3a 66  6c 61 67 3d 32 30 31 0d  |pix%=0:flag=201.|
000027e0  09 38 2a 20 62 75 66 66  25 3d a4 64 69 6d 28 73  |.8* buff%=.dim(s|
000027f0  78 25 29 3a 63 61 73 78  25 3d 62 75 66 66 25 2b  |x%):casx%=buff%+|
00002800  73 78 25 3a f2 73 69 7a  65 0d 09 42 60 20 69 6e  |sx%:.size..B` in|
00002810  66 6f 24 3d 22 43 61 64  73 6f 66 74 20 74 79 70  |fo$="Cadsoft typ|
00002820  65 20 22 2b c3 63 61 64  73 6f 66 74 74 79 70 65  |e "+.cadsofttype|
00002830  25 2b 22 20 69 6d 61 67  65 2c 20 22 2b c3 73 78  |%+" image, "+.sx|
00002840  25 2b 22 20 62 79 20 22  2b c3 73 79 25 2b 22 20  |%+" by "+.sy%+" |
00002850  70 69 78 65 6c 73 2c 20  38 20 62 69 74 73 20 70  |pixels, 8 bits p|
00002860  65 72 20 70 69 78 65 6c  22 0d 09 4c 17 c9 20 33  |er pixel"..L.. 3|
00002870  30 30 3a f4 20 41 72 76  69 73 20 56 69 64 65 6f  |00:. Arvis Video|
00002880  0d 09 56 4a 20 71 75 61  6e 74 25 3d 35 3a cf 23  |..VJ quant%=5:.#|
00002890  63 25 3d 26 32 63 3a 73  74 25 3d a4 57 2b 28 26  |c%=&2c:st%=.W+(&|
000028a0  33 38 2d 26 32 63 29 3a  cf 23 63 63 25 3d 26 32  |38-&2c):.#cc%=&2|
000028b0  63 3a 73 74 63 63 25 3d  a4 57 31 28 63 63 25 29  |c:stcc%=.W1(cc%)|
000028c0  2b 28 26 33 38 2d 26 32  63 29 0d 09 60 38 20 cf  |+(&38-&2c)..`8 .|
000028d0  23 63 25 3d 26 31 63 3a  73 78 25 3d 28 a4 57 2b  |#c%=&1c:sx%=(.W+|
000028e0  31 29 2a 34 3a 73 79 25  3d a4 57 2b 31 3a cf 23  |1)*4:sy%=.W+1:.#|
000028f0  63 25 3d 73 74 25 3a cf  23 63 63 25 3d 73 74 63  |c%=st%:.#cc%=stc|
00002900  63 25 0d 09 6a 27 20 de  20 72 70 61 6c 25 28 32  |c%..j' . rpal%(2|
00002910  35 35 29 2c 67 70 61 6c  25 28 32 35 35 29 2c 62  |55),gpal%(255),b|
00002920  70 61 6c 25 28 32 35 35  29 0d 09 74 0e 20 e3 43  |pal%(255)..t. .C|
00002930  25 3d 30 b8 32 35 35 0d  09 7e 1b 20 20 72 70 61  |%=0.255..~.  rpa|
00002940  6c 25 28 43 25 29 3d 28  43 25 80 37 29 2f 33 31  |l%(C%)=(C%.7)/31|
00002950  2a 46 0d 09 88 21 20 20  67 70 61 6c 25 28 43 25  |*F...!  gpal%(C%|
00002960  29 3d 28 28 43 25 80 36  34 29 3e 3e 36 29 2f 33  |)=((C%.64)>>6)/3|
00002970  31 2a 46 0d 09 92 1e 20  20 62 70 61 6c 25 28 43  |1*F....  bpal%(C|
00002980  25 29 3d 28 43 25 3e 3e  33 80 37 29 2f 33 31 2a  |%)=(C%>>3.7)/31*|
00002990  46 0d 09 9c 25 20 20 72  25 28 43 25 29 3d 28 43  |F...%  r%(C%)=(C|
000029a0  25 80 31 36 20 84 20 28  43 25 80 34 29 3c 3c 31  |%.16 . (C%.4)<<1|
000029b0  29 2f 33 31 2a 46 0d 09  a6 2b 20 20 67 25 28 43  |)/31*F...+  g%(C|
000029c0  25 29 3d 28 28 43 25 80  26 36 30 29 3e 3e 32 20  |%)=((C%.&60)>>2 |
000029d0  84 20 28 43 25 80 33 29  3c 3c 31 29 2f 33 31 2a  |. (C%.3)<<1)/31*|
000029e0  46 0d 09 b0 26 20 20 62  25 28 43 25 29 3d 28 28  |F...&  b%(C%)=((|
000029f0  43 25 80 31 32 38 29 3e  3e 33 20 84 20 43 25 80  |C%.128)>>3 . C%.|
00002a00  38 29 2f 33 31 2a 46 0d  09 ba 06 20 ed 0d 09 c4  |8)/31*F.... ....|
00002a10  48 20 62 75 66 66 25 3d  a4 64 69 6d 28 73 78 25  |H buff%=.dim(sx%|
00002a20  2a 32 29 3a 61 62 25 3d  62 75 66 66 25 2d 31 3a  |*2):ab%=buff%-1:|
00002a30  62 62 25 3d 62 75 66 66  25 2b 73 78 25 2d 31 3a  |bb%=buff%+sx%-1:|
00002a40  e7 73 63 61 6c 65 25 20  79 6d 75 6c 25 3d 79 6d  |.scale% ymul%=ym|
00002a50  75 6c 25 2a 32 0d 09 ce  48 20 69 6e 66 6f 24 3d  |ul%*2...H info$=|
00002a60  22 41 72 56 69 73 20 69  6d 61 67 65 2c 20 22 2b  |"ArVis image, "+|
00002a70  c3 73 78 25 2b 22 20 62  79 20 22 2b c3 73 79 25  |.sx%+" by "+.sy%|
00002a80  2b 22 20 70 69 78 65 6c  73 2c 20 31 35 20 62 69  |+" pixels, 15 bi|
00002a90  74 73 20 70 65 72 20 70  69 78 65 6c 22 0d 09 d8  |ts per pixel"...|
00002aa0  17 c9 20 34 30 30 3a f4  20 52 54 20 22 69 6d 61  |.. 400:. RT "ima|
00002ab0  67 65 2e 22 0d 09 e2 3e  20 71 75 61 6e 74 25 3d  |ge."...> quant%=|
00002ac0  38 3a cf 23 63 25 3d 30  3a 73 78 25 3d a4 62 65  |8:.#c%=0:sx%=.be|
00002ad0  48 57 3a 73 79 25 3d a4  62 65 48 57 3a 58 25 3d  |HW:sy%=.beHW:X%=|
00002ae0  a4 62 65 48 57 3a cf 23  63 25 3d 8f 23 63 25 2b  |.beHW:.#c%=.#c%+|
00002af0  58 25 0d 09 ec 3e 20 62  75 66 66 25 3d a4 64 69  |X%...> buff%=.di|
00002b00  6d 28 73 78 25 2a 33 29  3a 72 62 25 3d 62 75 66  |m(sx%*3):rb%=buf|
00002b10  66 25 3a 67 62 25 3d 62  75 66 66 25 2b 73 78 25  |f%:gb%=buff%+sx%|
00002b20  3a 62 62 25 3d 62 75 66  66 25 2b 32 2a 73 78 25  |:bb%=buff%+2*sx%|
00002b30  0d 09 f6 2c 20 f2 6e 6f  70 61 6c 3a 69 6e 70 75  |..., .nopal:inpu|
00002b40  74 3d 32 34 3a 73 74 65  70 32 34 3d 31 3a 72 74  |t=24:step24=1:rt|
00002b50  70 69 78 25 3d 30 3a f2  73 69 7a 65 0d 0a 00 5f  |pix%=0:.size..._|
00002b60  20 69 6e 66 6f 24 3d 22  52 54 20 69 6d 61 67 65  | info$="RT image|
00002b70  2e 20 72 75 6e 20 6c 65  6e 67 74 68 20 65 6e 63  |. run length enc|
00002b80  6f 64 65 64 20 69 6d 61  67 65 2c 20 22 2b c3 73  |oded image, "+.s|
00002b90  78 25 2b 22 20 62 79 20  22 2b c3 73 79 25 2b 22  |x%+" by "+.sy%+"|
00002ba0  20 70 69 78 65 6c 73 2c  20 32 34 20 62 69 74 73  | pixels, 24 bits|
00002bb0  20 70 65 72 20 70 69 78  65 6c 22 0d 0a 0a 14 c9  | per pixel".....|
00002bc0  20 35 30 30 3a f4 20 47  49 46 20 66 69 6c 65 0d  | 500:. GIF file.|
00002bd0  0a 14 2f 20 63 6f 6d 70  72 65 73 73 69 6f 6e 3d  |../ compression=|
00002be0  35 3a cf 23 63 25 3d 36  3a 73 78 25 3d a4 48 57  |5:.#c%=6:sx%=.HW|
00002bf0  3a 73 79 25 3d a4 48 57  3a f2 73 69 7a 65 0d 0a  |:sy%=.HW:.size..|
00002c00  1e 39 20 47 49 46 3d 9a  23 63 25 3a 47 49 46 62  |.9 GIF=.#c%:GIFb|
00002c10  61 63 6b 3d 9a 23 63 25  3a 47 49 46 65 78 74 3d  |ack=.#c%:GIFext=|
00002c20  9a 23 63 25 3a 71 75 61  6e 74 25 3d 28 47 49 46  |.#c%:quant%=(GIF|
00002c30  20 80 20 37 29 2b 31 0d  0a 28 11 20 e7 47 49 46  | . 7)+1..(. .GIF|
00002c40  20 80 20 26 38 30 20 8c  0d 0a 32 19 20 20 e3 43  | . &80 ...2.  .C|
00002c50  25 3d 30 b8 28 31 3c 3c  71 75 61 6e 74 25 29 2d  |%=0.(1<<quant%)-|
00002c60  31 0d 0a 3c 3c 20 20 20  72 25 28 43 25 29 3d 9a  |1..<<   r%(C%)=.|
00002c70  23 63 25 2f 32 35 35 2a  46 3a 67 25 28 43 25 29  |#c%/255*F:g%(C%)|
00002c80  3d 9a 23 63 25 2f 32 35  35 2a 46 3a 62 25 28 43  |=.#c%/255*F:b%(C|
00002c90  25 29 3d 9a 23 63 25 2f  32 35 35 2a 46 0d 0a 46  |%)=.#c%/255*F..F|
00002ca0  07 20 20 ed 0d 0a 50 06  20 cd 0d 0a 5a 3f 20 49  |.  ...P. ...Z? I|
00002cb0  25 3d 9a 23 63 25 3a e7  49 25 3c 3e 97 22 2c 22  |%=.#c%:.I%<>.","|
00002cc0  20 85 20 34 32 2c 22 47  49 46 20 66 69 6c 65 20  | . 42,"GIF file |
00002cd0  77 69 74 68 6f 75 74 20  2c 20 69 6e 20 72 69 67  |without , in rig|
00002ce0  68 74 20 70 6c 61 63 65  22 0d 0a 64 31 20 47 49  |ht place"..d1 GI|
00002cf0  46 6c 65 66 74 3d a4 48  57 3a 47 49 46 72 69 67  |Fleft=.HW:GIFrig|
00002d00  68 74 3d a4 48 57 3a 47  49 46 73 78 3d a4 48 57  |ht=.HW:GIFsx=.HW|
00002d10  3a 47 49 46 73 79 3d a4  48 57 0d 0a 6e 44 20 e7  |:GIFsy=.HW..nD .|
00002d20  47 49 46 73 78 3e 73 78  25 20 84 20 47 49 46 73  |GIFsx>sx% . GIFs|
00002d30  79 3e 73 79 25 20 85 20  34 32 2c 22 47 49 46 20  |y>sy% . 42,"GIF |
00002d40  66 69 6c 65 20 77 69 74  68 20 62 69 67 67 65 72  |file with bigger|
00002d50  20 69 6d 61 67 65 20 69  6e 73 69 64 65 22 0d 0a  | image inside"..|
00002d60  78 21 20 47 49 46 3d 9a  23 63 25 3a e7 47 49 46  |x! GIF=.#c%:.GIF|
00002d70  20 80 20 26 34 30 20 66  6c 61 67 3d 35 30 31 0d  | . &40 flag=501.|
00002d80  0a 82 34 20 73 65 74 63  6f 64 65 73 25 3d 9a 23  |..4 setcodes%=.#|
00002d90  63 25 3a 63 6c 65 61 72  63 6f 64 65 25 3d 31 3c  |c%:clearcode%=1<|
00002da0  3c 73 65 74 63 6f 64 65  73 25 3a 73 74 25 3d 8f  |<setcodes%:st%=.|
00002db0  23 63 25 0d 0a 8c 46 20  de 20 74 61 62 6c 65 25  |#c%...F . table%|
00002dc0  28 31 3c 3c 31 32 2c 31  29 3a 73 74 6b 25 3d a4  |(1<<12,1):stk%=.|
00002dd0  64 69 6d 28 31 3c 3c 31  33 29 3a 62 75 66 25 3d  |dim(1<<13):buf%=|
00002de0  a4 64 69 6d 28 32 38 30  29 3a 62 75 66 66 25 3d  |.dim(280):buff%=|
00002df0  a4 64 69 6d 28 73 78 25  29 0d 0a 96 34 20 74 61  |.dim(sx%)...4 ta|
00002e00  62 6c 65 25 28 29 3d 30  3a e3 49 25 3d 30 b8 63  |ble%()=0:.I%=0.c|
00002e10  6c 65 61 72 63 6f 64 65  25 2d 31 3a 74 61 62 6c  |learcode%-1:tabl|
00002e20  65 25 28 49 25 2c 31 29  3d 49 25 3a ed 0d 0a a0  |e%(I%,1)=I%:....|
00002e30  4e 20 69 6e 66 6f 24 3d  22 47 49 46 20 66 69 6c  |N info$="GIF fil|
00002e40  65 2c 20 22 2b c3 73 78  25 2b 22 20 62 79 20 22  |e, "+.sx%+" by "|
00002e50  2b c3 73 79 25 2b 22 20  70 69 78 65 6c 73 2c 20  |+.sy%+" pixels, |
00002e60  22 2b c3 71 75 61 6e 74  25 2b 22 20 62 69 74 73  |"+.quant%+" bits|
00002e70  20 70 65 72 20 70 69 78  65 6c 22 0d 0a aa 1d c9  | per pixel".....|
00002e80  20 36 30 30 3a f4 20 66  75 6e 6e 79 20 41 56 5f  | 600:. funny AV_|
00002e90  56 4f 20 73 74 75 66 66  0d 0a b4 20 20 71 75 61  |VO stuff...  qua|
00002ea0  6e 74 25 3d 38 3a cf 23  63 25 3d 26 35 63 3a e3  |nt%=8:.#c%=&5c:.|
00002eb0  43 25 3d 30 b8 32 35 35  0d 0a be 3b 20 20 72 25  |C%=0.255...;  r%|
00002ec0  28 43 25 29 3d 9a 23 63  25 2f 32 35 35 2a 46 3a  |(C%)=.#c%/255*F:|
00002ed0  67 25 28 43 25 29 3d 9a  23 63 25 2f 32 35 35 2a  |g%(C%)=.#c%/255*|
00002ee0  46 3a 62 25 28 43 25 29  3d 9a 23 63 25 2f 32 35  |F:b%(C%)=.#c%/25|
00002ef0  35 2a 46 0d 0a c8 06 20  ed 0d 0a d2 24 20 cf 23  |5*F.... ....$ .#|
00002f00  63 25 3d 26 33 36 65 3a  73 79 25 3d a4 48 57 3a  |c%=&36e:sy%=.HW:|
00002f10  73 78 25 3d a4 48 57 3a  f2 73 69 7a 65 0d 0a dc  |sx%=.HW:.size...|
00002f20  1e 20 cf 23 63 25 3d 26  33 38 30 3a 62 75 66 66  |. .#c%=&380:buff|
00002f30  25 3d a4 64 69 6d 28 73  78 25 29 0d 0a e6 46 20  |%=.dim(sx%)...F |
00002f40  69 6e 66 6f 24 3d 22 2e  50 49 43 20 69 6d 61 67  |info$=".PIC imag|
00002f50  65 2c 20 22 2b c3 73 78  25 2b 22 20 62 79 20 22  |e, "+.sx%+" by "|
00002f60  2b c3 73 79 25 2b 22 20  70 69 78 65 6c 73 2c 20  |+.sy%+" pixels, |
00002f70  38 20 62 69 74 73 20 70  65 72 20 70 69 78 65 6c  |8 bits per pixel|
00002f80  22 0d 0a f0 1c c9 20 37  30 30 3a f4 20 4d 54 56  |"..... 700:. MTV|
00002f90  20 22 2e 70 69 63 22 20  69 6d 61 67 65 0d 0a fa  | ".pic" image...|
00002fa0  39 20 71 75 61 6e 74 25  3d 38 3a cf 23 63 25 3d  |9 quant%=8:.#c%=|
00002fb0  30 3a 61 24 3d be 23 63  25 3a 73 78 25 3d bb 61  |0:a$=.#c%:sx%=.a|
00002fc0  24 3a 73 79 25 3d bb 28  c1 61 24 2c a7 61 24 2c  |$:sy%=.(.a$,.a$,|
00002fd0  22 20 22 29 29 29 0d 0b  04 23 20 f2 73 69 7a 65  |" ")))...# .size|
00002fe0  3a f2 6e 6f 70 61 6c 3a  69 6e 70 75 74 3d 32 34  |:.nopal:input=24|
00002ff0  3a 73 74 65 70 32 34 3d  33 0d 0b 0e 38 20 62 75  |:step24=3...8 bu|
00003000  66 66 25 3d a4 64 69 6d  28 73 78 25 2a 33 29 3a  |ff%=.dim(sx%*3):|
00003010  72 62 25 3d 62 75 66 66  25 3a 67 62 25 3d 62 75  |rb%=buff%:gb%=bu|
00003020  66 66 25 2b 31 3a 62 62  25 3d 62 75 66 66 25 2b  |ff%+1:bb%=buff%+|
00003030  32 0d 0b 18 4b 20 69 6e  66 6f 24 3d 22 4d 54 56  |2...K info$="MTV|
00003040  20 2e 70 69 63 20 69 6d  61 67 65 2c 20 22 2b c3  | .pic image, "+.|
00003050  73 78 25 2b 22 20 62 79  20 22 2b c3 73 79 25 2b  |sx%+" by "+.sy%+|
00003060  22 20 70 69 78 65 6c 73  2c 20 32 34 20 62 69 74  |" pixels, 24 bit|
00003070  73 20 70 65 72 20 70 69  78 65 6c 22 0d 0b 22 1b  |s per pixel"..".|
00003080  c9 20 38 30 30 3a f4 20  57 61 74 66 6f 72 64 20  |. 800:. Watford |
00003090  70 69 63 74 75 72 65 0d  0b 2c 2a 20 73 78 25 3d  |picture..,* sx%=|
000030a0  35 31 32 3a 73 79 25 3d  32 35 36 3a e7 73 63 61  |512:sy%=256:.sca|
000030b0  6c 65 25 20 79 6d 75 6c  25 3d 79 6d 75 6c 25 2a  |le% ymul%=ymul%*|
000030c0  32 0d 0b 36 33 20 62 75  66 66 25 3d a4 64 69 6d  |2..63 buff%=.dim|
000030d0  28 73 78 25 29 3a 77 74  70 69 78 25 3d 30 3a 77  |(sx%):wtpix%=0:w|
000030e0  74 25 3d 30 3a 77 74 73  78 25 3d 62 75 66 66 25  |t%=0:wtsx%=buff%|
000030f0  2b 73 78 25 0d 0b 40 41  20 e3 43 25 3d 30 b8 32  |+sx%..@A .C%=0.2|
00003100  35 35 3a 72 25 28 43 25  29 3d 28 43 25 80 36 33  |55:r%(C%)=(C%.63|
00003110  29 2f 36 33 2a 46 3a ed  3a 67 25 28 29 3d 72 25  |)/63*F:.:g%()=r%|
00003120  28 29 3a 62 25 28 29 3d  72 25 28 29 3a 71 75 61  |():b%()=r%():qua|
00003130  6e 74 25 3d 36 0d 0b 4a  4b 20 69 6e 66 6f 24 3d  |nt%=6..JK info$=|
00003140  22 57 61 74 66 6f 72 64  20 64 69 67 69 74 69 73  |"Watford digitis|
00003150  65 72 20 70 69 63 74 75  72 65 2c 20 35 31 32 20  |er picture, 512 |
00003160  62 79 20 32 35 36 20 70  69 78 65 6c 73 2c 20 36  |by 256 pixels, 6|
00003170  20 62 69 74 73 20 70 65  72 20 70 69 78 65 6c 22  | bits per pixel"|
00003180  0d 0b 54 22 c9 20 38 30  31 3a f4 20 54 72 69 70  |..T". 801:. Trip|
00003190  6c 65 20 57 61 74 66 6f  72 64 20 70 69 63 74 75  |le Watford pictu|
000031a0  72 65 0d 0b 5e 45 20 73  78 25 3d 35 31 32 3a 73  |re..^E sx%=512:s|
000031b0  79 25 3d 32 35 36 3a 69  6e 70 75 74 3d 32 34 3a  |y%=256:input=24:|
000031c0  73 74 65 70 32 34 3d 31  3a 71 75 61 6e 74 25 3d  |step24=1:quant%=|
000031d0  36 3a e7 73 63 61 6c 65  25 20 79 6d 75 6c 25 3d  |6:.scale% ymul%=|
000031e0  79 6d 75 6c 25 2a 32 0d  0b 68 37 20 77 74 70 69  |ymul%*2..h7 wtpi|
000031f0  78 31 25 3d 30 3a 77 74  31 25 3d 30 3a 77 74 70  |x1%=0:wt1%=0:wtp|
00003200  69 78 32 25 3d 30 3a 77  74 32 25 3d 30 3a 77 74  |ix2%=0:wt2%=0:wt|
00003210  70 69 78 33 25 3d 30 3a  77 74 33 25 3d 30 0d 0b  |pix3%=0:wt3%=0..|
00003220  72 3e 20 62 75 66 66 25  3d a4 64 69 6d 28 73 78  |r> buff%=.dim(sx|
00003230  25 2a 33 29 3a 72 62 25  3d 62 75 66 66 25 3a 67  |%*3):rb%=buff%:g|
00003240  62 25 3d 62 75 66 66 25  2b 73 78 25 3a 62 62 25  |b%=buff%+sx%:bb%|
00003250  3d 62 75 66 66 25 2b 32  2a 73 78 25 0d 0b 7c 3b  |=buff%+2*sx%..|;|
00003260  20 77 74 73 78 31 25 3d  62 75 66 66 25 2b 73 78  | wtsx1%=buff%+sx|
00003270  25 3a 77 74 73 78 32 25  3d 62 75 66 66 25 2b 32  |%:wtsx2%=buff%+2|
00003280  2a 73 78 25 3a 77 74 73  78 33 25 3d 62 75 66 66  |*sx%:wtsx3%=buff|
00003290  25 2b 33 2a 73 78 25 0d  0b 86 38 20 e3 43 25 3d  |%+3*sx%...8 .C%=|
000032a0  30 b8 32 35 35 3a 72 25  28 43 25 29 3d 28 43 25  |0.255:r%(C%)=(C%|
000032b0  80 36 33 29 2f 36 33 2a  46 3a ed 3a 67 25 28 29  |.63)/63*F:.:g%()|
000032c0  3d 72 25 28 29 3a 62 25  28 29 3d 72 25 28 29 0d  |=r%():b%()=r%().|
000032d0  0b 90 53 20 69 6e 66 6f  24 3d 22 54 72 69 70 6c  |..S info$="Tripl|
000032e0  65 20 57 61 74 66 6f 72  64 20 64 69 67 69 74 69  |e Watford digiti|
000032f0  73 65 72 20 70 69 63 74  75 72 65 2c 20 35 31 32  |ser picture, 512|
00003300  20 62 79 20 32 35 36 20  70 69 78 65 6c 73 2c 20  | by 256 pixels, |
00003310  31 38 20 62 69 74 73 20  70 65 72 20 70 69 78 65  |18 bits per pixe|
00003320  6c 22 0d 0b 9a 1b c9 20  39 30 30 3a f4 20 41 49  |l"..... 900:. AI|
00003330  4d 2f 57 69 6c 64 20 56  69 73 69 6f 6e 0d 0b a4  |M/Wild Vision...|
00003340  51 20 71 75 61 6e 74 25  3d 38 3a 73 78 25 3d 32  |Q quant%=8:sx%=2|
00003350  35 36 3a 73 79 25 3d 32  35 36 3a 62 75 66 66 25  |56:sy%=256:buff%|
00003360  3d a4 64 69 6d 28 73 78  25 29 3a e7 73 63 61 6c  |=.dim(sx%):.scal|
00003370  65 25 20 79 6d 75 6c 25  3d 79 6d 75 6c 25 2a 32  |e% ymul%=ymul%*2|
00003380  3a 78 6d 75 6c 25 3d 78  6d 75 6c 25 2a 32 0d 0b  |:xmul%=xmul%*2..|
00003390  ae 34 20 e3 43 25 3d 30  b8 32 35 35 3a 72 25 28  |.4 .C%=0.255:r%(|
000033a0  43 25 29 3d 43 25 2f 32  35 35 2a 46 3a ed 3a 67  |C%)=C%/255*F:.:g|
000033b0  25 28 29 3d 72 25 28 29  3a 62 25 28 29 3d 72 25  |%()=r%():b%()=r%|
000033c0  28 29 0d 0b b8 40 20 69  6e 66 6f 24 3d 22 41 49  |()...@ info$="AI|
000033d0  4d 20 2e 72 61 77 20 69  6d 61 67 65 2c 20 32 35  |M .raw image, 25|
000033e0  36 20 62 79 20 32 35 36  20 70 69 78 65 6c 73 2c  |6 by 256 pixels,|
000033f0  20 38 20 62 69 74 73 20  70 65 72 20 70 69 78 65  | 8 bits per pixe|
00003400  6c 22 0d 0b c2 45 c9 20  39 30 31 3a f4 20 41 49  |l"...E. 901:. AI|
00003410  4d 2f 57 69 6c 64 20 56  69 73 69 6f 6e 3a 20 54  |M/Wild Vision: T|
00003420  65 6d 70 6f 72 61 72 79  20 77 68 69 6c 65 20 56  |emporary while V|
00003430  39 20 67 65 74 73 20 69  74 73 20 61 63 74 20 74  |9 gets its act t|
00003440  6f 67 65 74 68 65 72 0d  0b cc 41 20 71 75 61 6e  |ogether...A quan|
00003450  74 25 3d 34 3a 73 78 25  3d 32 35 36 3a 73 79 25  |t%=4:sx%=256:sy%|
00003460  3d 32 35 36 3a e7 73 63  61 6c 65 25 20 79 6d 75  |=256:.scale% ymu|
00003470  6c 25 3d 79 6d 75 6c 25  2a 32 3a 78 6d 75 6c 25  |l%=ymul%*2:xmul%|
00003480  3d 78 6d 75 6c 25 2a 32  0d 0b d6 3e 20 62 75 66  |=xmul%*2...> buf|
00003490  66 25 3d a4 64 69 6d 28  73 78 25 2a 33 29 3a 72  |f%=.dim(sx%*3):r|
000034a0  62 25 3d 62 75 66 66 25  3a 67 62 25 3d 62 75 66  |b%=buff%:gb%=buf|
000034b0  66 25 2b 73 78 25 3a 62  62 25 3d 62 75 66 66 25  |f%+sx%:bb%=buff%|
000034c0  2b 73 78 25 2a 32 0d 0b  e0 3a 20 e3 43 25 3d 30  |+sx%*2...: .C%=0|
000034d0  b8 32 35 35 3a 72 25 28  43 25 29 3d 28 43 25 80  |.255:r%(C%)=(C%.|
000034e0  26 46 30 29 2f 26 46 30  2a 46 3a ed 3a 67 25 28  |&F0)/&F0*F:.:g%(|
000034f0  29 3d 72 25 28 29 3a 62  25 28 29 3d 72 25 28 29  |)=r%():b%()=r%()|
00003500  0d 0b ea 16 20 69 6e 70  75 74 3d 32 34 3a 73 74  |.... input=24:st|
00003510  65 70 32 34 3d 31 0d 0b  f4 47 20 69 6e 66 6f 24  |ep24=1...G info$|
00003520  3d 22 48 61 77 6b 20 56  39 20 54 72 69 70 6c 65  |="Hawk V9 Triple|
00003530  20 69 6d 61 67 65 2c 20  32 35 36 20 62 79 20 32  | image, 256 by 2|
00003540  35 36 20 70 69 78 65 6c  73 2c 20 31 32 20 62 69  |56 pixels, 12 bi|
00003550  74 73 20 70 65 72 20 70  69 78 65 6c 22 0d 0b fe  |ts per pixel"...|
00003560  17 c9 20 31 30 30 30 3a  f4 20 50 72 6f 41 72 74  |.. 1000:. ProArt|
00003570  69 73 61 6e 0d 0c 08 4b  20 71 75 61 6e 74 25 3d  |isan...K quant%=|
00003580  34 3a 73 78 25 3d 36 34  30 3a 73 79 25 3d 32 35  |4:sx%=640:sy%=25|
00003590  36 3a f2 64 65 66 70 61  6c 3a 73 74 25 3d a4 57  |6:.defpal:st%=.W|
000035a0  3a 66 6c 61 67 2b 3d a4  57 3a e7 73 63 61 6c 65  |:flag+=.W:.scale|
000035b0  25 20 79 6d 75 6c 25 3d  79 6d 75 6c 25 2a 32 0d  |% ymul%=ymul%*2.|
000035c0  0c 12 38 20 f4 20 72 65  61 64 20 63 6f 6d 70 72  |..8 . read compr|
000035d0  65 73 73 69 6f 6e 20 74  79 70 65 20 61 6e 64 20  |ession type and |
000035e0  61 64 64 20 74 6f 20 66  6c 61 67 2e 20 30 2f 31  |add to flag. 0/1|
000035f0  20 6b 6e 6f 77 6e 21 0d  0c 1c 26 20 62 75 66 66  | known!...& buff|
00003600  25 3d a4 64 69 6d 28 73  78 25 29 3a 63 74 61 62  |%=.dim(sx%):ctab|
00003610  6c 65 25 3d a4 64 69 6d  28 73 74 25 29 0d 0c 26  |le%=.dim(st%)..&|
00003620  31 20 c8 99 31 32 2c 34  2c 63 25 2c 63 74 61 62  |1 ..12,4,c%,ctab|
00003630  6c 65 25 2c 73 74 25 3a  f4 20 72 65 61 64 20 69  |le%,st%:. read i|
00003640  6e 20 63 6f 6c 6f 75 72  20 74 61 62 6c 65 0d 0c  |n colour table..|
00003650  30 33 20 70 61 25 3d 63  74 61 62 6c 65 25 3a 70  |03 pa%=ctable%:p|
00003660  61 70 69 78 25 3d 30 3a  70 61 70 69 78 32 25 3d  |apix%=0:papix2%=|
00003670  30 3a 70 61 73 78 25 3d  62 75 66 66 25 2b 73 78  |0:pasx%=buff%+sx|
00003680  25 0d 0c 3a 42 20 69 6e  66 6f 24 3d 22 50 72 6f  |%..:B info$="Pro|
00003690  41 72 74 69 73 61 6e 20  69 6d 61 67 65 2c 20 36  |Artisan image, 6|
000036a0  34 30 20 62 79 20 32 35  36 20 70 69 78 65 6c 73  |40 by 256 pixels|
000036b0  2c 20 38 20 62 69 74 73  20 70 65 72 20 70 69 78  |, 8 bits per pix|
000036c0  65 6c 22 0d 0c 44 28 c9  20 31 31 30 30 3a f4 20  |el"..D(. 1100:. |
000036d0  4d 6f 6e 6f 63 68 72 6f  6d 65 3f 20 49 6d 61 67  |Monochrome? Imag|
000036e0  65 73 20 66 72 6f 6d 20  53 75 6e 0d 0c 4e 31 20  |es from Sun..N1 |
000036f0  71 75 61 6e 74 25 3d 31  3a cf 23 63 25 3d 34 3a  |quant%=1:.#c%=4:|
00003700  73 78 25 3d a4 62 65 57  3a 73 79 25 3d a4 62 65  |sx%=.beW:sy%=.be|
00003710  57 3a 69 6e 70 75 74 3d  a4 62 65 57 0d 0c 58 34  |W:input=.beW..X4|
00003720  20 e7 69 6e 70 75 74 3c  3e 31 20 85 34 32 2c 22  | .input<>1 .42,"|
00003730  4f 6e 6c 79 20 6b 6e 6f  77 20 68 6f 77 20 74 6f  |Only know how to|
00003740  20 64 65 61 6c 20 77 69  74 68 20 31 62 70 70 22  | deal with 1bpp"|
00003750  0d 0c 62 27 20 cf 23 63  25 3d 33 32 3a 62 75 66  |..b' .#c%=32:buf|
00003760  66 25 3d a4 64 69 6d 28  73 78 25 2b 37 3e 3e 33  |f%=.dim(sx%+7>>3|
00003770  29 3a f2 73 69 7a 65 0d  0c 6c 2c 20 72 25 28 30  |):.size..l, r%(0|
00003780  29 3d 46 3a 67 25 28 30  29 3d 46 3a 62 25 28 30  |)=F:g%(0)=F:b%(0|
00003790  29 3d 46 3a 62 69 67 65  6e 64 69 61 6e 62 69 74  |)=F:bigendianbit|
000037a0  73 3d b9 0d 0c 76 44 20  69 6e 66 6f 24 3d 22 53  |s=...vD info$="S|
000037b0  75 6e 20 69 6d 61 67 65  2c 20 22 2b c3 73 78 25  |un image, "+.sx%|
000037c0  2b 22 20 62 79 20 22 2b  c3 73 79 25 2b 22 20 70  |+" by "+.sy%+" p|
000037d0  69 78 65 6c 73 2c 20 31  20 62 69 74 20 70 65 72  |ixels, 1 bit per|
000037e0  20 70 69 78 65 6c 22 0d  0c 80 2e c9 20 31 32 30  | pixel"..... 120|
000037f0  30 3a f4 20 75 6e 6b 6e  6f 77 6e 20 54 69 6d 65  |0:. unknown Time|
00003800  53 74 65 70 20 73 61 74  65 6c 6c 69 74 65 20 66  |Step satellite f|
00003810  6f 72 6d 61 74 0d 0c 8a  47 20 71 75 61 6e 74 25  |ormat...G quant%|
00003820  3d 38 3a 73 78 25 3d 38  30 30 3a 73 79 25 3d 38  |=8:sx%=800:sy%=8|
00003830  30 30 3a 62 75 66 66 25  3d a4 64 69 6d 28 73 78  |00:buff%=.dim(sx|
00003840  25 29 3a cf 23 63 25 3d  31 36 30 30 3a 76 66 6c  |%):.#c%=1600:vfl|
00003850  69 70 25 3d ac 20 76 66  6c 69 70 25 0d 0c 94 34  |ip%=. vflip%...4|
00003860  20 e3 43 25 3d 30 b8 32  35 35 3a 72 25 28 43 25  | .C%=0.255:r%(C%|
00003870  29 3d 43 25 2f 32 35 35  2a 46 3a ed 3a 67 25 28  |)=C%/255*F:.:g%(|
00003880  29 3d 72 25 28 29 3a 62  25 28 29 3d 72 25 28 29  |)=r%():b%()=r%()|
00003890  0d 0c 9e 4a 20 69 6e 66  6f 24 3d 22 54 69 6d 65  |...J info$="Time|
000038a0  53 74 65 70 20 73 61 74  65 6c 6c 69 74 65 20 69  |Step satellite i|
000038b0  6d 61 67 65 2c 20 38 30  30 20 62 79 20 38 30 30  |mage, 800 by 800|
000038c0  20 70 69 78 65 6c 73 2c  20 38 20 62 69 74 73 20  | pixels, 8 bits |
000038d0  70 65 72 20 70 69 78 65  6c 22 0d 0c a8 36 c9 20  |per pixel"...6. |
000038e0  31 33 30 30 3a f4 20 61  6e 6f 74 68 65 72 20 75  |1300:. another u|
000038f0  6e 6b 6e 6f 77 6e 20 54  69 6d 65 53 74 65 70 20  |nknown TimeStep |
00003900  73 61 74 65 6c 6c 69 74  65 20 66 6f 72 6d 61 74  |satellite format|
00003910  0d 0c b2 51 20 71 75 61  6e 74 25 3d 38 3a 73 78  |...Q quant%=8:sx|
00003920  25 3d 31 32 38 3a 73 79  25 3d 32 35 36 3a 62 75  |%=128:sy%=256:bu|
00003930  66 66 25 3d a4 64 69 6d  28 73 78 25 29 3a e7 73  |ff%=.dim(sx%):.s|
00003940  63 61 6c 65 25 20 78 6d  75 6c 25 3d 78 6d 75 6c  |cale% xmul%=xmul|
00003950  25 2a 34 3a 79 6d 75 6c  25 3d 79 6d 75 6c 25 2a  |%*4:ymul%=ymul%*|
00003960  32 0d 0c bc 34 20 e3 43  25 3d 30 b8 32 35 35 3a  |2...4 .C%=0.255:|
00003970  72 25 28 43 25 29 3d 43  25 2f 32 35 35 2a 46 3a  |r%(C%)=C%/255*F:|
00003980  ed 3a 67 25 28 29 3d 72  25 28 29 3a 62 25 28 29  |.:g%()=r%():b%()|
00003990  3d 72 25 28 29 0d 0c c6  41 20 69 6e 66 6f 24 3d  |=r%()...A info$=|
000039a0  22 73 61 74 65 6c 6c 69  74 65 20 69 6d 61 67 65  |"satellite image|
000039b0  2c 20 31 32 38 20 62 79  20 32 35 36 20 70 69 78  |, 128 by 256 pix|
000039c0  65 6c 73 2c 20 38 20 62  69 74 73 20 70 65 72 20  |els, 8 bits per |
000039d0  70 69 78 65 6c 22 0d 0c  d0 37 c9 20 31 33 30 31  |pixel"...7. 1301|
000039e0  3a f4 20 22 63 6f 6c 6f  75 72 22 20 75 6e 6b 6e  |:. "colour" unkn|
000039f0  6f 77 6e 20 54 69 6d 65  53 74 65 70 20 73 61 74  |own TimeStep sat|
00003a00  65 6c 6c 69 74 65 20 66  6f 72 6d 61 74 0d 0c da  |ellite format...|
00003a10  53 20 69 6e 70 75 74 3d  32 34 3a 73 74 65 70 32  |S input=24:step2|
00003a20  34 3d 31 3a 71 75 61 6e  74 25 3d 38 3a 73 78 25  |4=1:quant%=8:sx%|
00003a30  3d 31 32 38 3a 73 79 25  3d 32 35 36 3a e7 73 63  |=128:sy%=256:.sc|
00003a40  61 6c 65 25 20 78 6d 75  6c 25 3d 78 6d 75 6c 25  |ale% xmul%=xmul%|
00003a50  2a 34 3a 79 6d 75 6c 25  3d 79 6d 75 6c 25 2a 32  |*4:ymul%=ymul%*2|
00003a60  0d 0c e4 3e 20 62 75 66  66 25 3d a4 64 69 6d 28  |...> buff%=.dim(|
00003a70  73 78 25 2a 33 29 3a 72  62 25 3d 62 75 66 66 25  |sx%*3):rb%=buff%|
00003a80  3a 67 62 25 3d 62 75 66  66 25 2b 73 78 25 3a 62  |:gb%=buff%+sx%:b|
00003a90  62 25 3d 62 75 66 66 25  2b 32 2a 73 78 25 0d 0c  |b%=buff%+2*sx%..|
00003aa0  ee 34 20 e3 43 25 3d 30  b8 32 35 35 3a 72 25 28  |.4 .C%=0.255:r%(|
00003ab0  43 25 29 3d 43 25 2f 32  35 35 2a 46 3a ed 3a 67  |C%)=C%/255*F:.:g|
00003ac0  25 28 29 3d 72 25 28 29  3a 62 25 28 29 3d 72 25  |%()=r%():b%()=r%|
00003ad0  28 29 0d 0c f8 49 20 69  6e 66 6f 24 3d 22 54 72  |()...I info$="Tr|
00003ae0  69 70 6c 65 20 73 61 74  65 6c 6c 69 74 65 20 69  |iple satellite i|
00003af0  6d 61 67 65 2c 20 31 32  38 20 62 79 20 32 35 36  |mage, 128 by 256|
00003b00  20 70 69 78 65 6c 73 2c  20 32 34 20 62 69 74 73  | pixels, 24 bits|
00003b10  20 70 65 72 20 70 69 78  65 6c 22 0d 0d 02 1c c9  | per pixel".....|
00003b20  20 31 34 30 30 3a f4 20  47 45 4d 20 49 4d 47 2e  | 1400:. GEM IMG.|
00003b30  20 66 6f 72 6d 61 74 0d  0d 0c 25 20 70 6c 61 6e  | format...% plan|
00003b40  61 72 3d b9 3a cf 23 63  25 3d 30 3a 5a 25 3d a4  |ar=.:.#c%=0:Z%=.|
00003b50  48 57 3a e7 5a 25 3e 32  35 35 20 8c 0d 0d 16 2c  |HW:.Z%>255 ....,|
00003b60  20 20 73 74 25 3d a4 62  65 48 57 2a 32 3a 71 75  |  st%=.beHW*2:qu|
00003b70  61 6e 74 25 3d a4 62 65  48 57 3a 70 61 74 6c 65  |ant%=.beHW:patle|
00003b80  6e 25 3d a4 62 65 48 57  0d 0d 20 2d 20 20 70 77  |n%=.beHW.. -  pw|
00003b90  25 3d a4 62 65 48 57 3a  70 68 25 3d a4 62 65 48  |%=.beHW:ph%=.beH|
00003ba0  57 3a 73 78 25 3d a4 62  65 48 57 3a 73 79 25 3d  |W:sx%=.beHW:sy%=|
00003bb0  a4 62 65 48 57 0d 0d 2a  06 20 cc 0d 0d 34 45 20  |.beHW..*. ...4E |
00003bc0  20 73 74 25 3d a4 48 57  2a 32 3a 69 6e 70 75 74  | st%=.HW*2:input|
00003bd0  3d a4 48 57 3a 70 61 74  6c 65 6e 25 3d a4 48 57  |=.HW:patlen%=.HW|
00003be0  3a 70 77 25 3d a4 48 57  3a 70 68 25 3d a4 48 57  |:pw%=.HW:ph%=.HW|
00003bf0  3a 73 78 25 3d a4 48 57  3a 73 79 25 3d a4 48 57  |:sx%=.HW:sy%=.HW|
00003c00  0d 0d 3e 06 20 cd 0d 0d  48 0e 20 e7 73 63 61 6c  |..>. ...H. .scal|
00003c10  65 25 20 8c 0d 0d 52 25  20 20 78 6d 75 6c 25 3d  |e% ...R%  xmul%=|
00003c20  78 6d 75 6c 25 2a 70 77  25 3a 78 64 69 76 25 3d  |xmul%*pw%:xdiv%=|
00003c30  78 64 69 76 25 2a 32 38  32 0d 0d 5c 25 20 20 79  |xdiv%*282..\%  y|
00003c40  6d 75 6c 25 3d 79 6d 75  6c 25 2a 70 68 25 3a 79  |mul%=ymul%*ph%:y|
00003c50  64 69 76 25 3d 79 64 69  76 25 2a 32 38 32 0d 0d  |div%=ydiv%*282..|
00003c60  66 06 20 cd 0d 0d 70 30  20 72 73 78 25 3d 73 78  |f. ...p0 rsx%=sx|
00003c70  25 2b 37 3e 3e 33 3a de  20 73 74 25 28 71 75 61  |%+7>>3:. st%(qua|
00003c80  6e 74 25 29 3a 62 75 66  66 25 3d a4 64 69 6d 28  |nt%):buff%=.dim(|
00003c90  73 78 25 29 0d 0d 7a 3b  20 e3 58 25 3d 31 b8 71  |sx%)..z; .X%=1.q|
00003ca0  75 61 6e 74 25 3a 73 74  25 28 58 25 29 3d a4 64  |uant%:st%(X%)=.d|
00003cb0  69 6d 28 72 73 78 25 2a  73 79 25 29 3a ed 3a cf  |im(rsx%*sy%):.:.|
00003cc0  23 63 25 3d 73 74 25 3a  76 72 65 70 25 3d 30 0d  |#c%=st%:vrep%=0.|
00003cd0  0d 84 4c 20 e3 43 25 3d  30 b8 28 31 3c 3c 71 75  |..L .C%=0.(1<<qu|
00003ce0  61 6e 74 25 29 2d 31 3a  72 25 28 43 25 29 3d 46  |ant%)-1:r%(C%)=F|
00003cf0  2d 43 25 2f 28 28 31 3c  3c 71 75 61 6e 74 25 29  |-C%/((1<<quant%)|
00003d00  2d 31 29 2a 46 3a ed 3a  67 25 28 29 3d 72 25 28  |-1)*F:.:g%()=r%(|
00003d10  29 3a 62 25 28 29 3d 72  25 28 29 0d 0d 8e 4e 20  |):b%()=r%()...N |
00003d20  69 6e 66 6f 24 3d 22 49  4d 47 20 66 69 6c 65 2c  |info$="IMG file,|
00003d30  20 22 2b c3 73 78 25 2b  22 20 62 79 20 22 2b c3  | "+.sx%+" by "+.|
00003d40  73 79 25 2b 22 20 70 69  78 65 6c 73 2c 20 22 2b  |sy%+" pixels, "+|
00003d50  c3 71 75 61 6e 74 25 2b  22 20 62 69 74 73 20 70  |.quant%+" bits p|
00003d60  65 72 20 70 69 78 65 6c  22 0d 0d 98 11 c9 20 31  |er pixel"..... 1|
00003d70  35 30 30 3a f4 20 54 49  46 46 0d 0d a2 23 20 cf  |500:. TIFF...# .|
00003d80  23 63 25 3d 34 3a 64 69  72 25 3d a4 74 69 66 66  |#c%=4:dir%=.tiff|
00003d90  28 34 29 3a cf 23 63 25  3d 64 69 72 25 0d 0d ac  |(4):.#c%=dir%...|
00003da0  46 20 72 67 62 3d a3 3a  72 6f 77 73 70 65 72 73  |F rgb=.:rowspers|
00003db0  74 72 69 70 3d 2d 31 3a  67 72 65 79 75 6e 69 74  |trip=-1:greyunit|
00003dc0  3d 31 30 30 3a 70 6c 61  6e 61 72 3d 31 3a 66 69  |=100:planar=1:fi|
00003dd0  6c 6c 6f 72 64 65 72 3d  31 3a 72 65 73 75 6e 69  |llorder=1:resuni|
00003de0  74 3d 32 0d 0d b6 19 20  45 25 3d a4 74 69 66 66  |t=2.... E%=.tiff|
00003df0  28 33 29 3a e3 5a 25 3d  31 b8 45 25 0d 0d c0 29  |(3):.Z%=1.E%...)|
00003e00  20 20 54 25 3d a4 74 69  66 66 28 33 29 3a 44 25  |  T%=.tiff(3):D%|
00003e10  3d a4 74 69 66 66 28 33  29 3a 43 25 3d a4 74 69  |=.tiff(3):C%=.ti|
00003e20  66 66 28 34 29 0d 0d ca  52 20 20 e7 44 25 3d 32  |ff(4)...R  .D%=2|
00003e30  20 8f 23 63 25 3d 64 69  72 25 2b 32 2b 5a 25 2a  | .#c%=dir%+2+Z%*|
00003e40  31 32 20 8b 20 e7 44 25  3c 34 20 56 25 3d a4 74  |12 . .D%<4 V%=.t|
00003e50  69 66 66 28 44 25 29 3a  cf 23 63 25 3d 64 69 72  |iff(D%):.#c%=dir|
00003e60  25 2b 32 2b 5a 25 2a 31  32 20 8b 20 56 25 3d a4  |%+2+Z%*12 . V%=.|
00003e70  74 69 66 66 28 34 29 0d  0d d4 47 20 20 f4 20 50  |tiff(4)...G  . P|
00003e80  52 49 4e 54 22 52 65 61  64 20 74 61 67 20 22 3b  |RINT"Read tag ";|
00003e90  54 25 22 20 64 61 74 61  74 79 70 65 20 22 44 25  |T%" datatype "D%|
00003ea0  22 20 63 6f 75 6e 74 20  22 43 25 22 20 76 61 6c  |" count "C%" val|
00003eb0  75 65 2f 70 6f 69 6e 74  65 72 20 22 56 25 0d 0d  |ue/pointer "V%..|
00003ec0  de 0d 20 20 c8 8e 20 54  25 20 ca 0d 0d e8 12 20  |..  .. T% ..... |
00003ed0  20 c9 20 32 35 36 3a 73  78 25 3d 56 25 0d 0d f2  | . 256:sx%=V%...|
00003ee0  12 20 20 c9 20 32 35 37  3a 73 79 25 3d 56 25 0d  |.  . 257:sy%=V%.|
00003ef0  0d fc 54 20 20 c9 20 32  35 38 3a 71 75 61 6e 74  |..T  . 258:quant|
00003f00  25 3d 56 25 3a 69 6e 70  75 74 3d 71 75 61 6e 74  |%=V%:input=quant|
00003f10  25 3a e3 49 25 3d 30 b8  28 31 3c 3c 71 75 61 6e  |%:.I%=0.(1<<quan|
00003f20  74 25 29 2d 31 3a 72 25  28 49 25 29 3d 49 25 2f  |t%)-1:r%(I%)=I%/|
00003f30  28 28 31 3c 3c 71 75 61  6e 74 25 29 2d 31 29 2a  |((1<<quant%)-1)*|
00003f40  46 3a ed 0d 0e 06 1a 20  20 20 67 25 28 29 3d 72  |F:.....   g%()=r|
00003f50  25 28 29 3a 62 25 28 29  3d 72 25 28 29 0d 0e 10  |%():b%()=r%()...|
00003f60  1a 20 20 c9 20 32 35 39  3a 63 6f 6d 70 72 65 73  |.  . 259:compres|
00003f70  73 69 6f 6e 3d 56 25 0d  0e 1a 1a 20 20 c9 20 32  |sion=V%....  . 2|
00003f80  36 32 3a 70 68 6f 74 6f  6d 65 74 72 69 63 3d 56  |62:photometric=V|
00003f90  25 0d 0e 24 18 20 20 c9  20 32 36 36 3a 66 69 6c  |%..$.  . 266:fil|
00003fa0  6c 6f 72 64 65 72 3d 56  25 0d 0e 2e 1b 20 20 c9  |lorder=V%....  .|
00003fb0  20 32 37 33 3a 73 74 63  25 3d 43 25 3a 73 74 76  | 273:stc%=C%:stv|
00003fc0  25 3d 56 25 0d 0e 38 24  20 20 c9 20 32 37 37 3a  |%=V%..8$  . 277:|
00003fd0  69 6e 70 75 74 3d 71 75  61 6e 74 25 2a 56 25 3a  |input=quant%*V%:|
00003fe0  72 67 62 3d 56 25 3d 33  0d 0e 42 1b 20 20 c9 20  |rgb=V%=3..B.  . |
00003ff0  32 37 38 3a 72 6f 77 73  70 65 72 73 74 72 69 70  |278:rowsperstrip|
00004000  3d 56 25 0d 0e 4c 33 20  20 c9 20 32 38 32 3a cf  |=V%..L3  . 282:.|
00004010  23 63 25 3d 56 25 3a 78  6e 75 6d 25 3d a4 74 69  |#c%=V%:xnum%=.ti|
00004020  66 66 28 34 29 3a 78 64  65 6e 6f 6d 25 3d a4 74  |ff(4):xdenom%=.t|
00004030  69 66 66 28 34 29 0d 0e  56 18 20 20 20 cf 23 63  |iff(4)..V.   .#c|
00004040  25 3d 64 69 72 25 2b 32  2b 5a 25 2a 31 32 0d 0e  |%=dir%+2+Z%*12..|
00004050  60 33 20 20 c9 20 32 38  33 3a cf 23 63 25 3d 56  |`3  . 283:.#c%=V|
00004060  25 3a 79 6e 75 6d 25 3d  a4 74 69 66 66 28 34 29  |%:ynum%=.tiff(4)|
00004070  3a 79 64 65 6e 6f 6d 25  3d a4 74 69 66 66 28 34  |:ydenom%=.tiff(4|
00004080  29 0d 0e 6a 18 20 20 20  cf 23 63 25 3d 64 69 72  |)..j.   .#c%=dir|
00004090  25 2b 32 2b 5a 25 2a 31  32 0d 0e 74 15 20 20 c9  |%+2+Z%*12..t.  .|
000040a0  20 32 38 34 3a 70 6c 61  6e 61 72 3d 56 25 0d 0e  | 284:planar=V%..|
000040b0  7e 1a 20 20 c9 20 32 39  30 3a 67 72 65 79 75 6e  |~.  . 290:greyun|
000040c0  69 74 3d 31 30 5e 56 25  0d 0e 88 3e 20 20 c9 20  |it=10^V%...>  . |
000040d0  32 39 31 3a cf 23 63 25  3d 56 25 3a e3 49 25 3d  |291:.#c%=V%:.I%=|
000040e0  30 b8 43 25 2d 31 3a 72  25 28 49 25 29 3d a4 74  |0.C%-1:r%(I%)=.t|
000040f0  69 66 66 28 44 25 29 2f  67 72 65 79 75 6e 69 74  |iff(D%)/greyunit|
00004100  2f 32 2a 46 3a ed 0d 0e  92 1a 20 20 20 67 25 28  |/2*F:.....   g%(|
00004110  29 3d 72 25 28 29 3a 62  25 28 29 3d 72 25 28 29  |)=r%():b%()=r%()|
00004120  0d 0e 9c 18 20 20 20 cf  23 63 25 3d 64 69 72 25  |....   .#c%=dir%|
00004130  2b 32 2b 5a 25 2a 31 32  0d 0e a6 16 20 20 c9 20  |+2+Z%*12....  . |
00004140  32 39 36 3a 72 65 73 75  6e 69 74 3d 56 25 0d 0e  |296:resunit=V%..|
00004150  b0 10 f4 20 20 57 48 45  4e 20 33 32 30 3a 0d 0e  |...  WHEN 320:..|
00004160  ba 1b f4 20 20 20 50 54  52 23 63 25 3d 64 69 72  |...   PTR#c%=dir|
00004170  25 2b 32 2b 5a 25 2a 31  32 0d 0e c4 07 20 20 7f  |%+2+Z%*12....  .|
00004180  0d 0e ce 4c 20 20 e7 69  6e 66 6f 25 20 f1 22 49  |...L  .info% ."I|
00004190  67 6e 6f 72 69 6e 67 20  74 61 67 20 22 3b 54 25  |gnoring tag ";T%|
000041a0  22 20 64 61 74 61 74 79  70 65 20 22 44 25 22 20  |" datatype "D%" |
000041b0  63 6f 75 6e 74 20 22 43  25 22 20 76 61 6c 75 65  |count "C%" value|
000041c0  2f 70 6f 69 6e 74 65 72  20 22 56 25 0d 0e d8 07  |/pointer "V%....|
000041d0  20 20 cb 0d 0e e2 06 20  ed 0d 0e ec 1a 20 de 20  |  ..... ..... . |
000041e0  73 74 25 28 73 74 63 25  29 3a e7 73 74 63 25 3e  |st%(stc%):.stc%>|
000041f0  31 20 8c 0d 0e f6 2e 20  20 cf 23 63 25 3d 73 74  |1 .....  .#c%=st|
00004200  76 25 3a e3 49 25 3d 30  b8 43 25 2d 31 3a 73 74  |v%:.I%=0.C%-1:st|
00004210  25 28 49 25 29 3d a4 74  69 66 66 28 44 25 29 3a  |%(I%)=.tiff(D%):|
00004220  ed 0d 0f 00 06 20 cc 0d  0f 0a 11 20 20 73 74 25  |..... .....  st%|
00004230  28 30 29 3d 73 74 76 25  0d 0f 14 06 20 cd 0d 0f  |(0)=stv%.... ...|
00004240  1e 33 20 e7 63 6f 6d 70  72 65 73 73 69 6f 6e 3c  |.3 .compression<|
00004250  3e 31 20 69 6e 66 6f 24  3d 22 43 6f 6d 70 72 65  |>1 info$="Compre|
00004260  73 73 65 64 20 22 20 8b  20 69 6e 66 6f 24 3d 22  |ssed " . info$="|
00004270  22 0d 0f 28 4f 20 69 6e  66 6f 24 2b 3d 22 54 49  |"..(O info$+="TI|
00004280  46 46 20 66 69 6c 65 2c  20 22 2b c3 73 78 25 2b  |FF file, "+.sx%+|
00004290  22 20 62 79 20 22 2b c3  73 79 25 2b 22 20 70 69  |" by "+.sy%+" pi|
000042a0  78 65 6c 73 2c 20 22 2b  c3 69 6e 70 75 74 2b 22  |xels, "+.input+"|
000042b0  20 62 69 74 73 20 70 65  72 20 70 69 78 65 6c 22  | bits per pixel"|
000042c0  0d 0f 32 46 20 e7 70 6c  61 6e 61 72 3c 3e 31 20  |..2F .planar<>1 |
000042d0  84 20 63 6f 6d 70 72 65  73 73 69 6f 6e 3c 3e 31  |. compression<>1|
000042e0  20 85 34 32 2c 22 43 61  6e 27 74 20 64 6f 20 74  | .42,"Can't do t|
000042f0  68 69 73 20 73 74 79 6c  65 20 6f 66 20 54 49 46  |his style of TIF|
00004300  46 20 79 65 74 22 0d 0f  3c 1e 20 62 69 67 65 6e  |F yet"..<. bigen|
00004310  64 69 61 6e 62 69 74 73  3d 66 69 6c 6c 6f 72 64  |dianbits=fillord|
00004320  65 72 3d 31 0d 0f 46 10  20 c8 8e 20 71 75 61 6e  |er=1..F. .. quan|
00004330  74 25 20 ca 0d 0f 50 16  20 c9 20 31 3a 6e 73 78  |t% ...P. . 1:nsx|
00004340  25 3d 73 78 25 2b 37 3e  3e 33 0d 0f 5a 16 20 c9  |%=sx%+7>>3..Z. .|
00004350  20 32 3a 6e 73 78 25 3d  73 78 25 2b 33 3e 3e 32  | 2:nsx%=sx%+3>>2|
00004360  0d 0f 64 16 20 c9 20 34  3a 6e 73 78 25 3d 73 78  |..d. . 4:nsx%=sx|
00004370  25 2b 31 3e 3e 31 0d 0f  6e 11 20 c9 20 38 3a 6e  |%+1>>1..n. . 8:n|
00004380  73 78 25 3d 73 78 25 0d  0f 78 34 20 7f 20 85 20  |sx%=sx%..x4 . . |
00004390  34 32 2c 22 43 61 6e 27  74 20 64 6f 20 22 3b 71  |42,"Can't do ";q|
000043a0  75 61 6e 74 25 22 20 62  69 74 73 20 70 65 72 20  |uant%" bits per |
000043b0  70 69 78 65 6c 20 54 49  46 46 22 0d 0f 82 06 20  |pixel TIFF".... |
000043c0  cb 0d 0f 8c 42 20 62 75  66 66 25 3d a4 64 69 6d  |....B buff%=.dim|
000043d0  28 6e 73 78 25 29 3a 54  49 46 46 72 65 61 64 25  |(nsx%):TIFFread%|
000043e0  3d 72 6f 77 73 70 65 72  73 74 72 69 70 3a cf 23  |=rowsperstrip:.#|
000043f0  63 25 3d 73 74 25 28 30  29 3a 54 49 46 46 70 74  |c%=st%(0):TIFFpt|
00004400  72 3d 30 0d 0f 96 0e 20  e7 73 63 61 6c 65 25 20  |r=0.... .scale% |
00004410  8c 0d 0f a0 1c 20 20 53  25 3d 72 65 73 75 6e 69  |.....  S%=resuni|
00004420  74 3a e7 53 25 3d 32 20  53 25 3d 39 30 0d 0f aa  |t:.S%=2 S%=90...|
00004430  11 20 20 e7 53 25 3d 33  20 53 25 3d 33 35 0d 0f  |.  .S%=3 S%=35..|
00004440  b4 2e 20 20 78 64 69 76  25 3d 78 64 69 76 25 2a  |..  xdiv%=xdiv%*|
00004450  78 6e 75 6d 25 3a 78 6d  75 6c 25 3d 78 6d 75 6c  |xnum%:xmul%=xmul|
00004460  25 2a 78 64 65 6e 6f 6d  25 2a 53 25 0d 0f be 2e  |%*xdenom%*S%....|
00004470  20 20 79 64 69 76 25 3d  79 64 69 76 25 2a 79 6e  |  ydiv%=ydiv%*yn|
00004480  75 6d 25 3a 79 6d 75 6c  25 3d 79 6d 75 6c 25 2a  |um%:ymul%=ymul%*|
00004490  79 64 65 6e 6f 6d 25 2a  53 25 0d 0f c8 06 20 cd  |ydenom%*S%.... .|
000044a0  0d 0f d2 2c c9 20 31 36  30 30 3a f4 20 45 6c 65  |...,. 1600:. Ele|
000044b0  63 74 72 6f 6e 69 63 20  41 72 74 73 20 49 4c 42  |ctronic Arts ILB|
000044c0  4d 20 69 6e 73 69 64 65  20 49 46 46 0d 0f dc 1e  |M inside IFF....|
000044d0  20 cf 23 63 25 3d 31 32  3a 63 61 6d 67 3d 30 3a  | .#c%=12:camg=0:|
000044e0  70 6c 61 6e 61 72 3d b9  3a f5 0d 0f e6 27 20 53  |planar=.:....' S|
000044f0  24 3d bd 9a 23 63 25 2b  bd 9a 23 63 25 2b bd 9a  |$=..#c%+..#c%+..|
00004500  23 63 25 2b bd 9a 23 63  25 3a 53 25 3d a4 62 65  |#c%+..#c%:S%=.be|
00004510  57 0d 0f f0 0c 20 c8 8e  20 53 24 20 ca 0d 0f fa  |W.... .. S$ ....|
00004520  43 20 c9 20 22 42 4d 48  44 22 3a 73 78 25 3d a4  |C . "BMHD":sx%=.|
00004530  62 65 48 57 3a 73 79 25  3d a4 62 65 48 57 3a 53  |beHW:sy%=.beHW:S|
00004540  25 3d a4 57 3a 71 75 61  6e 74 25 3d 9a 23 63 25  |%=.W:quant%=.#c%|
00004550  3a 6d 61 73 6b 69 6e 67  25 3d 9a 23 63 25 3d 31  |:masking%=.#c%=1|
00004560  0d 10 04 38 20 20 63 6f  6d 70 72 65 73 73 69 6f  |...8  compressio|
00004570  6e 3d 9a 23 63 25 3a 53  25 3d 9a 23 63 25 2b a4  |n=.#c%:S%=.#c%+.|
00004580  48 57 3a 55 25 3d 9a 23  63 25 3a 56 25 3d 9a 23  |HW:U%=.#c%:V%=.#|
00004590  63 25 3a 53 25 3d a4 57  0d 10 0e 2b 20 20 e7 73  |c%:S%=.W...+  .s|
000045a0  63 61 6c 65 25 20 79 6d  75 6c 25 3d 79 6d 75 6c  |cale% ymul%=ymul|
000045b0  25 2a 56 25 3a 79 64 69  76 25 3d 79 64 69 76 25  |%*V%:ydiv%=ydiv%|
000045c0  2a 55 25 0d 10 18 4b 20  20 e3 49 25 3d 30 b8 28  |*U%...K  .I%=0.(|
000045d0  31 3c 3c 71 75 61 6e 74  25 29 2d 31 3a 72 25 28  |1<<quant%)-1:r%(|
000045e0  49 25 29 3d 49 25 2f 28  28 31 3c 3c 71 75 61 6e  |I%)=I%/((1<<quan|
000045f0  74 25 29 2d 31 29 2a 46  3a ed 3a 67 25 28 29 3d  |t%)-1)*F:.:g%()=|
00004600  72 25 28 29 3a 62 25 28  29 3d 72 25 28 29 0d 10  |r%():b%()=r%()..|
00004610  22 42 20 c9 20 22 43 4d  41 50 22 3a 53 25 3d 8f  |"B . "CMAP":S%=.|
00004620  23 63 25 2b 53 25 3a e3  49 25 3d 30 b8 28 31 3c  |#c%+S%:.I%=0.(1<|
00004630  3c 71 75 61 6e 74 25 29  2d 31 3a 72 25 28 49 25  |<quant%)-1:r%(I%|
00004640  29 3d 28 9a 23 63 25 3e  3e 34 29 2f 31 35 2a 46  |)=(.#c%>>4)/15*F|
00004650  0d 10 2c 33 20 20 67 25  28 49 25 29 3d 28 9a 23  |..,3  g%(I%)=(.#|
00004660  63 25 3e 3e 34 29 2f 31  35 2a 46 3a 62 25 28 49  |c%>>4)/15*F:b%(I|
00004670  25 29 3d 28 9a 23 63 25  3e 3e 34 29 2f 31 35 2a  |%)=(.#c%>>4)/15*|
00004680  46 3a ed 0d 10 36 49 20  20 cf 23 63 25 3d 53 25  |F:...6I  .#c%=S%|
00004690  3a e7 69 6e 66 6f 25 20  f1 22 57 61 72 6e 69 6e  |:.info% ."Warnin|
000046a0  67 3a 20 74 72 75 6e 63  61 74 65 64 20 49 46 46  |g: truncated IFF|
000046b0  20 43 4d 41 50 20 69 6e  66 6f 72 6d 61 74 69 6f  | CMAP informatio|
000046c0  6e 20 74 6f 20 34 20 62  69 74 73 22 0d 10 40 3c  |n to 4 bits"..@<|
000046d0  20 c9 20 22 43 41 4d 47  22 3a 63 61 6d 67 3d a4  | . "CAMG":camg=.|
000046e0  62 65 57 3a e7 69 6e 66  6f 25 20 f1 22 41 6d 69  |beW:.info% ."Ami|
000046f0  67 61 20 76 69 65 77 70  6f 72 74 20 6d 6f 64 65  |ga viewport mode|
00004700  20 22 3b 7e 63 61 6d 67  0d 10 4a 16 20 c9 20 22  | ";~camg..J. . "|
00004710  42 4f 44 59 22 3a 73 74  25 3d 8f 23 63 25 0d 10  |BODY":st%=.#c%..|
00004720  54 35 20 7f 20 e7 20 69  6e 66 6f 25 20 f1 22 49  |T5 . . info% ."I|
00004730  67 6e 6f 72 69 6e 67 20  49 46 46 20 70 72 6f 70  |gnoring IFF prop|
00004740  65 72 74 79 20 22 53 24  22 20 73 69 7a 65 20 22  |erty "S$" size "|
00004750  3b 53 25 0d 10 5e 12 20  20 cf 23 63 25 3d 8f 23  |;S%..^.  .#c%=.#|
00004760  63 25 2b 53 25 0d 10 68  06 20 cb 0d 10 72 3b 20  |c%+S%..h. ...r; |
00004770  fd 53 24 3d 22 42 4f 44  59 22 3a e7 63 6f 6d 70  |.S$="BODY":.comp|
00004780  72 65 73 73 69 6f 6e 20  69 6e 66 6f 24 3d 22 43  |ression info$="C|
00004790  6f 6d 70 72 65 73 73 65  64 20 22 20 8b 20 69 6e  |ompressed " . in|
000047a0  66 6f 24 3d 22 22 0d 10  7c 4e 20 69 6e 66 6f 24  |fo$=""..|N info$|
000047b0  3d 22 49 46 46 20 66 69  6c 65 2c 20 22 2b c3 73  |="IFF file, "+.s|
000047c0  78 25 2b 22 20 62 79 20  22 2b c3 73 79 25 2b 22  |x%+" by "+.sy%+"|
000047d0  20 70 69 78 65 6c 73 2c  20 22 2b c3 71 75 61 6e  | pixels, "+.quan|
000047e0  74 25 2b 22 20 62 69 74  73 20 70 65 72 20 70 69  |t%+" bits per pi|
000047f0  78 65 6c 22 0d 10 86 31  20 68 61 6d 3d 28 63 61  |xel"...1 ham=(ca|
00004800  6d 67 20 80 20 26 38 30  30 29 3c 3e 30 3a e7 68  |mg . &800)<>0:.h|
00004810  61 6d 20 69 6e 66 6f 24  3d 22 48 41 4d 20 22 2b  |am info$="HAM "+|
00004820  69 6e 66 6f 24 0d 10 90  2b 20 e7 6d 61 73 6b 69  |info$...+ .maski|
00004830  6e 67 25 20 69 6e 66 6f  24 2b 3d 22 20 77 69 74  |ng% info$+=" wit|
00004840  68 20 6d 61 73 6b 20 28  75 6e 75 73 65 64 29 22  |h mask (unused)"|
00004850  0d 10 9a 47 20 de 20 73  74 25 28 71 75 61 6e 74  |...G . st%(quant|
00004860  25 29 3a 72 73 78 25 3d  28 73 78 25 2b 31 35 3e  |%):rsx%=(sx%+15>|
00004870  3e 34 29 3c 3c 31 3a e3  49 25 3d 31 b8 71 75 61  |>4)<<1:.I%=1.qua|
00004880  6e 74 25 3a 73 74 25 28  49 25 29 3d a4 64 69 6d  |nt%:st%(I%)=.dim|
00004890  28 73 78 25 29 3a ed 0d  10 a4 2f 20 62 75 66 66  |(sx%):..../ buff|
000048a0  25 3d a4 64 69 6d 28 73  78 25 29 3a 66 6c 61 67  |%=.dim(sx%):flag|
000048b0  2b 3d 63 6f 6d 70 72 65  73 73 69 6f 6e 3a cf 23  |+=compression:.#|
000048c0  63 25 3d 73 74 25 0d 10  ae 23 c9 20 31 37 30 30  |c%=st%...#. 1700|
000048d0  3a f4 20 45 47 41 20 69  6d 61 67 65 20 69 6e 20  |:. EGA image in |
000048e0  44 53 50 2e 3c 66 6f 6f  3e 0d 10 b8 37 20 73 78  |DSP.<foo>...7 sx|
000048f0  25 3d 36 34 30 3a 72 73  78 25 3d 38 30 3a 73 79  |%=640:rsx%=80:sy|
00004900  25 3d 33 35 30 3a 71 75  61 6e 74 25 3d 34 3a 70  |%=350:quant%=4:p|
00004910  6c 61 6e 61 72 3d b9 3a  de 20 73 74 25 28 34 29  |lanar=.:. st%(4)|
00004920  0d 10 c2 3d 20 e3 58 25  3d 31 b8 34 3a 73 74 25  |...= .X%=1.4:st%|
00004930  28 58 25 29 3d a4 64 69  6d 28 38 30 29 3a ed 3a  |(X%)=.dim(80):.:|
00004940  62 75 66 66 25 3d a4 64  69 6d 28 36 34 30 29 3a  |buff%=.dim(640):|
00004950  47 3d 46 2f 33 3a 48 3d  46 2a 32 2f 33 0d 10 cc  |G=F/3:H=F*2/3...|
00004960  29 20 72 25 28 29 3d 30  2c 30 2c 30 2c 30 2c 46  |) r%()=0,0,0,0,F|
00004970  2c 46 2c 46 2c 48 2c 47  2c 47 2c 47 2c 47 2c 46  |,F,F,H,G,G,G,G,F|
00004980  2c 46 2c 46 2c 46 0d 10  d6 29 20 67 25 28 29 3d  |,F,F,F...) g%()=|
00004990  30 2c 30 2c 46 2c 46 2c  30 2c 30 2c 46 2c 48 2c  |0,0,F,F,0,0,F,H,|
000049a0  47 2c 47 2c 46 2c 46 2c  47 2c 47 2c 46 2c 46 0d  |G,G,F,F,G,G,F,F.|
000049b0  10 e0 29 20 62 25 28 29  3d 30 2c 46 2c 30 2c 46  |..) b%()=0,F,0,F|
000049c0  2c 30 2c 46 2c 30 2c 48  2c 47 2c 46 2c 47 2c 46  |,0,F,0,H,G,F,G,F|
000049d0  2c 47 2c 46 2c 47 2c 46  0d 10 ea 28 20 6d 61 73  |,G,F,G,F...( mas|
000049e0  6b 69 6e 67 25 3d a3 3a  66 6c 61 67 3d 31 36 30  |king%=.:flag=160|
000049f0  30 3a 73 74 25 3d 31 36  3a cf 23 63 25 3d 31 36  |0:st%=16:.#c%=16|
00004a00  0d 10 f4 54 20 69 6e 66  6f 24 3d 22 50 43 20 45  |...T info$="PC E|
00004a10  47 41 20 27 2e 64 73 70  27 20 66 69 6c 65 2c 20  |GA '.dsp' file, |
00004a20  36 34 30 20 62 79 20 33  35 30 20 70 69 78 65 6c  |640 by 350 pixel|
00004a30  73 2c 20 34 20 62 69 74  73 20 70 65 72 20 70 69  |s, 4 bits per pi|
00004a40  78 65 6c 20 28 66 69 78  65 64 20 70 61 6c 65 74  |xel (fixed palet|
00004a50  74 65 29 22 0d 10 fe 1a  c9 20 32 30 30 30 3a f4  |te)"..... 2000:.|
00004a60  20 55 6e 6b 6e 6f 77 6e  20 22 53 43 46 22 0d 11  | Unknown "SCF"..|
00004a70  08 24 20 73 74 25 3d 26  33 30 30 3a cf 23 63 25  |.$ st%=&300:.#c%|
00004a80  3d 34 3a 73 78 25 3d a4  48 57 3a 73 79 25 3d a4  |=4:sx%=.HW:sy%=.|
00004a90  48 57 0d 11 12 0f 20 f1  9a 23 63 25 20 9a 23 63  |HW.... ..#c% .#c|
00004aa0  25 0d 11 1c 14 20 62 75  66 66 25 3d a4 64 69 6d  |%.... buff%=.dim|
00004ab0  28 73 78 25 29 0d 11 26  05 cb 0d 11 30 11 e7 69  |(sx%)..&....0..i|
00004ac0  6e 66 6f 25 20 f1 69 6e  66 6f 24 0d 11 3a 43 c8  |nfo% .info$..:C.|
00004ad0  99 22 48 6f 75 72 67 6c  61 73 73 5f 4f 6e 22 2c  |."Hourglass_On",|
00004ae0  31 3a e7 69 6e 76 65 72  74 25 20 72 25 28 29 3d  |1:.invert% r%()=|
00004af0  46 2d 72 25 28 29 3a 67  25 28 29 3d 46 2d 67 25  |F-r%():g%()=F-g%|
00004b00  28 29 3a 62 25 28 29 3d  46 2d 62 25 28 29 0d 11  |():b%()=F-b%()..|
00004b10  44 0a c8 8e 20 6d 20 ca  0d 11 4e 44 20 c9 20 2d  |D... m ...ND . -|
00004b20  31 3a 78 25 3d 32 35 36  3a 79 25 3d 32 35 36 3a  |1:x%=256:y%=256:|
00004b30  6e 63 6f 6c 3d 32 35 35  3a e7 73 63 61 6c 65 25  |ncol=255:.scale%|
00004b40  20 78 64 69 76 25 3d 78  64 69 76 25 2a 32 3a 79  | xdiv%=xdiv%*2:y|
00004b50  64 69 76 25 3d 79 64 69  76 25 2a 32 0d 11 58 06  |div%=ydiv%*2..X.|
00004b60  20 7f 0d 11 62 37 20 20  c8 99 35 33 2c 6d 2c 34  | ...b7  ..53,m,4|
00004b70  20 b8 20 2c 2c 6e 78 3a  c8 99 35 33 2c 6d 2c 35  | . ,,nx:..53,m,5|
00004b80  20 b8 20 2c 2c 6e 79 3a  6e 78 3d 31 3c 3c 6e 78  | . ,,ny:nx=1<<nx|
00004b90  3a 6e 79 3d 31 3c 3c 6e  79 0d 11 6c 33 20 20 c8  |:ny=1<<ny..l3  .|
00004ba0  99 35 33 2c 6d 2c 31 31  20 b8 20 2c 2c 78 25 3a  |.53,m,11 . ,,x%:|
00004bb0  c8 99 35 33 2c 6d 2c 31  32 20 b8 20 2c 2c 79 25  |..53,m,12 . ,,y%|
00004bc0  3a 78 25 2b 3d 31 3a 79  25 2b 3d 31 0d 11 76 41  |:x%+=1:y%+=1..vA|
00004bd0  20 20 c8 99 35 33 2c 6d  2c 33 20 b8 20 2c 2c 6e  |  ..53,m,3 . ,,n|
00004be0  63 6f 6c 3a e7 73 63 61  6c 65 25 20 78 64 69 76  |col:.scale% xdiv|
00004bf0  25 3d 78 64 69 76 25 2a  6e 78 2f 32 3a 79 64 69  |%=xdiv%*nx/2:ydi|
00004c00  76 25 3d 79 64 69 76 25  2a 6e 79 2f 32 0d 11 80  |v%=ydiv%*ny/2...|
00004c10  05 cb 0d 11 8a 1f e7 78  73 24 3d 22 3d 22 20 78  |.......xs$="=" x|
00004c20  6d 75 6c 25 3d 78 25 3a  78 64 69 76 25 3d 73 78  |mul%=x%:xdiv%=sx|
00004c30  25 0d 11 94 1f e7 79 73  24 3d 22 3d 22 20 79 6d  |%.....ys$="=" ym|
00004c40  75 6c 25 3d 79 25 3a 79  64 69 76 25 3d 73 79 25  |ul%=y%:ydiv%=sy%|
00004c50  0d 11 9e 2f e7 6e 63 6f  6c 3d 31 20 e7 6d 24 3d  |.../.ncol=1 .m$=|
00004c60  22 43 22 20 78 64 69 76  25 3d 78 64 69 76 25 2a  |"C" xdiv%=xdiv%*|
00004c70  34 3a 79 64 69 76 25 3d  79 64 69 76 25 2a 34 0d  |4:ydiv%=ydiv%*4.|
00004c80  11 a8 2d f2 72 65 64 75  63 65 28 78 6d 75 6c 25  |..-.reduce(xmul%|
00004c90  2c 78 64 69 76 25 29 3a  f2 72 65 64 75 63 65 28  |,xdiv%):.reduce(|
00004ca0  79 6d 75 6c 25 2c 79 64  69 76 25 29 0d 11 b2 0c  |ymul%,ydiv%)....|
00004cb0  e7 69 6e 66 6f 25 20 8c  0d 11 bc 3b 20 f1 22 53  |.info% ....; ."S|
00004cc0  69 7a 65 20 72 61 74 69  6f 73 20 61 72 65 20 78  |ize ratios are x|
00004cd0  20 22 3b 78 6d 75 6c 25  22 3a 22 78 64 69 76 25  | ";xmul%":"xdiv%|
00004ce0  22 20 79 20 22 79 6d 75  6c 25 22 3a 22 79 64 69  |" y "ymul%":"ydi|
00004cf0  76 25 3b 0d 11 c6 4e 20  e7 78 64 69 76 25 3e 31  |v%;...N .xdiv%>1|
00004d00  30 20 84 79 64 69 76 25  3e 31 30 20 84 78 6d 75  |0 .ydiv%>10 .xmu|
00004d10  6c 25 3e 32 30 20 84 79  6d 75 6c 25 3e 32 30 20  |l%>20 .ymul%>20 |
00004d20  f1 22 20 77 68 69 63 68  20 6d 61 79 20 74 61 6b  |." which may tak|
00004d30  65 20 61 20 77 68 69 6c  65 2e 2e 2e 22 20 8b 20  |e a while..." . |
00004d40  f1 0d 11 d0 05 cd 0d 11  da 3f 78 25 3d 73 78 25  |.........?x%=sx%|
00004d50  2a 78 6d 75 6c 25 2f 78  64 69 76 25 2b 2e 39 39  |*xmul%/xdiv%+.99|
00004d60  39 39 3a 79 25 3d 73 79  25 2a 79 6d 75 6c 25 2f  |99:y%=sy%*ymul%/|
00004d70  79 64 69 76 25 2b 2e 39  39 39 39 3a 72 6f 77 73  |ydiv%+.9999:rows|
00004d80  25 3d 73 79 25 0d 11 e4  2d 6f 72 64 65 72 25 3d  |%=sy%...-order%=|
00004d90  78 25 2a 79 25 3e 73 78  25 2a 73 79 25 3a f4 20  |x%*y%>sx%*sy%:. |
00004da0  54 52 55 45 20 69 66 20  73 63 61 6c 69 6e 67 20  |TRUE if scaling |
00004db0  75 70 0d 11 ee 2a f4 20  74 65 73 74 20 66 6f 72  |up...*. test for|
00004dc0  20 61 73 20 6d 61 6e 79  20 63 6f 6c 6f 75 72 73  | as many colours|
00004dd0  20 61 73 20 70 6f 73 73  69 62 6c 65 0d 11 f8 0a  | as possible....|
00004de0  c8 8e 20 6d 20 ca 0d 12  02 2a 20 c9 20 2d 31 3a  |.. m ....* . -1:|
00004df0  63 6f 6c 3d 30 3a f4 20  61 69 6d 20 66 6f 72 6d  |col=0:. aim form|
00004e00  61 74 20 69 73 20 6d 6f  6e 6f 63 68 72 6f 6d 65  |at is monochrome|
00004e10  0d 12 0c 06 20 7f 0d 12  16 1c 20 e7 6d 24 3d 22  |.... ..... .m$="|
00004e20  44 22 20 e7 6e 63 6f 6c  3c 3e 31 35 20 6d 24 3d  |D" .ncol<>15 m$=|
00004e30  22 22 0d 12 20 44 20 63  6f 6c 3d 30 3a e7 6e 63  |"".. D col=0:.nc|
00004e40  6f 6c 3e 31 35 20 84 20  6d 24 3d 22 43 22 20 84  |ol>15 . m$="C" .|
00004e50  20 6d 24 3d 22 44 22 20  63 6f 6c 3d 32 3a f4 20  | m$="D" col=2:. |
00004e60  64 65 70 74 68 20 6f 66  20 63 6f 6c 6f 75 72 20  |depth of colour |
00004e70  61 72 72 61 79 73 0d 12  2a 05 cb 0d 12 34 24 e7  |arrays..*....4$.|
00004e80  6e 63 6f 6c 3d 31 20 e7  6d 24 3d 22 43 22 20 63  |ncol=1 .m$="C" c|
00004e90  6f 6c 3d 30 3a 78 25 3d  78 25 2b 31 80 ac 31 0d  |ol=0:x%=x%+1..1.|
00004ea0  12 3e 47 e7 63 6f 6c 3d  30 20 e7 69 6e 70 75 74  |.>G.col=0 .input|
00004eb0  3c 39 20 e3 43 25 3d 30  b8 32 35 35 3a 72 25 28  |<9 .C%=0.255:r%(|
00004ec0  43 25 29 3d 72 25 28 43  25 29 2a 72 77 74 2b 67  |C%)=r%(C%)*rwt+g|
00004ed0  25 28 43 25 29 2a 67 77  74 2b 62 25 28 43 25 29  |%(C%)*gwt+b%(C%)|
00004ee0  2a 62 77 74 3a ed 0d 12  48 29 e7 63 6f 6c 3d 30  |*bwt:...H).col=0|
00004ef0  20 e7 69 6e 70 75 74 3d  32 34 20 72 62 25 2d 3d  | .input=24 rb%-=|
00004f00  31 3a 67 62 25 2d 3d 31  3a 62 62 25 2d 3d 31 0d  |1:gb%-=1:bb%-=1.|
00004f10  12 52 1b e7 73 68 61 72  70 65 6e 25 3d b9 20 73  |.R..sharpen%=. s|
00004f20  68 61 72 70 65 6e 25 3d  32 34 0d 12 5c 32 de 20  |harpen%=24..\2. |
00004f30  63 6c 25 28 78 25 2b 37  2c 63 6f 6c 29 3a f4 20  |cl%(x%+7,col):. |
00004f40  63 75 72 72 65 6e 74 20  6c 69 6e 65 20 61 64 64  |current line add|
00004f50  69 74 69 76 65 20 65 72  72 6f 72 73 0d 12 66 4c  |itive errors..fL|
00004f60  de 20 78 6c 25 28 78 25  2b 37 2c 63 6f 6c 29 2c  |. xl%(x%+7,col),|
00004f70  78 70 25 28 73 78 25 2b  37 2c 63 6f 6c 29 3a f4  |xp%(sx%+7,col):.|
00004f80  20 65 78 74 72 61 20 69  6e 70 75 74 20 6c 69 6e  | extra input lin|
00004f90  65 20 66 6f 72 20 73 63  61 6c 69 6e 67 20 76 65  |e for scaling ve|
00004fa0  72 74 69 63 61 6c 6c 79  0d 12 70 0f e7 73 68 61  |rtically..p..sha|
00004fb0  72 70 65 6e 25 20 8c 0d  12 7a 0e 20 e7 6f 72 64  |rpen% ...z. .ord|
00004fc0  65 72 25 20 8c 0d 12 84  36 20 20 de 20 72 6d 25  |er% ....6  . rm%|
00004fd0  28 73 78 25 2b 37 2c 63  6f 6c 29 2c 72 6d 31 25  |(sx%+7,col),rm1%|
00004fe0  28 73 78 25 2b 37 2c 63  6f 6c 29 2c 72 6d 32 25  |(sx%+7,col),rm2%|
00004ff0  28 73 78 25 2b 37 2c 63  6f 6c 29 0d 12 8e 06 20  |(sx%+7,col).... |
00005000  cc 0d 12 98 33 20 20 de  20 72 6d 25 28 78 25 2b  |....3  . rm%(x%+|
00005010  37 2c 63 6f 6c 29 2c 72  6d 31 25 28 78 25 2b 37  |7,col),rm1%(x%+7|
00005020  2c 63 6f 6c 29 2c 72 6d  32 25 28 78 25 2b 37 2c  |,col),rm2%(x%+7,|
00005030  63 6f 6c 29 0d 12 a2 06  20 cd 0d 12 ac 05 cd 0d  |col).... .......|
00005040  12 b6 22 e7 68 69 73 74  25 84 65 71 75 61 6c 25  |..".hist%.equal%|
00005050  20 de 20 76 61 6c 73 25  28 32 35 36 2c 63 6f 6c  | . vals%(256,col|
00005060  29 0d 12 c0 2f de 20 6e  6c 25 28 78 25 2b 37 2c  |).../. nl%(x%+7,|
00005070  63 6f 6c 29 3a f4 20 6e  65 78 74 20 6c 69 6e 65  |col):. next line|
00005080  20 61 64 64 69 74 69 76  65 20 65 72 72 6f 72 73  | additive errors|
00005090  0d 12 ca 45 74 6f 74 61  6c 76 61 6c 73 25 3d 78  |...Etotalvals%=x|
000050a0  25 2a 28 63 6f 6c 2b 31  29 3a f4 20 74 6f 74 61  |%*(col+1):. tota|
000050b0  6c 20 6e 75 6d 62 65 72  20 6f 66 20 65 6c 65 6d  |l number of elem|
000050c0  65 6e 74 73 20 69 6e 20  61 20 73 63 61 6c 65 64  |ents in a scaled|
000050d0  20 6c 69 6e 65 0d 12 d4  47 74 6f 74 61 6c 76 61  | line...Gtotalva|
000050e0  6c 73 32 25 3d 73 78 25  2a 28 63 6f 6c 2b 31 29  |ls2%=sx%*(col+1)|
000050f0  3a f4 20 74 6f 74 61 6c  20 6e 75 6d 62 65 72 20  |:. total number |
00005100  6f 66 20 65 6c 65 6d 65  6e 74 73 20 69 6e 20 61  |of elements in a|
00005110  6e 20 69 6e 70 75 74 20  6c 69 6e 65 0d 12 de 36  |n input line...6|
00005120  e7 66 6c 61 67 3d 33 30  30 20 de 20 7a 32 25 28  |.flag=300 . z2%(|
00005130  73 78 25 2b 37 2c 63 6f  6c 29 3a f4 20 65 78 74  |sx%+7,col):. ext|
00005140  72 61 20 61 72 72 61 79  20 66 6f 72 20 41 72 56  |ra array for ArV|
00005150  69 73 0d 12 e8 16 e7 6e  63 6f 6c 3d 31 20 80 20  |is.....ncol=1 . |
00005160  6d 24 3d 22 43 22 20 8c  0d 12 f2 13 de 20 41 25  |m$="C" ...... A%|
00005170  28 31 36 29 2c 42 25 28  31 36 29 0d 12 fc aa 41  |(16),B%(16)....A|
00005180  25 28 29 3d 30 2c 26 30  30 30 30 30 30 30 31 2c  |%()=0,&00000001,|
00005190  26 30 38 30 30 30 30 30  31 2c 26 30 38 30 30 30  |&08000001,&08000|
000051a0  31 30 31 2c 26 30 38 30  38 30 31 30 31 2c 26 30  |101,&08080101,&0|
000051b0  38 30 38 30 31 30 33 2c  26 30 43 30 38 30 31 30  |8080103,&0C08010|
000051c0  33 2c 26 30 43 30 38 30  33 30 33 2c 26 30 43 30  |3,&0C080303,&0C0|
000051d0  43 30 33 30 33 2c 26 30  43 30 45 30 33 30 33 2c  |C0303,&0C0E0303,|
000051e0  26 30 43 30 45 30 37 30  33 2c 26 30 45 30 45 30  |&0C0E0703,&0E0E0|
000051f0  37 30 33 2c 26 30 45 30  45 30 37 30 37 2c 26 30  |703,&0E0E0707,&0|
00005200  45 30 46 30 37 30 37 2c  26 30 45 30 46 30 46 30  |E0F0707,&0E0F0F0|
00005210  37 2c 26 30 46 30 46 30  46 30 37 2c 26 30 46 30  |7,&0F0F0F07,&0F0|
00005220  46 30 46 30 46 0d 13 06  aa 42 25 28 29 3d 30 2c  |F0F0F....B%()=0,|
00005230  26 30 30 30 30 30 30 30  38 2c 26 30 31 30 30 30  |&00000008,&01000|
00005240  30 30 38 2c 26 30 31 30  30 30 38 30 38 2c 26 30  |008,&01000808,&0|
00005250  31 30 31 30 38 30 38 2c  26 30 31 30 31 30 38 30  |1010808,&0101080|
00005260  43 2c 26 30 33 30 31 30  38 30 43 2c 26 30 33 30  |C,&0301080C,&030|
00005270  31 30 43 30 43 2c 26 30  33 30 33 30 43 30 43 2c  |10C0C,&03030C0C,|
00005280  26 30 33 30 37 30 43 30  43 2c 26 30 33 30 37 30  |&03070C0C,&03070|
00005290  45 30 43 2c 26 30 37 30  37 30 45 30 43 2c 26 30  |E0C,&07070E0C,&0|
000052a0  37 30 37 30 45 30 45 2c  26 30 37 30 46 30 45 30  |7070E0E,&070F0E0|
000052b0  45 2c 26 30 37 30 46 30  46 30 45 2c 26 30 46 30  |E,&070F0F0E,&0F0|
000052c0  46 30 46 30 45 2c 26 30  46 30 46 30 46 30 46 0d  |F0F0E,&0F0F0F0F.|
000052d0  13 10 32 65 76 65 6e 5f  67 61 72 64 3d a4 64 69  |..2even_gard=.di|
000052e0  6d 28 31 37 2a 33 32 2a  34 29 3a 6f 64 64 5f 67  |m(17*32*4):odd_g|
000052f0  61 72 64 3d a4 64 69 6d  28 31 37 2a 33 32 2a 34  |ard=.dim(17*32*4|
00005300  29 0d 13 1a 43 e3 49 25  3d 30 b8 31 36 3a e3 4a  |)...C.I%=0.16:.J|
00005310  25 3d 30 b8 31 36 3a 65  76 65 6e 5f 67 61 72 64  |%=0.16:even_gard|
00005320  21 28 4a 25 2a 33 32 2a  34 2b 49 25 2a 34 29 3d  |!(J%*32*4+I%*4)=|
00005330  41 25 28 49 25 29 84 42  25 28 4a 25 29 3c 3c 34  |A%(I%).B%(J%)<<4|
00005340  3a ed 3a ed 0d 13 24 43  e3 49 25 3d 30 b8 31 36  |:.:...$C.I%=0.16|
00005350  3a e3 4a 25 3d 30 b8 31  36 3a 20 6f 64 64 5f 67  |:.J%=0.16: odd_g|
00005360  61 72 64 21 28 4a 25 2a  33 32 2a 34 2b 49 25 2a  |ard!(J%*32*4+I%*|
00005370  34 29 3d 42 25 28 49 25  29 84 41 25 28 4a 25 29  |4)=B%(I%).A%(J%)|
00005380  3c 3c 34 3a ed 3a ed 0d  13 2e 05 cd 0d 13 38 1a  |<<4:.:........8.|
00005390  63 6f 64 65 25 3d a4 64  69 6d 28 34 30 39 36 29  |code%=.dim(4096)|
000053a0  3a 53 50 3d 31 33 0d 13  42 15 e3 5a 3d 30 b8 32  |:SP=13..B..Z=0.2|
000053b0  88 32 3a 50 25 3d 63 6f  64 65 25 0d 13 4c 0d c8  |.2:P%=code%..L..|
000053c0  8e 20 6e 63 6f 6c 20 ca  0d 13 56 0a c9 20 32 35  |. ncol ...V.. 25|
000053d0  35 3a 0d 13 60 0a 5b 4f  50 54 20 5a 0d 13 6a 3f  |5:..`.[OPT Z..j?|
000053e0  3b 20 d6 20 66 73 25 2c  63 75 72 72 65 6e 74 25  |; . fs%,current%|
000053f0  28 29 2c 6e 65 78 74 25  28 29 2c 70 69 78 65 6c  |(),next%(),pixel|
00005400  20 61 64 64 72 65 73 73  25 2c 69 6e 63 72 65 6d  | address%,increm|
00005410  65 6e 74 25 2c 63 6f 75  6e 74 25 0d 13 74 08 2e  |ent%,count%..t..|
00005420  66 73 25 0d 13 7e 15 20  53 54 4d 46 44 20 53 50  |fs%..~. STMFD SP|
00005430  20 21 2c 7b 52 31 34 7d  0d 13 88 24 20 4c 44 52  | !,{R14}...$ LDR|
00005440  20 52 31 30 2c 5b 52 39  2c 23 34 2a 38 5d 20 3b  | R10,[R9,#4*8] ;|
00005450  61 64 64 72 20 63 75 72  72 65 6e 74 0d 13 92 21  |addr current...!|
00005460  20 4c 44 52 20 52 31 31  2c 5b 52 39 2c 23 33 2a  | LDR R11,[R9,#3*|
00005470  38 5d 20 3b 61 64 64 72  20 6e 65 78 74 0d 13 9c  |8] ;addr next...|
00005480  2a 20 4c 44 52 20 52 31  32 2c 5b 52 39 2c 23 32  |* LDR R12,[R9,#2|
00005490  2a 38 5d 20 3b 61 64 64  72 20 70 69 78 65 6c 20  |*8] ;addr pixel |
000054a0  61 64 64 72 65 73 73 0d  13 a6 21 20 4c 44 52 20  |address...! LDR |
000054b0  52 31 32 2c 5b 52 31 32  5d 20 3b 70 69 78 65 6c  |R12,[R12] ;pixel|
000054c0  20 61 64 64 72 65 73 73  0d 13 b0 1e 20 4c 44 52  | address.... LDR|
000054d0  20 52 38 2c 5b 52 39 2c  23 38 5d 20 3b 61 64 64  | R8,[R9,#8] ;add|
000054e0  72 20 73 74 65 70 0d 13  ba 16 20 4c 44 52 20 52  |r step.... LDR R|
000054f0  38 2c 5b 52 38 5d 20 3b  73 74 65 70 0d 13 c4 1c  |8,[R8] ;step....|
00005500  20 4c 44 52 20 52 39 2c  5b 52 39 5d 20 3b 61 64  | LDR R9,[R9] ;ad|
00005510  64 72 20 63 6f 75 6e 74  0d 13 ce 17 20 4c 44 52  |dr count.... LDR|
00005520  20 52 39 2c 5b 52 39 5d  20 3b 63 6f 75 6e 74 0d  | R9,[R9] ;count.|
00005530  13 d8 20 20 4c 44 52 20  52 34 2c 5b 52 31 30 5d  |..  LDR R4,[R10]|
00005540  2c 52 38 20 3b 6d 6f 6e  6f 20 76 61 6c 75 65 0d  |,R8 ;mono value.|
00005550  13 e2 3f 20 54 45 51 20  52 38 2c 23 30 3a 4d 4f  |..? TEQ R8,#0:MO|
00005560  56 50 4c 20 52 31 2c 23  31 3a 4d 56 4e 4d 49 20  |VPL R1,#1:MVNMI |
00005570  52 31 2c 23 30 20 3b 2b  2f 2d 20 31 20 66 6f 72  |R1,#0 ;+/- 1 for|
00005580  20 73 70 72 69 74 65 20  6f 75 74 70 75 74 0d 13  | sprite output..|
00005590  ec 0b 2e 66 73 6c 6f 6f  70 0d 13 f6 3b 20 54 45  |...fsloop...; TE|
000055a0  51 20 52 34 2c 23 30 3a  4d 4f 56 4d 49 20 52 34  |Q R4,#0:MOVMI R4|
000055b0  2c 23 30 3a 43 4d 50 20  52 34 2c 23 46 3a 4d 4f  |,#0:CMP R4,#F:MO|
000055c0  56 43 53 20 52 34 2c 23  46 20 3b 30 3c 3d 76 61  |VCS R4,#F ;0<=va|
000055d0  6c 3c 3d 31 0d 14 00 1a  20 4d 4f 56 20 52 30 2c  |l<=1.... MOV R0,|
000055e0  52 34 2c 4c 53 52 20 23  62 69 74 73 2d 38 0d 14  |R4,LSR #bits-8..|
000055f0  0a 2f 20 43 4d 50 20 52  30 2c 23 32 35 36 3a 4d  |./ CMP R0,#256:M|
00005600  4f 56 43 53 20 52 30 2c  23 32 35 35 3a 53 54 52  |OVCS R0,#255:STR|
00005610  42 20 52 30 2c 5b 52 31  32 5d 2c 52 31 0d 14 14  |B R0,[R12],R1...|
00005620  1a 20 4d 4f 56 20 52 32  2c 52 30 2c 4c 53 4c 20  |. MOV R2,R0,LSL |
00005630  23 62 69 74 73 2d 38 0d  14 1e 2b 20 53 55 42 20  |#bits-8...+ SUB |
00005640  52 34 2c 52 34 2c 52 32  20 3b 73 75 62 74 72 61  |R4,R4,R2 ;subtra|
00005650  63 74 20 63 6f 6e 76 65  72 74 65 64 20 76 61 6c  |ct converted val|
00005660  75 65 0d 14 28 10 20 4d  4f 56 43 53 20 52 34 2c  |ue..(. MOVCS R4,|
00005670  23 30 0d 14 32 1c 20 41  44 44 20 52 32 2c 52 34  |#0..2. ADD R2,R4|
00005680  2c 52 34 2c 4c 53 4c 20  23 31 20 3b 2a 33 0d 14  |,R4,LSL #1 ;*3..|
00005690  3c 30 20 4c 44 52 20 52  33 2c 5b 52 31 31 2c 2d  |<0 LDR R3,[R11,-|
000056a0  52 38 5d 3a 41 44 44 20  52 33 2c 52 33 2c 52 32  |R8]:ADD R3,R3,R2|
000056b0  2c 41 53 52 20 23 34 20  3b 2b 33 2f 31 36 0d 14  |,ASR #4 ;+3/16..|
000056c0  46 15 20 53 54 52 20 52  33 2c 5b 52 31 31 2c 2d  |F. STR R3,[R11,-|
000056d0  52 38 5d 0d 14 50 1c 20  41 44 44 20 52 32 2c 52  |R8]..P. ADD R2,R|
000056e0  34 2c 52 34 2c 4c 53 4c  20 23 32 20 3b 2a 35 0d  |4,R4,LSL #2 ;*5.|
000056f0  14 5a 2c 20 4c 44 52 20  52 33 2c 5b 52 31 31 5d  |.Z, LDR R3,[R11]|
00005700  3a 41 44 44 20 52 33 2c  52 33 2c 52 32 2c 41 53  |:ADD R3,R3,R2,AS|
00005710  52 20 23 34 20 3b 2b 35  2f 31 36 0d 14 64 11 20  |R #4 ;+5/16..d. |
00005720  53 54 52 20 52 33 2c 5b  52 31 31 5d 0d 14 6e 1a  |STR R3,[R11]..n.|
00005730  20 4d 4f 56 20 52 33 2c  52 34 2c 41 53 52 20 23  | MOV R3,R4,ASR #|
00005740  34 20 3b 2f 31 36 0d 14  78 31 20 53 54 52 20 52  |4 ;/16..x1 STR R|
00005750  33 2c 5b 52 31 31 2c 52  38 5d 21 20 3b 6e 6f 74  |3,[R11,R8]! ;not|
00005760  20 73 65 65 6e 20 73 6f  20 66 61 72 20 69 6e 63  | seen so far inc|
00005770  20 6e 6c 20 70 74 72 0d  14 82 1c 20 52 53 42 20  | nl ptr.... RSB |
00005780  52 32 2c 52 34 2c 52 34  2c 4c 53 4c 20 23 33 20  |R2,R4,R4,LSL #3 |
00005790  3b 2a 37 0d 14 8c 26 20  4c 44 52 20 52 34 2c 5b  |;*7...& LDR R4,[|
000057a0  52 31 30 5d 2c 52 38 20  3b 6e 65 78 74 20 6c 69  |R10],R8 ;next li|
000057b0  67 68 74 20 76 61 6c 75  65 0d 14 96 40 20 41 44  |ght value...@ AD|
000057c0  44 20 52 34 2c 52 34 2c  52 32 2c 41 53 52 20 23  |D R4,R4,R2,ASR #|
000057d0  34 20 3b 6e 65 78 74 20  76 61 6c 75 65 20 2b 37  |4 ;next value +7|
000057e0  2f 31 36 20 6f 66 20 65  72 72 6f 72 20 2d 3e 20  |/16 of error -> |
000057f0  6e 65 77 20 76 61 6c 75  65 0d 14 a0 1d 20 53 55  |new value.... SU|
00005800  42 53 20 52 39 2c 52 39  2c 23 31 3a 42 4e 45 20  |BS R9,R9,#1:BNE |
00005810  66 73 6c 6f 6f 70 0d 14  aa 15 20 4c 44 4d 46 44  |fsloop.... LDMFD|
00005820  20 53 50 20 21 2c 7b 50  43 7d 5e 0d 14 b4 06 20  | SP !,{PC}^.... |
00005830  5d 0d 14 be 09 c9 20 36  33 3a 0d 14 c8 0a 5b 4f  |]..... 63:....[O|
00005840  50 54 20 5a 0d 14 d2 18  2e 73 6c 61 73 68 66 69  |PT Z.....slashfi|
00005850  66 74 65 65 6e 20 45 51  55 44 20 30 0d 14 dc 10  |fteen EQUD 0....|
00005860  20 45 51 55 44 20 34 2f  31 35 2a 46 0d 14 e6 10  | EQUD 4/15*F....|
00005870  20 45 51 55 44 20 38 2f  31 35 2a 46 0d 14 f0 11  | EQUD 8/15*F....|
00005880  20 45 51 55 44 20 31 32  2f 31 35 2a 46 0d 14 fa  | EQUD 12/15*F...|
00005890  08 2e 66 73 25 0d 15 04  15 20 53 54 4d 46 44 20  |..fs%.... STMFD |
000058a0  53 50 20 21 2c 7b 52 31  34 7d 0d 15 0e 24 20 4c  |SP !,{R14}...$ L|
000058b0  44 52 20 52 31 30 2c 5b  52 39 2c 23 34 2a 38 5d  |DR R10,[R9,#4*8]|
000058c0  20 3b 61 64 64 72 20 63  75 72 72 65 6e 74 0d 15  | ;addr current..|
000058d0  18 21 20 4c 44 52 20 52  31 31 2c 5b 52 39 2c 23  |.! LDR R11,[R9,#|
000058e0  33 2a 38 5d 20 3b 61 64  64 72 20 6e 65 78 74 0d  |3*8] ;addr next.|
000058f0  15 22 2a 20 4c 44 52 20  52 31 32 2c 5b 52 39 2c  |."* LDR R12,[R9,|
00005900  23 32 2a 38 5d 20 3b 61  64 64 72 20 70 69 78 65  |#2*8] ;addr pixe|
00005910  6c 20 61 64 64 72 65 73  73 0d 15 2c 21 20 4c 44  |l address..,! LD|
00005920  52 20 52 31 32 2c 5b 52  31 32 5d 20 3b 70 69 78  |R R12,[R12] ;pix|
00005930  65 6c 20 61 64 64 72 65  73 73 0d 15 36 1e 20 4c  |el address..6. L|
00005940  44 52 20 52 38 2c 5b 52  39 2c 23 38 5d 20 3b 61  |DR R8,[R9,#8] ;a|
00005950  64 64 72 20 73 74 65 70  0d 15 40 16 20 4c 44 52  |ddr step..@. LDR|
00005960  20 52 38 2c 5b 52 38 5d  20 3b 73 74 65 70 0d 15  | R8,[R8] ;step..|
00005970  4a 1c 20 4c 44 52 20 52  39 2c 5b 52 39 5d 20 3b  |J. LDR R9,[R9] ;|
00005980  61 64 64 72 20 63 6f 75  6e 74 0d 15 54 17 20 4c  |addr count..T. L|
00005990  44 52 20 52 39 2c 5b 52  39 5d 20 3b 63 6f 75 6e  |DR R9,[R9] ;coun|
000059a0  74 0d 15 5e 14 20 4c 44  52 20 52 34 2c 5b 52 31  |t..^. LDR R4,[R1|
000059b0  30 5d 20 3b 72 0d 15 68  17 20 4c 44 52 20 52 35  |0] ;r..h. LDR R5|
000059c0  2c 5b 52 31 30 2c 23 34  5d 20 3b 67 0d 15 72 17  |,[R10,#4] ;g..r.|
000059d0  20 4c 44 52 20 52 36 2c  5b 52 31 30 2c 23 38 5d  | LDR R6,[R10,#8]|
000059e0  20 3b 62 0d 15 7c 18 20  41 44 52 20 52 37 2c 73  | ;b..|. ADR R7,s|
000059f0  6c 61 73 68 66 69 66 74  65 65 6e 0d 15 86 3f 20  |lashfifteen...? |
00005a00  54 45 51 20 52 38 2c 23  30 3a 4d 4f 56 50 4c 20  |TEQ R8,#0:MOVPL |
00005a10  52 31 2c 23 31 3a 4d 56  4e 4d 49 20 52 31 2c 23  |R1,#1:MVNMI R1,#|
00005a20  30 20 3b 2b 2f 2d 20 31  20 66 6f 72 20 73 70 72  |0 ;+/- 1 for spr|
00005a30  69 74 65 20 6f 75 74 70  75 74 0d 15 90 0b 2e 66  |ite output.....f|
00005a40  73 6c 6f 6f 70 0d 15 9a  1a 20 41 44 44 20 52 31  |sloop.... ADD R1|
00005a50  30 2c 52 31 30 2c 52 38  20 3b 2b 73 74 65 70 0d  |0,R10,R8 ;+step.|
00005a60  15 a4 39 20 54 45 51 20  52 34 2c 23 30 3a 4d 4f  |..9 TEQ R4,#0:MO|
00005a70  56 4d 49 20 52 34 2c 23  30 3a 43 4d 50 20 52 34  |VMI R4,#0:CMP R4|
00005a80  2c 23 46 3a 4d 4f 56 43  53 20 52 34 2c 23 46 20  |,#F:MOVCS R4,#F |
00005a90  3b 30 3c 3d 72 3c 3d 31  0d 15 ae 1d 20 52 53 42  |;0<=r<=1.... RSB|
00005aa0  20 52 33 2c 52 34 2c 52  34 2c 4c 53 4c 20 23 34  | R3,R4,R4,LSL #4|
00005ab0  20 3b 2a 31 35 0d 15 b8  30 20 4d 4f 56 53 20 52  | ;*15...0 MOVS R|
00005ac0  33 2c 52 33 2c 4c 53 52  20 23 32 2b 62 69 74 73  |3,R3,LSR #2+bits|
00005ad0  20 3b 66 69 6e 61 6c 20  69 6e 74 30 2c 20 31 2c  | ;final int0, 1,|
00005ae0  20 32 2c 20 33 0d 15 c2  35 20 4c 44 52 4e 45 20  | 2, 3...5 LDRNE |
00005af0  52 32 2c 5b 52 37 2c 52  33 2c 4c 53 4c 20 23 32  |R2,[R7,R3,LSL #2|
00005b00  5d 20 3b 64 69 76 69 64  65 20 62 79 20 31 35 20  |] ;divide by 15 |
00005b10  66 72 6f 6d 20 74 61 62  6c 65 0d 15 cc 2d 20 53  |from table...- S|
00005b20  55 42 4e 45 20 52 34 2c  52 34 2c 52 32 20 3b 73  |UBNE R4,R4,R2 ;s|
00005b30  75 62 74 72 61 63 74 20  63 6f 6e 76 65 72 74 65  |ubtract converte|
00005b40  64 20 76 61 6c 75 65 0d  15 d6 2c 20 80 20 52 32  |d value..., . R2|
00005b50  2c 52 33 2c 23 31 3a 4d  4f 56 20 52 30 2c 52 32  |,R3,#1:MOV R0,R2|
00005b60  2c 4c 53 4c 20 23 32 20  3b 62 69 74 20 32 20 6f  |,LSL #2 ;bit 2 o|
00005b70  66 20 72 0d 15 e0 2e 20  80 20 52 32 2c 52 33 2c  |f r.... . R2,R3,|
00005b80  23 32 3a 84 52 20 52 30  2c 52 30 2c 52 32 2c 4c  |#2:.R R0,R0,R2,L|
00005b90  53 4c 20 23 33 20 3b 62  69 74 20 33 20 6f 66 20  |SL #3 ;bit 3 of |
00005ba0  72 0d 15 ea 39 20 54 45  51 20 52 35 2c 23 30 3a  |r...9 TEQ R5,#0:|
00005bb0  4d 4f 56 4d 49 20 52 35  2c 23 30 3a 43 4d 50 20  |MOVMI R5,#0:CMP |
00005bc0  52 35 2c 23 46 3a 4d 4f  56 43 53 20 52 35 2c 23  |R5,#F:MOVCS R5,#|
00005bd0  46 20 3b 30 3c 3d 67 3c  3d 31 0d 15 f4 1d 20 52  |F ;0<=g<=1.... R|
00005be0  53 42 20 52 33 2c 52 35  2c 52 35 2c 4c 53 4c 20  |SB R3,R5,R5,LSL |
00005bf0  23 34 20 3b 2a 31 35 0d  15 fe 30 20 4d 4f 56 53  |#4 ;*15...0 MOVS|
00005c00  20 52 33 2c 52 33 2c 4c  53 52 20 23 32 2b 62 69  | R3,R3,LSR #2+bi|
00005c10  74 73 20 3b 66 69 6e 61  6c 20 69 6e 74 30 2c 20  |ts ;final int0, |
00005c20  31 2c 20 32 2c 20 33 0d  16 08 35 20 4c 44 52 4e  |1, 2, 3...5 LDRN|
00005c30  45 20 52 32 2c 5b 52 37  2c 52 33 2c 4c 53 4c 20  |E R2,[R7,R3,LSL |
00005c40  23 32 5d 20 3b 64 69 76  69 64 65 20 62 79 20 31  |#2] ;divide by 1|
00005c50  35 20 66 72 6f 6d 20 74  61 62 6c 65 0d 16 12 2d  |5 from table...-|
00005c60  20 53 55 42 4e 45 20 52  35 2c 52 35 2c 52 32 20  | SUBNE R5,R5,R2 |
00005c70  3b 73 75 62 74 72 61 63  74 20 63 6f 6e 76 65 72  |;subtract conver|
00005c80  74 65 64 20 76 61 6c 75  65 0d 16 1c 2a 20 84 52  |ted value...* .R|
00005c90  20 52 30 2c 52 30 2c 52  33 2c 4c 53 4c 20 23 35  | R0,R0,R3,LSL #5|
00005ca0  20 3b 62 69 74 73 20 33  20 61 6e 64 20 32 20 6f  | ;bits 3 and 2 o|
00005cb0  66 20 67 0d 16 26 39 20  54 45 51 20 52 36 2c 23  |f g..&9 TEQ R6,#|
00005cc0  30 3a 4d 4f 56 4d 49 20  52 36 2c 23 30 3a 43 4d  |0:MOVMI R6,#0:CM|
00005cd0  50 20 52 36 2c 23 46 3a  4d 4f 56 43 53 20 52 36  |P R6,#F:MOVCS R6|
00005ce0  2c 23 46 20 3b 30 3c 3d  62 3c 3d 31 0d 16 30 1d  |,#F ;0<=b<=1..0.|
00005cf0  20 52 53 42 20 52 33 2c  52 36 2c 52 36 2c 4c 53  | RSB R3,R6,R6,LS|
00005d00  4c 20 23 34 20 3b 2a 31  35 0d 16 3a 30 20 4d 4f  |L #4 ;*15..:0 MO|
00005d10  56 53 20 52 33 2c 52 33  2c 4c 53 52 20 23 32 2b  |VS R3,R3,LSR #2+|
00005d20  62 69 74 73 20 3b 66 69  6e 61 6c 20 69 6e 74 30  |bits ;final int0|
00005d30  2c 20 31 2c 20 32 2c 20  33 0d 16 44 35 20 4c 44  |, 1, 2, 3..D5 LD|
00005d40  52 4e 45 20 52 32 2c 5b  52 37 2c 52 33 2c 4c 53  |RNE R2,[R7,R3,LS|
00005d50  4c 20 23 32 5d 20 3b 64  69 76 69 64 65 20 62 79  |L #2] ;divide by|
00005d60  20 31 35 20 66 72 6f 6d  20 74 61 62 6c 65 0d 16  | 15 from table..|
00005d70  4e 2d 20 53 55 42 4e 45  20 52 36 2c 52 36 2c 52  |N- SUBNE R6,R6,R|
00005d80  32 20 3b 73 75 62 74 72  61 63 74 20 63 6f 6e 76  |2 ;subtract conv|
00005d90  65 72 74 65 64 20 76 61  6c 75 65 0d 16 58 2e 20  |erted value..X. |
00005da0  80 20 52 32 2c 52 33 2c  23 31 3a 84 52 20 52 30  |. R2,R3,#1:.R R0|
00005db0  2c 52 30 2c 52 32 2c 4c  53 4c 20 23 33 20 3b 62  |,R0,R2,LSL #3 ;b|
00005dc0  69 74 20 32 20 6f 66 20  62 0d 16 62 2e 20 80 20  |it 2 of b..b. . |
00005dd0  52 32 2c 52 33 2c 23 32  3a 84 52 20 52 30 2c 52  |R2,R3,#2:.R R0,R|
00005de0  30 2c 52 32 2c 4c 53 4c  20 23 36 20 3b 62 69 74  |0,R2,LSL #6 ;bit|
00005df0  20 33 20 6f 66 20 62 0d  16 6c 06 20 5d 0d 16 76  | 3 of b..l. ]..v|
00005e00  0e e7 6d 24 3c 3e 22 54  22 20 8c 0d 16 80 0a 5b  |..m$<>"T" .....[|
00005e10  4f 50 54 20 5a 0d 16 8a  30 20 41 44 44 20 52 32  |OPT Z...0 ADD R2|
00005e20  2c 52 34 2c 52 35 3a 41  44 44 20 52 32 2c 52 32  |,R4,R5:ADD R2,R2|
00005e30  2c 52 36 20 3b 72 2b 67  2b 62 20 72 65 6d 61 69  |,R6 ;r+g+b remai|
00005e40  6e 64 65 72 73 0d 16 94  27 20 41 44 44 20 52 32  |nders...' ADD R2|
00005e50  2c 52 32 2c 52 32 2c 4c  53 4c 20 23 32 20 3b 61  |,R2,R2,LSL #2 ;a|
00005e60  76 65 72 61 67 65 20 2a  31 35 2f 33 0d 16 9e 18  |verage *15/3....|
00005e70  20 4d 4f 56 20 52 32 2c  52 32 2c 4c 53 52 20 23  | MOV R2,R2,LSR #|
00005e80  62 69 74 73 0d 16 a8 1a  20 43 4d 50 20 52 32 2c  |bits.... CMP R2,|
00005e90  23 33 3a 4d 4f 56 43 53  20 52 32 2c 23 33 0d 16  |#3:MOVCS R2,#3..|
00005ea0  b2 10 20 84 52 20 52 30  2c 52 30 2c 52 32 0d 16  |.. .R R0,R0,R2..|
00005eb0  bc 21 20 4c 44 52 20 52  32 2c 5b 52 37 2c 52 32  |.! LDR R2,[R7,R2|
00005ec0  2c 4c 53 4c 20 23 32 5d  20 3b 2a 31 2f 31 35 0d  |,LSL #2] ;*1/15.|
00005ed0  16 c6 24 20 53 55 42 20  52 34 2c 52 34 2c 52 32  |..$ SUB R4,R4,R2|
00005ee0  2c 4c 53 52 20 23 32 20  3b 73 75 62 74 72 61 63  |,LSR #2 ;subtrac|
00005ef0  74 20 74 0d 16 d0 31 20  53 55 42 20 52 35 2c 52  |t t...1 SUB R5,R|
00005f00  35 2c 52 32 2c 4c 53 52  20 23 32 20 3b 6e 6f 74  |5,R2,LSR #2 ;not|
00005f10  65 20 74 61 62 6c 65 20  34 2a 20 74 6f 6f 20 6c  |e table 4* too l|
00005f20  61 72 67 65 0d 16 da 18  20 53 55 42 20 52 36 2c  |arge.... SUB R6,|
00005f30  52 36 2c 52 32 2c 4c 53  52 20 23 32 0d 16 e4 06  |R6,R2,LSR #2....|
00005f40  20 5d 0d 16 ee 05 cd 0d  16 f8 0a 5b 4f 50 54 20  | ].........[OPT |
00005f50  5a 0d 17 02 15 20 53 54  52 42 20 52 30 2c 5b 52  |Z.... STRB R0,[R|
00005f60  31 32 5d 2c 52 31 0d 17  0c 1d 20 41 44 44 20 52  |12],R1.... ADD R|
00005f70  30 2c 52 31 31 2c 23 34  20 3b 6e 6c 20 67 25 28  |0,R11,#4 ;nl g%(|
00005f80  53 25 29 0d 17 16 1d 20  41 44 44 20 52 32 2c 52  |S%).... ADD R2,R|
00005f90  34 2c 52 34 2c 4c 53 4c  20 23 31 20 3b 72 2a 33  |4,R4,LSL #1 ;r*3|
00005fa0  0d 17 20 30 20 4c 44 52  20 52 33 2c 5b 52 31 31  |.. 0 LDR R3,[R11|
00005fb0  2c 2d 52 38 5d 3a 41 44  44 20 52 33 2c 52 33 2c  |,-R8]:ADD R3,R3,|
00005fc0  52 32 2c 41 53 52 20 23  34 20 3b 2b 33 2f 31 36  |R2,ASR #4 ;+3/16|
00005fd0  0d 17 2a 15 20 53 54 52  20 52 33 2c 5b 52 31 31  |..*. STR R3,[R11|
00005fe0  2c 2d 52 38 5d 0d 17 34  1d 20 41 44 44 20 52 32  |,-R8]..4. ADD R2|
00005ff0  2c 52 34 2c 52 34 2c 4c  53 4c 20 23 32 20 3b 72  |,R4,R4,LSL #2 ;r|
00006000  2a 35 0d 17 3e 2c 20 4c  44 52 20 52 33 2c 5b 52  |*5..>, LDR R3,[R|
00006010  31 31 5d 3a 41 44 44 20  52 33 2c 52 33 2c 52 32  |11]:ADD R3,R3,R2|
00006020  2c 41 53 52 20 23 34 20  3b 2b 35 2f 31 36 0d 17  |,ASR #4 ;+5/16..|
00006030  48 11 20 53 54 52 20 52  33 2c 5b 52 31 31 5d 0d  |H. STR R3,[R11].|
00006040  17 52 1b 20 4d 4f 56 20  52 33 2c 52 34 2c 41 53  |.R. MOV R3,R4,AS|
00006050  52 20 23 34 20 3b 72 2f  31 36 0d 17 5c 31 20 53  |R #4 ;r/16..\1 S|
00006060  54 52 20 52 33 2c 5b 52  31 31 2c 52 38 5d 21 20  |TR R3,[R11,R8]! |
00006070  3b 6e 6f 74 20 73 65 65  6e 20 73 6f 20 66 61 72  |;not seen so far|
00006080  20 69 6e 63 20 6e 6c 20  70 74 72 0d 17 66 1d 20  | inc nl ptr..f. |
00006090  52 53 42 20 52 32 2c 52  34 2c 52 34 2c 4c 53 4c  |RSB R2,R4,R4,LSL|
000060a0  20 23 33 20 3b 72 2a 37  0d 17 70 25 20 4c 44 52  | #3 ;r*7..p% LDR|
000060b0  20 52 34 2c 5b 52 31 30  5d 20 3b 6e 65 78 74 20  | R4,[R10] ;next |
000060c0  72 20 6c 69 67 68 74 20  76 61 6c 75 65 0d 17 7a  |r light value..z|
000060d0  3e 20 41 44 44 20 52 34  2c 52 34 2c 52 32 2c 41  |> ADD R4,R4,R2,A|
000060e0  53 52 20 23 34 20 3b 6e  65 78 74 20 76 61 6c 75  |SR #4 ;next valu|
000060f0  65 20 2b 37 2f 31 36 20  6f 66 20 72 20 65 72 72  |e +7/16 of r err|
00006100  6f 72 20 2d 3e 20 6e 65  77 20 72 0d 17 84 1d 20  |or -> new r.... |
00006110  41 44 44 20 52 32 2c 52  35 2c 52 35 2c 4c 53 4c  |ADD R2,R5,R5,LSL|
00006120  20 23 31 20 3b 67 2a 33  0d 17 8e 2f 20 4c 44 52  | #1 ;g*3.../ LDR|
00006130  20 52 33 2c 5b 52 30 2c  2d 52 38 5d 3a 41 44 44  | R3,[R0,-R8]:ADD|
00006140  20 52 33 2c 52 33 2c 52  32 2c 41 53 52 20 23 34  | R3,R3,R2,ASR #4|
00006150  20 3b 2b 33 2f 31 36 0d  17 98 14 20 53 54 52 20  | ;+3/16.... STR |
00006160  52 33 2c 5b 52 30 2c 2d  52 38 5d 0d 17 a2 1b 20  |R3,[R0,-R8].... |
00006170  4d 4f 56 20 52 33 2c 52  35 2c 41 53 52 20 23 34  |MOV R3,R5,ASR #4|
00006180  20 3b 67 2f 31 36 0d 17  ac 24 20 53 54 52 20 52  | ;g/16...$ STR R|
00006190  33 2c 5b 52 30 2c 52 38  5d 20 3b 6e 6f 74 20 73  |3,[R0,R8] ;not s|
000061a0  65 65 6e 20 73 6f 20 66  61 72 0d 17 b6 1d 20 41  |een so far.... A|
000061b0  44 44 20 52 32 2c 52 35  2c 52 35 2c 4c 53 4c 20  |DD R2,R5,R5,LSL |
000061c0  23 32 20 3b 67 2a 35 0d  17 c0 2b 20 4c 44 52 20  |#2 ;g*5...+ LDR |
000061d0  52 33 2c 5b 52 30 5d 3a  41 44 44 20 52 33 2c 52  |R3,[R0]:ADD R3,R|
000061e0  33 2c 52 32 2c 41 53 52  20 23 34 20 3b 2b 35 2f  |3,R2,ASR #4 ;+5/|
000061f0  31 36 0d 17 ca 33 20 53  54 52 20 52 33 2c 5b 52  |16...3 STR R3,[R|
00006200  30 5d 2c 23 34 20 3b 63  6f 6d 70 75 74 65 73 20  |0],#4 ;computes |
00006210  6e 6c 20 62 20 69 6e 74  6f 20 74 68 65 20 62 61  |nl b into the ba|
00006220  72 67 61 69 6e 0d 17 d4  1d 20 52 53 42 20 52 32  |rgain.... RSB R2|
00006230  2c 52 35 2c 52 35 2c 4c  53 4c 20 23 33 20 3b 67  |,R5,R5,LSL #3 ;g|
00006240  2a 37 0d 17 de 28 20 4c  44 52 20 52 35 2c 5b 52  |*7...( LDR R5,[R|
00006250  31 30 2c 23 34 5d 20 3b  6e 65 78 74 20 67 20 6c  |10,#4] ;next g l|
00006260  69 67 68 74 20 76 61 6c  75 65 0d 17 e8 3e 20 41  |ight value...> A|
00006270  44 44 20 52 35 2c 52 35  2c 52 32 2c 41 53 52 20  |DD R5,R5,R2,ASR |
00006280  23 34 20 3b 6e 65 78 74  20 76 61 6c 75 65 20 2b  |#4 ;next value +|
00006290  37 2f 31 36 20 6f 66 20  67 20 65 72 72 6f 72 20  |7/16 of g error |
000062a0  2d 3e 20 6e 65 77 20 67  0d 17 f2 1d 20 41 44 44  |-> new g.... ADD|
000062b0  20 52 32 2c 52 36 2c 52  36 2c 4c 53 4c 20 23 31  | R2,R6,R6,LSL #1|
000062c0  20 3b 62 2a 33 0d 17 fc  2f 20 4c 44 52 20 52 33  | ;b*3.../ LDR R3|
000062d0  2c 5b 52 30 2c 2d 52 38  5d 3a 41 44 44 20 52 33  |,[R0,-R8]:ADD R3|
000062e0  2c 52 33 2c 52 32 2c 41  53 52 20 23 34 20 3b 2b  |,R3,R2,ASR #4 ;+|
000062f0  33 2f 31 36 0d 18 06 14  20 53 54 52 20 52 33 2c  |3/16.... STR R3,|
00006300  5b 52 30 2c 2d 52 38 5d  0d 18 10 1d 20 41 44 44  |[R0,-R8].... ADD|
00006310  20 52 32 2c 52 36 2c 52  36 2c 4c 53 4c 20 23 32  | R2,R6,R6,LSL #2|
00006320  20 3b 62 2a 35 0d 18 1a  2b 20 4c 44 52 20 52 33  | ;b*5...+ LDR R3|
00006330  2c 5b 52 30 5d 3a 41 44  44 20 52 33 2c 52 33 2c  |,[R0]:ADD R3,R3,|
00006340  52 32 2c 41 53 52 20 23  34 20 3b 2b 35 2f 31 36  |R2,ASR #4 ;+5/16|
00006350  0d 18 24 10 20 53 54 52  20 52 33 2c 5b 52 30 5d  |..$. STR R3,[R0]|
00006360  0d 18 2e 1b 20 4d 4f 56  20 52 33 2c 52 36 2c 41  |.... MOV R3,R6,A|
00006370  53 52 20 23 34 20 3b 62  2f 31 36 0d 18 38 24 20  |SR #4 ;b/16..8$ |
00006380  53 54 52 20 52 33 2c 5b  52 30 2c 52 38 5d 20 3b  |STR R3,[R0,R8] ;|
00006390  6e 6f 74 20 73 65 65 6e  20 73 6f 20 66 61 72 0d  |not seen so far.|
000063a0  18 42 1d 20 52 53 42 20  52 32 2c 52 36 2c 52 36  |.B. RSB R2,R6,R6|
000063b0  2c 4c 53 4c 20 23 33 20  3b 62 2a 37 0d 18 4c 28  |,LSL #3 ;b*7..L(|
000063c0  20 4c 44 52 20 52 36 2c  5b 52 31 30 2c 23 38 5d  | LDR R6,[R10,#8]|
000063d0  20 3b 6e 65 78 74 20 62  20 6c 69 67 68 74 20 76  | ;next b light v|
000063e0  61 6c 75 65 0d 18 56 3e  20 41 44 44 20 52 36 2c  |alue..V> ADD R6,|
000063f0  52 36 2c 52 32 2c 41 53  52 20 23 34 20 3b 6e 65  |R6,R2,ASR #4 ;ne|
00006400  78 74 20 76 61 6c 75 65  20 2b 37 2f 31 36 20 6f  |xt value +7/16 o|
00006410  66 20 62 20 65 72 72 6f  72 20 2d 3e 20 6e 65 77  |f b error -> new|
00006420  20 62 0d 18 60 1d 20 53  55 42 53 20 52 39 2c 52  | b..`. SUBS R9,R|
00006430  39 2c 23 31 3a 42 4e 45  20 66 73 6c 6f 6f 70 0d  |9,#1:BNE fsloop.|
00006440  18 6a 15 20 4c 44 4d 46  44 20 53 50 20 21 2c 7b  |.j. LDMFD SP !,{|
00006450  50 43 7d 5e 0d 18 74 06  20 5d 0d 18 7e 09 c9 20  |PC}^..t. ]..~.. |
00006460  31 35 3a 0d 18 88 0b c8  8e 20 6d 24 20 ca 0d 18  |15:...... m$ ...|
00006470  92 1b c9 20 22 44 22 3a  f4 20 4e 6f 20 74 61 62  |... "D":. No tab|
00006480  6c 65 20 6e 65 65 64 65  64 0d 18 9c 09 c9 20 22  |le needed..... "|
00006490  43 22 0d 18 a6 0a 5b 4f  50 54 20 5a 0d 18 b0 14  |C"....[OPT Z....|
000064a0  2e 64 69 76 74 61 62 6c  65 20 45 51 55 44 20 30  |.divtable EQUD 0|
000064b0  0d 18 ba 0f 20 45 51 55  44 20 31 2f 33 2a 46 0d  |.... EQUD 1/3*F.|
000064c0  18 c4 0f 20 45 51 55 44  20 32 2f 33 2a 46 0d 18  |... EQUD 2/3*F..|
000064d0  ce 0b 20 45 51 55 44 20  46 0d 18 d8 06 20 5d 0d  |.. EQUD F.... ].|
000064e0  18 e2 09 c9 20 22 54 22  0d 18 ec 0a 5b 4f 50 54  |.... "T"....[OPT|
000064f0  20 5a 0d 18 f6 14 2e 64  69 76 74 61 62 6c 65 20  | Z.....divtable |
00006500  45 51 55 44 20 30 0d 19  00 10 20 45 51 55 44 20  |EQUD 0.... EQUD |
00006510  31 2f 31 35 2a 46 0d 19  0a 10 20 45 51 55 44 20  |1/15*F.... EQUD |
00006520  32 2f 31 35 2a 46 0d 19  14 10 20 45 51 55 44 20  |2/15*F.... EQUD |
00006530  33 2f 31 35 2a 46 0d 19  1e 10 20 45 51 55 44 20  |3/15*F.... EQUD |
00006540  34 2f 31 35 2a 46 0d 19  28 10 20 45 51 55 44 20  |4/15*F..(. EQUD |
00006550  35 2f 31 35 2a 46 0d 19  32 10 20 45 51 55 44 20  |5/15*F..2. EQUD |
00006560  36 2f 31 35 2a 46 0d 19  3c 10 20 45 51 55 44 20  |6/15*F..<. EQUD |
00006570  37 2f 31 35 2a 46 0d 19  46 10 20 45 51 55 44 20  |7/15*F..F. EQUD |
00006580  38 2f 31 35 2a 46 0d 19  50 10 20 45 51 55 44 20  |8/15*F..P. EQUD |
00006590  39 2f 31 35 2a 46 0d 19  5a 11 20 45 51 55 44 20  |9/15*F..Z. EQUD |
000065a0  31 30 2f 31 35 2a 46 0d  19 64 11 20 45 51 55 44  |10/15*F..d. EQUD|
000065b0  20 31 31 2f 31 35 2a 46  0d 19 6e 11 20 45 51 55  | 11/15*F..n. EQU|
000065c0  44 20 31 32 2f 31 35 2a  46 0d 19 78 11 20 45 51  |D 12/15*F..x. EQ|
000065d0  55 44 20 31 33 2f 31 35  2a 46 0d 19 82 11 20 45  |UD 13/15*F.... E|
000065e0  51 55 44 20 31 34 2f 31  35 2a 46 0d 19 8c 0b 20  |QUD 14/15*F.... |
000065f0  45 51 55 44 20 46 0d 19  96 06 20 5d 0d 19 a0 08  |EQUD F.... ]....|
00006600  c9 20 22 22 0d 19 aa 0a  5b 4f 50 54 20 5a 0d 19  |. ""....[OPT Z..|
00006610  b4 14 2e 64 69 76 74 61  62 6c 65 20 45 51 55 44  |...divtable EQUD|
00006620  20 30 0d 19 be 0f 20 45  51 55 44 20 31 2f 37 2a  | 0.... EQUD 1/7*|
00006630  46 0d 19 c8 0f 20 45 51  55 44 20 32 2f 37 2a 46  |F.... EQUD 2/7*F|
00006640  0d 19 d2 0f 20 45 51 55  44 20 33 2f 37 2a 46 0d  |.... EQUD 3/7*F.|
00006650  19 dc 0f 20 45 51 55 44  20 34 2f 37 2a 46 0d 19  |... EQUD 4/7*F..|
00006660  e6 0f 20 45 51 55 44 20  35 2f 37 2a 46 0d 19 f0  |.. EQUD 5/7*F...|
00006670  0f 20 45 51 55 44 20 36  2f 37 2a 46 0d 19 fa 0b  |. EQUD 6/7*F....|
00006680  20 45 51 55 44 20 46 0d  1a 04 06 20 5d 0d 1a 0e  | EQUD F.... ]...|
00006690  05 cb 0d 1a 18 0a 5b 4f  50 54 20 5a 0d 1a 22 08  |......[OPT Z..".|
000066a0  2e 66 73 25 0d 1a 2c 15  20 53 54 4d 46 44 20 53  |.fs%..,. STMFD S|
000066b0  50 20 21 2c 7b 52 31 34  7d 0d 1a 36 24 20 4c 44  |P !,{R14}..6$ LD|
000066c0  52 20 52 31 30 2c 5b 52  39 2c 23 34 2a 38 5d 20  |R R10,[R9,#4*8] |
000066d0  3b 61 64 64 72 20 63 75  72 72 65 6e 74 0d 1a 40  |;addr current..@|
000066e0  21 20 4c 44 52 20 52 31  31 2c 5b 52 39 2c 23 33  |! LDR R11,[R9,#3|
000066f0  2a 38 5d 20 3b 61 64 64  72 20 6e 65 78 74 0d 1a  |*8] ;addr next..|
00006700  4a 2a 20 4c 44 52 20 52  31 32 2c 5b 52 39 2c 23  |J* LDR R12,[R9,#|
00006710  32 2a 38 5d 20 3b 61 64  64 72 20 70 69 78 65 6c  |2*8] ;addr pixel|
00006720  20 61 64 64 72 65 73 73  0d 1a 54 21 20 4c 44 52  | address..T! LDR|
00006730  20 52 31 32 2c 5b 52 31  32 5d 20 3b 70 69 78 65  | R12,[R12] ;pixe|
00006740  6c 20 61 64 64 72 65 73  73 0d 1a 5e 1e 20 4c 44  |l address..^. LD|
00006750  52 20 52 38 2c 5b 52 39  2c 23 38 5d 20 3b 61 64  |R R8,[R9,#8] ;ad|
00006760  64 72 20 73 74 65 70 0d  1a 68 16 20 4c 44 52 20  |dr step..h. LDR |
00006770  52 38 2c 5b 52 38 5d 20  3b 73 74 65 70 0d 1a 72  |R8,[R8] ;step..r|
00006780  1c 20 4c 44 52 20 52 39  2c 5b 52 39 5d 20 3b 61  |. LDR R9,[R9] ;a|
00006790  64 64 72 20 63 6f 75 6e  74 0d 1a 7c 17 20 4c 44  |ddr count..|. LD|
000067a0  52 20 52 39 2c 5b 52 39  5d 20 3b 63 6f 75 6e 74  |R R9,[R9] ;count|
000067b0  0d 1a 86 06 20 5d 0d 1a  90 16 e7 6d 24 3d 22 43  |.... ].....m$="C|
000067c0  22 20 84 20 6d 24 3d 22  44 22 20 8c 0d 1a 9a 0a  |" . m$="D" .....|
000067d0  5b 4f 50 54 20 5a 0d 1a  a4 14 20 4c 44 52 20 52  |[OPT Z.... LDR R|
000067e0  34 2c 5b 52 31 30 5d 20  3b 72 0d 1a ae 17 20 4c  |4,[R10] ;r.... L|
000067f0  44 52 20 52 35 2c 5b 52  31 30 2c 23 34 5d 20 3b  |DR R5,[R10,#4] ;|
00006800  67 0d 1a b8 17 20 4c 44  52 20 52 36 2c 5b 52 31  |g.... LDR R6,[R1|
00006810  30 2c 23 38 5d 20 3b 62  0d 1a c2 06 20 5d 0d 1a  |0,#8] ;b.... ]..|
00006820  cc 05 cc 0d 1a d6 0a 5b  4f 50 54 20 5a 0d 1a e0  |.......[OPT Z...|
00006830  20 20 4c 44 52 20 52 34  2c 5b 52 31 30 5d 2c 52  |  LDR R4,[R10],R|
00006840  38 20 3b 6d 6f 6e 6f 20  76 61 6c 75 65 0d 1a ea  |8 ;mono value...|
00006850  06 20 5d 0d 1a f4 05 cd  0d 1a fe 0e e7 6d 24 3c  |. ]..........m$<|
00006860  3e 22 44 22 20 8c 0d 1b  08 0a 5b 4f 50 54 20 5a  |>"D" .....[OPT Z|
00006870  0d 1b 12 14 20 41 44 52  20 52 37 2c 64 69 76 74  |.... ADR R7,divt|
00006880  61 62 6c 65 0d 1b 1c 06  20 5d 0d 1b 26 05 cd 0d  |able.... ]..&...|
00006890  1b 30 0a 5b 4f 50 54 20  5a 0d 1b 3a 3f 20 54 45  |.0.[OPT Z..:? TE|
000068a0  51 20 52 38 2c 23 30 3a  4d 4f 56 50 4c 20 52 31  |Q R8,#0:MOVPL R1|
000068b0  2c 23 31 3a 4d 56 4e 4d  49 20 52 31 2c 23 30 20  |,#1:MVNMI R1,#0 |
000068c0  3b 2b 2f 2d 20 31 20 66  6f 72 20 73 70 72 69 74  |;+/- 1 for sprit|
000068d0  65 20 6f 75 74 70 75 74  0d 1b 44 0b 2e 66 73 6c  |e output..D..fsl|
000068e0  6f 6f 70 0d 1b 4e 06 20  5d 0d 1b 58 0b c8 8e 20  |oop..N. ]..X... |
000068f0  6d 24 20 ca 0d 1b 62 09  c9 20 22 44 22 0d 1b 6c  |m$ ...b.. "D"..l|
00006900  0a 5b 4f 50 54 20 5a 0d  1b 76 1a 20 41 44 44 20  |.[OPT Z..v. ADD |
00006910  52 31 30 2c 52 31 30 2c  52 38 20 3b 2b 73 74 65  |R10,R10,R8 ;+ste|
00006920  70 0d 1b 80 0e 20 4d 4f  56 20 52 33 2c 23 30 0d  |p.... MOV R3,#0.|
00006930  1b 8a 39 20 54 45 51 20  52 34 2c 23 30 3a 4d 4f  |..9 TEQ R4,#0:MO|
00006940  56 4d 49 20 52 34 2c 23  30 3a 43 4d 50 20 52 34  |VMI R4,#0:CMP R4|
00006950  2c 23 46 3a 4d 4f 56 43  53 20 52 34 2c 23 46 20  |,#F:MOVCS R4,#F |
00006960  3b 30 3c 3d 72 3c 3d 31  0d 1b 94 18 20 43 4d 50  |;0<=r<=1.... CMP|
00006970  20 52 34 2c 23 46 3e 3e  31 20 3b 3e 31 2f 32 3f  | R4,#F>>1 ;>1/2?|
00006980  0d 1b 9e 21 20 53 55 42  43 53 20 52 34 2c 52 34  |...! SUBCS R4,R4|
00006990  2c 23 46 3a 84 52 43 53  20 52 33 2c 52 33 2c 23  |,#F:.RCS R3,R3,#|
000069a0  31 0d 1b a8 39 20 54 45  51 20 52 35 2c 23 30 3a  |1...9 TEQ R5,#0:|
000069b0  4d 4f 56 4d 49 20 52 35  2c 23 30 3a 43 4d 50 20  |MOVMI R5,#0:CMP |
000069c0  52 35 2c 23 46 3a 4d 4f  56 43 53 20 52 35 2c 23  |R5,#F:MOVCS R5,#|
000069d0  46 20 3b 30 3c 3d 67 3c  3d 31 0d 1b b2 16 20 43  |F ;0<=g<=1.... C|
000069e0  4d 50 20 52 35 2c 23 46  3e 3e 31 20 3b 3e 31 3f  |MP R5,#F>>1 ;>1?|
000069f0  0d 1b bc 21 20 53 55 42  43 53 20 52 35 2c 52 35  |...! SUBCS R5,R5|
00006a00  2c 23 46 3a 84 52 43 53  20 52 33 2c 52 33 2c 23  |,#F:.RCS R3,R3,#|
00006a10  32 0d 1b c6 39 20 54 45  51 20 52 36 2c 23 30 3a  |2...9 TEQ R6,#0:|
00006a20  4d 4f 56 4d 49 20 52 36  2c 23 30 3a 43 4d 50 20  |MOVMI R6,#0:CMP |
00006a30  52 36 2c 23 46 3a 4d 4f  56 43 53 20 52 36 2c 23  |R6,#F:MOVCS R6,#|
00006a40  46 20 3b 30 3c 3d 62 3c  3d 31 0d 1b d0 16 20 43  |F ;0<=b<=1.... C|
00006a50  4d 50 20 52 36 2c 23 46  3e 3e 31 20 3b 3e 31 3f  |MP R6,#F>>1 ;>1?|
00006a60  0d 1b da 21 20 53 55 42  43 53 20 52 36 2c 52 36  |...! SUBCS R6,R6|
00006a70  2c 23 46 3a 84 52 43 53  20 52 33 2c 52 33 2c 23  |,#F:.RCS R3,R3,#|
00006a80  34 0d 1b e4 06 20 5d 0d  1b ee 09 c9 20 22 43 22  |4.... ]..... "C"|
00006a90  0d 1b f8 0a 5b 4f 50 54  20 5a 0d 1c 02 1a 20 41  |....[OPT Z.... A|
00006aa0  44 44 20 52 31 30 2c 52  31 30 2c 52 38 20 3b 2b  |DD R10,R10,R8 ;+|
00006ab0  73 74 65 70 0d 1c 0c 39  20 54 45 51 20 52 35 2c  |step...9 TEQ R5,|
00006ac0  23 30 3a 4d 4f 56 4d 49  20 52 35 2c 23 30 3a 43  |#0:MOVMI R5,#0:C|
00006ad0  4d 50 20 52 35 2c 23 46  3a 4d 4f 56 43 53 20 52  |MP R5,#F:MOVCS R|
00006ae0  35 2c 23 46 20 3b 30 3c  3d 67 3c 3d 31 0d 1c 16  |5,#F ;0<=g<=1...|
00006af0  1c 20 41 44 44 20 52 33  2c 52 35 2c 52 35 2c 4c  |. ADD R3,R5,R5,L|
00006b00  53 4c 20 23 31 20 3b 2a  33 0d 1c 20 1e 20 41 44  |SL #1 ;*3.. . AD|
00006b10  44 20 52 33 2c 52 33 2c  23 46 3e 3e 31 20 3b 72  |D R3,R3,#F>>1 ;r|
00006b20  6f 75 6e 64 20 75 70 0d  1c 2a 27 20 4d 4f 56 53  |ound up..*' MOVS|
00006b30  20 52 33 2c 52 33 2c 4c  53 52 20 23 62 69 74 73  | R3,R3,LSR #bits|
00006b40  20 3b 66 69 6e 61 6c 20  69 6e 74 30 2d 33 0d 1c  | ;final int0-3..|
00006b50  34 34 20 4c 44 52 4e 45  20 52 32 2c 5b 52 37 2c  |44 LDRNE R2,[R7,|
00006b60  52 33 2c 4c 53 4c 20 23  32 5d 20 3b 64 69 76 69  |R3,LSL #2] ;divi|
00006b70  64 65 20 62 79 20 33 20  66 72 6f 6d 20 74 61 62  |de by 3 from tab|
00006b80  6c 65 0d 1c 3e 2d 20 53  55 42 4e 45 20 52 35 2c  |le..>- SUBNE R5,|
00006b90  52 35 2c 52 32 20 3b 73  75 62 74 72 61 63 74 20  |R5,R2 ;subtract |
00006ba0  63 6f 6e 76 65 72 74 65  64 20 76 61 6c 75 65 0d  |converted value.|
00006bb0  1c 48 39 20 54 45 51 20  52 34 2c 23 30 3a 4d 4f  |.H9 TEQ R4,#0:MO|
00006bc0  56 4d 49 20 52 34 2c 23  30 3a 43 4d 50 20 52 34  |VMI R4,#0:CMP R4|
00006bd0  2c 23 46 3a 4d 4f 56 43  53 20 52 34 2c 23 46 20  |,#F:MOVCS R4,#F |
00006be0  3b 30 3c 3d 72 3c 3d 31  0d 1c 52 18 20 43 4d 50  |;0<=r<=1..R. CMP|
00006bf0  20 52 34 2c 23 46 3e 3e  31 20 3b 3e 31 2f 32 3f  | R4,#F>>1 ;>1/2?|
00006c00  0d 1c 5c 21 20 53 55 42  43 53 20 52 34 2c 52 34  |..\! SUBCS R4,R4|
00006c10  2c 23 46 3a 84 52 43 53  20 52 33 2c 52 33 2c 23  |,#F:.RCS R3,R3,#|
00006c20  34 0d 1c 66 39 20 54 45  51 20 52 36 2c 23 30 3a  |4..f9 TEQ R6,#0:|
00006c30  4d 4f 56 4d 49 20 52 36  2c 23 30 3a 43 4d 50 20  |MOVMI R6,#0:CMP |
00006c40  52 36 2c 23 46 3a 4d 4f  56 43 53 20 52 36 2c 23  |R6,#F:MOVCS R6,#|
00006c50  46 20 3b 30 3c 3d 62 3c  3d 31 0d 1c 70 18 20 43  |F ;0<=b<=1..p. C|
00006c60  4d 50 20 52 36 2c 23 46  3e 3e 31 20 3b 3e 31 2f  |MP R6,#F>>1 ;>1/|
00006c70  32 3f 0d 1c 7a 21 20 53  55 42 43 53 20 52 36 2c  |2?..z! SUBCS R6,|
00006c80  52 36 2c 23 46 3a 84 52  43 53 20 52 33 2c 52 33  |R6,#F:.RCS R3,R3|
00006c90  2c 23 38 0d 1c 84 06 20  5d 0d 1c 8e 09 c9 20 22  |,#8.... ]..... "|
00006ca0  54 22 0d 1c 98 0a 5b 4f  50 54 20 5a 0d 1c a2 3b  |T"....[OPT Z...;|
00006cb0  20 54 45 51 20 52 34 2c  23 30 3a 4d 4f 56 4d 49  | TEQ R4,#0:MOVMI|
00006cc0  20 52 34 2c 23 30 3a 43  4d 50 20 52 34 2c 23 46  | R4,#0:CMP R4,#F|
00006cd0  3a 4d 4f 56 43 53 20 52  34 2c 23 46 20 3b 30 3c  |:MOVCS R4,#F ;0<|
00006ce0  3d 76 61 6c 3c 3d 31 0d  1c ac 1d 20 52 53 42 20  |=val<=1.... RSB |
00006cf0  52 33 2c 52 34 2c 52 34  2c 4c 53 4c 20 23 34 20  |R3,R4,R4,LSL #4 |
00006d00  3b 2a 31 35 0d 1c b6 1e  20 41 44 44 20 52 33 2c  |;*15.... ADD R3,|
00006d10  52 33 2c 23 46 3e 3e 31  20 3b 72 6f 75 6e 64 20  |R3,#F>>1 ;round |
00006d20  75 70 0d 1c c0 28 20 4d  4f 56 53 20 52 33 2c 52  |up...( MOVS R3,R|
00006d30  33 2c 4c 53 52 20 23 62  69 74 73 20 3b 66 69 6e  |3,LSR #bits ;fin|
00006d40  61 6c 20 69 6e 74 30 2d  31 35 0d 1c ca 35 20 4c  |al int0-15...5 L|
00006d50  44 52 4e 45 20 52 32 2c  5b 52 37 2c 52 33 2c 4c  |DRNE R2,[R7,R3,L|
00006d60  53 4c 20 23 32 5d 20 3b  64 69 76 69 64 65 20 62  |SL #2] ;divide b|
00006d70  79 20 31 35 20 66 72 6f  6d 20 74 61 62 6c 65 0d  |y 15 from table.|
00006d80  1c d4 2d 20 53 55 42 4e  45 20 52 34 2c 52 34 2c  |..- SUBNE R4,R4,|
00006d90  52 32 20 3b 73 75 62 74  72 61 63 74 20 63 6f 6e  |R2 ;subtract con|
00006da0  76 65 72 74 65 64 20 76  61 6c 75 65 0d 1c de 06  |verted value....|
00006db0  20 5d 0d 1c e8 08 c9 20  22 22 0d 1c f2 0a 5b 4f  | ]..... ""....[O|
00006dc0  50 54 20 5a 0d 1c fc 3b  20 54 45 51 20 52 34 2c  |PT Z...; TEQ R4,|
00006dd0  23 30 3a 4d 4f 56 4d 49  20 52 34 2c 23 30 3a 43  |#0:MOVMI R4,#0:C|
00006de0  4d 50 20 52 34 2c 23 46  3a 4d 4f 56 43 53 20 52  |MP R4,#F:MOVCS R|
00006df0  34 2c 23 46 20 3b 30 3c  3d 76 61 6c 3c 3d 31 0d  |4,#F ;0<=val<=1.|
00006e00  1d 06 1c 20 52 53 42 20  52 33 2c 52 34 2c 52 34  |... RSB R3,R4,R4|
00006e10  2c 4c 53 4c 20 23 33 20  3b 2a 37 0d 1d 10 1e 20  |,LSL #3 ;*7.... |
00006e20  41 44 44 20 52 33 2c 52  33 2c 23 46 3e 3e 31 20  |ADD R3,R3,#F>>1 |
00006e30  3b 72 6f 75 6e 64 20 75  70 0d 1d 1a 27 20 4d 4f  |;round up...' MO|
00006e40  56 53 20 52 33 2c 52 33  2c 4c 53 52 20 23 62 69  |VS R3,R3,LSR #bi|
00006e50  74 73 20 3b 66 69 6e 61  6c 20 69 6e 74 30 2d 37  |ts ;final int0-7|
00006e60  0d 1d 24 34 20 4c 44 52  4e 45 20 52 32 2c 5b 52  |..$4 LDRNE R2,[R|
00006e70  37 2c 52 33 2c 4c 53 4c  20 23 32 5d 20 3b 64 69  |7,R3,LSL #2] ;di|
00006e80  76 69 64 65 20 62 79 20  37 20 66 72 6f 6d 20 74  |vide by 7 from t|
00006e90  61 62 6c 65 0d 1d 2e 2d  20 53 55 42 4e 45 20 52  |able...- SUBNE R|
00006ea0  34 2c 52 34 2c 52 32 20  3b 73 75 62 74 72 61 63  |4,R4,R2 ;subtrac|
00006eb0  74 20 63 6f 6e 76 65 72  74 65 64 20 76 61 6c 75  |t converted valu|
00006ec0  65 0d 1d 38 06 20 5d 0d  1d 42 05 cb 0d 1d 4c 0a  |e..8. ]..B....L.|
00006ed0  5b 4f 50 54 20 5a 0d 1d  56 16 20 4d 4f 56 20 52  |[OPT Z..V. MOV R|
00006ee0  32 2c 52 31 32 2c 4c 53  52 20 23 31 0d 1d 60 0f  |2,R12,LSR #1..`.|
00006ef0  20 54 53 54 20 52 31 32  2c 23 31 0d 1d 6a 11 20  | TST R12,#1..j. |
00006f00  4c 44 52 42 20 52 30 2c  5b 52 32 5d 0d 1d 74 21  |LDRB R0,[R2]..t!|
00006f10  20 80 45 51 20 52 30 2c  52 30 2c 23 26 46 30 3a  | .EQ R0,R0,#&F0:|
00006f20  84 52 45 51 20 52 30 2c  52 30 2c 52 33 0d 1d 7e  |.REQ R0,R0,R3..~|
00006f30  28 20 80 4e 45 20 52 30  2c 52 30 2c 23 26 30 46  |( .NE R0,R0,#&0F|
00006f40  3a 84 52 4e 45 20 52 30  2c 52 30 2c 52 33 2c 4c  |:.RNE R0,R0,R3,L|
00006f50  53 4c 20 23 34 0d 1d 88  11 20 53 54 52 42 20 52  |SL #4.... STRB R|
00006f60  30 2c 5b 52 32 5d 0d 1d  92 13 20 41 44 44 20 52  |0,[R2].... ADD R|
00006f70  31 32 2c 52 31 32 2c 52  31 0d 1d 9c 06 20 5d 0d  |12,R12,R1.... ].|
00006f80  1d a6 16 e7 6d 24 3d 22  43 22 20 84 20 6d 24 3d  |....m$="C" . m$=|
00006f90  22 44 22 20 8c 0d 1d b0  0a 5b 4f 50 54 20 5a 0d  |"D" .....[OPT Z.|
00006fa0  1d ba 1d 20 41 44 44 20  52 30 2c 52 31 31 2c 23  |... ADD R0,R11,#|
00006fb0  34 20 3b 6e 6c 20 67 25  28 53 25 29 0d 1d c4 1d  |4 ;nl g%(S%)....|
00006fc0  20 41 44 44 20 52 32 2c  52 34 2c 52 34 2c 4c 53  | ADD R2,R4,R4,LS|
00006fd0  4c 20 23 31 20 3b 72 2a  33 0d 1d ce 30 20 4c 44  |L #1 ;r*3...0 LD|
00006fe0  52 20 52 33 2c 5b 52 31  31 2c 2d 52 38 5d 3a 41  |R R3,[R11,-R8]:A|
00006ff0  44 44 20 52 33 2c 52 33  2c 52 32 2c 41 53 52 20  |DD R3,R3,R2,ASR |
00007000  23 34 20 3b 2b 33 2f 31  36 0d 1d d8 15 20 53 54  |#4 ;+3/16.... ST|
00007010  52 20 52 33 2c 5b 52 31  31 2c 2d 52 38 5d 0d 1d  |R R3,[R11,-R8]..|
00007020  e2 1d 20 41 44 44 20 52  32 2c 52 34 2c 52 34 2c  |.. ADD R2,R4,R4,|
00007030  4c 53 4c 20 23 32 20 3b  72 2a 35 0d 1d ec 2c 20  |LSL #2 ;r*5..., |
00007040  4c 44 52 20 52 33 2c 5b  52 31 31 5d 3a 41 44 44  |LDR R3,[R11]:ADD|
00007050  20 52 33 2c 52 33 2c 52  32 2c 41 53 52 20 23 34  | R3,R3,R2,ASR #4|
00007060  20 3b 2b 35 2f 31 36 0d  1d f6 11 20 53 54 52 20  | ;+5/16.... STR |
00007070  52 33 2c 5b 52 31 31 5d  0d 1e 00 1b 20 4d 4f 56  |R3,[R11].... MOV|
00007080  20 52 33 2c 52 34 2c 41  53 52 20 23 34 20 3b 72  | R3,R4,ASR #4 ;r|
00007090  2f 31 36 0d 1e 0a 31 20  53 54 52 20 52 33 2c 5b  |/16...1 STR R3,[|
000070a0  52 31 31 2c 52 38 5d 21  20 3b 6e 6f 74 20 73 65  |R11,R8]! ;not se|
000070b0  65 6e 20 73 6f 20 66 61  72 20 69 6e 63 20 6e 6c  |en so far inc nl|
000070c0  20 70 74 72 0d 1e 14 1d  20 52 53 42 20 52 32 2c  | ptr.... RSB R2,|
000070d0  52 34 2c 52 34 2c 4c 53  4c 20 23 33 20 3b 72 2a  |R4,R4,LSL #3 ;r*|
000070e0  37 0d 1e 1e 25 20 4c 44  52 20 52 34 2c 5b 52 31  |7...% LDR R4,[R1|
000070f0  30 5d 20 3b 6e 65 78 74  20 72 20 6c 69 67 68 74  |0] ;next r light|
00007100  20 76 61 6c 75 65 0d 1e  28 3e 20 41 44 44 20 52  | value..(> ADD R|
00007110  34 2c 52 34 2c 52 32 2c  41 53 52 20 23 34 20 3b  |4,R4,R2,ASR #4 ;|
00007120  6e 65 78 74 20 76 61 6c  75 65 20 2b 37 2f 31 36  |next value +7/16|
00007130  20 6f 66 20 72 20 65 72  72 6f 72 20 2d 3e 20 6e  | of r error -> n|
00007140  65 77 20 72 0d 1e 32 1d  20 41 44 44 20 52 32 2c  |ew r..2. ADD R2,|
00007150  52 35 2c 52 35 2c 4c 53  4c 20 23 31 20 3b 67 2a  |R5,R5,LSL #1 ;g*|
00007160  33 0d 1e 3c 2f 20 4c 44  52 20 52 33 2c 5b 52 30  |3..</ LDR R3,[R0|
00007170  2c 2d 52 38 5d 3a 41 44  44 20 52 33 2c 52 33 2c  |,-R8]:ADD R3,R3,|
00007180  52 32 2c 41 53 52 20 23  34 20 3b 2b 33 2f 31 36  |R2,ASR #4 ;+3/16|
00007190  0d 1e 46 14 20 53 54 52  20 52 33 2c 5b 52 30 2c  |..F. STR R3,[R0,|
000071a0  2d 52 38 5d 0d 1e 50 1b  20 4d 4f 56 20 52 33 2c  |-R8]..P. MOV R3,|
000071b0  52 35 2c 41 53 52 20 23  34 20 3b 67 2f 31 36 0d  |R5,ASR #4 ;g/16.|
000071c0  1e 5a 24 20 53 54 52 20  52 33 2c 5b 52 30 2c 52  |.Z$ STR R3,[R0,R|
000071d0  38 5d 20 3b 6e 6f 74 20  73 65 65 6e 20 73 6f 20  |8] ;not seen so |
000071e0  66 61 72 0d 1e 64 1d 20  41 44 44 20 52 32 2c 52  |far..d. ADD R2,R|
000071f0  35 2c 52 35 2c 4c 53 4c  20 23 32 20 3b 67 2a 35  |5,R5,LSL #2 ;g*5|
00007200  0d 1e 6e 2b 20 4c 44 52  20 52 33 2c 5b 52 30 5d  |..n+ LDR R3,[R0]|
00007210  3a 41 44 44 20 52 33 2c  52 33 2c 52 32 2c 41 53  |:ADD R3,R3,R2,AS|
00007220  52 20 23 34 20 3b 2b 35  2f 31 36 0d 1e 78 33 20  |R #4 ;+5/16..x3 |
00007230  53 54 52 20 52 33 2c 5b  52 30 5d 2c 23 34 20 3b  |STR R3,[R0],#4 ;|
00007240  63 6f 6d 70 75 74 65 73  20 6e 6c 20 62 20 69 6e  |computes nl b in|
00007250  74 6f 20 74 68 65 20 62  61 72 67 61 69 6e 0d 1e  |to the bargain..|
00007260  82 1d 20 52 53 42 20 52  32 2c 52 35 2c 52 35 2c  |.. RSB R2,R5,R5,|
00007270  4c 53 4c 20 23 33 20 3b  67 2a 37 0d 1e 8c 28 20  |LSL #3 ;g*7...( |
00007280  4c 44 52 20 52 35 2c 5b  52 31 30 2c 23 34 5d 20  |LDR R5,[R10,#4] |
00007290  3b 6e 65 78 74 20 67 20  6c 69 67 68 74 20 76 61  |;next g light va|
000072a0  6c 75 65 0d 1e 96 3e 20  41 44 44 20 52 35 2c 52  |lue...> ADD R5,R|
000072b0  35 2c 52 32 2c 41 53 52  20 23 34 20 3b 6e 65 78  |5,R2,ASR #4 ;nex|
000072c0  74 20 76 61 6c 75 65 20  2b 37 2f 31 36 20 6f 66  |t value +7/16 of|
000072d0  20 67 20 65 72 72 6f 72  20 2d 3e 20 6e 65 77 20  | g error -> new |
000072e0  67 0d 1e a0 1d 20 41 44  44 20 52 32 2c 52 36 2c  |g.... ADD R2,R6,|
000072f0  52 36 2c 4c 53 4c 20 23  31 20 3b 62 2a 33 0d 1e  |R6,LSL #1 ;b*3..|
00007300  aa 2f 20 4c 44 52 20 52  33 2c 5b 52 30 2c 2d 52  |./ LDR R3,[R0,-R|
00007310  38 5d 3a 41 44 44 20 52  33 2c 52 33 2c 52 32 2c  |8]:ADD R3,R3,R2,|
00007320  41 53 52 20 23 34 20 3b  2b 33 2f 31 36 0d 1e b4  |ASR #4 ;+3/16...|
00007330  14 20 53 54 52 20 52 33  2c 5b 52 30 2c 2d 52 38  |. STR R3,[R0,-R8|
00007340  5d 0d 1e be 1d 20 41 44  44 20 52 32 2c 52 36 2c  |].... ADD R2,R6,|
00007350  52 36 2c 4c 53 4c 20 23  32 20 3b 62 2a 35 0d 1e  |R6,LSL #2 ;b*5..|
00007360  c8 2b 20 4c 44 52 20 52  33 2c 5b 52 30 5d 3a 41  |.+ LDR R3,[R0]:A|
00007370  44 44 20 52 33 2c 52 33  2c 52 32 2c 41 53 52 20  |DD R3,R3,R2,ASR |
00007380  23 34 20 3b 2b 35 2f 31  36 0d 1e d2 10 20 53 54  |#4 ;+5/16.... ST|
00007390  52 20 52 33 2c 5b 52 30  5d 0d 1e dc 1b 20 4d 4f  |R R3,[R0].... MO|
000073a0  56 20 52 33 2c 52 36 2c  41 53 52 20 23 34 20 3b  |V R3,R6,ASR #4 ;|
000073b0  62 2f 31 36 0d 1e e6 24  20 53 54 52 20 52 33 2c  |b/16...$ STR R3,|
000073c0  5b 52 30 2c 52 38 5d 20  3b 6e 6f 74 20 73 65 65  |[R0,R8] ;not see|
000073d0  6e 20 73 6f 20 66 61 72  0d 1e f0 1d 20 52 53 42  |n so far.... RSB|
000073e0  20 52 32 2c 52 36 2c 52  36 2c 4c 53 4c 20 23 33  | R2,R6,R6,LSL #3|
000073f0  20 3b 62 2a 37 0d 1e fa  28 20 4c 44 52 20 52 36  | ;b*7...( LDR R6|
00007400  2c 5b 52 31 30 2c 23 38  5d 20 3b 6e 65 78 74 20  |,[R10,#8] ;next |
00007410  62 20 6c 69 67 68 74 20  76 61 6c 75 65 0d 1f 04  |b light value...|
00007420  3e 20 41 44 44 20 52 36  2c 52 36 2c 52 32 2c 41  |> ADD R6,R6,R2,A|
00007430  53 52 20 23 34 20 3b 6e  65 78 74 20 76 61 6c 75  |SR #4 ;next valu|
00007440  65 20 2b 37 2f 31 36 20  6f 66 20 62 20 65 72 72  |e +7/16 of b err|
00007450  6f 72 20 2d 3e 20 6e 65  77 20 62 0d 1f 0e 06 20  |or -> new b.... |
00007460  5d 0d 1f 18 05 cc 0d 1f  22 0a 5b 4f 50 54 20 5a  |].......".[OPT Z|
00007470  0d 1f 2c 1c 20 41 44 44  20 52 32 2c 52 34 2c 52  |..,. ADD R2,R4,R|
00007480  34 2c 4c 53 4c 20 23 31  20 3b 2a 33 0d 1f 36 30  |4,LSL #1 ;*3..60|
00007490  20 4c 44 52 20 52 33 2c  5b 52 31 31 2c 2d 52 38  | LDR R3,[R11,-R8|
000074a0  5d 3a 41 44 44 20 52 33  2c 52 33 2c 52 32 2c 41  |]:ADD R3,R3,R2,A|
000074b0  53 52 20 23 34 20 3b 2b  33 2f 31 36 0d 1f 40 15  |SR #4 ;+3/16..@.|
000074c0  20 53 54 52 20 52 33 2c  5b 52 31 31 2c 2d 52 38  | STR R3,[R11,-R8|
000074d0  5d 0d 1f 4a 1c 20 41 44  44 20 52 32 2c 52 34 2c  |]..J. ADD R2,R4,|
000074e0  52 34 2c 4c 53 4c 20 23  32 20 3b 2a 35 0d 1f 54  |R4,LSL #2 ;*5..T|
000074f0  2c 20 4c 44 52 20 52 33  2c 5b 52 31 31 5d 3a 41  |, LDR R3,[R11]:A|
00007500  44 44 20 52 33 2c 52 33  2c 52 32 2c 41 53 52 20  |DD R3,R3,R2,ASR |
00007510  23 34 20 3b 2b 35 2f 31  36 0d 1f 5e 11 20 53 54  |#4 ;+5/16..^. ST|
00007520  52 20 52 33 2c 5b 52 31  31 5d 0d 1f 68 1a 20 4d  |R R3,[R11]..h. M|
00007530  4f 56 20 52 33 2c 52 34  2c 41 53 52 20 23 34 20  |OV R3,R4,ASR #4 |
00007540  3b 2f 31 36 0d 1f 72 31  20 53 54 52 20 52 33 2c  |;/16..r1 STR R3,|
00007550  5b 52 31 31 2c 52 38 5d  21 20 3b 6e 6f 74 20 73  |[R11,R8]! ;not s|
00007560  65 65 6e 20 73 6f 20 66  61 72 20 69 6e 63 20 6e  |een so far inc n|
00007570  6c 20 70 74 72 0d 1f 7c  1c 20 52 53 42 20 52 32  |l ptr..|. RSB R2|
00007580  2c 52 34 2c 52 34 2c 4c  53 4c 20 23 33 20 3b 2a  |,R4,R4,LSL #3 ;*|
00007590  37 0d 1f 86 26 20 4c 44  52 20 52 34 2c 5b 52 31  |7...& LDR R4,[R1|
000075a0  30 5d 2c 52 38 20 3b 6e  65 78 74 20 6c 69 67 68  |0],R8 ;next ligh|
000075b0  74 20 76 61 6c 75 65 0d  1f 90 40 20 41 44 44 20  |t value...@ ADD |
000075c0  52 34 2c 52 34 2c 52 32  2c 41 53 52 20 23 34 20  |R4,R4,R2,ASR #4 |
000075d0  3b 6e 65 78 74 20 76 61  6c 75 65 20 2b 37 2f 31  |;next value +7/1|
000075e0  36 20 6f 66 20 65 72 72  6f 72 20 2d 3e 20 6e 65  |6 of error -> ne|
000075f0  77 20 76 61 6c 75 65 0d  1f 9a 06 20 5d 0d 1f a4  |w value.... ]...|
00007600  05 cd 0d 1f ae 0a 5b 4f  50 54 20 5a 0d 1f b8 1d  |......[OPT Z....|
00007610  20 53 55 42 53 20 52 39  2c 52 39 2c 23 31 3a 42  | SUBS R9,R9,#1:B|
00007620  4e 45 20 66 73 6c 6f 6f  70 0d 1f c2 15 20 4c 44  |NE fsloop.... LD|
00007630  4d 46 44 20 53 50 20 21  2c 7b 50 43 7d 5e 0d 1f  |MFD SP !,{PC}^..|
00007640  cc 06 20 5d 0d 1f d6 08  c9 20 33 3a 0d 1f e0 0c  |.. ]..... 3:....|
00007650  e7 6d 24 3d 22 22 20 8c  0d 1f ea 0a 5b 4f 50 54  |.m$="" .....[OPT|
00007660  20 5a 0d 1f f4 16 2e 73  6c 61 73 68 74 68 72 65  | Z.....slashthre|
00007670  65 20 45 51 55 44 20 30  0d 1f fe 0f 20 45 51 55  |e EQUD 0.... EQU|
00007680  44 20 31 2f 33 2a 46 0d  20 08 0f 20 45 51 55 44  |D 1/3*F. .. EQUD|
00007690  20 32 2f 33 2a 46 0d 20  12 0b 20 45 51 55 44 20  | 2/3*F. .. EQUD |
000076a0  46 0d 20 1c 06 20 5d 0d  20 26 05 cd 0d 20 30 0a  |F. .. ]. &... 0.|
000076b0  5b 4f 50 54 20 5a 0d 20  3a 08 2e 66 73 25 0d 20  |[OPT Z. :..fs%. |
000076c0  44 15 20 53 54 4d 46 44  20 53 50 20 21 2c 7b 52  |D. STMFD SP !,{R|
000076d0  31 34 7d 0d 20 4e 24 20  4c 44 52 20 52 31 30 2c  |14}. N$ LDR R10,|
000076e0  5b 52 39 2c 23 34 2a 38  5d 20 3b 61 64 64 72 20  |[R9,#4*8] ;addr |
000076f0  63 75 72 72 65 6e 74 0d  20 58 21 20 4c 44 52 20  |current. X! LDR |
00007700  52 31 31 2c 5b 52 39 2c  23 33 2a 38 5d 20 3b 61  |R11,[R9,#3*8] ;a|
00007710  64 64 72 20 6e 65 78 74  0d 20 62 2a 20 4c 44 52  |ddr next. b* LDR|
00007720  20 52 31 32 2c 5b 52 39  2c 23 32 2a 38 5d 20 3b  | R12,[R9,#2*8] ;|
00007730  61 64 64 72 20 70 69 78  65 6c 20 61 64 64 72 65  |addr pixel addre|
00007740  73 73 0d 20 6c 21 20 4c  44 52 20 52 31 32 2c 5b  |ss. l! LDR R12,[|
00007750  52 31 32 5d 20 3b 70 69  78 65 6c 20 61 64 64 72  |R12] ;pixel addr|
00007760  65 73 73 0d 20 76 1e 20  4c 44 52 20 52 38 2c 5b  |ess. v. LDR R8,[|
00007770  52 39 2c 23 38 5d 20 3b  61 64 64 72 20 73 74 65  |R9,#8] ;addr ste|
00007780  70 0d 20 80 16 20 4c 44  52 20 52 38 2c 5b 52 38  |p. .. LDR R8,[R8|
00007790  5d 20 3b 73 74 65 70 0d  20 8a 1c 20 4c 44 52 20  |] ;step. .. LDR |
000077a0  52 39 2c 5b 52 39 5d 20  3b 61 64 64 72 20 63 6f  |R9,[R9] ;addr co|
000077b0  75 6e 74 0d 20 94 17 20  4c 44 52 20 52 39 2c 5b  |unt. .. LDR R9,[|
000077c0  52 39 5d 20 3b 63 6f 75  6e 74 0d 20 9e 06 20 5d  |R9] ;count. .. ]|
000077d0  0d 20 a8 0d e7 6d 24 3d  22 43 22 20 8c 0d 20 b2  |. ...m$="C" .. .|
000077e0  0a 5b 4f 50 54 20 5a 0d  20 bc 14 20 4c 44 52 20  |.[OPT Z. .. LDR |
000077f0  52 34 2c 5b 52 31 30 5d  20 3b 72 0d 20 c6 17 20  |R4,[R10] ;r. .. |
00007800  4c 44 52 20 52 35 2c 5b  52 31 30 2c 23 34 5d 20  |LDR R5,[R10,#4] |
00007810  3b 67 0d 20 d0 17 20 4c  44 52 20 52 36 2c 5b 52  |;g. .. LDR R6,[R|
00007820  31 30 2c 23 38 5d 20 3b  62 0d 20 da 06 20 5d 0d  |10,#8] ;b. .. ].|
00007830  20 e4 05 cc 0d 20 ee 0a  5b 4f 50 54 20 5a 0d 20  | .... ..[OPT Z. |
00007840  f8 20 20 4c 44 52 20 52  34 2c 5b 52 31 30 5d 2c  |.  LDR R4,[R10],|
00007850  52 38 20 3b 6d 6f 6e 6f  20 76 61 6c 75 65 0d 21  |R8 ;mono value.!|
00007860  02 16 20 41 44 52 20 52  37 2c 73 6c 61 73 68 74  |.. ADR R7,slasht|
00007870  68 72 65 65 0d 21 0c 06  20 5d 0d 21 16 05 cd 0d  |hree.!.. ].!....|
00007880  21 20 0a 5b 4f 50 54 20  5a 0d 21 2a 3f 20 54 45  |! .[OPT Z.!*? TE|
00007890  51 20 52 38 2c 23 30 3a  4d 4f 56 50 4c 20 52 31  |Q R8,#0:MOVPL R1|
000078a0  2c 23 31 3a 4d 56 4e 4d  49 20 52 31 2c 23 30 20  |,#1:MVNMI R1,#0 |
000078b0  3b 2b 2f 2d 20 31 20 66  6f 72 20 73 70 72 69 74  |;+/- 1 for sprit|
000078c0  65 20 6f 75 74 70 75 74  0d 21 34 0b 2e 66 73 6c  |e output.!4..fsl|
000078d0  6f 6f 70 0d 21 3e 06 20  5d 0d 21 48 0d e7 6d 24  |oop.!>. ].!H..m$|
000078e0  3d 22 43 22 20 8c 0d 21  52 0a 5b 4f 50 54 20 5a  |="C" ..!R.[OPT Z|
000078f0  0d 21 5c 1a 20 41 44 44  20 52 31 30 2c 52 31 30  |.!\. ADD R10,R10|
00007900  2c 52 38 20 3b 2b 73 74  65 70 0d 21 66 39 20 54  |,R8 ;+step.!f9 T|
00007910  45 51 20 52 34 2c 23 30  3a 4d 4f 56 4d 49 20 52  |EQ R4,#0:MOVMI R|
00007920  34 2c 23 30 3a 43 4d 50  20 52 34 2c 23 46 3a 4d  |4,#0:CMP R4,#F:M|
00007930  4f 56 43 53 20 52 34 2c  23 46 20 3b 30 3c 3d 72  |OVCS R4,#F ;0<=r|
00007940  3c 3d 31 0d 21 70 39 20  54 45 51 20 52 35 2c 23  |<=1.!p9 TEQ R5,#|
00007950  30 3a 4d 4f 56 4d 49 20  52 35 2c 23 30 3a 43 4d  |0:MOVMI R5,#0:CM|
00007960  50 20 52 35 2c 23 46 3a  4d 4f 56 43 53 20 52 35  |P R5,#F:MOVCS R5|
00007970  2c 23 46 20 3b 30 3c 3d  67 3c 3d 31 0d 21 7a 39  |,#F ;0<=g<=1.!z9|
00007980  20 54 45 51 20 52 36 2c  23 30 3a 4d 4f 56 4d 49  | TEQ R6,#0:MOVMI|
00007990  20 52 36 2c 23 30 3a 43  4d 50 20 52 36 2c 23 46  | R6,#0:CMP R6,#F|
000079a0  3a 4d 4f 56 43 53 20 52  36 2c 23 46 20 3b 30 3c  |:MOVCS R6,#F ;0<|
000079b0  3d 62 3c 3d 31 0d 21 84  1c 20 4d 4f 56 20 52 33  |=b<=1.!.. MOV R3|
000079c0  2c 23 30 20 3b 62 6c 61  63 6b 20 6f 63 74 61 6e  |,#0 ;black octan|
000079d0  74 0d 21 8e 1f 20 43 4d  50 20 52 34 2c 23 46 3e  |t.!.. CMP R4,#F>|
000079e0  3e 31 3a 84 52 43 53 20  52 33 2c 52 33 2c 23 31  |>1:.RCS R3,R3,#1|
000079f0  0d 21 98 1f 20 43 4d 50  20 52 35 2c 23 46 3e 3e  |.!.. CMP R5,#F>>|
00007a00  31 3a 84 52 43 53 20 52  33 2c 52 33 2c 23 32 0d  |1:.RCS R3,R3,#2.|
00007a10  21 a2 1f 20 43 4d 50 20  52 36 2c 23 46 3e 3e 31  |!.. CMP R6,#F>>1|
00007a20  3a 84 52 43 53 20 52 33  2c 52 33 2c 23 34 0d 21  |:.RCS R3,R3,#4.!|
00007a30  ac 23 20 43 4d 50 20 52  33 2c 23 36 3a ec 51 20  |.# CMP R3,#6:.Q |
00007a40  52 33 2c 23 31 3a 42 45  51 20 6f 63 74 63 79 61  |R3,#1:BEQ octcya|
00007a50  6e 0d 21 b6 11 20 42 43  53 20 6f 63 74 77 68 69  |n.!.. BCS octwhi|
00007a60  74 65 0d 21 c0 1a 20 43  4d 50 20 52 33 2c 23 34  |te.!.. CMP R3,#4|
00007a70  3a 42 45 51 20 6f 63 74  62 6c 75 65 0d 21 ca 1f  |:BEQ octblue.!..|
00007a80  20 4d 4f 56 43 53 20 52  33 2c 23 32 3a 42 43 53  | MOVCS R3,#2:BCS|
00007a90  20 6f 63 74 6d 61 67 65  6e 74 61 0d 21 d4 1b 20  | octmagenta.!.. |
00007aa0  43 4d 50 20 52 33 2c 23  32 3a 42 45 51 20 6f 63  |CMP R3,#2:BEQ oc|
00007ab0  74 67 72 65 65 6e 0d 21  de 12 20 42 43 53 20 6f  |tgreen.!.. BCS o|
00007ac0  63 74 79 65 6c 6c 6f 77  0d 21 e8 1b 20 43 4d 50  |ctyellow.!.. CMP|
00007ad0  20 52 33 2c 23 30 3a 42  45 51 20 6f 63 74 62 6c  | R3,#0:BEQ octbl|
00007ae0  61 63 6b 0d 21 f2 0b 2e  6f 63 74 72 65 64 0d 21  |ack.!...octred.!|
00007af0  fc 16 20 52 53 42 20 52  30 2c 52 34 2c 23 46 20  |.. RSB R0,R4,#F |
00007b00  3b 31 2d 72 0d 22 06 16  20 43 4d 50 20 52 35 2c  |;1-r.".. CMP R5,|
00007b10  52 30 20 3b 67 3e 31 2d  72 3f 0d 22 10 10 20 42  |R0 ;g>1-r?.".. B|
00007b20  4c 54 20 6f 63 74 72 65  64 31 0d 22 1a 19 20 43  |LT octred1.".. C|
00007b30  4d 50 20 52 35 2c 52 36  20 3b 79 65 73 2d 20 67  |MP R5,R6 ;yes- g|
00007b40  3e 62 3f 0d 22 24 2a 20  4d 4f 56 47 45 20 52 33  |>b?."$* MOVGE R3|
00007b50  2c 23 33 20 3b 69 66 20  67 3e 62 20 74 68 65 6e  |,#3 ;if g>b then|
00007b60  20 67 20 69 73 20 6c 61  72 67 65 73 74 0d 22 2e  | g is largest.".|
00007b70  1b 20 4d 4f 56 4c 54 20  52 33 2c 23 32 20 3b 65  |. MOVLT R3,#2 ;e|
00007b80  6c 73 65 20 62 20 69 73  0d 22 38 11 20 42 20 6f  |lse b is."8. B o|
00007b90  63 74 63 6f 6e 76 65 72  74 0d 22 42 0c 2e 6f 63  |ctconvert."B..oc|
00007ba0  74 72 65 64 31 0d 22 4c  1a 20 43 4d 50 20 52 30  |tred1."L. CMP R0|
00007bb0  2c 52 36 20 3b 6e 6f 2d  20 31 2d 72 3e 62 3f 0d  |,R6 ;no- 1-r>b?.|
00007bc0  22 56 2e 20 4d 4f 56 47  45 20 52 33 2c 23 30 20  |"V. MOVGE R3,#0 |
00007bd0  3b 69 66 20 31 2d 72 3e  62 20 74 68 65 6e 20 31  |;if 1-r>b then 1|
00007be0  2d 72 20 69 73 20 6c 61  72 67 65 73 74 0d 22 60  |-r is largest."`|
00007bf0  1b 20 4d 4f 56 4c 54 20  52 33 2c 23 32 20 3b 65  |. MOVLT R3,#2 ;e|
00007c00  6c 73 65 20 62 20 69 73  0d 22 6a 11 20 42 20 6f  |lse b is."j. B o|
00007c10  63 74 63 6f 6e 76 65 72  74 0d 22 74 0d 2e 6f 63  |ctconvert."t..oc|
00007c20  74 67 72 65 65 6e 0d 22  7e 16 20 52 53 42 20 52  |tgreen."~. RSB R|
00007c30  30 2c 52 35 2c 23 46 20  3b 31 2d 67 0d 22 88 16  |0,R5,#F ;1-g."..|
00007c40  20 43 4d 50 20 52 30 2c  52 34 20 3b 31 2d 67 3e  | CMP R0,R4 ;1-g>|
00007c50  72 3f 0d 22 92 12 20 42  4c 54 20 6f 63 74 67 72  |r?.".. BLT octgr|
00007c60  65 65 6e 31 0d 22 9c 1b  20 43 4d 50 20 52 30 2c  |een1.".. CMP R0,|
00007c70  52 36 20 3b 79 65 73 2d  20 31 2d 67 3e 62 3f 0d  |R6 ;yes- 1-g>b?.|
00007c80  22 a6 2e 20 4d 4f 56 47  45 20 52 33 2c 23 30 20  |".. MOVGE R3,#0 |
00007c90  3b 69 66 20 31 2d 67 3e  62 20 74 68 65 6e 20 31  |;if 1-g>b then 1|
00007ca0  2d 67 20 69 73 20 6c 61  72 67 65 73 74 0d 22 b0  |-g is largest.".|
00007cb0  1b 20 4d 4f 56 4c 54 20  52 33 2c 23 31 20 3b 65  |. MOVLT R3,#1 ;e|
00007cc0  6c 73 65 20 62 20 69 73  0d 22 ba 11 20 42 20 6f  |lse b is.".. B o|
00007cd0  63 74 63 6f 6e 76 65 72  74 0d 22 c4 0e 2e 6f 63  |ctconvert."...oc|
00007ce0  74 67 72 65 65 6e 31 0d  22 ce 18 20 43 4d 50 20  |tgreen1.".. CMP |
00007cf0  52 34 2c 52 36 20 3b 6e  6f 2d 20 72 3e 62 3f 0d  |R4,R6 ;no- r>b?.|
00007d00  22 d8 2a 20 4d 4f 56 47  45 20 52 33 2c 23 33 20  |".* MOVGE R3,#3 |
00007d10  3b 69 66 20 72 3e 62 20  74 68 65 6e 20 72 20 69  |;if r>b then r i|
00007d20  73 20 6c 61 72 67 65 73  74 0d 22 e2 1b 20 4d 4f  |s largest.".. MO|
00007d30  56 4c 54 20 52 33 2c 23  31 20 3b 65 6c 73 65 20  |VLT R3,#1 ;else |
00007d40  62 20 69 73 0d 22 ec 11  20 42 20 6f 63 74 63 6f  |b is.".. B octco|
00007d50  6e 76 65 72 74 0d 22 f6  0c 2e 6f 63 74 62 6c 75  |nvert."...octblu|
00007d60  65 0d 23 00 16 20 52 53  42 20 52 30 2c 52 36 2c  |e.#.. RSB R0,R6,|
00007d70  23 46 20 3b 31 2d 62 0d  23 0a 16 20 43 4d 50 20  |#F ;1-b.#.. CMP |
00007d80  52 30 2c 52 34 20 3b 31  2d 62 3e 72 3f 0d 23 14  |R0,R4 ;1-b>r?.#.|
00007d90  11 20 42 4c 54 20 6f 63  74 62 6c 75 65 31 0d 23  |. BLT octblue1.#|
00007da0  1e 1b 20 43 4d 50 20 52  30 2c 52 35 20 3b 79 65  |.. CMP R0,R5 ;ye|
00007db0  73 2d 20 31 2d 62 3e 67  3f 0d 23 28 2e 20 4d 4f  |s- 1-b>g?.#(. MO|
00007dc0  56 47 45 20 52 33 2c 23  30 20 3b 69 66 20 31 2d  |VGE R3,#0 ;if 1-|
00007dd0  62 3e 67 20 74 68 65 6e  20 31 2d 62 20 69 73 20  |b>g then 1-b is |
00007de0  6c 61 72 67 65 73 74 0d  23 32 1b 20 4d 4f 56 4c  |largest.#2. MOVL|
00007df0  54 20 52 33 2c 23 31 20  3b 65 6c 73 65 20 67 20  |T R3,#1 ;else g |
00007e00  69 73 0d 23 3c 11 20 42  20 6f 63 74 63 6f 6e 76  |is.#<. B octconv|
00007e10  65 72 74 0d 23 46 0d 2e  6f 63 74 62 6c 75 65 31  |ert.#F..octblue1|
00007e20  0d 23 50 18 20 43 4d 50  20 52 34 2c 52 35 20 3b  |.#P. CMP R4,R5 ;|
00007e30  6e 6f 2d 20 72 3e 67 3f  0d 23 5a 2a 20 4d 4f 56  |no- r>g?.#Z* MOV|
00007e40  47 45 20 52 33 2c 23 32  20 3b 69 66 20 72 3e 67  |GE R3,#2 ;if r>g|
00007e50  20 74 68 65 6e 20 72 20  69 73 20 6c 61 72 67 65  | then r is large|
00007e60  73 74 0d 23 64 1b 20 4d  4f 56 4c 54 20 52 33 2c  |st.#d. MOVLT R3,|
00007e70  23 31 20 3b 65 6c 73 65  20 67 20 69 73 0d 23 6e  |#1 ;else g is.#n|
00007e80  11 20 42 20 6f 63 74 63  6f 6e 76 65 72 74 0d 23  |. B octconvert.#|
00007e90  78 0d 2e 6f 63 74 77 68  69 74 65 0d 23 82 16 20  |x..octwhite.#.. |
00007ea0  43 4d 50 20 52 34 2c 52  35 20 3b 69 66 20 72 3e  |CMP R4,R5 ;if r>|
00007eb0  67 0d 23 8c 12 20 42 4c  54 20 6f 63 74 77 68 69  |g.#.. BLT octwhi|
00007ec0  74 65 31 0d 23 96 1a 20  43 4d 50 20 52 35 2c 52  |te1.#.. CMP R5,R|
00007ed0  36 20 3b 79 65 73 20 2d  20 67 3e 62 3f 0d 23 a0  |6 ;yes - g>b?.#.|
00007ee0  26 20 4d 4f 56 47 45 20  52 33 2c 23 33 20 3b 69  |& MOVGE R3,#3 ;i|
00007ef0  66 20 67 3e 62 20 62 20  69 73 20 73 6d 61 6c 6c  |f g>b b is small|
00007f00  65 73 74 0d 23 aa 1b 20  4d 4f 56 4c 54 20 52 33  |est.#.. MOVLT R3|
00007f10  2c 23 32 20 3b 65 6c 73  65 20 67 20 69 73 0d 23  |,#2 ;else g is.#|
00007f20  b4 11 20 42 20 6f 63 74  63 6f 6e 76 65 72 74 0d  |.. B octconvert.|
00007f30  23 be 0e 2e 6f 63 74 77  68 69 74 65 31 0d 23 c8  |#...octwhite1.#.|
00007f40  19 20 43 4d 50 20 52 34  2c 52 36 20 3b 6e 6f 20  |. CMP R4,R6 ;no |
00007f50  2d 20 72 3e 62 3f 0d 23  d2 26 20 4d 4f 56 47 45  |- r>b?.#.& MOVGE|
00007f60  20 52 33 2c 23 33 20 3b  69 66 20 72 3e 62 20 62  | R3,#3 ;if r>b b|
00007f70  20 69 73 20 73 6d 61 6c  6c 65 73 74 0d 23 dc 1b  | is smallest.#..|
00007f80  20 4d 4f 56 4c 54 20 52  33 2c 23 31 20 3b 65 6c  | MOVLT R3,#1 ;el|
00007f90  73 65 20 72 20 69 73 0d  23 e6 0f 2e 6f 63 74 63  |se r is.#...octc|
00007fa0  6f 6e 76 65 72 74 0d 23  f0 1c 20 43 4d 50 20 52  |onvert.#.. CMP R|
00007fb0  33 2c 23 31 20 3b 6e 6f  74 20 72 65 64 3d 63 79  |3,#1 ;not red=cy|
00007fc0  61 6e 0d 23 fa 0c 2e 6f  63 74 63 79 61 6e 0d 24  |an.#...octcyan.$|
00007fd0  04 13 20 53 55 42 45 51  20 52 35 2c 52 35 2c 23  |.. SUBEQ R5,R5,#|
00007fe0  46 0d 24 0e 13 20 53 55  42 45 51 20 52 36 2c 52  |F.$.. SUBEQ R6,R|
00007ff0  36 2c 23 46 0d 24 18 0f  2e 6f 63 74 6d 61 67 65  |6,#F.$...octmage|
00008000  6e 74 61 0d 24 22 21 20  43 4d 50 20 52 33 2c 23  |nta.$"! CMP R3,#|
00008010  32 20 3b 6e 6f 74 20 67  72 65 65 6e 3d 6d 61 67  |2 ;not green=mag|
00008020  65 6e 74 61 0d 24 2c 13  20 53 55 42 45 51 20 52  |enta.$,. SUBEQ R|
00008030  34 2c 52 34 2c 23 46 0d  24 36 13 20 53 55 42 45  |4,R4,#F.$6. SUBE|
00008040  51 20 52 36 2c 52 36 2c  23 46 0d 24 40 0e 2e 6f  |Q R6,R6,#F.$@..o|
00008050  63 74 79 65 6c 6c 6f 77  0d 24 4a 1f 20 43 4d 50  |ctyellow.$J. CMP|
00008060  20 52 33 2c 23 33 20 3b  6e 6f 74 20 62 6c 75 65  | R3,#3 ;not blue|
00008070  3d 79 65 6c 6c 6f 77 0d  24 54 13 20 53 55 42 45  |=yellow.$T. SUBE|
00008080  51 20 52 34 2c 52 34 2c  23 46 0d 24 5e 13 20 53  |Q R4,R4,#F.$^. S|
00008090  55 42 45 51 20 52 35 2c  52 35 2c 23 46 0d 24 68  |UBEQ R5,R5,#F.$h|
000080a0  0d 2e 6f 63 74 62 6c 61  63 6b 0d 24 72 16 20 4d  |..octblack.$r. M|
000080b0  4f 56 20 52 32 2c 52 31  32 2c 4c 53 52 20 23 32  |OV R2,R12,LSR #2|
000080c0  0d 24 7c 21 20 80 20 52  37 2c 52 31 32 2c 23 33  |.$|! . R7,R12,#3|
000080d0  3a 4d 4f 56 20 52 37 2c  52 37 2c 4c 53 4c 20 23  |:MOV R7,R7,LSL #|
000080e0  31 0d 24 86 0f 20 4d 4f  56 20 52 31 34 2c 23 33  |1.$.. MOV R14,#3|
000080f0  0d 24 90 17 20 4d 4f 56  20 52 31 34 2c 52 31 34  |.$.. MOV R14,R14|
00008100  2c 4c 53 4c 20 52 37 0d  24 9a 3f 20 4c 44 52 42  |,LSL R7.$.? LDRB|
00008110  20 52 30 2c 5b 52 32 5d  3a 42 49 43 20 52 30 2c  | R0,[R2]:BIC R0,|
00008120  52 30 2c 52 31 34 3a 84  52 20 52 30 2c 52 30 2c  |R0,R14:.R R0,R0,|
00008130  52 33 2c 4c 53 4c 20 52  37 3a 53 54 52 42 20 52  |R3,LSL R7:STRB R|
00008140  30 2c 5b 52 32 5d 0d 24  a4 13 20 41 44 44 20 52  |0,[R2].$.. ADD R|
00008150  31 32 2c 52 31 32 2c 52  31 0d 24 ae 1d 20 41 44  |12,R12,R1.$.. AD|
00008160  44 20 52 30 2c 52 31 31  2c 23 34 20 3b 6e 6c 20  |D R0,R11,#4 ;nl |
00008170  67 25 28 53 25 29 0d 24  b8 1d 20 41 44 44 20 52  |g%(S%).$.. ADD R|
00008180  32 2c 52 34 2c 52 34 2c  4c 53 4c 20 23 31 20 3b  |2,R4,R4,LSL #1 ;|
00008190  72 2a 33 0d 24 c2 30 20  4c 44 52 20 52 33 2c 5b  |r*3.$.0 LDR R3,[|
000081a0  52 31 31 2c 2d 52 38 5d  3a 41 44 44 20 52 33 2c  |R11,-R8]:ADD R3,|
000081b0  52 33 2c 52 32 2c 41 53  52 20 23 34 20 3b 2b 33  |R3,R2,ASR #4 ;+3|
000081c0  2f 31 36 0d 24 cc 15 20  53 54 52 20 52 33 2c 5b  |/16.$.. STR R3,[|
000081d0  52 31 31 2c 2d 52 38 5d  0d 24 d6 1d 20 41 44 44  |R11,-R8].$.. ADD|
000081e0  20 52 32 2c 52 34 2c 52  34 2c 4c 53 4c 20 23 32  | R2,R4,R4,LSL #2|
000081f0  20 3b 72 2a 35 0d 24 e0  2c 20 4c 44 52 20 52 33  | ;r*5.$., LDR R3|
00008200  2c 5b 52 31 31 5d 3a 41  44 44 20 52 33 2c 52 33  |,[R11]:ADD R3,R3|
00008210  2c 52 32 2c 41 53 52 20  23 34 20 3b 2b 35 2f 31  |,R2,ASR #4 ;+5/1|
00008220  36 0d 24 ea 11 20 53 54  52 20 52 33 2c 5b 52 31  |6.$.. STR R3,[R1|
00008230  31 5d 0d 24 f4 1b 20 4d  4f 56 20 52 33 2c 52 34  |1].$.. MOV R3,R4|
00008240  2c 41 53 52 20 23 34 20  3b 72 2f 31 36 0d 24 fe  |,ASR #4 ;r/16.$.|
00008250  31 20 53 54 52 20 52 33  2c 5b 52 31 31 2c 52 38  |1 STR R3,[R11,R8|
00008260  5d 21 20 3b 6e 6f 74 20  73 65 65 6e 20 73 6f 20  |]! ;not seen so |
00008270  66 61 72 20 69 6e 63 20  6e 6c 20 70 74 72 0d 25  |far inc nl ptr.%|
00008280  08 1d 20 52 53 42 20 52  32 2c 52 34 2c 52 34 2c  |.. RSB R2,R4,R4,|
00008290  4c 53 4c 20 23 33 20 3b  72 2a 37 0d 25 12 25 20  |LSL #3 ;r*7.%.% |
000082a0  4c 44 52 20 52 34 2c 5b  52 31 30 5d 20 3b 6e 65  |LDR R4,[R10] ;ne|
000082b0  78 74 20 72 20 6c 69 67  68 74 20 76 61 6c 75 65  |xt r light value|
000082c0  0d 25 1c 3e 20 41 44 44  20 52 34 2c 52 34 2c 52  |.%.> ADD R4,R4,R|
000082d0  32 2c 41 53 52 20 23 34  20 3b 6e 65 78 74 20 76  |2,ASR #4 ;next v|
000082e0  61 6c 75 65 20 2b 37 2f  31 36 20 6f 66 20 72 20  |alue +7/16 of r |
000082f0  65 72 72 6f 72 20 2d 3e  20 6e 65 77 20 72 0d 25  |error -> new r.%|
00008300  26 1d 20 41 44 44 20 52  32 2c 52 35 2c 52 35 2c  |&. ADD R2,R5,R5,|
00008310  4c 53 4c 20 23 31 20 3b  67 2a 33 0d 25 30 2f 20  |LSL #1 ;g*3.%0/ |
00008320  4c 44 52 20 52 33 2c 5b  52 30 2c 2d 52 38 5d 3a  |LDR R3,[R0,-R8]:|
00008330  41 44 44 20 52 33 2c 52  33 2c 52 32 2c 41 53 52  |ADD R3,R3,R2,ASR|
00008340  20 23 34 20 3b 2b 33 2f  31 36 0d 25 3a 14 20 53  | #4 ;+3/16.%:. S|
00008350  54 52 20 52 33 2c 5b 52  30 2c 2d 52 38 5d 0d 25  |TR R3,[R0,-R8].%|
00008360  44 1b 20 4d 4f 56 20 52  33 2c 52 35 2c 41 53 52  |D. MOV R3,R5,ASR|
00008370  20 23 34 20 3b 67 2f 31  36 0d 25 4e 24 20 53 54  | #4 ;g/16.%N$ ST|
00008380  52 20 52 33 2c 5b 52 30  2c 52 38 5d 20 3b 6e 6f  |R R3,[R0,R8] ;no|
00008390  74 20 73 65 65 6e 20 73  6f 20 66 61 72 0d 25 58  |t seen so far.%X|
000083a0  1d 20 41 44 44 20 52 32  2c 52 35 2c 52 35 2c 4c  |. ADD R2,R5,R5,L|
000083b0  53 4c 20 23 32 20 3b 67  2a 35 0d 25 62 2b 20 4c  |SL #2 ;g*5.%b+ L|
000083c0  44 52 20 52 33 2c 5b 52  30 5d 3a 41 44 44 20 52  |DR R3,[R0]:ADD R|
000083d0  33 2c 52 33 2c 52 32 2c  41 53 52 20 23 34 20 3b  |3,R3,R2,ASR #4 ;|
000083e0  2b 35 2f 31 36 0d 25 6c  33 20 53 54 52 20 52 33  |+5/16.%l3 STR R3|
000083f0  2c 5b 52 30 5d 2c 23 34  20 3b 63 6f 6d 70 75 74  |,[R0],#4 ;comput|
00008400  65 73 20 6e 6c 20 62 20  69 6e 74 6f 20 74 68 65  |es nl b into the|
00008410  20 62 61 72 67 61 69 6e  0d 25 76 1d 20 52 53 42  | bargain.%v. RSB|
00008420  20 52 32 2c 52 35 2c 52  35 2c 4c 53 4c 20 23 33  | R2,R5,R5,LSL #3|
00008430  20 3b 67 2a 37 0d 25 80  28 20 4c 44 52 20 52 35  | ;g*7.%.( LDR R5|
00008440  2c 5b 52 31 30 2c 23 34  5d 20 3b 6e 65 78 74 20  |,[R10,#4] ;next |
00008450  67 20 6c 69 67 68 74 20  76 61 6c 75 65 0d 25 8a  |g light value.%.|
00008460  3e 20 41 44 44 20 52 35  2c 52 35 2c 52 32 2c 41  |> ADD R5,R5,R2,A|
00008470  53 52 20 23 34 20 3b 6e  65 78 74 20 76 61 6c 75  |SR #4 ;next valu|
00008480  65 20 2b 37 2f 31 36 20  6f 66 20 67 20 65 72 72  |e +7/16 of g err|
00008490  6f 72 20 2d 3e 20 6e 65  77 20 67 0d 25 94 1d 20  |or -> new g.%.. |
000084a0  41 44 44 20 52 32 2c 52  36 2c 52 36 2c 4c 53 4c  |ADD R2,R6,R6,LSL|
000084b0  20 23 31 20 3b 62 2a 33  0d 25 9e 2f 20 4c 44 52  | #1 ;b*3.%./ LDR|
000084c0  20 52 33 2c 5b 52 30 2c  2d 52 38 5d 3a 41 44 44  | R3,[R0,-R8]:ADD|
000084d0  20 52 33 2c 52 33 2c 52  32 2c 41 53 52 20 23 34  | R3,R3,R2,ASR #4|
000084e0  20 3b 2b 33 2f 31 36 0d  25 a8 14 20 53 54 52 20  | ;+3/16.%.. STR |
000084f0  52 33 2c 5b 52 30 2c 2d  52 38 5d 0d 25 b2 1d 20  |R3,[R0,-R8].%.. |
00008500  41 44 44 20 52 32 2c 52  36 2c 52 36 2c 4c 53 4c  |ADD R2,R6,R6,LSL|
00008510  20 23 32 20 3b 62 2a 35  0d 25 bc 2b 20 4c 44 52  | #2 ;b*5.%.+ LDR|
00008520  20 52 33 2c 5b 52 30 5d  3a 41 44 44 20 52 33 2c  | R3,[R0]:ADD R3,|
00008530  52 33 2c 52 32 2c 41 53  52 20 23 34 20 3b 2b 35  |R3,R2,ASR #4 ;+5|
00008540  2f 31 36 0d 25 c6 10 20  53 54 52 20 52 33 2c 5b  |/16.%.. STR R3,[|
00008550  52 30 5d 0d 25 d0 1b 20  4d 4f 56 20 52 33 2c 52  |R0].%.. MOV R3,R|
00008560  36 2c 41 53 52 20 23 34  20 3b 62 2f 31 36 0d 25  |6,ASR #4 ;b/16.%|
00008570  da 24 20 53 54 52 20 52  33 2c 5b 52 30 2c 52 38  |.$ STR R3,[R0,R8|
00008580  5d 20 3b 6e 6f 74 20 73  65 65 6e 20 73 6f 20 66  |] ;not seen so f|
00008590  61 72 0d 25 e4 1d 20 52  53 42 20 52 32 2c 52 36  |ar.%.. RSB R2,R6|
000085a0  2c 52 36 2c 4c 53 4c 20  23 33 20 3b 62 2a 37 0d  |,R6,LSL #3 ;b*7.|
000085b0  25 ee 28 20 4c 44 52 20  52 36 2c 5b 52 31 30 2c  |%.( LDR R6,[R10,|
000085c0  23 38 5d 20 3b 6e 65 78  74 20 62 20 6c 69 67 68  |#8] ;next b ligh|
000085d0  74 20 76 61 6c 75 65 0d  25 f8 3e 20 41 44 44 20  |t value.%.> ADD |
000085e0  52 36 2c 52 36 2c 52 32  2c 41 53 52 20 23 34 20  |R6,R6,R2,ASR #4 |
000085f0  3b 6e 65 78 74 20 76 61  6c 75 65 20 2b 37 2f 31  |;next value +7/1|
00008600  36 20 6f 66 20 62 20 65  72 72 6f 72 20 2d 3e 20  |6 of b error -> |
00008610  6e 65 77 20 62 0d 26 02  06 20 5d 0d 26 0c 05 cc  |new b.&.. ].&...|
00008620  0d 26 16 0a 5b 4f 50 54  20 5a 0d 26 20 3b 20 54  |.&..[OPT Z.& ; T|
00008630  45 51 20 52 34 2c 23 30  3a 4d 4f 56 4d 49 20 52  |EQ R4,#0:MOVMI R|
00008640  34 2c 23 30 3a 43 4d 50  20 52 34 2c 23 46 3a 4d  |4,#0:CMP R4,#F:M|
00008650  4f 56 43 53 20 52 34 2c  23 46 20 3b 30 3c 3d 76  |OVCS R4,#F ;0<=v|
00008660  61 6c 3c 3d 31 0d 26 2a  1c 20 41 44 44 20 52 33  |al<=1.&*. ADD R3|
00008670  2c 52 34 2c 52 34 2c 4c  53 4c 20 23 31 20 3b 2a  |,R4,R4,LSL #1 ;*|
00008680  33 0d 26 34 1e 20 41 44  44 20 52 33 2c 52 33 2c  |3.&4. ADD R3,R3,|
00008690  23 46 3e 3e 31 20 3b 72  6f 75 6e 64 20 75 70 0d  |#F>>1 ;round up.|
000086a0  26 3e 27 20 4d 4f 56 53  20 52 33 2c 52 33 2c 4c  |&>' MOVS R3,R3,L|
000086b0  53 52 20 23 62 69 74 73  20 3b 66 69 6e 61 6c 20  |SR #bits ;final |
000086c0  69 6e 74 30 2d 33 0d 26  48 34 20 4c 44 52 4e 45  |int0-3.&H4 LDRNE|
000086d0  20 52 32 2c 5b 52 37 2c  52 33 2c 4c 53 4c 20 23  | R2,[R7,R3,LSL #|
000086e0  32 5d 20 3b 64 69 76 69  64 65 20 62 79 20 33 20  |2] ;divide by 3 |
000086f0  66 72 6f 6d 20 74 61 62  6c 65 0d 26 52 2d 20 53  |from table.&R- S|
00008700  55 42 4e 45 20 52 34 2c  52 34 2c 52 32 20 3b 73  |UBNE R4,R4,R2 ;s|
00008710  75 62 74 72 61 63 74 20  63 6f 6e 76 65 72 74 65  |ubtract converte|
00008720  64 20 76 61 6c 75 65 0d  26 5c 16 20 4d 4f 56 20  |d value.&\. MOV |
00008730  52 32 2c 52 31 32 2c 4c  53 52 20 23 32 0d 26 66  |R2,R12,LSR #2.&f|
00008740  21 20 80 20 52 35 2c 52  31 32 2c 23 33 3a 4d 4f  |! . R5,R12,#3:MO|
00008750  56 20 52 35 2c 52 35 2c  4c 53 4c 20 23 31 0d 26  |V R5,R5,LSL #1.&|
00008760  70 1f 20 4d 4f 56 20 52  36 2c 23 33 3a 4d 4f 56  |p. MOV R6,#3:MOV|
00008770  20 52 36 2c 52 36 2c 4c  53 4c 20 52 35 0d 26 7a  | R6,R6,LSL R5.&z|
00008780  3e 20 4c 44 52 42 20 52  30 2c 5b 52 32 5d 3a 42  |> LDRB R0,[R2]:B|
00008790  49 43 20 52 30 2c 52 30  2c 52 36 3a 84 52 20 52  |IC R0,R0,R6:.R R|
000087a0  30 2c 52 30 2c 52 33 2c  4c 53 4c 20 52 35 3a 53  |0,R0,R3,LSL R5:S|
000087b0  54 52 42 20 52 30 2c 5b  52 32 5d 0d 26 84 13 20  |TRB R0,[R2].&.. |
000087c0  41 44 44 20 52 31 32 2c  52 31 32 2c 52 31 0d 26  |ADD R12,R12,R1.&|
000087d0  8e 1c 20 41 44 44 20 52  32 2c 52 34 2c 52 34 2c  |.. ADD R2,R4,R4,|
000087e0  4c 53 4c 20 23 31 20 3b  2a 33 0d 26 98 30 20 4c  |LSL #1 ;*3.&.0 L|
000087f0  44 52 20 52 33 2c 5b 52  31 31 2c 2d 52 38 5d 3a  |DR R3,[R11,-R8]:|
00008800  41 44 44 20 52 33 2c 52  33 2c 52 32 2c 41 53 52  |ADD R3,R3,R2,ASR|
00008810  20 23 34 20 3b 2b 33 2f  31 36 0d 26 a2 15 20 53  | #4 ;+3/16.&.. S|
00008820  54 52 20 52 33 2c 5b 52  31 31 2c 2d 52 38 5d 0d  |TR R3,[R11,-R8].|
00008830  26 ac 1c 20 41 44 44 20  52 32 2c 52 34 2c 52 34  |&.. ADD R2,R4,R4|
00008840  2c 4c 53 4c 20 23 32 20  3b 2a 35 0d 26 b6 2c 20  |,LSL #2 ;*5.&., |
00008850  4c 44 52 20 52 33 2c 5b  52 31 31 5d 3a 41 44 44  |LDR R3,[R11]:ADD|
00008860  20 52 33 2c 52 33 2c 52  32 2c 41 53 52 20 23 34  | R3,R3,R2,ASR #4|
00008870  20 3b 2b 35 2f 31 36 0d  26 c0 11 20 53 54 52 20  | ;+5/16.&.. STR |
00008880  52 33 2c 5b 52 31 31 5d  0d 26 ca 1a 20 4d 4f 56  |R3,[R11].&.. MOV|
00008890  20 52 33 2c 52 34 2c 41  53 52 20 23 34 20 3b 2f  | R3,R4,ASR #4 ;/|
000088a0  31 36 0d 26 d4 31 20 53  54 52 20 52 33 2c 5b 52  |16.&.1 STR R3,[R|
000088b0  31 31 2c 52 38 5d 21 20  3b 6e 6f 74 20 73 65 65  |11,R8]! ;not see|
000088c0  6e 20 73 6f 20 66 61 72  20 69 6e 63 20 6e 6c 20  |n so far inc nl |
000088d0  70 74 72 0d 26 de 1c 20  52 53 42 20 52 32 2c 52  |ptr.&.. RSB R2,R|
000088e0  34 2c 52 34 2c 4c 53 4c  20 23 33 20 3b 2a 37 0d  |4,R4,LSL #3 ;*7.|
000088f0  26 e8 26 20 4c 44 52 20  52 34 2c 5b 52 31 30 5d  |&.& LDR R4,[R10]|
00008900  2c 52 38 20 3b 6e 65 78  74 20 6c 69 67 68 74 20  |,R8 ;next light |
00008910  76 61 6c 75 65 0d 26 f2  40 20 41 44 44 20 52 34  |value.&.@ ADD R4|
00008920  2c 52 34 2c 52 32 2c 41  53 52 20 23 34 20 3b 6e  |,R4,R2,ASR #4 ;n|
00008930  65 78 74 20 76 61 6c 75  65 20 2b 37 2f 31 36 20  |ext value +7/16 |
00008940  6f 66 20 65 72 72 6f 72  20 2d 3e 20 6e 65 77 20  |of error -> new |
00008950  76 61 6c 75 65 0d 26 fc  06 20 5d 0d 27 06 05 cd  |value.&.. ].'...|
00008960  0d 27 10 0a 5b 4f 50 54  20 5a 0d 27 1a 1d 20 53  |.'..[OPT Z.'.. S|
00008970  55 42 53 20 52 39 2c 52  39 2c 23 31 3a 42 4e 45  |UBS R9,R9,#1:BNE|
00008980  20 66 73 6c 6f 6f 70 0d  27 24 15 20 4c 44 4d 46  | fsloop.'$. LDMF|
00008990  44 20 53 50 20 21 2c 7b  50 43 7d 5e 0d 27 2e 06  |D SP !,{PC}^.'..|
000089a0  20 5d 0d 27 38 08 c9 20  31 3a 0d 27 42 0d e7 6d  | ].'8.. 1:.'B..m|
000089b0  24 3d 22 43 22 20 8c 0d  27 4c 0a 5b 4f 50 54 20  |$="C" ..'L.[OPT |
000089c0  5a 0d 27 56 1f 2e 65 76  65 6e 72 6f 77 5f 67 61  |Z.'V..evenrow_ga|
000089d0  72 64 20 44 43 44 20 65  76 65 6e 5f 67 61 72 64  |rd DCD even_gard|
000089e0  0d 27 60 1d 2e 6f 64 64  72 6f 77 5f 67 61 72 64  |.'`..oddrow_gard|
000089f0  20 44 43 44 20 6f 64 64  5f 67 61 72 64 0d 27 6a  | DCD odd_gard.'j|
00008a00  18 2e 71 75 61 72 74 65  72 72 6f 77 69 6e 63 20  |..quarterrowinc |
00008a10  44 43 44 20 30 0d 27 74  08 2e 66 73 25 0d 27 7e  |DCD 0.'t..fs%.'~|
00008a20  15 20 53 54 4d 46 44 20  53 50 20 21 2c 7b 52 31  |. STMFD SP !,{R1|
00008a30  34 7d 0d 27 88 24 20 4c  44 52 20 52 31 30 2c 5b  |4}.'.$ LDR R10,[|
00008a40  52 39 2c 23 34 2a 38 5d  20 3b 61 64 64 72 20 63  |R9,#4*8] ;addr c|
00008a50  75 72 72 65 6e 74 0d 27  92 21 20 4c 44 52 20 52  |urrent.'.! LDR R|
00008a60  31 31 2c 5b 52 39 2c 23  33 2a 38 5d 20 3b 61 64  |11,[R9,#3*8] ;ad|
00008a70  64 72 20 6e 65 78 74 0d  27 9c 2a 20 4c 44 52 20  |dr next.'.* LDR |
00008a80  52 31 32 2c 5b 52 39 2c  23 32 2a 38 5d 20 3b 61  |R12,[R9,#2*8] ;a|
00008a90  64 64 72 20 70 69 78 65  6c 20 61 64 64 72 65 73  |ddr pixel addres|
00008aa0  73 0d 27 a6 21 20 4c 44  52 20 52 31 32 2c 5b 52  |s.'.! LDR R12,[R|
00008ab0  31 32 5d 20 3b 70 69 78  65 6c 20 61 64 64 72 65  |12] ;pixel addre|
00008ac0  73 73 0d 27 b0 1e 20 4c  44 52 20 52 38 2c 5b 52  |ss.'.. LDR R8,[R|
00008ad0  39 2c 23 38 5d 20 3b 61  64 64 72 20 73 74 65 70  |9,#8] ;addr step|
00008ae0  0d 27 ba 16 20 4c 44 52  20 52 38 2c 5b 52 38 5d  |.'.. LDR R8,[R8]|
00008af0  20 3b 73 74 65 70 0d 27  c4 1c 20 4c 44 52 20 52  | ;step.'.. LDR R|
00008b00  39 2c 5b 52 39 5d 20 3b  61 64 64 72 20 63 6f 75  |9,[R9] ;addr cou|
00008b10  6e 74 0d 27 ce 17 20 4c  44 52 20 52 39 2c 5b 52  |nt.'.. LDR R9,[R|
00008b20  39 5d 20 3b 63 6f 75 6e  74 0d 27 d8 20 20 4c 44  |9] ;count.'.  LD|
00008b30  52 20 52 34 2c 5b 52 31  30 5d 2c 52 38 20 3b 6d  |R R4,[R10],R8 ;m|
00008b40  6f 6e 6f 20 76 61 6c 75  65 0d 27 e2 0e 20 54 45  |ono value.'.. TE|
00008b50  51 20 52 38 2c 23 30 0d  27 ec 10 20 4d 4f 56 50  |Q R8,#0.'.. MOVP|
00008b60  4c 20 52 31 2c 23 32 0d  27 f6 1a 20 4c 44 52 50  |L R1,#2.'.. LDRP|
00008b70  4c 20 52 36 2c 65 76 65  6e 72 6f 77 5f 67 61 72  |L R6,evenrow_gar|
00008b80  64 0d 28 00 29 20 4d 56  4e 4d 49 20 52 31 2c 23  |d.(.) MVNMI R1,#|
00008b90  31 20 3b 2b 2f 2d 20 32  20 66 6f 72 20 73 70 72  |1 ;+/- 2 for spr|
00008ba0  69 74 65 20 6f 75 74 70  75 74 0d 28 0a 19 20 4c  |ite output.(.. L|
00008bb0  44 52 4d 49 20 52 36 2c  6f 64 64 72 6f 77 5f 67  |DRMI R6,oddrow_g|
00008bc0  61 72 64 0d 28 14 19 20  4c 44 52 20 52 37 2c 71  |ard.(.. LDR R7,q|
00008bd0  75 61 72 74 65 72 72 6f  77 69 6e 63 0d 28 1e 0b  |uarterrowinc.(..|
00008be0  2e 66 73 6c 6f 6f 70 0d  28 28 3b 20 54 45 51 20  |.fsloop.((; TEQ |
00008bf0  52 34 2c 23 30 3a 4d 4f  56 4d 49 20 52 34 2c 23  |R4,#0:MOVMI R4,#|
00008c00  30 3a 43 4d 50 20 52 34  2c 23 46 3a 4d 4f 56 43  |0:CMP R4,#F:MOVC|
00008c10  53 20 52 34 2c 23 46 20  3b 30 3c 3d 76 61 6c 3c  |S R4,#F ;0<=val<|
00008c20  3d 31 0d 28 32 1e 20 41  44 44 20 52 35 2c 52 34  |=1.(2. ADD R5,R4|
00008c30  2c 23 46 3e 3e 35 20 3b  72 6f 75 6e 64 20 75 70  |,#F>>5 ;round up|
00008c40  0d 28 3c 2b 20 4d 4f 56  53 20 52 35 2c 52 35 2c  |.(<+ MOVS R5,R5,|
00008c50  4c 53 52 20 23 62 69 74  73 2d 34 20 3b 66 69 6e  |LSR #bits-4 ;fin|
00008c60  61 6c 20 69 6e 74 20 30  2d 31 36 0d 28 46 39 20  |al int 0-16.(F9 |
00008c70  53 55 42 4e 45 20 52 34  2c 52 34 2c 52 35 2c 4c  |SUBNE R4,R4,R5,L|
00008c80  53 4c 20 23 62 69 74 73  2d 34 20 3b 73 75 62 74  |SL #bits-4 ;subt|
00008c90  72 61 63 74 20 63 6f 6e  76 65 72 74 65 64 20 76  |ract converted v|
00008ca0  61 6c 75 65 0d 28 50 1c  20 41 44 44 20 52 32 2c  |alue.(P. ADD R2,|
00008cb0  52 34 2c 52 34 2c 4c 53  4c 20 23 31 20 3b 2a 33  |R4,R4,LSL #1 ;*3|
00008cc0  0d 28 5a 30 20 4c 44 52  20 52 33 2c 5b 52 31 31  |.(Z0 LDR R3,[R11|
00008cd0  2c 2d 52 38 5d 3a 41 44  44 20 52 33 2c 52 33 2c  |,-R8]:ADD R3,R3,|
00008ce0  52 32 2c 41 53 52 20 23  34 20 3b 2b 33 2f 31 36  |R2,ASR #4 ;+3/16|
00008cf0  0d 28 64 15 20 53 54 52  20 52 33 2c 5b 52 31 31  |.(d. STR R3,[R11|
00008d00  2c 2d 52 38 5d 0d 28 6e  1c 20 41 44 44 20 52 32  |,-R8].(n. ADD R2|
00008d10  2c 52 34 2c 52 34 2c 4c  53 4c 20 23 32 20 3b 2a  |,R4,R4,LSL #2 ;*|
00008d20  35 0d 28 78 2c 20 4c 44  52 20 52 33 2c 5b 52 31  |5.(x, LDR R3,[R1|
00008d30  31 5d 3a 41 44 44 20 52  33 2c 52 33 2c 52 32 2c  |1]:ADD R3,R3,R2,|
00008d40  41 53 52 20 23 34 20 3b  2b 35 2f 31 36 0d 28 82  |ASR #4 ;+5/16.(.|
00008d50  11 20 53 54 52 20 52 33  2c 5b 52 31 31 5d 0d 28  |. STR R3,[R11].(|
00008d60  8c 1a 20 4d 4f 56 20 52  33 2c 52 34 2c 41 53 52  |.. MOV R3,R4,ASR|
00008d70  20 23 34 20 3b 2f 31 36  0d 28 96 31 20 53 54 52  | #4 ;/16.(.1 STR|
00008d80  20 52 33 2c 5b 52 31 31  2c 52 38 5d 21 20 3b 6e  | R3,[R11,R8]! ;n|
00008d90  6f 74 20 73 65 65 6e 20  73 6f 20 66 61 72 20 69  |ot seen so far i|
00008da0  6e 63 20 6e 6c 20 70 74  72 0d 28 a0 1c 20 52 53  |nc nl ptr.(.. RS|
00008db0  42 20 52 32 2c 52 34 2c  52 34 2c 4c 53 4c 20 23  |B R2,R4,R4,LSL #|
00008dc0  33 20 3b 2a 37 0d 28 aa  26 20 4c 44 52 20 52 34  |3 ;*7.(.& LDR R4|
00008dd0  2c 5b 52 31 30 5d 2c 52  38 20 3b 6e 65 78 74 20  |,[R10],R8 ;next |
00008de0  6c 69 67 68 74 20 76 61  6c 75 65 0d 28 b4 41 20  |light value.(.A |
00008df0  41 44 44 53 20 52 34 2c  52 34 2c 52 32 2c 41 53  |ADDS R4,R4,R2,AS|
00008e00  52 20 23 34 20 3b 6e 65  78 74 20 76 61 6c 75 65  |R #4 ;next value|
00008e10  20 2b 37 2f 31 36 20 6f  66 20 65 72 72 6f 72 20  | +7/16 of error |
00008e20  2d 3e 20 6e 65 77 20 76  61 6c 75 65 0d 28 be 31  |-> new value.(.1|
00008e30  20 4d 4f 56 4d 49 20 52  34 2c 23 30 3a 43 4d 50  | MOVMI R4,#0:CMP|
00008e40  20 52 34 2c 23 46 3a 4d  4f 56 43 53 20 52 34 2c  | R4,#F:MOVCS R4,|
00008e50  23 46 20 3b 30 3c 3d 76  61 6c 3c 3d 31 0d 28 c8  |#F ;0<=val<=1.(.|
00008e60  1e 20 41 44 44 20 52 33  2c 52 34 2c 23 46 3e 3e  |. ADD R3,R4,#F>>|
00008e70  35 20 3b 72 6f 75 6e 64  20 75 70 0d 28 d2 2b 20  |5 ;round up.(.+ |
00008e80  4d 4f 56 53 20 52 33 2c  52 33 2c 4c 53 52 20 23  |MOVS R3,R3,LSR #|
00008e90  62 69 74 73 2d 34 20 3b  66 69 6e 61 6c 20 69 6e  |bits-4 ;final in|
00008ea0  74 20 30 2d 31 36 0d 28  dc 39 20 53 55 42 4e 45  |t 0-16.(.9 SUBNE|
00008eb0  20 52 34 2c 52 34 2c 52  33 2c 4c 53 4c 20 23 62  | R4,R4,R3,LSL #b|
00008ec0  69 74 73 2d 34 20 3b 73  75 62 74 72 61 63 74 20  |its-4 ;subtract |
00008ed0  63 6f 6e 76 65 72 74 65  64 20 76 61 6c 75 65 0d  |converted value.|
00008ee0  28 e6 38 20 54 45 51 20  52 31 2c 23 30 3a 84 52  |(.8 TEQ R1,#0:.R|
00008ef0  50 4c 20 52 35 2c 52 35  2c 52 33 2c 4c 53 4c 20  |PL R5,R5,R3,LSL |
00008f00  23 35 3a 84 52 4d 49 20  52 35 2c 52 33 2c 52 35  |#5:.RMI R5,R3,R5|
00008f10  2c 4c 53 4c 20 23 35 0d  28 f0 2a 20 4c 44 52 20  |,LSL #5.(.* LDR |
00008f20  52 33 2c 5b 52 36 2c 52  35 2c 4c 53 4c 20 23 32  |R3,[R6,R5,LSL #2|
00008f30  5d 20 3b 67 65 74 20 34  20 70 61 74 74 65 72 6e  |] ;get 4 pattern|
00008f40  73 0d 28 fa 47 20 4d 4f  56 20 52 32 2c 52 31 32  |s.(.G MOV R2,R12|
00008f50  2c 4c 53 52 20 23 31 3a  53 54 52 42 20 52 33 2c  |,LSR #1:STRB R3,|
00008f60  5b 52 32 5d 2c 52 37 3a  4d 4f 56 20 52 33 2c 52  |[R2],R7:MOV R3,R|
00008f70  33 2c 4c 53 52 20 23 38  3a 53 54 52 42 20 52 33  |3,LSR #8:STRB R3|
00008f80  2c 5b 52 32 5d 2c 52 37  0d 29 04 43 20 4d 4f 56  |,[R2],R7.).C MOV|
00008f90  20 52 33 2c 52 33 2c 4c  53 52 20 23 38 3a 53 54  | R3,R3,LSR #8:ST|
00008fa0  52 42 20 52 33 2c 5b 52  32 5d 2c 52 37 3a 4d 4f  |RB R3,[R2],R7:MO|
00008fb0  56 20 52 33 2c 52 33 2c  4c 53 52 20 23 38 3a 53  |V R3,R3,LSR #8:S|
00008fc0  54 52 42 20 52 33 2c 5b  52 32 5d 0d 29 0e 13 20  |TRB R3,[R2].).. |
00008fd0  41 44 44 20 52 31 32 2c  52 31 32 2c 52 31 0d 29  |ADD R12,R12,R1.)|
00008fe0  18 1c 20 41 44 44 20 52  32 2c 52 34 2c 52 34 2c  |.. ADD R2,R4,R4,|
00008ff0  4c 53 4c 20 23 31 20 3b  2a 33 0d 29 22 30 20 4c  |LSL #1 ;*3.)"0 L|
00009000  44 52 20 52 33 2c 5b 52  31 31 2c 2d 52 38 5d 3a  |DR R3,[R11,-R8]:|
00009010  41 44 44 20 52 33 2c 52  33 2c 52 32 2c 41 53 52  |ADD R3,R3,R2,ASR|
00009020  20 23 34 20 3b 2b 33 2f  31 36 0d 29 2c 15 20 53  | #4 ;+3/16.),. S|
00009030  54 52 20 52 33 2c 5b 52  31 31 2c 2d 52 38 5d 0d  |TR R3,[R11,-R8].|
00009040  29 36 1c 20 41 44 44 20  52 32 2c 52 34 2c 52 34  |)6. ADD R2,R4,R4|
00009050  2c 4c 53 4c 20 23 32 20  3b 2a 35 0d 29 40 2c 20  |,LSL #2 ;*5.)@, |
00009060  4c 44 52 20 52 33 2c 5b  52 31 31 5d 3a 41 44 44  |LDR R3,[R11]:ADD|
00009070  20 52 33 2c 52 33 2c 52  32 2c 41 53 52 20 23 34  | R3,R3,R2,ASR #4|
00009080  20 3b 2b 35 2f 31 36 0d  29 4a 11 20 53 54 52 20  | ;+5/16.)J. STR |
00009090  52 33 2c 5b 52 31 31 5d  0d 29 54 1a 20 4d 4f 56  |R3,[R11].)T. MOV|
000090a0  20 52 33 2c 52 34 2c 41  53 52 20 23 34 20 3b 2f  | R3,R4,ASR #4 ;/|
000090b0  31 36 0d 29 5e 31 20 53  54 52 20 52 33 2c 5b 52  |16.)^1 STR R3,[R|
000090c0  31 31 2c 52 38 5d 21 20  3b 6e 6f 74 20 73 65 65  |11,R8]! ;not see|
000090d0  6e 20 73 6f 20 66 61 72  20 69 6e 63 20 6e 6c 20  |n so far inc nl |
000090e0  70 74 72 0d 29 68 1c 20  52 53 42 20 52 32 2c 52  |ptr.)h. RSB R2,R|
000090f0  34 2c 52 34 2c 4c 53 4c  20 23 33 20 3b 2a 37 0d  |4,R4,LSL #3 ;*7.|
00009100  29 72 26 20 4c 44 52 20  52 34 2c 5b 52 31 30 5d  |)r& LDR R4,[R10]|
00009110  2c 52 38 20 3b 6e 65 78  74 20 6c 69 67 68 74 20  |,R8 ;next light |
00009120  76 61 6c 75 65 0d 29 7c  40 20 41 44 44 20 52 34  |value.)|@ ADD R4|
00009130  2c 52 34 2c 52 32 2c 41  53 52 20 23 34 20 3b 6e  |,R4,R2,ASR #4 ;n|
00009140  65 78 74 20 76 61 6c 75  65 20 2b 37 2f 31 36 20  |ext value +7/16 |
00009150  6f 66 20 65 72 72 6f 72  20 2d 3e 20 6e 65 77 20  |of error -> new |
00009160  76 61 6c 75 65 0d 29 86  1d 20 53 55 42 53 20 52  |value.).. SUBS R|
00009170  39 2c 52 39 2c 23 32 3a  42 4e 45 20 66 73 6c 6f  |9,R9,#2:BNE fslo|
00009180  6f 70 0d 29 90 15 20 4c  44 4d 46 44 20 53 50 20  |op.).. LDMFD SP |
00009190  21 2c 7b 50 43 7d 5e 0d  29 9a 06 20 5d 0d 29 a4  |!,{PC}^.).. ].).|
000091a0  05 cc 0d 29 ae 0a 5b 4f  50 54 20 5a 0d 29 b8 08  |...)..[OPT Z.)..|
000091b0  2e 66 73 25 0d 29 c2 15  20 53 54 4d 46 44 20 53  |.fs%.).. STMFD S|
000091c0  50 20 21 2c 7b 52 31 34  7d 0d 29 cc 24 20 4c 44  |P !,{R14}.).$ LD|
000091d0  52 20 52 31 30 2c 5b 52  39 2c 23 34 2a 38 5d 20  |R R10,[R9,#4*8] |
000091e0  3b 61 64 64 72 20 63 75  72 72 65 6e 74 0d 29 d6  |;addr current.).|
000091f0  21 20 4c 44 52 20 52 31  31 2c 5b 52 39 2c 23 33  |! LDR R11,[R9,#3|
00009200  2a 38 5d 20 3b 61 64 64  72 20 6e 65 78 74 0d 29  |*8] ;addr next.)|
00009210  e0 2a 20 4c 44 52 20 52  31 32 2c 5b 52 39 2c 23  |.* LDR R12,[R9,#|
00009220  32 2a 38 5d 20 3b 61 64  64 72 20 70 69 78 65 6c  |2*8] ;addr pixel|
00009230  20 61 64 64 72 65 73 73  0d 29 ea 21 20 4c 44 52  | address.).! LDR|
00009240  20 52 31 32 2c 5b 52 31  32 5d 20 3b 70 69 78 65  | R12,[R12] ;pixe|
00009250  6c 20 61 64 64 72 65 73  73 0d 29 f4 1e 20 4c 44  |l address.).. LD|
00009260  52 20 52 38 2c 5b 52 39  2c 23 38 5d 20 3b 61 64  |R R8,[R9,#8] ;ad|
00009270  64 72 20 73 74 65 70 0d  29 fe 16 20 4c 44 52 20  |dr step.).. LDR |
00009280  52 38 2c 5b 52 38 5d 20  3b 73 74 65 70 0d 2a 08  |R8,[R8] ;step.*.|
00009290  1c 20 4c 44 52 20 52 39  2c 5b 52 39 5d 20 3b 61  |. LDR R9,[R9] ;a|
000092a0  64 64 72 20 63 6f 75 6e  74 0d 2a 12 17 20 4c 44  |ddr count.*.. LD|
000092b0  52 20 52 39 2c 5b 52 39  5d 20 3b 63 6f 75 6e 74  |R R9,[R9] ;count|
000092c0  0d 2a 1c 20 20 4c 44 52  20 52 34 2c 5b 52 31 30  |.*.  LDR R4,[R10|
000092d0  5d 2c 52 38 20 3b 6d 6f  6e 6f 20 76 61 6c 75 65  |],R8 ;mono value|
000092e0  0d 2a 26 3f 20 54 45 51  20 52 38 2c 23 30 3a 4d  |.*&? TEQ R8,#0:M|
000092f0  4f 56 50 4c 20 52 31 2c  23 31 3a 4d 56 4e 4d 49  |OVPL R1,#1:MVNMI|
00009300  20 52 31 2c 23 30 20 3b  2b 2f 2d 20 31 20 66 6f  | R1,#0 ;+/- 1 fo|
00009310  72 20 73 70 72 69 74 65  20 6f 75 74 70 75 74 0d  |r sprite output.|
00009320  2a 30 0b 2e 66 73 6c 6f  6f 70 0d 2a 3a 3b 20 54  |*0..fsloop.*:; T|
00009330  45 51 20 52 34 2c 23 30  3a 4d 4f 56 4d 49 20 52  |EQ R4,#0:MOVMI R|
00009340  34 2c 23 30 3a 43 4d 50  20 52 34 2c 23 46 3a 4d  |4,#0:CMP R4,#F:M|
00009350  4f 56 43 53 20 52 34 2c  23 46 20 3b 30 3c 3d 76  |OVCS R4,#F ;0<=v|
00009360  61 6c 3c 3d 31 0d 2a 44  0e 20 4d 4f 56 20 52 33  |al<=1.*D. MOV R3|
00009370  2c 23 30 0d 2a 4e 18 20  43 4d 50 20 52 34 2c 23  |,#0.*N. CMP R4,#|
00009380  46 3e 3e 31 20 3b 3e 31  2f 32 3f 0d 2a 58 2e 20  |F>>1 ;>1/2?.*X. |
00009390  53 55 42 43 53 20 52 34  2c 52 34 2c 23 46 3a 4d  |SUBCS R4,R4,#F:M|
000093a0  4f 56 43 53 20 52 33 2c  23 31 20 3b 66 69 6e 61  |OVCS R3,#1 ;fina|
000093b0  6c 20 69 6e 74 20 30 2d  31 0d 2a 62 16 20 4d 4f  |l int 0-1.*b. MO|
000093c0  56 20 52 32 2c 52 31 32  2c 4c 53 52 20 23 33 0d  |V R2,R12,LSR #3.|
000093d0  2a 6c 2b 20 80 20 52 35  2c 52 31 32 2c 23 37 3a  |*l+ . R5,R12,#7:|
000093e0  4d 4f 56 20 52 36 2c 23  31 3a 4d 4f 56 20 52 36  |MOV R6,#1:MOV R6|
000093f0  2c 52 36 2c 4c 53 4c 20  52 35 0d 2a 76 4d 20 4c  |,R6,LSL R5.*vM L|
00009400  44 52 42 20 52 30 2c 5b  52 32 5d 3a 42 49 43 20  |DRB R0,[R2]:BIC |
00009410  52 30 2c 52 30 2c 52 36  3a 84 52 20 52 30 2c 52  |R0,R0,R6:.R R0,R|
00009420  30 2c 52 33 2c 4c 53 4c  20 52 35 20 3b 69 6e 76  |0,R3,LSL R5 ;inv|
00009430  65 72 74 20 72 33 20 76  61 6c 75 65 20 69 6e 20  |ert r3 value in |
00009440  70 72 6f 63 65 73 73 0d  2a 80 11 20 53 54 52 42  |process.*.. STRB|
00009450  20 52 30 2c 5b 52 32 5d  0d 2a 8a 13 20 41 44 44  | R0,[R2].*.. ADD|
00009460  20 52 31 32 2c 52 31 32  2c 52 31 0d 2a 94 1c 20  | R12,R12,R1.*.. |
00009470  41 44 44 20 52 32 2c 52  34 2c 52 34 2c 4c 53 4c  |ADD R2,R4,R4,LSL|
00009480  20 23 31 20 3b 2a 33 0d  2a 9e 30 20 4c 44 52 20  | #1 ;*3.*.0 LDR |
00009490  52 33 2c 5b 52 31 31 2c  2d 52 38 5d 3a 41 44 44  |R3,[R11,-R8]:ADD|
000094a0  20 52 33 2c 52 33 2c 52  32 2c 41 53 52 20 23 34  | R3,R3,R2,ASR #4|
000094b0  20 3b 2b 33 2f 31 36 0d  2a a8 15 20 53 54 52 20  | ;+3/16.*.. STR |
000094c0  52 33 2c 5b 52 31 31 2c  2d 52 38 5d 0d 2a b2 1c  |R3,[R11,-R8].*..|
000094d0  20 41 44 44 20 52 32 2c  52 34 2c 52 34 2c 4c 53  | ADD R2,R4,R4,LS|
000094e0  4c 20 23 32 20 3b 2a 35  0d 2a bc 2c 20 4c 44 52  |L #2 ;*5.*., LDR|
000094f0  20 52 33 2c 5b 52 31 31  5d 3a 41 44 44 20 52 33  | R3,[R11]:ADD R3|
00009500  2c 52 33 2c 52 32 2c 41  53 52 20 23 34 20 3b 2b  |,R3,R2,ASR #4 ;+|
00009510  35 2f 31 36 0d 2a c6 11  20 53 54 52 20 52 33 2c  |5/16.*.. STR R3,|
00009520  5b 52 31 31 5d 0d 2a d0  1a 20 4d 4f 56 20 52 33  |[R11].*.. MOV R3|
00009530  2c 52 34 2c 41 53 52 20  23 34 20 3b 2f 31 36 0d  |,R4,ASR #4 ;/16.|
00009540  2a da 31 20 53 54 52 20  52 33 2c 5b 52 31 31 2c  |*.1 STR R3,[R11,|
00009550  52 38 5d 21 20 3b 6e 6f  74 20 73 65 65 6e 20 73  |R8]! ;not seen s|
00009560  6f 20 66 61 72 20 69 6e  63 20 6e 6c 20 70 74 72  |o far inc nl ptr|
00009570  0d 2a e4 1c 20 52 53 42  20 52 32 2c 52 34 2c 52  |.*.. RSB R2,R4,R|
00009580  34 2c 4c 53 4c 20 23 33  20 3b 2a 37 0d 2a ee 26  |4,LSL #3 ;*7.*.&|
00009590  20 4c 44 52 20 52 34 2c  5b 52 31 30 5d 2c 52 38  | LDR R4,[R10],R8|
000095a0  20 3b 6e 65 78 74 20 6c  69 67 68 74 20 76 61 6c  | ;next light val|
000095b0  75 65 0d 2a f8 40 20 41  44 44 20 52 34 2c 52 34  |ue.*.@ ADD R4,R4|
000095c0  2c 52 32 2c 41 53 52 20  23 34 20 3b 6e 65 78 74  |,R2,ASR #4 ;next|
000095d0  20 76 61 6c 75 65 20 2b  37 2f 31 36 20 6f 66 20  | value +7/16 of |
000095e0  65 72 72 6f 72 20 2d 3e  20 6e 65 77 20 76 61 6c  |error -> new val|
000095f0  75 65 0d 2b 02 1d 20 53  55 42 53 20 52 39 2c 52  |ue.+.. SUBS R9,R|
00009600  39 2c 23 31 3a 42 4e 45  20 66 73 6c 6f 6f 70 0d  |9,#1:BNE fsloop.|
00009610  2b 0c 15 20 4c 44 4d 46  44 20 53 50 20 21 2c 7b  |+.. LDMFD SP !,{|
00009620  50 43 7d 5e 0d 2b 16 06  20 5d 0d 2b 20 05 cd 0d  |PC}^.+.. ].+ ...|
00009630  2b 2a 05 cb 0d 2b 34 0c  c8 8e 20 63 6f 6c 20 ca  |+*...+4... col .|
00009640  0d 2b 3e 08 c9 20 30 3a  0d 2b 48 0a 5b 4f 50 54  |.+>.. 0:.+H.[OPT|
00009650  20 5a 0d 2b 52 3c 2e 6d  61 70 70 69 78 25 20 3b  | Z.+R<.mappix% ;|
00009660  20 d6 20 6d 61 70 70 69  78 25 2c 7a 25 28 31 2c  | . mappix%,z%(1,|
00009670  30 29 2c 72 25 28 30 29  2c 67 25 28 30 29 2c 62  |0),r%(0),g%(0),b|
00009680  25 28 30 29 2c 62 75 66  66 25 2c 73 78 25 0d 2b  |%(0),buff%,sx%.+|
00009690  5c 23 20 4c 44 52 20 52  30 2c 5b 52 39 5d 3a 4c  |\# LDR R0,[R9]:L|
000096a0  44 52 20 52 30 2c 5b 52  30 5d 20 3b 63 6f 75 6e  |DR R0,[R0] ;coun|
000096b0  74 0d 2b 66 33 20 4c 44  52 20 52 31 2c 5b 52 39  |t.+f3 LDR R1,[R9|
000096c0  2c 23 38 5d 3a 4c 44 52  20 52 31 2c 5b 52 31 5d  |,#8]:LDR R1,[R1]|
000096d0  20 3b 62 61 73 65 20 6f  66 20 62 79 74 65 20 61  | ;base of byte a|
000096e0  72 72 61 79 0d 2b 70 26  20 4c 44 52 20 52 32 2c  |rray.+p& LDR R2,|
000096f0  5b 52 39 2c 23 34 2a 38  5d 20 3b 62 61 73 65 20  |[R9,#4*8] ;base |
00009700  6f 66 20 72 20 61 72 72  61 79 0d 2b 7a 26 20 4c  |of r array.+z& L|
00009710  44 52 20 52 35 2c 5b 52  39 2c 23 35 2a 38 5d 20  |DR R5,[R9,#5*8] |
00009720  3b 62 61 73 65 20 6f 66  20 7a 20 61 72 72 61 79  |;base of z array|
00009730  0d 2b 84 0d 2e 6d 61 70  70 69 78 6c 70 0d 2b 8e  |.+...mappixlp.+.|
00009740  14 20 4c 44 52 42 20 52  36 2c 5b 52 31 5d 2c 23  |. LDRB R6,[R1],#|
00009750  31 0d 2b 98 06 20 5d 0d  2b a2 0e c8 8e 20 69 6e  |1.+.. ].+.... in|
00009760  70 75 74 20 ca 0d 2b ac  08 c9 20 38 3a 0d 2b b6  |put ..+... 8:.+.|
00009770  0a 5b 4f 50 54 20 5a 0d  2b c0 29 20 4c 44 52 20  |.[OPT Z.+.) LDR |
00009780  52 37 2c 5b 52 32 2c 52  36 2c 4c 53 4c 20 23 32  |R7,[R2,R6,LSL #2|
00009790  5d 3a 53 54 52 20 52 37  2c 5b 52 35 5d 2c 23 34  |]:STR R7,[R5],#4|
000097a0  0d 2b ca 1f 20 53 55 42  53 20 52 30 2c 52 30 2c  |.+.. SUBS R0,R0,|
000097b0  23 31 3a 42 4e 45 20 6d  61 70 70 69 78 6c 70 0d  |#1:BNE mappixlp.|
000097c0  2b d4 10 20 4d 4f 56 53  20 50 43 2c 52 31 34 0d  |+.. MOVS PC,R14.|
000097d0  2b de 06 20 5d 0d 2b e8  08 c9 20 34 3a 0d 2b f2  |+.. ].+... 4:.+.|
000097e0  14 e7 62 69 67 65 6e 64  69 61 6e 62 69 74 73 20  |..bigendianbits |
000097f0  8c 0d 2b fc 0a 5b 4f 50  54 20 5a 0d 2c 06 16 20  |..+..[OPT Z.,.. |
00009800  4d 4f 56 20 52 31 30 2c  52 36 2c 4c 53 52 20 23  |MOV R10,R6,LSR #|
00009810  34 0d 2c 10 2a 20 4c 44  52 20 52 37 2c 5b 52 32  |4.,.* LDR R7,[R2|
00009820  2c 52 31 30 2c 4c 53 4c  20 23 32 5d 3a 53 54 52  |,R10,LSL #2]:STR|
00009830  20 52 37 2c 5b 52 35 5d  2c 23 34 0d 2c 1a 11 20  | R7,[R5],#4.,.. |
00009840  80 20 52 31 30 2c 52 36  2c 23 26 46 0d 2c 24 06  |. R10,R6,#&F.,$.|
00009850  20 5d 0d 2c 2e 05 cc 0d  2c 38 0a 5b 4f 50 54 20  | ].,....,8.[OPT |
00009860  5a 0d 2c 42 11 20 80 20  52 31 30 2c 52 36 2c 23  |Z.,B. . R10,R6,#|
00009870  26 46 0d 2c 4c 2a 20 4c  44 52 20 52 37 2c 5b 52  |&F.,L* LDR R7,[R|
00009880  32 2c 52 31 30 2c 4c 53  4c 20 23 32 5d 3a 53 54  |2,R10,LSL #2]:ST|
00009890  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 2c 56 16  |R R7,[R5],#4.,V.|
000098a0  20 4d 4f 56 20 52 31 30  2c 52 36 2c 4c 53 52 20  | MOV R10,R6,LSR |
000098b0  23 34 0d 2c 60 06 20 5d  0d 2c 6a 05 cd 0d 2c 74  |#4.,`. ].,j...,t|
000098c0  0a 5b 4f 50 54 20 5a 0d  2c 7e 2a 20 4c 44 52 20  |.[OPT Z.,~* LDR |
000098d0  52 37 2c 5b 52 32 2c 52  31 30 2c 4c 53 4c 20 23  |R7,[R2,R10,LSL #|
000098e0  32 5d 3a 53 54 52 20 52  37 2c 5b 52 35 5d 2c 23  |2]:STR R7,[R5],#|
000098f0  34 0d 2c 88 1f 20 53 55  42 53 20 52 30 2c 52 30  |4.,.. SUBS R0,R0|
00009900  2c 23 32 3a 42 48 49 20  6d 61 70 70 69 78 6c 70  |,#2:BHI mappixlp|
00009910  0d 2c 92 10 20 4d 4f 56  53 20 50 43 2c 52 31 34  |.,.. MOVS PC,R14|
00009920  0d 2c 9c 06 20 5d 0d 2c  a6 08 c9 20 32 3a 0d 2c  |.,.. ].,... 2:.,|
00009930  b0 14 e7 62 69 67 65 6e  64 69 61 6e 62 69 74 73  |...bigendianbits|
00009940  20 8c 0d 2c ba 0a 5b 4f  50 54 20 5a 0d 2c c4 16  | ..,..[OPT Z.,..|
00009950  20 4d 4f 56 20 52 31 30  2c 52 36 2c 4c 53 52 20  | MOV R10,R6,LSR |
00009960  23 36 0d 2c ce 2a 20 4c  44 52 20 52 37 2c 5b 52  |#6.,.* LDR R7,[R|
00009970  32 2c 52 31 30 2c 4c 53  4c 20 23 32 5d 3a 53 54  |2,R10,LSL #2]:ST|
00009980  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 2c d8 12  |R R7,[R5],#4.,..|
00009990  20 80 20 52 31 30 2c 52  36 2c 23 26 33 30 0d 2c  | . R10,R6,#&30.,|
000099a0  e2 2a 20 4c 44 52 20 52  37 2c 5b 52 32 2c 52 31  |.* LDR R7,[R2,R1|
000099b0  30 2c 4c 53 52 20 23 32  5d 3a 53 54 52 20 52 37  |0,LSR #2]:STR R7|
000099c0  2c 5b 52 35 5d 2c 23 34  0d 2c ec 11 20 80 20 52  |,[R5],#4.,.. . R|
000099d0  31 30 2c 52 36 2c 23 26  43 0d 2c f6 23 20 4c 44  |10,R6,#&C.,.# LD|
000099e0  52 20 52 37 2c 5b 52 32  2c 52 31 30 5d 3a 53 54  |R R7,[R2,R10]:ST|
000099f0  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 2d 00 11  |R R7,[R5],#4.-..|
00009a00  20 80 20 52 31 30 2c 52  36 2c 23 26 33 0d 2d 0a  | . R10,R6,#&3.-.|
00009a10  06 20 5d 0d 2d 14 05 cc  0d 2d 1e 0a 5b 4f 50 54  |. ].-....-..[OPT|
00009a20  20 5a 0d 2d 28 11 20 80  20 52 31 30 2c 52 36 2c  | Z.-(. . R10,R6,|
00009a30  23 26 33 0d 2d 32 2a 20  4c 44 52 20 52 37 2c 5b  |#&3.-2* LDR R7,[|
00009a40  52 32 2c 52 31 30 2c 4c  53 4c 20 23 32 5d 3a 53  |R2,R10,LSL #2]:S|
00009a50  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 2d 3c  |TR R7,[R5],#4.-<|
00009a60  11 20 80 20 52 31 30 2c  52 36 2c 23 26 43 0d 2d  |. . R10,R6,#&C.-|
00009a70  46 23 20 4c 44 52 20 52  37 2c 5b 52 32 2c 52 31  |F# LDR R7,[R2,R1|
00009a80  30 5d 3a 53 54 52 20 52  37 2c 5b 52 35 5d 2c 23  |0]:STR R7,[R5],#|
00009a90  34 0d 2d 50 12 20 80 20  52 31 30 2c 52 36 2c 23  |4.-P. . R10,R6,#|
00009aa0  26 33 30 0d 2d 5a 2a 20  4c 44 52 20 52 37 2c 5b  |&30.-Z* LDR R7,[|
00009ab0  52 32 2c 52 31 30 2c 4c  53 52 20 23 32 5d 3a 53  |R2,R10,LSR #2]:S|
00009ac0  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 2d 64  |TR R7,[R5],#4.-d|
00009ad0  16 20 4d 4f 56 20 52 31  30 2c 52 36 2c 4c 53 52  |. MOV R10,R6,LSR|
00009ae0  20 23 36 0d 2d 6e 06 20  5d 0d 2d 78 05 cd 0d 2d  | #6.-n. ].-x...-|
00009af0  82 0a 5b 4f 50 54 20 5a  0d 2d 8c 2a 20 4c 44 52  |..[OPT Z.-.* LDR|
00009b00  20 52 37 2c 5b 52 32 2c  52 31 30 2c 4c 53 4c 20  | R7,[R2,R10,LSL |
00009b10  23 32 5d 3a 53 54 52 20  52 37 2c 5b 52 35 5d 2c  |#2]:STR R7,[R5],|
00009b20  23 34 0d 2d 96 1f 20 53  55 42 53 20 52 30 2c 52  |#4.-.. SUBS R0,R|
00009b30  30 2c 23 34 3a 42 48 49  20 6d 61 70 70 69 78 6c  |0,#4:BHI mappixl|
00009b40  70 0d 2d a0 10 20 4d 4f  56 53 20 50 43 2c 52 31  |p.-.. MOVS PC,R1|
00009b50  34 0d 2d aa 06 20 5d 0d  2d b4 08 c9 20 31 3a 0d  |4.-.. ].-... 1:.|
00009b60  2d be 14 e7 62 69 67 65  6e 64 69 61 6e 62 69 74  |-...bigendianbit|
00009b70  73 20 8c 0d 2d c8 0a 5b  4f 50 54 20 5a 0d 2d d2  |s ..-..[OPT Z.-.|
00009b80  12 20 80 20 52 31 30 2c  52 36 2c 23 26 38 30 0d  |. . R10,R6,#&80.|
00009b90  2d dc 2a 20 4c 44 52 20  52 37 2c 5b 52 32 2c 52  |-.* LDR R7,[R2,R|
00009ba0  31 30 2c 4c 53 52 20 23  35 5d 3a 53 54 52 20 52  |10,LSR #5]:STR R|
00009bb0  37 2c 5b 52 35 5d 2c 23  34 0d 2d e6 12 20 80 20  |7,[R5],#4.-.. . |
00009bc0  52 31 30 2c 52 36 2c 23  26 34 30 0d 2d f0 2a 20  |R10,R6,#&40.-.* |
00009bd0  4c 44 52 20 52 37 2c 5b  52 32 2c 52 31 30 2c 4c  |LDR R7,[R2,R10,L|
00009be0  53 52 20 23 34 5d 3a 53  54 52 20 52 37 2c 5b 52  |SR #4]:STR R7,[R|
00009bf0  35 5d 2c 23 34 0d 2d fa  12 20 80 20 52 31 30 2c  |5],#4.-.. . R10,|
00009c00  52 36 2c 23 26 32 30 0d  2e 04 2a 20 4c 44 52 20  |R6,#&20...* LDR |
00009c10  52 37 2c 5b 52 32 2c 52  31 30 2c 4c 53 52 20 23  |R7,[R2,R10,LSR #|
00009c20  33 5d 3a 53 54 52 20 52  37 2c 5b 52 35 5d 2c 23  |3]:STR R7,[R5],#|
00009c30  34 0d 2e 0e 12 20 80 20  52 31 30 2c 52 36 2c 23  |4.... . R10,R6,#|
00009c40  26 31 30 0d 2e 18 2a 20  4c 44 52 20 52 37 2c 5b  |&10...* LDR R7,[|
00009c50  52 32 2c 52 31 30 2c 4c  53 52 20 23 32 5d 3a 53  |R2,R10,LSR #2]:S|
00009c60  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 2e 22  |TR R7,[R5],#4.."|
00009c70  11 20 80 20 52 31 30 2c  52 36 2c 23 26 38 0d 2e  |. . R10,R6,#&8..|
00009c80  2c 2a 20 4c 44 52 20 52  37 2c 5b 52 32 2c 52 31  |,* LDR R7,[R2,R1|
00009c90  30 2c 4c 53 52 20 23 31  5d 3a 53 54 52 20 52 37  |0,LSR #1]:STR R7|
00009ca0  2c 5b 52 35 5d 2c 23 34  0d 2e 36 11 20 80 20 52  |,[R5],#4..6. . R|
00009cb0  31 30 2c 52 36 2c 23 26  34 0d 2e 40 23 20 4c 44  |10,R6,#&4..@# LD|
00009cc0  52 20 52 37 2c 5b 52 32  2c 52 31 30 5d 3a 53 54  |R R7,[R2,R10]:ST|
00009cd0  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 2e 4a 11  |R R7,[R5],#4..J.|
00009ce0  20 80 20 52 31 30 2c 52  36 2c 23 26 32 0d 2e 54  | . R10,R6,#&2..T|
00009cf0  2a 20 4c 44 52 20 52 37  2c 5b 52 32 2c 52 31 30  |* LDR R7,[R2,R10|
00009d00  2c 4c 53 4c 20 23 31 5d  3a 53 54 52 20 52 37 2c  |,LSL #1]:STR R7,|
00009d10  5b 52 35 5d 2c 23 34 0d  2e 5e 11 20 80 20 52 31  |[R5],#4..^. . R1|
00009d20  30 2c 52 36 2c 23 26 31  0d 2e 68 06 20 5d 0d 2e  |0,R6,#&1..h. ]..|
00009d30  72 05 cc 0d 2e 7c 0a 5b  4f 50 54 20 5a 0d 2e 86  |r....|.[OPT Z...|
00009d40  11 20 80 20 52 31 30 2c  52 36 2c 23 26 31 0d 2e  |. . R10,R6,#&1..|
00009d50  90 2a 20 4c 44 52 20 52  37 2c 5b 52 32 2c 52 31  |.* LDR R7,[R2,R1|
00009d60  30 2c 4c 53 4c 20 23 32  5d 3a 53 54 52 20 52 37  |0,LSL #2]:STR R7|
00009d70  2c 5b 52 35 5d 2c 23 34  0d 2e 9a 11 20 80 20 52  |,[R5],#4.... . R|
00009d80  31 30 2c 52 36 2c 23 26  32 0d 2e a4 2a 20 4c 44  |10,R6,#&2...* LD|
00009d90  52 20 52 37 2c 5b 52 32  2c 52 31 30 2c 4c 53 4c  |R R7,[R2,R10,LSL|
00009da0  20 23 31 5d 3a 53 54 52  20 52 37 2c 5b 52 35 5d  | #1]:STR R7,[R5]|
00009db0  2c 23 34 0d 2e ae 11 20  80 20 52 31 30 2c 52 36  |,#4.... . R10,R6|
00009dc0  2c 23 26 34 0d 2e b8 23  20 4c 44 52 20 52 37 2c  |,#&4...# LDR R7,|
00009dd0  5b 52 32 2c 52 31 30 5d  3a 53 54 52 20 52 37 2c  |[R2,R10]:STR R7,|
00009de0  5b 52 35 5d 2c 23 34 0d  2e c2 11 20 80 20 52 31  |[R5],#4.... . R1|
00009df0  30 2c 52 36 2c 23 26 38  0d 2e cc 2a 20 4c 44 52  |0,R6,#&8...* LDR|
00009e00  20 52 37 2c 5b 52 32 2c  52 31 30 2c 4c 53 52 20  | R7,[R2,R10,LSR |
00009e10  23 31 5d 3a 53 54 52 20  52 37 2c 5b 52 35 5d 2c  |#1]:STR R7,[R5],|
00009e20  23 34 0d 2e d6 12 20 80  20 52 31 30 2c 52 36 2c  |#4.... . R10,R6,|
00009e30  23 26 31 30 0d 2e e0 2a  20 4c 44 52 20 52 37 2c  |#&10...* LDR R7,|
00009e40  5b 52 32 2c 52 31 30 2c  4c 53 52 20 23 32 5d 3a  |[R2,R10,LSR #2]:|
00009e50  53 54 52 20 52 37 2c 5b  52 35 5d 2c 23 34 0d 2e  |STR R7,[R5],#4..|
00009e60  ea 12 20 80 20 52 31 30  2c 52 36 2c 23 26 32 30  |.. . R10,R6,#&20|
00009e70  0d 2e f4 2a 20 4c 44 52  20 52 37 2c 5b 52 32 2c  |...* LDR R7,[R2,|
00009e80  52 31 30 2c 4c 53 52 20  23 33 5d 3a 53 54 52 20  |R10,LSR #3]:STR |
00009e90  52 37 2c 5b 52 35 5d 2c  23 34 0d 2e fe 12 20 80  |R7,[R5],#4.... .|
00009ea0  20 52 31 30 2c 52 36 2c  23 26 34 30 0d 2f 08 2a  | R10,R6,#&40./.*|
00009eb0  20 4c 44 52 20 52 37 2c  5b 52 32 2c 52 31 30 2c  | LDR R7,[R2,R10,|
00009ec0  4c 53 52 20 23 34 5d 3a  53 54 52 20 52 37 2c 5b  |LSR #4]:STR R7,[|
00009ed0  52 35 5d 2c 23 34 0d 2f  12 16 20 4d 4f 56 20 52  |R5],#4./.. MOV R|
00009ee0  31 30 2c 52 36 2c 4c 53  52 20 23 37 0d 2f 1c 06  |10,R6,LSR #7./..|
00009ef0  20 5d 0d 2f 26 05 cd 0d  2f 30 0a 5b 4f 50 54 20  | ]./&.../0.[OPT |
00009f00  5a 0d 2f 3a 2a 20 4c 44  52 20 52 37 2c 5b 52 32  |Z./:* LDR R7,[R2|
00009f10  2c 52 31 30 2c 4c 53 4c  20 23 32 5d 3a 53 54 52  |,R10,LSL #2]:STR|
00009f20  20 52 37 2c 5b 52 35 5d  2c 23 34 0d 2f 44 1f 20  | R7,[R5],#4./D. |
00009f30  53 55 42 53 20 52 30 2c  52 30 2c 23 38 3a 42 48  |SUBS R0,R0,#8:BH|
00009f40  49 20 6d 61 70 70 69 78  6c 70 0d 2f 4e 10 20 4d  |I mappixlp./N. M|
00009f50  4f 56 53 20 50 43 2c 52  31 34 0d 2f 58 06 20 5d  |OVS PC,R14./X. ]|
00009f60  0d 2f 62 05 cb 0d 2f 6c  0a 5b 4f 50 54 20 5a 0d  |./b.../l.[OPT Z.|
00009f70  2f 76 53 3b 20 72 6f 75  74 69 6e 65 20 74 6f 20  |/vS; routine to |
00009f80  61 64 64 20 74 77 6f 20  61 72 72 61 79 73 20 61  |add two arrays a|
00009f90  6e 64 20 68 61 6c 76 65  20 6f 75 74 70 75 74 20  |nd halve output |
00009fa0  6f 66 20 66 69 78 65 64  20 70 6f 69 6e 74 20 6e  |of fixed point n|
00009fb0  75 6d 62 65 72 73 20 66  6f 72 20 73 63 61 6c 69  |umbers for scali|
00009fc0  6e 67 0d 2f 80 0d 2e 61  64 64 68 61 6c 66 25 0d  |ng./...addhalf%.|
00009fd0  2f 8a 1c 20 4c 44 52 20  52 30 2c 5b 52 39 5d 3a  |/.. LDR R0,[R9]:|
00009fe0  4c 44 52 20 52 30 2c 5b  52 30 5d 0d 2f 94 1b 20  |LDR R0,[R0]./.. |
00009ff0  4c 44 52 20 52 31 2c 5b  52 39 2c 23 38 5d 20 3b  |LDR R1,[R9,#8] ;|
0000a000  6f 75 74 70 75 74 0d 2f  9e 1c 20 4c 44 52 20 52  |output./.. LDR R|
0000a010  32 2c 5b 52 39 2c 23 32  2a 38 5d 20 3b 69 6e 70  |2,[R9,#2*8] ;inp|
0000a020  75 74 0d 2f a8 0e 2e 61  64 64 68 61 6c 66 6c 70  |ut./...addhalflp|
0000a030  0d 2f b2 4c 20 4c 44 52  20 52 33 2c 5b 52 31 5d  |./.L LDR R3,[R1]|
0000a040  3a 4c 44 52 20 52 34 2c  5b 52 32 5d 2c 23 34 3a  |:LDR R4,[R2],#4:|
0000a050  41 44 44 20 52 33 2c 52  33 2c 52 34 3a 4d 4f 56  |ADD R3,R3,R4:MOV|
0000a060  20 52 33 2c 52 33 2c 4c  53 52 20 23 31 3a 53 54  | R3,R3,LSR #1:ST|
0000a070  52 20 52 33 2c 5b 52 31  5d 2c 23 34 0d 2f bc 20  |R R3,[R1],#4./. |
0000a080  20 53 55 42 53 20 52 30  2c 52 30 2c 23 31 3a 42  | SUBS R0,R0,#1:B|
0000a090  50 4c 20 61 64 64 68 61  6c 66 6c 70 0d 2f c6 10  |PL addhalflp./..|
0000a0a0  20 4d 4f 56 53 20 50 43  2c 52 31 34 0d 2f d0 40  | MOVS PC,R14./.@|
0000a0b0  3b 20 63 68 61 6e 67 65  20 73 69 7a 65 20 69 6e  |; change size in|
0000a0c0  20 78 20 d6 78 73 61 6d  70 6c 65 25 2c 78 6d 75  | x .xsample%,xmu|
0000a0d0  6c 25 2c 78 64 69 76 25  2c 7a 25 28 31 2c 30 29  |l%,xdiv%,z%(1,0)|
0000a0e0  2c 78 70 25 28 31 2c 30  29 2c 78 25 0d 2f da 0d  |,xp%(1,0),x%./..|
0000a0f0  2e 78 73 61 6d 70 6c 65  25 0d 2f e4 20 20 4c 44  |.xsample%./.  LD|
0000a100  52 20 52 30 2c 5b 52 39  5d 3a 4c 44 52 20 52 30  |R R0,[R9]:LDR R0|
0000a110  2c 5b 52 30 5d 20 3b 78  25 0d 2f ee 1c 20 4c 44  |,[R0] ;x%./.. LD|
0000a120  52 20 52 31 2c 5b 52 39  2c 23 38 5d 20 3b 78 70  |R R1,[R9,#8] ;xp|
0000a130  20 28 69 6e 29 0d 2f f8  18 20 4c 44 52 20 52 32  | (in)./.. LDR R2|
0000a140  2c 5b 52 39 2c 23 32 2a  38 5d 20 3b 7a 0d 30 02  |,[R9,#2*8] ;z.0.|
0000a150  28 20 4c 44 52 20 52 33  2c 5b 52 39 2c 23 33 2a  |( LDR R3,[R9,#3*|
0000a160  38 5d 3a 4c 44 52 20 52  33 2c 5b 52 33 5d 20 3b  |8]:LDR R3,[R3] ;|
0000a170  78 64 69 76 25 0d 30 0c  28 20 4c 44 52 20 52 34  |xdiv%.0.( LDR R4|
0000a180  2c 5b 52 39 2c 23 34 2a  38 5d 3a 4c 44 52 20 52  |,[R9,#4*8]:LDR R|
0000a190  34 2c 5b 52 34 5d 20 3b  78 6d 75 6c 25 0d 30 16  |4,[R4] ;xmul%.0.|
0000a1a0  0f 20 4d 4f 56 20 52 31  31 2c 52 34 0d 30 20 0e  |. MOV R11,R4.0 .|
0000a1b0  2e 78 73 61 6d 70 6c 65  6c 70 0d 30 2a 12 20 4c  |.xsamplelp.0*. L|
0000a1c0  44 4d 49 41 20 52 31 2c  7b 52 35 7d 0d 30 34 2d  |DMIA R1,{R5}.04-|
0000a1d0  20 53 55 42 53 20 52 31  31 2c 52 31 31 2c 23 31  | SUBS R11,R11,#1|
0000a1e0  3a ec 51 20 52 31 31 2c  52 34 3a 41 44 44 45 51  |:.Q R11,R4:ADDEQ|
0000a1f0  20 52 31 2c 52 31 2c 23  34 0d 30 3e 23 20 53 55  | R1,R1,#4.0># SU|
0000a200  42 53 20 52 31 32 2c 52  33 2c 23 31 20 3b 28 69  |BS R12,R3,#1 ;(i|
0000a210  6e 20 72 61 6e 67 65 20  31 2e 2e 29 0d 30 48 11  |n range 1..).0H.|
0000a220  20 42 45 51 20 78 64 6f  6e 65 64 69 76 0d 30 52  | BEQ xdonediv.0R|
0000a230  0b 2e 78 64 69 76 6c 70  0d 30 5c 12 20 4c 44 4d  |..xdivlp.0\. LDM|
0000a240  49 41 20 52 31 2c 7b 52  38 7d 0d 30 66 2d 20 53  |IA R1,{R8}.0f- S|
0000a250  55 42 53 20 52 31 31 2c  52 31 31 2c 23 31 3a ec  |UBS R11,R11,#1:.|
0000a260  51 20 52 31 31 2c 52 34  3a 41 44 44 45 51 20 52  |Q R11,R4:ADDEQ R|
0000a270  31 2c 52 31 2c 23 34 0d  30 70 22 20 41 44 44 20  |1,R1,#4.0p" ADD |
0000a280  52 35 2c 52 35 2c 52 38  3a 4d 4f 56 20 52 35 2c  |R5,R5,R8:MOV R5,|
0000a290  52 35 2c 4c 53 52 20 23  31 0d 30 7a 1f 20 53 55  |R5,LSR #1.0z. SU|
0000a2a0  42 53 20 52 31 32 2c 52  31 32 2c 23 31 3a 42 4e  |BS R12,R12,#1:BN|
0000a2b0  45 20 78 64 69 76 6c 70  0d 30 84 0d 2e 78 64 6f  |E xdivlp.0...xdo|
0000a2c0  6e 65 64 69 76 0d 30 8e  13 20 53 54 4d 49 41 20  |nediv.0.. STMIA |
0000a2d0  52 32 21 2c 7b 52 35 7d  0d 30 98 20 20 53 55 42  |R2!,{R5}.0.  SUB|
0000a2e0  53 20 52 30 2c 52 30 2c  23 31 3a 42 50 4c 20 78  |S R0,R0,#1:BPL x|
0000a2f0  73 61 6d 70 6c 65 6c 70  0d 30 a2 10 20 4d 4f 56  |samplelp.0.. MOV|
0000a300  53 20 50 43 2c 52 31 34  0d 30 ac 05 5d 0d 30 b6  |S PC,R14.0..].0.|
0000a310  14 c9 20 32 3a f4 20 77  68 65 6e 20 63 6f 6c 3d  |.. 2:. when col=|
0000a320  32 0d 30 c0 0a 5b 4f 50  54 20 5a 0d 30 ca 3c 2e  |2.0..[OPT Z.0.<.|
0000a330  6d 61 70 70 69 78 25 20  3b 20 d6 20 6d 61 70 70  |mappix% ; . mapp|
0000a340  69 78 25 2c 7a 25 28 31  2c 30 29 2c 72 25 28 30  |ix%,z%(1,0),r%(0|
0000a350  29 2c 67 25 28 30 29 2c  62 25 28 30 29 2c 62 75  |),g%(0),b%(0),bu|
0000a360  66 66 25 2c 73 78 25 0d  30 d4 23 20 4c 44 52 20  |ff%,sx%.0.# LDR |
0000a370  52 30 2c 5b 52 39 5d 3a  4c 44 52 20 52 30 2c 5b  |R0,[R9]:LDR R0,[|
0000a380  52 30 5d 20 3b 63 6f 75  6e 74 0d 30 de 33 20 4c  |R0] ;count.0.3 L|
0000a390  44 52 20 52 31 2c 5b 52  39 2c 23 38 5d 3a 4c 44  |DR R1,[R9,#8]:LD|
0000a3a0  52 20 52 31 2c 5b 52 31  5d 20 3b 62 61 73 65 20  |R R1,[R1] ;base |
0000a3b0  6f 66 20 62 79 74 65 20  61 72 72 61 79 0d 30 e8  |of byte array.0.|
0000a3c0  26 20 4c 44 52 20 52 32  2c 5b 52 39 2c 23 34 2a  |& LDR R2,[R9,#4*|
0000a3d0  38 5d 20 3b 62 61 73 65  20 6f 66 20 72 20 61 72  |8] ;base of r ar|
0000a3e0  72 61 79 0d 30 f2 26 20  4c 44 52 20 52 33 2c 5b  |ray.0.& LDR R3,[|
0000a3f0  52 39 2c 23 33 2a 38 5d  20 3b 62 61 73 65 20 6f  |R9,#3*8] ;base o|
0000a400  66 20 67 20 61 72 72 61  79 0d 30 fc 26 20 4c 44  |f g array.0.& LD|
0000a410  52 20 52 34 2c 5b 52 39  2c 23 32 2a 38 5d 20 3b  |R R4,[R9,#2*8] ;|
0000a420  62 61 73 65 20 6f 66 20  62 20 61 72 72 61 79 0d  |base of b array.|
0000a430  31 06 26 20 4c 44 52 20  52 35 2c 5b 52 39 2c 23  |1.& LDR R5,[R9,#|
0000a440  35 2a 38 5d 20 3b 62 61  73 65 20 6f 66 20 7a 20  |5*8] ;base of z |
0000a450  61 72 72 61 79 0d 31 10  0d 2e 6d 61 70 70 69 78  |array.1...mappix|
0000a460  6c 70 0d 31 1a 14 20 4c  44 52 42 20 52 36 2c 5b  |lp.1.. LDRB R6,[|
0000a470  52 31 5d 2c 23 31 0d 31  24 06 20 5d 0d 31 2e 0e  |R1],#1.1$. ].1..|
0000a480  c8 8e 20 69 6e 70 75 74  20 ca 0d 31 38 08 c9 20  |.. input ..18.. |
0000a490  38 3a 0d 31 42 22 e7 66  6c 61 67 3d 31 36 30 30  |8:.1B".flag=1600|
0000a4a0  20 84 20 66 6c 61 67 3d  31 36 30 31 20 80 20 68  | . flag=1601 . h|
0000a4b0  61 6d 20 8c 0d 31 4c 0a  5b 4f 50 54 20 5a 0d 31  |am ..1L.[OPT Z.1|
0000a4c0  56 12 20 41 44 52 20 52  39 2c 6c 74 61 62 6c 65  |V. ADR R9,ltable|
0000a4d0  0d 31 60 22 20 4d 4f 56  53 20 52 37 2c 52 36 2c  |.1`" MOVS R7,R6,|
0000a4e0  4c 53 52 20 23 34 3a 80  20 52 36 2c 52 36 2c 23  |LSR #4:. R6,R6,#|
0000a4f0  31 35 0d 31 6a 4f 20 4c  44 52 45 51 20 52 31 30  |15.1jO LDREQ R10|
0000a500  2c 5b 52 32 2c 52 36 2c  4c 53 4c 20 23 32 5d 3a  |,[R2,R6,LSL #2]:|
0000a510  4c 44 52 45 51 20 52 31  31 2c 5b 52 33 2c 52 36  |LDREQ R11,[R3,R6|
0000a520  2c 4c 53 4c 20 23 32 5d  3a 4c 44 52 45 51 20 52  |,LSL #2]:LDREQ R|
0000a530  31 32 2c 5b 52 34 2c 52  36 2c 4c 53 4c 20 23 32  |12,[R4,R6,LSL #2|
0000a540  5d 0d 31 74 27 20 43 4d  50 20 52 37 2c 23 31 3a  |].1t' CMP R7,#1:|
0000a550  4c 44 52 45 51 20 52 31  32 2c 5b 52 39 2c 52 36  |LDREQ R12,[R9,R6|
0000a560  2c 4c 53 4c 20 23 32 5d  0d 31 7e 27 20 43 4d 50  |,LSL #2].1~' CMP|
0000a570  20 52 37 2c 23 32 3a 4c  44 52 45 51 20 52 31 30  | R7,#2:LDREQ R10|
0000a580  2c 5b 52 39 2c 52 36 2c  4c 53 4c 20 23 32 5d 0d  |,[R9,R6,LSL #2].|
0000a590  31 88 27 20 43 4d 50 20  52 37 2c 23 33 3a 4c 44  |1.' CMP R7,#3:LD|
0000a5a0  52 45 51 20 52 31 31 2c  5b 52 39 2c 52 36 2c 4c  |REQ R11,[R9,R6,L|
0000a5b0  53 4c 20 23 32 5d 0d 31  92 1c 20 53 54 4d 49 41  |SL #2].1.. STMIA|
0000a5c0  20 52 35 21 2c 7b 52 31  30 2c 52 31 31 2c 52 31  | R5!,{R10,R11,R1|
0000a5d0  32 7d 0d 31 9c 1f 20 53  55 42 53 20 52 30 2c 52  |2}.1.. SUBS R0,R|
0000a5e0  30 2c 23 31 3a 42 4e 45  20 6d 61 70 70 69 78 6c  |0,#1:BNE mappixl|
0000a5f0  70 0d 31 a6 10 20 4d 4f  56 53 20 50 43 2c 52 31  |p.1.. MOVS PC,R1|
0000a600  34 0d 31 b0 12 2e 6c 74  61 62 6c 65 20 45 51 55  |4.1...ltable EQU|
0000a610  44 20 30 0d 31 ba 10 20  45 51 55 44 20 31 2f 31  |D 0.1.. EQUD 1/1|
0000a620  35 2a 46 0d 31 c4 10 20  45 51 55 44 20 32 2f 31  |5*F.1.. EQUD 2/1|
0000a630  35 2a 46 0d 31 ce 10 20  45 51 55 44 20 33 2f 31  |5*F.1.. EQUD 3/1|
0000a640  35 2a 46 0d 31 d8 10 20  45 51 55 44 20 34 2f 31  |5*F.1.. EQUD 4/1|
0000a650  35 2a 46 0d 31 e2 10 20  45 51 55 44 20 35 2f 31  |5*F.1.. EQUD 5/1|
0000a660  35 2a 46 0d 31 ec 10 20  45 51 55 44 20 36 2f 31  |5*F.1.. EQUD 6/1|
0000a670  35 2a 46 0d 31 f6 10 20  45 51 55 44 20 37 2f 31  |5*F.1.. EQUD 7/1|
0000a680  35 2a 46 0d 32 00 10 20  45 51 55 44 20 38 2f 31  |5*F.2.. EQUD 8/1|
0000a690  35 2a 46 0d 32 0a 10 20  45 51 55 44 20 39 2f 31  |5*F.2.. EQUD 9/1|
0000a6a0  35 2a 46 0d 32 14 11 20  45 51 55 44 20 31 30 2f  |5*F.2.. EQUD 10/|
0000a6b0  31 35 2a 46 0d 32 1e 11  20 45 51 55 44 20 31 31  |15*F.2.. EQUD 11|
0000a6c0  2f 31 35 2a 46 0d 32 28  11 20 45 51 55 44 20 31  |/15*F.2(. EQUD 1|
0000a6d0  32 2f 31 35 2a 46 0d 32  32 11 20 45 51 55 44 20  |2/15*F.22. EQUD |
0000a6e0  31 33 2f 31 35 2a 46 0d  32 3c 11 20 45 51 55 44  |13/15*F.2<. EQUD|
0000a6f0  20 31 34 2f 31 35 2a 46  0d 32 46 0b 20 45 51 55  | 14/15*F.2F. EQU|
0000a700  44 20 46 0d 32 50 06 20  5d 0d 32 5a 05 cc 0d 32  |D F.2P. ].2Z...2|
0000a710  64 0a 5b 4f 50 54 20 5a  0d 32 6e 29 20 4c 44 52  |d.[OPT Z.2n) LDR|
0000a720  20 52 37 2c 5b 52 32 2c  52 36 2c 4c 53 4c 20 23  | R7,[R2,R6,LSL #|
0000a730  32 5d 3a 53 54 52 20 52  37 2c 5b 52 35 5d 2c 23  |2]:STR R7,[R5],#|
0000a740  34 0d 32 78 29 20 4c 44  52 20 52 37 2c 5b 52 33  |4.2x) LDR R7,[R3|
0000a750  2c 52 36 2c 4c 53 4c 20  23 32 5d 3a 53 54 52 20  |,R6,LSL #2]:STR |
0000a760  52 37 2c 5b 52 35 5d 2c  23 34 0d 32 82 29 20 4c  |R7,[R5],#4.2.) L|
0000a770  44 52 20 52 37 2c 5b 52  34 2c 52 36 2c 4c 53 4c  |DR R7,[R4,R6,LSL|
0000a780  20 23 32 5d 3a 53 54 52  20 52 37 2c 5b 52 35 5d  | #2]:STR R7,[R5]|
0000a790  2c 23 34 0d 32 8c 1f 20  53 55 42 53 20 52 30 2c  |,#4.2.. SUBS R0,|
0000a7a0  52 30 2c 23 31 3a 42 4e  45 20 6d 61 70 70 69 78  |R0,#1:BNE mappix|
0000a7b0  6c 70 0d 32 96 10 20 4d  4f 56 53 20 50 43 2c 52  |lp.2.. MOVS PC,R|
0000a7c0  31 34 0d 32 a0 06 20 5d  0d 32 aa 05 cd 0d 32 b4  |14.2.. ].2....2.|
0000a7d0  08 c9 20 34 3a 0d 32 be  14 e7 62 69 67 65 6e 64  |.. 4:.2...bigend|
0000a7e0  69 61 6e 62 69 74 73 20  8c 0d 32 c8 0a 5b 4f 50  |ianbits ..2..[OP|
0000a7f0  54 20 5a 0d 32 d2 16 20  4d 4f 56 20 52 31 30 2c  |T Z.2.. MOV R10,|
0000a800  52 36 2c 4c 53 52 20 23  34 0d 32 dc 2a 20 4c 44  |R6,LSR #4.2.* LD|
0000a810  52 20 52 37 2c 5b 52 32  2c 52 31 30 2c 4c 53 4c  |R R7,[R2,R10,LSL|
0000a820  20 23 32 5d 3a 53 54 52  20 52 37 2c 5b 52 35 5d  | #2]:STR R7,[R5]|
0000a830  2c 23 34 0d 32 e6 2a 20  4c 44 52 20 52 37 2c 5b  |,#4.2.* LDR R7,[|
0000a840  52 33 2c 52 31 30 2c 4c  53 4c 20 23 32 5d 3a 53  |R3,R10,LSL #2]:S|
0000a850  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 32 f0  |TR R7,[R5],#4.2.|
0000a860  2a 20 4c 44 52 20 52 37  2c 5b 52 34 2c 52 31 30  |* LDR R7,[R4,R10|
0000a870  2c 4c 53 4c 20 23 32 5d  3a 53 54 52 20 52 37 2c  |,LSL #2]:STR R7,|
0000a880  5b 52 35 5d 2c 23 34 0d  32 fa 11 20 80 20 52 31  |[R5],#4.2.. . R1|
0000a890  30 2c 52 36 2c 23 26 46  0d 33 04 06 20 5d 0d 33  |0,R6,#&F.3.. ].3|
0000a8a0  0e 05 cc 0d 33 18 0a 5b  4f 50 54 20 5a 0d 33 22  |....3..[OPT Z.3"|
0000a8b0  11 20 80 20 52 31 30 2c  52 36 2c 23 26 46 0d 33  |. . R10,R6,#&F.3|
0000a8c0  2c 2a 20 4c 44 52 20 52  37 2c 5b 52 32 2c 52 31  |,* LDR R7,[R2,R1|
0000a8d0  30 2c 4c 53 4c 20 23 32  5d 3a 53 54 52 20 52 37  |0,LSL #2]:STR R7|
0000a8e0  2c 5b 52 35 5d 2c 23 34  0d 33 36 2a 20 4c 44 52  |,[R5],#4.36* LDR|
0000a8f0  20 52 37 2c 5b 52 33 2c  52 31 30 2c 4c 53 4c 20  | R7,[R3,R10,LSL |
0000a900  23 32 5d 3a 53 54 52 20  52 37 2c 5b 52 35 5d 2c  |#2]:STR R7,[R5],|
0000a910  23 34 0d 33 40 2a 20 4c  44 52 20 52 37 2c 5b 52  |#4.3@* LDR R7,[R|
0000a920  34 2c 52 31 30 2c 4c 53  4c 20 23 32 5d 3a 53 54  |4,R10,LSL #2]:ST|
0000a930  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 33 4a 16  |R R7,[R5],#4.3J.|
0000a940  20 4d 4f 56 20 52 31 30  2c 52 36 2c 4c 53 52 20  | MOV R10,R6,LSR |
0000a950  23 34 0d 33 54 06 20 5d  0d 33 5e 05 cd 0d 33 68  |#4.3T. ].3^...3h|
0000a960  0a 5b 4f 50 54 20 5a 0d  33 72 2a 20 4c 44 52 20  |.[OPT Z.3r* LDR |
0000a970  52 37 2c 5b 52 32 2c 52  31 30 2c 4c 53 4c 20 23  |R7,[R2,R10,LSL #|
0000a980  32 5d 3a 53 54 52 20 52  37 2c 5b 52 35 5d 2c 23  |2]:STR R7,[R5],#|
0000a990  34 0d 33 7c 2a 20 4c 44  52 20 52 37 2c 5b 52 33  |4.3|* LDR R7,[R3|
0000a9a0  2c 52 31 30 2c 4c 53 4c  20 23 32 5d 3a 53 54 52  |,R10,LSL #2]:STR|
0000a9b0  20 52 37 2c 5b 52 35 5d  2c 23 34 0d 33 86 2a 20  | R7,[R5],#4.3.* |
0000a9c0  4c 44 52 20 52 37 2c 5b  52 34 2c 52 31 30 2c 4c  |LDR R7,[R4,R10,L|
0000a9d0  53 4c 20 23 32 5d 3a 53  54 52 20 52 37 2c 5b 52  |SL #2]:STR R7,[R|
0000a9e0  35 5d 2c 23 34 0d 33 90  1f 20 53 55 42 53 20 52  |5],#4.3.. SUBS R|
0000a9f0  30 2c 52 30 2c 23 32 3a  42 48 49 20 6d 61 70 70  |0,R0,#2:BHI mapp|
0000aa00  69 78 6c 70 0d 33 9a 10  20 4d 4f 56 53 20 50 43  |ixlp.3.. MOVS PC|
0000aa10  2c 52 31 34 0d 33 a4 06  20 5d 0d 33 ae 08 c9 20  |,R14.3.. ].3... |
0000aa20  32 3a 0d 33 b8 14 e7 62  69 67 65 6e 64 69 61 6e  |2:.3...bigendian|
0000aa30  62 69 74 73 20 8c 0d 33  c2 0a 5b 4f 50 54 20 5a  |bits ..3..[OPT Z|
0000aa40  0d 33 cc 16 20 4d 4f 56  20 52 31 30 2c 52 36 2c  |.3.. MOV R10,R6,|
0000aa50  4c 53 52 20 23 36 0d 33  d6 2a 20 4c 44 52 20 52  |LSR #6.3.* LDR R|
0000aa60  37 2c 5b 52 32 2c 52 31  30 2c 4c 53 4c 20 23 32  |7,[R2,R10,LSL #2|
0000aa70  5d 3a 53 54 52 20 52 37  2c 5b 52 35 5d 2c 23 34  |]:STR R7,[R5],#4|
0000aa80  0d 33 e0 2a 20 4c 44 52  20 52 37 2c 5b 52 33 2c  |.3.* LDR R7,[R3,|
0000aa90  52 31 30 2c 4c 53 4c 20  23 32 5d 3a 53 54 52 20  |R10,LSL #2]:STR |
0000aaa0  52 37 2c 5b 52 35 5d 2c  23 34 0d 33 ea 2a 20 4c  |R7,[R5],#4.3.* L|
0000aab0  44 52 20 52 37 2c 5b 52  34 2c 52 31 30 2c 4c 53  |DR R7,[R4,R10,LS|
0000aac0  4c 20 23 32 5d 3a 53 54  52 20 52 37 2c 5b 52 35  |L #2]:STR R7,[R5|
0000aad0  5d 2c 23 34 0d 33 f4 12  20 80 20 52 31 30 2c 52  |],#4.3.. . R10,R|
0000aae0  36 2c 23 26 33 30 0d 33  fe 2a 20 4c 44 52 20 52  |6,#&30.3.* LDR R|
0000aaf0  37 2c 5b 52 32 2c 52 31  30 2c 4c 53 52 20 23 32  |7,[R2,R10,LSR #2|
0000ab00  5d 3a 53 54 52 20 52 37  2c 5b 52 35 5d 2c 23 34  |]:STR R7,[R5],#4|
0000ab10  0d 34 08 2a 20 4c 44 52  20 52 37 2c 5b 52 33 2c  |.4.* LDR R7,[R3,|
0000ab20  52 31 30 2c 4c 53 52 20  23 32 5d 3a 53 54 52 20  |R10,LSR #2]:STR |
0000ab30  52 37 2c 5b 52 35 5d 2c  23 34 0d 34 12 2a 20 4c  |R7,[R5],#4.4.* L|
0000ab40  44 52 20 52 37 2c 5b 52  34 2c 52 31 30 2c 4c 53  |DR R7,[R4,R10,LS|
0000ab50  52 20 23 32 5d 3a 53 54  52 20 52 37 2c 5b 52 35  |R #2]:STR R7,[R5|
0000ab60  5d 2c 23 34 0d 34 1c 11  20 80 20 52 31 30 2c 52  |],#4.4.. . R10,R|
0000ab70  36 2c 23 26 43 0d 34 26  23 20 4c 44 52 20 52 37  |6,#&C.4&# LDR R7|
0000ab80  2c 5b 52 32 2c 52 31 30  5d 3a 53 54 52 20 52 37  |,[R2,R10]:STR R7|
0000ab90  2c 5b 52 35 5d 2c 23 34  0d 34 30 23 20 4c 44 52  |,[R5],#4.40# LDR|
0000aba0  20 52 37 2c 5b 52 33 2c  52 31 30 5d 3a 53 54 52  | R7,[R3,R10]:STR|
0000abb0  20 52 37 2c 5b 52 35 5d  2c 23 34 0d 34 3a 23 20  | R7,[R5],#4.4:# |
0000abc0  4c 44 52 20 52 37 2c 5b  52 34 2c 52 31 30 5d 3a  |LDR R7,[R4,R10]:|
0000abd0  53 54 52 20 52 37 2c 5b  52 35 5d 2c 23 34 0d 34  |STR R7,[R5],#4.4|
0000abe0  44 11 20 80 20 52 31 30  2c 52 36 2c 23 26 33 0d  |D. . R10,R6,#&3.|
0000abf0  34 4e 06 20 5d 0d 34 58  05 cc 0d 34 62 0a 5b 4f  |4N. ].4X...4b.[O|
0000ac00  50 54 20 5a 0d 34 6c 11  20 80 20 52 31 30 2c 52  |PT Z.4l. . R10,R|
0000ac10  36 2c 23 26 33 0d 34 76  2a 20 4c 44 52 20 52 37  |6,#&3.4v* LDR R7|
0000ac20  2c 5b 52 32 2c 52 31 30  2c 4c 53 4c 20 23 32 5d  |,[R2,R10,LSL #2]|
0000ac30  3a 53 54 52 20 52 37 2c  5b 52 35 5d 2c 23 34 0d  |:STR R7,[R5],#4.|
0000ac40  34 80 2a 20 4c 44 52 20  52 37 2c 5b 52 33 2c 52  |4.* LDR R7,[R3,R|
0000ac50  31 30 2c 4c 53 4c 20 23  32 5d 3a 53 54 52 20 52  |10,LSL #2]:STR R|
0000ac60  37 2c 5b 52 35 5d 2c 23  34 0d 34 8a 2a 20 4c 44  |7,[R5],#4.4.* LD|
0000ac70  52 20 52 37 2c 5b 52 34  2c 52 31 30 2c 4c 53 4c  |R R7,[R4,R10,LSL|
0000ac80  20 23 32 5d 3a 53 54 52  20 52 37 2c 5b 52 35 5d  | #2]:STR R7,[R5]|
0000ac90  2c 23 34 0d 34 94 11 20  80 20 52 31 30 2c 52 36  |,#4.4.. . R10,R6|
0000aca0  2c 23 26 43 0d 34 9e 23  20 4c 44 52 20 52 37 2c  |,#&C.4.# LDR R7,|
0000acb0  5b 52 32 2c 52 31 30 5d  3a 53 54 52 20 52 37 2c  |[R2,R10]:STR R7,|
0000acc0  5b 52 35 5d 2c 23 34 0d  34 a8 23 20 4c 44 52 20  |[R5],#4.4.# LDR |
0000acd0  52 37 2c 5b 52 33 2c 52  31 30 5d 3a 53 54 52 20  |R7,[R3,R10]:STR |
0000ace0  52 37 2c 5b 52 35 5d 2c  23 34 0d 34 b2 23 20 4c  |R7,[R5],#4.4.# L|
0000acf0  44 52 20 52 37 2c 5b 52  34 2c 52 31 30 5d 3a 53  |DR R7,[R4,R10]:S|
0000ad00  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 34 bc  |TR R7,[R5],#4.4.|
0000ad10  12 20 80 20 52 31 30 2c  52 36 2c 23 26 33 30 0d  |. . R10,R6,#&30.|
0000ad20  34 c6 2a 20 4c 44 52 20  52 37 2c 5b 52 32 2c 52  |4.* LDR R7,[R2,R|
0000ad30  31 30 2c 4c 53 52 20 23  32 5d 3a 53 54 52 20 52  |10,LSR #2]:STR R|
0000ad40  37 2c 5b 52 35 5d 2c 23  34 0d 34 d0 2a 20 4c 44  |7,[R5],#4.4.* LD|
0000ad50  52 20 52 37 2c 5b 52 33  2c 52 31 30 2c 4c 53 52  |R R7,[R3,R10,LSR|
0000ad60  20 23 32 5d 3a 53 54 52  20 52 37 2c 5b 52 35 5d  | #2]:STR R7,[R5]|
0000ad70  2c 23 34 0d 34 da 2a 20  4c 44 52 20 52 37 2c 5b  |,#4.4.* LDR R7,[|
0000ad80  52 34 2c 52 31 30 2c 4c  53 52 20 23 32 5d 3a 53  |R4,R10,LSR #2]:S|
0000ad90  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 34 e4  |TR R7,[R5],#4.4.|
0000ada0  16 20 4d 4f 56 20 52 31  30 2c 52 36 2c 4c 53 52  |. MOV R10,R6,LSR|
0000adb0  20 23 36 0d 34 ee 06 20  5d 0d 34 f8 05 cd 0d 35  | #6.4.. ].4....5|
0000adc0  02 0a 5b 4f 50 54 20 5a  0d 35 0c 2a 20 4c 44 52  |..[OPT Z.5.* LDR|
0000add0  20 52 37 2c 5b 52 32 2c  52 31 30 2c 4c 53 4c 20  | R7,[R2,R10,LSL |
0000ade0  23 32 5d 3a 53 54 52 20  52 37 2c 5b 52 35 5d 2c  |#2]:STR R7,[R5],|
0000adf0  23 34 0d 35 16 2a 20 4c  44 52 20 52 37 2c 5b 52  |#4.5.* LDR R7,[R|
0000ae00  33 2c 52 31 30 2c 4c 53  4c 20 23 32 5d 3a 53 54  |3,R10,LSL #2]:ST|
0000ae10  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 35 20 2a  |R R7,[R5],#4.5 *|
0000ae20  20 4c 44 52 20 52 37 2c  5b 52 34 2c 52 31 30 2c  | LDR R7,[R4,R10,|
0000ae30  4c 53 4c 20 23 32 5d 3a  53 54 52 20 52 37 2c 5b  |LSL #2]:STR R7,[|
0000ae40  52 35 5d 2c 23 34 0d 35  2a 1f 20 53 55 42 53 20  |R5],#4.5*. SUBS |
0000ae50  52 30 2c 52 30 2c 23 34  3a 42 48 49 20 6d 61 70  |R0,R0,#4:BHI map|
0000ae60  70 69 78 6c 70 0d 35 34  10 20 4d 4f 56 53 20 50  |pixlp.54. MOVS P|
0000ae70  43 2c 52 31 34 0d 35 3e  06 20 5d 0d 35 48 08 c9  |C,R14.5>. ].5H..|
0000ae80  20 31 3a 0d 35 52 14 e7  62 69 67 65 6e 64 69 61  | 1:.5R..bigendia|
0000ae90  6e 62 69 74 73 20 8c 0d  35 5c 0a 5b 4f 50 54 20  |nbits ..5\.[OPT |
0000aea0  5a 0d 35 66 12 20 80 20  52 31 30 2c 52 36 2c 23  |Z.5f. . R10,R6,#|
0000aeb0  26 38 30 0d 35 70 2a 20  4c 44 52 20 52 37 2c 5b  |&80.5p* LDR R7,[|
0000aec0  52 32 2c 52 31 30 2c 4c  53 52 20 23 35 5d 3a 53  |R2,R10,LSR #5]:S|
0000aed0  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 35 7a  |TR R7,[R5],#4.5z|
0000aee0  2a 20 4c 44 52 20 52 37  2c 5b 52 33 2c 52 31 30  |* LDR R7,[R3,R10|
0000aef0  2c 4c 53 52 20 23 35 5d  3a 53 54 52 20 52 37 2c  |,LSR #5]:STR R7,|
0000af00  5b 52 35 5d 2c 23 34 0d  35 84 2a 20 4c 44 52 20  |[R5],#4.5.* LDR |
0000af10  52 37 2c 5b 52 34 2c 52  31 30 2c 4c 53 52 20 23  |R7,[R4,R10,LSR #|
0000af20  35 5d 3a 53 54 52 20 52  37 2c 5b 52 35 5d 2c 23  |5]:STR R7,[R5],#|
0000af30  34 0d 35 8e 12 20 80 20  52 31 30 2c 52 36 2c 23  |4.5.. . R10,R6,#|
0000af40  26 34 30 0d 35 98 2a 20  4c 44 52 20 52 37 2c 5b  |&40.5.* LDR R7,[|
0000af50  52 32 2c 52 31 30 2c 4c  53 52 20 23 34 5d 3a 53  |R2,R10,LSR #4]:S|
0000af60  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 35 a2  |TR R7,[R5],#4.5.|
0000af70  2a 20 4c 44 52 20 52 37  2c 5b 52 33 2c 52 31 30  |* LDR R7,[R3,R10|
0000af80  2c 4c 53 52 20 23 34 5d  3a 53 54 52 20 52 37 2c  |,LSR #4]:STR R7,|
0000af90  5b 52 35 5d 2c 23 34 0d  35 ac 2a 20 4c 44 52 20  |[R5],#4.5.* LDR |
0000afa0  52 37 2c 5b 52 34 2c 52  31 30 2c 4c 53 52 20 23  |R7,[R4,R10,LSR #|
0000afb0  34 5d 3a 53 54 52 20 52  37 2c 5b 52 35 5d 2c 23  |4]:STR R7,[R5],#|
0000afc0  34 0d 35 b6 12 20 80 20  52 31 30 2c 52 36 2c 23  |4.5.. . R10,R6,#|
0000afd0  26 32 30 0d 35 c0 2a 20  4c 44 52 20 52 37 2c 5b  |&20.5.* LDR R7,[|
0000afe0  52 32 2c 52 31 30 2c 4c  53 52 20 23 33 5d 3a 53  |R2,R10,LSR #3]:S|
0000aff0  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 35 ca  |TR R7,[R5],#4.5.|
0000b000  2a 20 4c 44 52 20 52 37  2c 5b 52 33 2c 52 31 30  |* LDR R7,[R3,R10|
0000b010  2c 4c 53 52 20 23 33 5d  3a 53 54 52 20 52 37 2c  |,LSR #3]:STR R7,|
0000b020  5b 52 35 5d 2c 23 34 0d  35 d4 2a 20 4c 44 52 20  |[R5],#4.5.* LDR |
0000b030  52 37 2c 5b 52 34 2c 52  31 30 2c 4c 53 52 20 23  |R7,[R4,R10,LSR #|
0000b040  33 5d 3a 53 54 52 20 52  37 2c 5b 52 35 5d 2c 23  |3]:STR R7,[R5],#|
0000b050  34 0d 35 de 12 20 80 20  52 31 30 2c 52 36 2c 23  |4.5.. . R10,R6,#|
0000b060  26 31 30 0d 35 e8 2a 20  4c 44 52 20 52 37 2c 5b  |&10.5.* LDR R7,[|
0000b070  52 32 2c 52 31 30 2c 4c  53 52 20 23 32 5d 3a 53  |R2,R10,LSR #2]:S|
0000b080  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 35 f2  |TR R7,[R5],#4.5.|
0000b090  2a 20 4c 44 52 20 52 37  2c 5b 52 33 2c 52 31 30  |* LDR R7,[R3,R10|
0000b0a0  2c 4c 53 52 20 23 32 5d  3a 53 54 52 20 52 37 2c  |,LSR #2]:STR R7,|
0000b0b0  5b 52 35 5d 2c 23 34 0d  35 fc 2a 20 4c 44 52 20  |[R5],#4.5.* LDR |
0000b0c0  52 37 2c 5b 52 34 2c 52  31 30 2c 4c 53 52 20 23  |R7,[R4,R10,LSR #|
0000b0d0  32 5d 3a 53 54 52 20 52  37 2c 5b 52 35 5d 2c 23  |2]:STR R7,[R5],#|
0000b0e0  34 0d 36 06 11 20 80 20  52 31 30 2c 52 36 2c 23  |4.6.. . R10,R6,#|
0000b0f0  26 38 0d 36 10 2a 20 4c  44 52 20 52 37 2c 5b 52  |&8.6.* LDR R7,[R|
0000b100  32 2c 52 31 30 2c 4c 53  52 20 23 31 5d 3a 53 54  |2,R10,LSR #1]:ST|
0000b110  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 36 1a 2a  |R R7,[R5],#4.6.*|
0000b120  20 4c 44 52 20 52 37 2c  5b 52 33 2c 52 31 30 2c  | LDR R7,[R3,R10,|
0000b130  4c 53 52 20 23 31 5d 3a  53 54 52 20 52 37 2c 5b  |LSR #1]:STR R7,[|
0000b140  52 35 5d 2c 23 34 0d 36  24 2a 20 4c 44 52 20 52  |R5],#4.6$* LDR R|
0000b150  37 2c 5b 52 34 2c 52 31  30 2c 4c 53 52 20 23 31  |7,[R4,R10,LSR #1|
0000b160  5d 3a 53 54 52 20 52 37  2c 5b 52 35 5d 2c 23 34  |]:STR R7,[R5],#4|
0000b170  0d 36 2e 11 20 80 20 52  31 30 2c 52 36 2c 23 26  |.6.. . R10,R6,#&|
0000b180  34 0d 36 38 23 20 4c 44  52 20 52 37 2c 5b 52 32  |4.68# LDR R7,[R2|
0000b190  2c 52 31 30 5d 3a 53 54  52 20 52 37 2c 5b 52 35  |,R10]:STR R7,[R5|
0000b1a0  5d 2c 23 34 0d 36 42 23  20 4c 44 52 20 52 37 2c  |],#4.6B# LDR R7,|
0000b1b0  5b 52 33 2c 52 31 30 5d  3a 53 54 52 20 52 37 2c  |[R3,R10]:STR R7,|
0000b1c0  5b 52 35 5d 2c 23 34 0d  36 4c 23 20 4c 44 52 20  |[R5],#4.6L# LDR |
0000b1d0  52 37 2c 5b 52 34 2c 52  31 30 5d 3a 53 54 52 20  |R7,[R4,R10]:STR |
0000b1e0  52 37 2c 5b 52 35 5d 2c  23 34 0d 36 56 11 20 80  |R7,[R5],#4.6V. .|
0000b1f0  20 52 31 30 2c 52 36 2c  23 26 32 0d 36 60 2a 20  | R10,R6,#&2.6`* |
0000b200  4c 44 52 20 52 37 2c 5b  52 32 2c 52 31 30 2c 4c  |LDR R7,[R2,R10,L|
0000b210  53 4c 20 23 31 5d 3a 53  54 52 20 52 37 2c 5b 52  |SL #1]:STR R7,[R|
0000b220  35 5d 2c 23 34 0d 36 6a  2a 20 4c 44 52 20 52 37  |5],#4.6j* LDR R7|
0000b230  2c 5b 52 33 2c 52 31 30  2c 4c 53 4c 20 23 31 5d  |,[R3,R10,LSL #1]|
0000b240  3a 53 54 52 20 52 37 2c  5b 52 35 5d 2c 23 34 0d  |:STR R7,[R5],#4.|
0000b250  36 74 2a 20 4c 44 52 20  52 37 2c 5b 52 34 2c 52  |6t* LDR R7,[R4,R|
0000b260  31 30 2c 4c 53 4c 20 23  31 5d 3a 53 54 52 20 52  |10,LSL #1]:STR R|
0000b270  37 2c 5b 52 35 5d 2c 23  34 0d 36 7e 11 20 80 20  |7,[R5],#4.6~. . |
0000b280  52 31 30 2c 52 36 2c 23  26 31 0d 36 88 06 20 5d  |R10,R6,#&1.6.. ]|
0000b290  0d 36 92 05 cc 0d 36 9c  0a 5b 4f 50 54 20 5a 0d  |.6....6..[OPT Z.|
0000b2a0  36 a6 11 20 80 20 52 31  30 2c 52 36 2c 23 26 31  |6.. . R10,R6,#&1|
0000b2b0  0d 36 b0 2a 20 4c 44 52  20 52 37 2c 5b 52 32 2c  |.6.* LDR R7,[R2,|
0000b2c0  52 31 30 2c 4c 53 4c 20  23 32 5d 3a 53 54 52 20  |R10,LSL #2]:STR |
0000b2d0  52 37 2c 5b 52 35 5d 2c  23 34 0d 36 ba 2a 20 4c  |R7,[R5],#4.6.* L|
0000b2e0  44 52 20 52 37 2c 5b 52  33 2c 52 31 30 2c 4c 53  |DR R7,[R3,R10,LS|
0000b2f0  4c 20 23 32 5d 3a 53 54  52 20 52 37 2c 5b 52 35  |L #2]:STR R7,[R5|
0000b300  5d 2c 23 34 0d 36 c4 2a  20 4c 44 52 20 52 37 2c  |],#4.6.* LDR R7,|
0000b310  5b 52 34 2c 52 31 30 2c  4c 53 4c 20 23 32 5d 3a  |[R4,R10,LSL #2]:|
0000b320  53 54 52 20 52 37 2c 5b  52 35 5d 2c 23 34 0d 36  |STR R7,[R5],#4.6|
0000b330  ce 11 20 80 20 52 31 30  2c 52 36 2c 23 26 32 0d  |.. . R10,R6,#&2.|
0000b340  36 d8 2a 20 4c 44 52 20  52 37 2c 5b 52 32 2c 52  |6.* LDR R7,[R2,R|
0000b350  31 30 2c 4c 53 4c 20 23  31 5d 3a 53 54 52 20 52  |10,LSL #1]:STR R|
0000b360  37 2c 5b 52 35 5d 2c 23  34 0d 36 e2 2a 20 4c 44  |7,[R5],#4.6.* LD|
0000b370  52 20 52 37 2c 5b 52 33  2c 52 31 30 2c 4c 53 4c  |R R7,[R3,R10,LSL|
0000b380  20 23 31 5d 3a 53 54 52  20 52 37 2c 5b 52 35 5d  | #1]:STR R7,[R5]|
0000b390  2c 23 34 0d 36 ec 2a 20  4c 44 52 20 52 37 2c 5b  |,#4.6.* LDR R7,[|
0000b3a0  52 34 2c 52 31 30 2c 4c  53 4c 20 23 31 5d 3a 53  |R4,R10,LSL #1]:S|
0000b3b0  54 52 20 52 37 2c 5b 52  35 5d 2c 23 34 0d 36 f6  |TR R7,[R5],#4.6.|
0000b3c0  11 20 80 20 52 31 30 2c  52 36 2c 23 26 34 0d 37  |. . R10,R6,#&4.7|
0000b3d0  00 23 20 4c 44 52 20 52  37 2c 5b 52 32 2c 52 31  |.# LDR R7,[R2,R1|
0000b3e0  30 5d 3a 53 54 52 20 52  37 2c 5b 52 35 5d 2c 23  |0]:STR R7,[R5],#|
0000b3f0  34 0d 37 0a 23 20 4c 44  52 20 52 37 2c 5b 52 33  |4.7.# LDR R7,[R3|
0000b400  2c 52 31 30 5d 3a 53 54  52 20 52 37 2c 5b 52 35  |,R10]:STR R7,[R5|
0000b410  5d 2c 23 34 0d 37 14 23  20 4c 44 52 20 52 37 2c  |],#4.7.# LDR R7,|
0000b420  5b 52 34 2c 52 31 30 5d  3a 53 54 52 20 52 37 2c  |[R4,R10]:STR R7,|
0000b430  5b 52 35 5d 2c 23 34 0d  37 1e 11 20 80 20 52 31  |[R5],#4.7.. . R1|
0000b440  30 2c 52 36 2c 23 26 38  0d 37 28 2a 20 4c 44 52  |0,R6,#&8.7(* LDR|
0000b450  20 52 37 2c 5b 52 32 2c  52 31 30 2c 4c 53 52 20  | R7,[R2,R10,LSR |
0000b460  23 31 5d 3a 53 54 52 20  52 37 2c 5b 52 35 5d 2c  |#1]:STR R7,[R5],|
0000b470  23 34 0d 37 32 2a 20 4c  44 52 20 52 37 2c 5b 52  |#4.72* LDR R7,[R|
0000b480  33 2c 52 31 30 2c 4c 53  52 20 23 31 5d 3a 53 54  |3,R10,LSR #1]:ST|
0000b490  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 37 3c 2a  |R R7,[R5],#4.7<*|
0000b4a0  20 4c 44 52 20 52 37 2c  5b 52 34 2c 52 31 30 2c  | LDR R7,[R4,R10,|
0000b4b0  4c 53 52 20 23 31 5d 3a  53 54 52 20 52 37 2c 5b  |LSR #1]:STR R7,[|
0000b4c0  52 35 5d 2c 23 34 0d 37  46 12 20 80 20 52 31 30  |R5],#4.7F. . R10|
0000b4d0  2c 52 36 2c 23 26 31 30  0d 37 50 2a 20 4c 44 52  |,R6,#&10.7P* LDR|
0000b4e0  20 52 37 2c 5b 52 32 2c  52 31 30 2c 4c 53 52 20  | R7,[R2,R10,LSR |
0000b4f0  23 32 5d 3a 53 54 52 20  52 37 2c 5b 52 35 5d 2c  |#2]:STR R7,[R5],|
0000b500  23 34 0d 37 5a 2a 20 4c  44 52 20 52 37 2c 5b 52  |#4.7Z* LDR R7,[R|
0000b510  33 2c 52 31 30 2c 4c 53  52 20 23 32 5d 3a 53 54  |3,R10,LSR #2]:ST|
0000b520  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 37 64 2a  |R R7,[R5],#4.7d*|
0000b530  20 4c 44 52 20 52 37 2c  5b 52 34 2c 52 31 30 2c  | LDR R7,[R4,R10,|
0000b540  4c 53 52 20 23 32 5d 3a  53 54 52 20 52 37 2c 5b  |LSR #2]:STR R7,[|
0000b550  52 35 5d 2c 23 34 0d 37  6e 12 20 80 20 52 31 30  |R5],#4.7n. . R10|
0000b560  2c 52 36 2c 23 26 32 30  0d 37 78 2a 20 4c 44 52  |,R6,#&20.7x* LDR|
0000b570  20 52 37 2c 5b 52 32 2c  52 31 30 2c 4c 53 52 20  | R7,[R2,R10,LSR |
0000b580  23 33 5d 3a 53 54 52 20  52 37 2c 5b 52 35 5d 2c  |#3]:STR R7,[R5],|
0000b590  23 34 0d 37 82 2a 20 4c  44 52 20 52 37 2c 5b 52  |#4.7.* LDR R7,[R|
0000b5a0  33 2c 52 31 30 2c 4c 53  52 20 23 33 5d 3a 53 54  |3,R10,LSR #3]:ST|
0000b5b0  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 37 8c 2a  |R R7,[R5],#4.7.*|
0000b5c0  20 4c 44 52 20 52 37 2c  5b 52 34 2c 52 31 30 2c  | LDR R7,[R4,R10,|
0000b5d0  4c 53 52 20 23 33 5d 3a  53 54 52 20 52 37 2c 5b  |LSR #3]:STR R7,[|
0000b5e0  52 35 5d 2c 23 34 0d 37  96 12 20 80 20 52 31 30  |R5],#4.7.. . R10|
0000b5f0  2c 52 36 2c 23 26 34 30  0d 37 a0 2a 20 4c 44 52  |,R6,#&40.7.* LDR|
0000b600  20 52 37 2c 5b 52 32 2c  52 31 30 2c 4c 53 52 20  | R7,[R2,R10,LSR |
0000b610  23 34 5d 3a 53 54 52 20  52 37 2c 5b 52 35 5d 2c  |#4]:STR R7,[R5],|
0000b620  23 34 0d 37 aa 2a 20 4c  44 52 20 52 37 2c 5b 52  |#4.7.* LDR R7,[R|
0000b630  33 2c 52 31 30 2c 4c 53  52 20 23 34 5d 3a 53 54  |3,R10,LSR #4]:ST|
0000b640  52 20 52 37 2c 5b 52 35  5d 2c 23 34 0d 37 b4 2a  |R R7,[R5],#4.7.*|
0000b650  20 4c 44 52 20 52 37 2c  5b 52 34 2c 52 31 30 2c  | LDR R7,[R4,R10,|
0000b660  4c 53 52 20 23 34 5d 3a  53 54 52 20 52 37 2c 5b  |LSR #4]:STR R7,[|
0000b670  52 35 5d 2c 23 34 0d 37  be 16 20 4d 4f 56 20 52  |R5],#4.7.. MOV R|
0000b680  31 30 2c 52 36 2c 4c 53  52 20 23 37 0d 37 c8 06  |10,R6,LSR #7.7..|
0000b690  20 5d 0d 37 d2 05 cd 0d  37 dc 0a 5b 4f 50 54 20  | ].7....7..[OPT |
0000b6a0  5a 0d 37 e6 2a 20 4c 44  52 20 52 37 2c 5b 52 32  |Z.7.* LDR R7,[R2|
0000b6b0  2c 52 31 30 2c 4c 53 4c  20 23 32 5d 3a 53 54 52  |,R10,LSL #2]:STR|
0000b6c0  20 52 37 2c 5b 52 35 5d  2c 23 34 0d 37 f0 2a 20  | R7,[R5],#4.7.* |
0000b6d0  4c 44 52 20 52 37 2c 5b  52 33 2c 52 31 30 2c 4c  |LDR R7,[R3,R10,L|
0000b6e0  53 4c 20 23 32 5d 3a 53  54 52 20 52 37 2c 5b 52  |SL #2]:STR R7,[R|
0000b6f0  35 5d 2c 23 34 0d 37 fa  2a 20 4c 44 52 20 52 37  |5],#4.7.* LDR R7|
0000b700  2c 5b 52 34 2c 52 31 30  2c 4c 53 4c 20 23 32 5d  |,[R4,R10,LSL #2]|
0000b710  3a 53 54 52 20 52 37 2c  5b 52 35 5d 2c 23 34 0d  |:STR R7,[R5],#4.|
0000b720  38 04 1f 20 53 55 42 53  20 52 30 2c 52 30 2c 23  |8.. SUBS R0,R0,#|
0000b730  38 3a 42 48 49 20 6d 61  70 70 69 78 6c 70 0d 38  |8:BHI mappixlp.8|
0000b740  0e 10 20 4d 4f 56 53 20  50 43 2c 52 31 34 0d 38  |.. MOVS PC,R14.8|
0000b750  18 06 20 5d 0d 38 22 09  c9 20 32 34 3a 0d 38 2c  |.. ].8".. 24:.8,|
0000b760  0a 5b 4f 50 54 20 5a 0d  38 36 41 2e 6d 61 70 70  |.[OPT Z.86A.mapp|
0000b770  69 78 25 20 3b 20 d6 6d  61 70 70 69 78 25 2c 7a  |ix% ; .mappix%,z|
0000b780  25 28 31 2c 30 29 2c 72  25 28 30 29 2c 67 25 28  |%(1,0),r%(0),g%(|
0000b790  30 29 2c 62 25 28 30 29  2c 72 62 25 2c 67 62 25  |0),b%(0),rb%,gb%|
0000b7a0  2c 62 62 25 2c 73 78 25  0d 38 40 23 20 4c 44 52  |,bb%,sx%.8@# LDR|
0000b7b0  20 52 30 2c 5b 52 39 5d  3a 4c 44 52 20 52 30 2c  | R0,[R9]:LDR R0,|
0000b7c0  5b 52 30 5d 20 3b 63 6f  75 6e 74 0d 38 4a 37 20  |[R0] ;count.8J7 |
0000b7d0  4c 44 52 20 52 31 2c 5b  52 39 2c 23 33 2a 38 5d  |LDR R1,[R9,#3*8]|
0000b7e0  3a 4c 44 52 20 52 31 2c  5b 52 31 5d 20 3b 62 61  |:LDR R1,[R1] ;ba|
0000b7f0  73 65 20 6f 66 20 72 20  62 79 74 65 20 61 72 72  |se of r byte arr|
0000b800  61 79 0d 38 54 37 20 4c  44 52 20 52 32 2c 5b 52  |ay.8T7 LDR R2,[R|
0000b810  39 2c 23 32 2a 38 5d 3a  4c 44 52 20 52 32 2c 5b  |9,#2*8]:LDR R2,[|
0000b820  52 32 5d 20 3b 62 61 73  65 20 6f 66 20 67 20 62  |R2] ;base of g b|
0000b830  79 74 65 20 61 72 72 61  79 0d 38 5e 35 20 4c 44  |yte array.8^5 LD|
0000b840  52 20 52 33 2c 5b 52 39  2c 23 38 5d 3a 4c 44 52  |R R3,[R9,#8]:LDR|
0000b850  20 52 33 2c 5b 52 33 5d  20 3b 62 61 73 65 20 6f  | R3,[R3] ;base o|
0000b860  66 20 62 20 62 79 74 65  20 61 72 72 61 79 0d 38  |f b byte array.8|
0000b870  68 26 20 4c 44 52 20 52  34 2c 5b 52 39 2c 23 36  |h& LDR R4,[R9,#6|
0000b880  2a 38 5d 20 3b 62 61 73  65 20 6f 66 20 72 20 61  |*8] ;base of r a|
0000b890  72 72 61 79 0d 38 72 26  20 4c 44 52 20 52 35 2c  |rray.8r& LDR R5,|
0000b8a0  5b 52 39 2c 23 35 2a 38  5d 20 3b 62 61 73 65 20  |[R9,#5*8] ;base |
0000b8b0  6f 66 20 67 20 61 72 72  61 79 0d 38 7c 26 20 4c  |of g array.8|& L|
0000b8c0  44 52 20 52 36 2c 5b 52  39 2c 23 34 2a 38 5d 20  |DR R6,[R9,#4*8] |
0000b8d0  3b 62 61 73 65 20 6f 66  20 62 20 61 72 72 61 79  |;base of b array|
0000b8e0  0d 38 86 26 20 4c 44 52  20 52 37 2c 5b 52 39 2c  |.8.& LDR R7,[R9,|
0000b8f0  23 37 2a 38 5d 20 3b 62  61 73 65 20 6f 66 20 7a  |#7*8] ;base of z|
0000b900  20 61 72 72 61 79 0d 38  90 0d 2e 6d 61 70 70 69  | array.8...mappi|
0000b910  78 6c 70 0d 38 9a 3e 20  4c 44 52 42 20 52 38 2c  |xlp.8.> LDRB R8,|
0000b920  5b 52 31 5d 2c 23 73 74  65 70 32 34 3a 4c 44 52  |[R1],#step24:LDR|
0000b930  20 52 38 2c 5b 52 34 2c  52 38 2c 4c 53 4c 20 23  | R8,[R4,R8,LSL #|
0000b940  32 5d 3a 53 54 52 20 52  38 2c 5b 52 37 5d 2c 23  |2]:STR R8,[R7],#|
0000b950  34 0d 38 a4 3e 20 4c 44  52 42 20 52 38 2c 5b 52  |4.8.> LDRB R8,[R|
0000b960  32 5d 2c 23 73 74 65 70  32 34 3a 4c 44 52 20 52  |2],#step24:LDR R|
0000b970  38 2c 5b 52 35 2c 52 38  2c 4c 53 4c 20 23 32 5d  |8,[R5,R8,LSL #2]|
0000b980  3a 53 54 52 20 52 38 2c  5b 52 37 5d 2c 23 34 0d  |:STR R8,[R7],#4.|
0000b990  38 ae 3e 20 4c 44 52 42  20 52 38 2c 5b 52 33 5d  |8.> LDRB R8,[R3]|
0000b9a0  2c 23 73 74 65 70 32 34  3a 4c 44 52 20 52 38 2c  |,#step24:LDR R8,|
0000b9b0  5b 52 36 2c 52 38 2c 4c  53 4c 20 23 32 5d 3a 53  |[R6,R8,LSL #2]:S|
0000b9c0  54 52 20 52 38 2c 5b 52  37 5d 2c 23 34 0d 38 b8  |TR R8,[R7],#4.8.|
0000b9d0  1f 20 53 55 42 53 20 52  30 2c 52 30 2c 23 31 3a  |. SUBS R0,R0,#1:|
0000b9e0  42 4e 45 20 6d 61 70 70  69 78 6c 70 0d 38 c2 10  |BNE mappixlp.8..|
0000b9f0  20 4d 4f 56 53 20 50 43  2c 52 31 34 0d 38 cc 06  | MOVS PC,R14.8..|
0000ba00  20 5d 0d 38 d6 05 cb 0d  38 e0 0b 20 5b 4f 50 54  | ].8....8.. [OPT|
0000ba10  20 5a 0d 38 ea 53 3b 20  72 6f 75 74 69 6e 65 20  | Z.8.S; routine |
0000ba20  74 6f 20 61 64 64 20 74  77 6f 20 61 72 72 61 79  |to add two array|
0000ba30  73 20 61 6e 64 20 68 61  6c 76 65 20 6f 75 74 70  |s and halve outp|
0000ba40  75 74 20 6f 66 20 66 69  78 65 64 20 70 6f 69 6e  |ut of fixed poin|
0000ba50  74 20 6e 75 6d 62 65 72  73 20 66 6f 72 20 73 63  |t numbers for sc|
0000ba60  61 6c 69 6e 67 0d 38 f4  0d 2e 61 64 64 68 61 6c  |aling.8...addhal|
0000ba70  66 25 0d 38 fe 1c 20 4c  44 52 20 52 30 2c 5b 52  |f%.8.. LDR R0,[R|
0000ba80  39 5d 3a 4c 44 52 20 52  30 2c 5b 52 30 5d 0d 39  |9]:LDR R0,[R0].9|
0000ba90  08 1b 20 4c 44 52 20 52  31 2c 5b 52 39 2c 23 38  |.. LDR R1,[R9,#8|
0000baa0  5d 20 3b 6f 75 74 70 75  74 0d 39 12 1c 20 4c 44  |] ;output.9.. LD|
0000bab0  52 20 52 32 2c 5b 52 39  2c 23 32 2a 38 5d 20 3b  |R R2,[R9,#2*8] ;|
0000bac0  69 6e 70 75 74 0d 39 1c  0e 2e 61 64 64 68 61 6c  |input.9...addhal|
0000bad0  66 6c 70 0d 39 26 4c 20  4c 44 52 20 52 33 2c 5b  |flp.9&L LDR R3,[|
0000bae0  52 31 5d 3a 4c 44 52 20  52 34 2c 5b 52 32 5d 2c  |R1]:LDR R4,[R2],|
0000baf0  23 34 3a 41 44 44 20 52  33 2c 52 33 2c 52 34 3a  |#4:ADD R3,R3,R4:|
0000bb00  4d 4f 56 20 52 33 2c 52  33 2c 4c 53 52 20 23 31  |MOV R3,R3,LSR #1|
0000bb10  3a 53 54 52 20 52 33 2c  5b 52 31 5d 2c 23 34 0d  |:STR R3,[R1],#4.|
0000bb20  39 30 4c 20 4c 44 52 20  52 33 2c 5b 52 31 5d 3a  |90L LDR R3,[R1]:|
0000bb30  4c 44 52 20 52 34 2c 5b  52 32 5d 2c 23 34 3a 41  |LDR R4,[R2],#4:A|
0000bb40  44 44 20 52 33 2c 52 33  2c 52 34 3a 4d 4f 56 20  |DD R3,R3,R4:MOV |
0000bb50  52 33 2c 52 33 2c 4c 53  52 20 23 31 3a 53 54 52  |R3,R3,LSR #1:STR|
0000bb60  20 52 33 2c 5b 52 31 5d  2c 23 34 0d 39 3a 4c 20  | R3,[R1],#4.9:L |
0000bb70  4c 44 52 20 52 33 2c 5b  52 31 5d 3a 4c 44 52 20  |LDR R3,[R1]:LDR |
0000bb80  52 34 2c 5b 52 32 5d 2c  23 34 3a 41 44 44 20 52  |R4,[R2],#4:ADD R|
0000bb90  33 2c 52 33 2c 52 34 3a  4d 4f 56 20 52 33 2c 52  |3,R3,R4:MOV R3,R|
0000bba0  33 2c 4c 53 52 20 23 31  3a 53 54 52 20 52 33 2c  |3,LSR #1:STR R3,|
0000bbb0  5b 52 31 5d 2c 23 34 0d  39 44 20 20 53 55 42 53  |[R1],#4.9D  SUBS|
0000bbc0  20 52 30 2c 52 30 2c 23  31 3a 42 50 4c 20 61 64  | R0,R0,#1:BPL ad|
0000bbd0  64 68 61 6c 66 6c 70 0d  39 4e 10 20 4d 4f 56 53  |dhalflp.9N. MOVS|
0000bbe0  20 50 43 2c 52 31 34 0d  39 58 40 3b 20 63 68 61  | PC,R14.9X@; cha|
0000bbf0  6e 67 65 20 73 69 7a 65  20 69 6e 20 78 20 d6 78  |nge size in x .x|
0000bc00  73 61 6d 70 6c 65 25 2c  78 6d 75 6c 25 2c 78 64  |sample%,xmul%,xd|
0000bc10  69 76 25 2c 7a 25 28 31  2c 30 29 2c 78 70 25 28  |iv%,z%(1,0),xp%(|
0000bc20  31 2c 30 29 2c 78 25 0d  39 62 0d 2e 78 73 61 6d  |1,0),x%.9b..xsam|
0000bc30  70 6c 65 25 0d 39 6c 20  20 4c 44 52 20 52 30 2c  |ple%.9l  LDR R0,|
0000bc40  5b 52 39 5d 3a 4c 44 52  20 52 30 2c 5b 52 30 5d  |[R9]:LDR R0,[R0]|
0000bc50  20 3b 78 25 0d 39 76 1c  20 4c 44 52 20 52 31 2c  | ;x%.9v. LDR R1,|
0000bc60  5b 52 39 2c 23 38 5d 20  3b 78 70 20 28 69 6e 29  |[R9,#8] ;xp (in)|
0000bc70  0d 39 80 18 20 4c 44 52  20 52 32 2c 5b 52 39 2c  |.9.. LDR R2,[R9,|
0000bc80  23 32 2a 38 5d 20 3b 7a  0d 39 8a 28 20 4c 44 52  |#2*8] ;z.9.( LDR|
0000bc90  20 52 33 2c 5b 52 39 2c  23 33 2a 38 5d 3a 4c 44  | R3,[R9,#3*8]:LD|
0000bca0  52 20 52 33 2c 5b 52 33  5d 20 3b 78 64 69 76 25  |R R3,[R3] ;xdiv%|
0000bcb0  0d 39 94 28 20 4c 44 52  20 52 34 2c 5b 52 39 2c  |.9.( LDR R4,[R9,|
0000bcc0  23 34 2a 38 5d 3a 4c 44  52 20 52 34 2c 5b 52 34  |#4*8]:LDR R4,[R4|
0000bcd0  5d 20 3b 78 6d 75 6c 25  0d 39 9e 0f 20 4d 4f 56  |] ;xmul%.9.. MOV|
0000bce0  20 52 31 31 2c 52 34 0d  39 a8 0e 2e 78 73 61 6d  | R11,R4.9...xsam|
0000bcf0  70 6c 65 6c 70 0d 39 b2  18 20 4c 44 4d 49 41 20  |plelp.9.. LDMIA |
0000bd00  52 31 2c 7b 52 35 2c 52  36 2c 52 37 7d 0d 39 bc  |R1,{R5,R6,R7}.9.|
0000bd10  2e 20 53 55 42 53 20 52  31 31 2c 52 31 31 2c 23  |. SUBS R11,R11,#|
0000bd20  31 3a ec 51 20 52 31 31  2c 52 34 3a 41 44 44 45  |1:.Q R11,R4:ADDE|
0000bd30  51 20 52 31 2c 52 31 2c  23 31 32 0d 39 c6 23 20  |Q R1,R1,#12.9.# |
0000bd40  53 55 42 53 20 52 31 32  2c 52 33 2c 23 31 20 3b  |SUBS R12,R3,#1 ;|
0000bd50  28 69 6e 20 72 61 6e 67  65 20 31 2e 2e 29 0d 39  |(in range 1..).9|
0000bd60  d0 11 20 42 45 51 20 78  64 6f 6e 65 64 69 76 0d  |.. BEQ xdonediv.|
0000bd70  39 da 0b 2e 78 64 69 76  6c 70 0d 39 e4 19 20 4c  |9...xdivlp.9.. L|
0000bd80  44 4d 49 41 20 52 31 2c  7b 52 38 2c 52 39 2c 52  |DMIA R1,{R8,R9,R|
0000bd90  31 30 7d 0d 39 ee 2e 20  53 55 42 53 20 52 31 31  |10}.9.. SUBS R11|
0000bda0  2c 52 31 31 2c 23 31 3a  ec 51 20 52 31 31 2c 52  |,R11,#1:.Q R11,R|
0000bdb0  34 3a 41 44 44 45 51 20  52 31 2c 52 31 2c 23 31  |4:ADDEQ R1,R1,#1|
0000bdc0  32 0d 39 f8 22 20 41 44  44 20 52 35 2c 52 35 2c  |2.9." ADD R5,R5,|
0000bdd0  52 38 3a 4d 4f 56 20 52  35 2c 52 35 2c 4c 53 52  |R8:MOV R5,R5,LSR|
0000bde0  20 23 31 0d 3a 02 22 20  41 44 44 20 52 36 2c 52  | #1.:." ADD R6,R|
0000bdf0  36 2c 52 39 3a 4d 4f 56  20 52 36 2c 52 36 2c 4c  |6,R9:MOV R6,R6,L|
0000be00  53 52 20 23 31 0d 3a 0c  23 20 41 44 44 20 52 37  |SR #1.:.# ADD R7|
0000be10  2c 52 37 2c 52 31 30 3a  4d 4f 56 20 52 37 2c 52  |,R7,R10:MOV R7,R|
0000be20  37 2c 4c 53 52 20 23 31  0d 3a 16 1f 20 53 55 42  |7,LSR #1.:.. SUB|
0000be30  53 20 52 31 32 2c 52 31  32 2c 23 31 3a 42 4e 45  |S R12,R12,#1:BNE|
0000be40  20 78 64 69 76 6c 70 0d  3a 20 0d 2e 78 64 6f 6e  | xdivlp.: ..xdon|
0000be50  65 64 69 76 0d 3a 2a 19  20 53 54 4d 49 41 20 52  |ediv.:*. STMIA R|
0000be60  32 21 2c 7b 52 35 2c 52  36 2c 52 37 7d 0d 3a 34  |2!,{R5,R6,R7}.:4|
0000be70  20 20 53 55 42 53 20 52  30 2c 52 30 2c 23 31 3a  |  SUBS R0,R0,#1:|
0000be80  42 50 4c 20 78 73 61 6d  70 6c 65 6c 70 0d 3a 3e  |BPL xsamplelp.:>|
0000be90  10 20 4d 4f 56 53 20 50  43 2c 52 31 34 0d 3a 48  |. MOVS PC,R14.:H|
0000bea0  06 20 5d 0d 3a 52 05 cb  0d 3a 5c 14 e7 63 6f 6d  |. ].:R...:\..com|
0000beb0  70 72 65 73 73 69 6f 6e  3d 35 20 8c 0d 3a 66 0a  |pression=5 ..:f.|
0000bec0  5b 4f 50 54 20 5a 0d 3a  70 2b 3b 20 d6 20 4c 5a  |[OPT Z.:p+; . LZ|
0000bed0  57 64 65 63 6f 64 65 25  2c 74 61 62 6c 65 25 28  |Wdecode%,table%(|
0000bee0  30 2c 30 29 2c 63 25 2c  62 75 66 66 25 2c 73 78  |0,0),c%,buff%,sx|
0000bef0  25 0d 3a 7a 14 2e 66 69  72 73 74 63 6f 64 65 20  |%.:z..firstcode |
0000bf00  44 43 44 20 30 0d 3a 84  12 2e 6f 6c 64 63 6f 64  |DCD 0.:...oldcod|
0000bf10  65 20 44 43 44 20 30 0d  3a 8e 1d 2e 63 6f 64 65  |e DCD 0.:...code|
0000bf20  73 69 7a 65 20 44 43 44  20 73 65 74 63 6f 64 65  |size DCD setcode|
0000bf30  73 25 2b 31 0d 3a 98 13  2e 73 74 61 63 6b 20 44  |s%+1.:...stack D|
0000bf40  43 44 20 73 74 6b 25 0d  3a a2 10 2e 73 70 20 44  |CD stk%.:...sp D|
0000bf50  43 44 20 73 74 6b 25 0d  3a ac 1d 2e 6d 61 78 63  |CD stk%.:...maxc|
0000bf60  6f 64 65 20 44 43 44 20  63 6c 65 61 72 63 6f 64  |ode DCD clearcod|
0000bf70  65 25 2b 32 0d 3a b6 21  2e 6d 61 78 63 6f 64 65  |e%+2.:.!.maxcode|
0000bf80  73 69 7a 65 20 44 43 44  20 32 2a 63 6c 65 61 72  |size DCD 2*clear|
0000bf90  63 6f 64 65 25 0d 3a c0  0f 2e 4c 5a 57 64 65 63  |code%.:...LZWdec|
0000bfa0  6f 64 65 25 0d 3a ca 15  20 4c 44 52 20 52 32 2c  |ode%.:.. LDR R2,|
0000bfb0  66 69 72 73 74 63 6f 64  65 0d 3a d4 13 20 4c 44  |firstcode.:.. LD|
0000bfc0  52 20 52 33 2c 6f 6c 64  63 6f 64 65 0d 3a de 11  |R R3,oldcode.:..|
0000bfd0  20 4c 44 52 20 52 34 2c  73 74 61 63 6b 0d 3a e8  | LDR R4,stack.:.|
0000bfe0  14 20 4c 44 52 20 52 35  2c 63 6f 64 65 73 69 7a  |. LDR R5,codesiz|
0000bff0  65 0d 3a f2 0e 20 4c 44  52 20 52 36 2c 73 70 0d  |e.:.. LDR R6,sp.|
0000c000  3a fc 13 20 4c 44 52 20  52 37 2c 6d 61 78 63 6f  |:.. LDR R7,maxco|
0000c010  64 65 0d 3b 06 17 20 4c  44 52 20 52 38 2c 6d 61  |de.;.. LDR R8,ma|
0000c020  78 63 6f 64 65 73 69 7a  65 0d 3b 10 11 20 4c 44  |xcodesize.;.. LD|
0000c030  52 20 52 31 30 2c 5b 52  39 5d 0d 3b 1a 17 20 4c  |R R10,[R9].;.. L|
0000c040  44 52 20 52 31 30 2c 5b  52 31 30 5d 20 3b 73 78  |DR R10,[R10] ;sx|
0000c050  25 0d 3b 24 14 20 4c 44  52 20 52 31 31 2c 5b 52  |%.;$. LDR R11,[R|
0000c060  39 2c 23 38 5d 0d 3b 2e  19 20 4c 44 52 20 52 31  |9,#8].;.. LDR R1|
0000c070  31 2c 5b 52 31 31 5d 20  3b 62 75 66 66 25 0d 3b  |1,[R11] ;buff%.;|
0000c080  38 1f 20 4c 44 52 20 52  31 32 2c 5b 52 39 2c 23  |8. LDR R12,[R9,#|
0000c090  32 34 5d 20 3b 74 61 62  6c 65 25 28 29 0d 3b 42  |24] ;table%().;B|
0000c0a0  15 20 53 54 4d 46 44 20  53 50 20 21 2c 7b 52 31  |. STMFD SP !,{R1|
0000c0b0  34 7d 0d 3b 4c 0c 2e 6c  7a 77 6c 6f 6f 70 0d 3b  |4}.;L..lzwloop.;|
0000c0c0  56 0e 20 43 4d 50 20 52  36 2c 52 34 0d 3b 60 13  |V. CMP R6,R4.;`.|
0000c0d0  20 42 48 49 20 6c 7a 77  75 6e 73 74 61 63 6b 0d  | BHI lzwunstack.|
0000c0e0  3b 6a 0e 2e 6c 7a 77 65  6e 67 69 6e 65 0d 3b 74  |;j..lzwengine.;t|
0000c0f0  0f 20 42 4c 20 67 65 74  63 6f 64 65 0d 3b 7e 17  |. BL getcode.;~.|
0000c100  20 43 4d 50 20 52 30 2c  23 63 6c 65 61 72 63 6f  | CMP R0,#clearco|
0000c110  64 65 25 0d 3b 88 11 20  42 45 51 20 6c 7a 77 63  |de%.;.. BEQ lzwc|
0000c120  6c 65 61 72 0d 3b 92 70  3b 72 65 61 6c 6c 79 20  |lear.;.p;really |
0000c130  6f 75 67 68 74 20 74 6f  20 63 68 65 63 6b 20 66  |ought to check f|
0000c140  6f 72 20 65 6e 64 63 6f  64 65 3d 63 6c 65 61 72  |or endcode=clear|
0000c150  63 6f 64 65 2b 31 2c 20  62 75 74 20 69 74 20 6f  |code+1, but it o|
0000c160  6e 6c 79 20 68 61 70 70  65 6e 73 20 6f 6e 63 65  |nly happens once|
0000c170  20 61 6e 64 20 74 68 65  6e 20 79 6f 75 20 64 6f  | and then you do|
0000c180  6e 27 74 20 6e 65 65 64  20 74 68 65 20 61 6e 73  |n't need the ans|
0000c190  77 65 72 21 0d 3b 9c 1b  20 4d 4f 56 20 52 31 2c  |wer!.;.. MOV R1,|
0000c1a0  52 30 20 3b 69 6e 63 6f  64 65 3d 63 6f 64 65 0d  |R0 ;incode=code.|
0000c1b0  3b a6 20 20 43 4d 50 20  52 30 2c 52 37 20 3b 69  |;.  CMP R0,R7 ;i|
0000c1c0  66 20 63 6f 64 65 3e 3d  6d 61 78 63 6f 64 65 0d  |f code>=maxcode.|
0000c1d0  3b b0 27 20 53 54 52 43  53 42 20 52 32 2c 5b 52  |;.' STRCSB R2,[R|
0000c1e0  36 5d 2c 23 31 20 3b 2a  73 70 2b 2b 3d 66 69 72  |6],#1 ;*sp++=fir|
0000c1f0  73 74 63 6f 64 65 0d 3b  ba 1e 20 4d 4f 56 43 53  |stcode.;.. MOVCS|
0000c200  20 52 30 2c 52 33 20 3b  63 6f 64 65 3d 6f 6c 64  | R0,R3 ;code=old|
0000c210  63 6f 64 65 0d 3b c4 2d  20 41 44 44 20 52 32 2c  |code.;.- ADD R2,|
0000c220  52 31 32 2c 23 34 20 3b  72 32 28 74 65 6d 70 29  |R12,#4 ;r2(temp)|
0000c230  3d 61 64 64 72 20 74 61  62 6c 65 25 28 78 2c 31  |=addr table%(x,1|
0000c240  29 0d 3b ce 17 20 43 4d  50 20 52 30 2c 23 63 6c  |).;.. CMP R0,#cl|
0000c250  65 61 72 63 6f 64 65 25  0d 3b d8 14 20 42 43 43  |earcode%.;.. BCC|
0000c260  20 6c 7a 77 64 6f 6e 65  70 75 73 68 0d 3b e2 11  | lzwdonepush.;..|
0000c270  2e 6c 7a 77 70 75 73 68  74 61 62 6c 65 0d 3b ec  |.lzwpushtable.;.|
0000c280  2c 20 4c 44 52 20 52 31  34 2c 5b 52 32 2c 52 30  |, LDR R14,[R2,R0|
0000c290  2c 4c 53 4c 20 23 33 5d  20 3b 74 61 62 6c 65 25  |,LSL #3] ;table%|
0000c2a0  28 63 6f 64 65 25 2c 31  29 0d 3b f6 1d 20 53 54  |(code%,1).;.. ST|
0000c2b0  52 42 20 52 31 34 2c 5b  52 36 5d 2c 23 31 20 3b  |RB R14,[R6],#1 ;|
0000c2c0  2a 73 70 2b 2b 3d 0d 3c  00 31 20 4c 44 52 20 52  |*sp++=.<.1 LDR R|
0000c2d0  30 2c 5b 52 31 32 2c 52  30 2c 4c 53 4c 20 23 33  |0,[R12,R0,LSL #3|
0000c2e0  5d 20 3b 63 6f 64 65 3d  74 61 62 6c 65 25 28 63  |] ;code=table%(c|
0000c2f0  6f 64 65 25 2c 30 29 0d  3c 0a 17 20 43 4d 50 20  |ode%,0).<.. CMP |
0000c300  52 30 2c 23 63 6c 65 61  72 63 6f 64 65 25 0d 3c  |R0,#clearcode%.<|
0000c310  14 15 20 42 43 53 20 6c  7a 77 70 75 73 68 74 61  |.. BCS lzwpushta|
0000c320  62 6c 65 0d 3c 1e 10 2e  6c 7a 77 64 6f 6e 65 70  |ble.<...lzwdonep|
0000c330  75 73 68 0d 3c 28 35 20  4c 44 52 20 52 32 2c 5b  |ush.<(5 LDR R2,[|
0000c340  52 32 2c 52 30 2c 4c 53  4c 20 23 33 5d 20 3b 66  |R2,R0,LSL #3] ;f|
0000c350  69 72 73 74 63 6f 64 65  3d 74 61 62 6c 65 25 28  |irstcode=table%(|
0000c360  63 6f 64 65 25 2c 31 29  0d 3c 32 25 20 53 54 52  |code%,1).<2% STR|
0000c370  42 20 52 32 2c 5b 52 36  5d 2c 23 31 20 3b 2a 73  |B R2,[R6],#1 ;*s|
0000c380  70 2b 2b 3d 66 69 72 73  74 63 6f 64 65 0d 3c 3c  |p++=firstcode.<<|
0000c390  1c 20 4d 4f 56 20 52 30  2c 52 37 20 3b 63 6f 64  |. MOV R0,R7 ;cod|
0000c3a0  65 3d 6d 61 78 63 6f 64  65 0d 3c 46 11 20 43 4d  |e=maxcode.<F. CM|
0000c3b0  50 20 52 30 2c 23 34 30  39 36 0d 3c 50 12 20 42  |P R0,#4096.<P. B|
0000c3c0  43 53 20 6c 7a 77 6e 6f  63 6f 64 65 0d 3c 5a 34  |CS lzwnocode.<Z4|
0000c3d0  20 53 54 52 20 52 33 2c  5b 52 31 32 2c 52 30 2c  | STR R3,[R12,R0,|
0000c3e0  4c 53 4c 20 23 33 5d 20  3b 74 61 62 6c 65 25 28  |LSL #3] ;table%(|
0000c3f0  63 6f 64 65 25 2c 30 29  3d 6f 6c 64 63 6f 64 65  |code%,0)=oldcode|
0000c400  0d 3c 64 13 20 41 44 44  20 52 31 34 2c 52 31 32  |.<d. ADD R14,R12|
0000c410  2c 23 34 0d 3c 6e 36 20  53 54 52 20 52 32 2c 5b  |,#4.<n6 STR R2,[|
0000c420  52 31 34 2c 52 30 2c 4c  53 4c 20 23 33 5d 20 3b  |R14,R0,LSL #3] ;|
0000c430  74 61 62 6c 65 25 28 63  6f 64 65 25 2c 31 29 3d  |table%(code%,1)=|
0000c440  66 69 72 73 74 63 6f 64  65 0d 3c 78 1c 20 41 44  |firstcode.<x. AD|
0000c450  44 20 52 37 2c 52 37 2c  23 31 20 3b 6d 61 78 63  |D R7,R7,#1 ;maxc|
0000c460  6f 64 65 2b 2b 0d 3c 82  0e 20 43 4d 50 20 52 37  |ode++.<.. CMP R7|
0000c470  2c 52 38 0d 3c 8c 2b 20  42 43 43 20 6c 7a 77 6e  |,R8.<.+ BCC lzwn|
0000c480  6f 63 6f 64 65 20 3b 69  66 20 6d 61 78 63 6f 64  |ocode ;if maxcod|
0000c490  65 3e 3d 6d 61 78 63 6f  64 65 73 69 7a 65 0d 3c  |e>=maxcodesize.<|
0000c4a0  96 27 20 43 4d 50 20 52  38 2c 23 34 30 39 36 20  |.' CMP R8,#4096 |
0000c4b0  3b 61 6e 64 20 6d 61 78  63 6f 64 65 73 69 7a 65  |;and maxcodesize|
0000c4c0  3c 34 30 39 36 0d 3c a0  1f 20 41 44 44 43 43 20  |<4096.<.. ADDCC |
0000c4d0  52 35 2c 52 35 2c 23 31  20 3b 63 6f 64 65 73 69  |R5,R5,#1 ;codesi|
0000c4e0  7a 65 2b 2b 0d 3c aa 2b  20 4d 4f 56 43 43 20 52  |ze++.<.+ MOVCC R|
0000c4f0  38 2c 52 38 2c 4c 53 4c  20 23 31 20 3b 64 6f 75  |8,R8,LSL #1 ;dou|
0000c500  62 6c 65 20 6d 61 78 63  6f 64 65 73 69 7a 65 0d  |ble maxcodesize.|
0000c510  3c b4 0e 2e 6c 7a 77 6e  6f 63 6f 64 65 0d 3c be  |<...lzwnocode.<.|
0000c520  1e 20 4d 4f 56 20 52 33  2c 52 31 20 3b 6f 6c 64  |. MOV R3,R1 ;old|
0000c530  63 6f 64 65 3d 69 6e 63  6f 64 65 0d 3c c8 1c 20  |code=incode.<.. |
0000c540  43 4d 50 20 52 36 2c 52  34 20 3b 75 6e 74 69 6c  |CMP R6,R4 ;until|
0000c550  20 73 70 3e 73 74 6b 0d  3c d2 12 20 42 4c 53 20  | sp>stk.<.. BLS |
0000c560  6c 7a 77 65 6e 67 69 6e  65 0d 3c dc 0f 2e 6c 7a  |lzwengine.<...lz|
0000c570  77 75 6e 73 74 61 63 6b  0d 3c e6 1d 20 4c 44 52  |wunstack.<.. LDR|
0000c580  42 20 52 30 2c 5b 52 36  2c 23 2d 31 5d 21 20 3b  |B R0,[R6,#-1]! ;|
0000c590  2a 2d 2d 73 70 0d 3c f0  0f 2e 6c 7a 77 6c 6f 6f  |*--sp.<...lzwloo|
0000c5a0  70 65 6e 64 0d 3c fa 15  20 53 54 52 42 20 52 30  |pend.<.. STRB R0|
0000c5b0  2c 5b 52 31 31 5d 2c 23  31 0d 3d 04 14 20 53 55  |,[R11],#1.=.. SU|
0000c5c0  42 53 20 52 31 30 2c 52  31 30 2c 23 31 0d 3d 0e  |BS R10,R10,#1.=.|
0000c5d0  10 20 42 4e 45 20 6c 7a  77 6c 6f 6f 70 0d 3d 18  |. BNE lzwloop.=.|
0000c5e0  15 20 53 54 52 20 52 32  2c 66 69 72 73 74 63 6f  |. STR R2,firstco|
0000c5f0  64 65 0d 3d 22 13 20 53  54 52 20 52 33 2c 6f 6c  |de.=". STR R3,ol|
0000c600  64 63 6f 64 65 0d 3d 2c  14 20 53 54 52 20 52 35  |dcode.=,. STR R5|
0000c610  2c 63 6f 64 65 73 69 7a  65 0d 3d 36 0e 20 53 54  |,codesize.=6. ST|
0000c620  52 20 52 36 2c 73 70 0d  3d 40 13 20 53 54 52 20  |R R6,sp.=@. STR |
0000c630  52 37 2c 6d 61 78 63 6f  64 65 0d 3d 4a 17 20 53  |R7,maxcode.=J. S|
0000c640  54 52 20 52 38 2c 6d 61  78 63 6f 64 65 73 69 7a  |TR R8,maxcodesiz|
0000c650  65 0d 3d 54 15 20 4c 44  4d 46 44 20 53 50 20 21  |e.=T. LDMFD SP !|
0000c660  2c 7b 50 43 7d 5e 0d 3d  5e 0d 2e 6c 7a 77 63 6c  |,{PC}^.=^..lzwcl|
0000c670  65 61 72 0d 3d 68 18 20  4d 4f 56 20 52 30 2c 23  |ear.=h. MOV R0,#|
0000c680  30 3a 4d 4f 56 20 52 31  2c 23 30 0d 3d 72 12 20  |0:MOV R1,#0.=r. |
0000c690  4d 4f 56 20 52 32 2c 23  31 3c 3c 31 32 0d 3d 7c  |MOV R2,#1<<12.=||
0000c6a0  0f 20 4d 4f 56 20 52 33  2c 52 31 32 0d 3d 86 11  |. MOV R3,R12.=..|
0000c6b0  2e 6c 7a 77 7a 65 72 6f  74 61 62 6c 65 0d 3d 90  |.lzwzerotable.=.|
0000c6c0  17 20 53 54 4d 49 41 20  52 33 20 21 2c 7b 52 30  |. STMIA R3 !,{R0|
0000c6d0  2c 52 31 7d 0d 3d 9a 12  20 53 55 42 53 20 52 32  |,R1}.=.. SUBS R2|
0000c6e0  2c 52 32 2c 23 31 0d 3d  a4 15 20 42 4e 45 20 6c  |,R2,#1.=.. BNE l|
0000c6f0  7a 77 7a 65 72 6f 74 61  62 6c 65 0d 3d ae 12 20  |zwzerotable.=.. |
0000c700  41 44 44 20 52 33 2c 52  31 32 2c 23 34 0d 3d b8  |ADD R3,R12,#4.=.|
0000c710  14 2e 6c 7a 77 64 65 66  61 75 6c 74 74 61 62 6c  |..lzwdefaulttabl|
0000c720  65 0d 3d c2 13 20 53 54  52 20 52 30 2c 5b 52 33  |e.=.. STR R0,[R3|
0000c730  5d 2c 23 38 0d 3d cc 11  20 41 44 44 20 52 30 2c  |],#8.=.. ADD R0,|
0000c740  52 30 2c 23 31 0d 3d d6  17 20 43 4d 50 20 52 30  |R0,#1.=.. CMP R0|
0000c750  2c 23 63 6c 65 61 72 63  6f 64 65 25 0d 3d e0 18  |,#clearcode%.=..|
0000c760  20 42 43 43 20 6c 7a 77  64 65 66 61 75 6c 74 74  | BCC lzwdefaultt|
0000c770  61 62 6c 65 0d 3d ea 18  20 4d 4f 56 20 52 35 2c  |able.=.. MOV R5,|
0000c780  23 73 65 74 63 6f 64 65  73 25 2b 31 0d 3d f4 17  |#setcodes%+1.=..|
0000c790  20 4d 4f 56 20 52 37 2c  23 63 6c 65 61 72 63 6f  | MOV R7,#clearco|
0000c7a0  64 65 25 0d 3d fe 2e 20  4d 4f 56 20 52 38 2c 52  |de%.=.. MOV R8,R|
0000c7b0  37 2c 4c 53 4c 20 23 31  20 3b 6d 61 78 63 6f 64  |7,LSL #1 ;maxcod|
0000c7c0  65 73 69 7a 65 3d 63 6c  65 61 72 63 6f 64 65 2a  |esize=clearcode*|
0000c7d0  32 0d 3e 08 26 20 41 44  44 20 52 37 2c 52 37 2c  |2.>.& ADD R7,R7,|
0000c7e0  23 32 20 3b 6d 61 78 63  6f 64 65 3d 63 6c 65 61  |#2 ;maxcode=clea|
0000c7f0  72 63 6f 64 65 2b 32 0d  3e 12 0f 20 42 4c 20 67  |rcode+2.>.. BL g|
0000c800  65 74 63 6f 64 65 0d 3e  1c 19 20 4d 4f 56 20 52  |etcode.>.. MOV R|
0000c810  32 2c 52 30 20 3b 66 69  72 73 74 63 6f 64 65 0d  |2,R0 ;firstcode.|
0000c820  3e 26 17 20 4d 4f 56 20  52 33 2c 52 30 20 3b 6f  |>&. MOV R3,R0 ;o|
0000c830  6c 64 63 6f 64 65 0d 3e  30 16 20 4d 4f 56 20 52  |ldcode.>0. MOV R|
0000c840  36 2c 52 34 20 3b 73 70  3d 73 74 6b 0d 3e 3a 11  |6,R4 ;sp=stk.>:.|
0000c850  20 42 20 6c 7a 77 6c 6f  6f 70 65 6e 64 0d 3e 44  | B lzwloopend.>D|
0000c860  36 3b 65 6e 74 65 72 20  77 69 74 68 20 63 6f 64  |6;enter with cod|
0000c870  65 73 69 7a 65 20 69 6e  20 52 35 2e 20 52 65 73  |esize in R5. Res|
0000c880  75 6c 74 20 69 6e 20 52  30 2e 20 4b 69 6c 6c 73  |ult in R0. Kills|
0000c890  20 52 31 0d 3e 4e 0c 2e  67 65 74 63 6f 64 65 0d  | R1.>N..getcode.|
0000c8a0  3e 58 1a 20 53 54 4d 46  44 20 53 50 20 21 2c 7b  |>X. STMFD SP !,{|
0000c8b0  52 36 2c 52 37 2c 52 38  7d 0d 3e 62 12 20 41 44  |R6,R7,R8}.>b. AD|
0000c8c0  52 20 52 36 2c 63 75 72  62 69 74 0d 3e 6c 18 20  |R R6,curbit.>l. |
0000c8d0  4c 44 4d 49 41 20 52 36  2c 7b 52 36 2c 52 37 2c  |LDMIA R6,{R6,R7,|
0000c8e0  52 38 7d 0d 3e 76 22 20  41 44 44 20 52 31 2c 52  |R8}.>v" ADD R1,R|
0000c8f0  35 2c 52 36 20 3b 63 75  72 62 69 74 2b 63 6f 64  |5,R6 ;curbit+cod|
0000c900  65 73 69 7a 65 0d 3e 80  0e 20 43 4d 50 20 52 31  |esize.>.. CMP R1|
0000c910  2c 52 37 0d 3e 8a 15 20  42 43 53 20 6e 65 65 64  |,R7.>.. BCS need|
0000c920  6d 6f 72 65 64 61 74 61  0d 3e 94 0f 2e 73 69 6d  |moredata.>...sim|
0000c930  70 6c 65 63 6f 64 65 0d  3e 9e 18 20 41 44 44 20  |plecode.>.. ADD |
0000c940  52 37 2c 52 38 2c 52 36  2c 4c 53 52 20 23 33 0d  |R7,R8,R6,LSR #3.|
0000c950  3e a8 11 20 42 49 43 20  52 37 2c 52 37 2c 23 33  |>.. BIC R7,R7,#3|
0000c960  0d 3e b2 15 20 4c 44 4d  49 41 20 52 37 2c 7b 52  |.>.. LDMIA R7,{R|
0000c970  30 2c 52 37 7d 0d 3e bc  49 20 80 53 20 52 31 2c  |0,R7}.>.I .S R1,|
0000c980  52 36 2c 23 33 31 3a 4d  4f 56 4e 45 20 52 30 2c  |R6,#31:MOVNE R0,|
0000c990  52 30 2c 4c 53 52 20 52  31 3a 52 53 42 4e 45 20  |R0,LSR R1:RSBNE |
0000c9a0  52 31 2c 52 31 2c 23 33  32 3a 84 52 4e 45 20 52  |R1,R1,#32:.RNE R|
0000c9b0  30 2c 52 30 2c 52 37 2c  4c 53 4c 20 52 31 0d 3e  |0,R0,R7,LSL R1.>|
0000c9c0  c6 22 20 4d 56 4e 20 52  31 2c 23 30 3a 42 49 43  |." MVN R1,#0:BIC|
0000c9d0  20 52 30 2c 52 30 2c 52  31 2c 4c 53 4c 20 52 35  | R0,R0,R1,LSL R5|
0000c9e0  0d 3e d0 11 20 41 44 44  20 52 36 2c 52 36 2c 52  |.>.. ADD R6,R6,R|
0000c9f0  35 0d 3e da 12 20 53 54  52 20 52 36 2c 63 75 72  |5.>.. STR R6,cur|
0000ca00  62 69 74 0d 3e e4 1a 20  4c 44 4d 46 44 20 53 50  |bit.>.. LDMFD SP|
0000ca10  20 21 2c 7b 52 36 2c 52  37 2c 52 38 7d 0d 3e ee  | !,{R6,R7,R8}.>.|
0000ca20  0f 20 4d 4f 56 20 50 43  2c 52 31 34 0d 3e f8 11  |. MOV PC,R14.>..|
0000ca30  2e 6e 65 65 64 6d 6f 72  65 64 61 74 61 0d 3f 02  |.needmoredata.?.|
0000ca40  1a 20 53 54 4d 46 44 20  53 50 20 21 2c 7b 52 32  |. STMFD SP !,{R2|
0000ca50  2c 52 33 2c 52 34 7d 0d  3f 0c 15 20 4d 4f 56 20  |,R3,R4}.?.. MOV |
0000ca60  52 33 2c 52 37 2c 4c 53  52 20 23 33 0d 3f 16 1d  |R3,R7,LSR #3.?..|
0000ca70  20 53 55 42 20 52 30 2c  52 33 2c 23 32 20 3b 6c  | SUB R0,R3,#2 ;l|
0000ca80  61 73 74 62 79 74 65 2d  32 0d 3f 20 14 20 4c 44  |astbyte-2.? . LD|
0000ca90  52 42 20 52 30 2c 5b 52  38 2c 52 30 5d 0d 3f 2a  |RB R0,[R8,R0].?*|
0000caa0  11 20 53 54 52 42 20 52  30 2c 5b 52 38 5d 0d 3f  |. STRB R0,[R8].?|
0000cab0  34 1d 20 53 55 42 20 52  30 2c 52 33 2c 23 31 20  |4. SUB R0,R3,#1 |
0000cac0  3b 6c 61 73 74 62 79 74  65 2d 31 0d 3f 3e 14 20  |;lastbyte-1.?>. |
0000cad0  4c 44 52 42 20 52 30 2c  5b 52 38 2c 52 30 5d 0d  |LDRB R0,[R8,R0].|
0000cae0  3f 48 14 20 53 54 52 42  20 52 30 2c 5b 52 38 2c  |?H. STRB R0,[R8,|
0000caf0  23 31 5d 0d 3f 52 14 20  4c 44 52 20 52 31 2c 5b  |#1].?R. LDR R1,[|
0000cb00  52 39 2c 23 31 36 5d 0d  3f 5c 14 20 4c 44 52 20  |R9,#16].?\. LDR |
0000cb10  52 31 2c 5b 52 31 5d 20  3b 63 25 0d 3f 66 12 20  |R1,[R1] ;c%.?f. |
0000cb20  53 57 49 20 22 4f 53 5f  42 47 65 74 22 0d 3f 70  |SWI "OS_BGet".?p|
0000cb30  16 20 4d 4f 56 53 20 52  33 2c 52 30 20 3b 63 6f  |. MOVS R3,R0 ;co|
0000cb40  75 6e 74 0d 3f 7a 14 20  42 45 51 20 73 69 6d 70  |unt.?z. BEQ simp|
0000cb50  6c 65 63 6f 64 65 31 0d  3f 84 21 20 53 55 42 20  |lecode1.?.! SUB |
0000cb60  52 36 2c 52 36 2c 52 37  20 3b 63 75 72 62 69 74  |R6,R6,R7 ;curbit|
0000cb70  2d 6c 61 73 74 62 69 74  0d 3f 8e 12 20 41 44 44  |-lastbit.?.. ADD|
0000cb80  20 52 36 2c 52 36 2c 23  31 36 0d 3f 98 23 20 41  | R6,R6,#16.?.# A|
0000cb90  44 44 20 52 30 2c 52 30  2c 23 32 20 3b 6c 61 73  |DD R0,R0,#2 ;las|
0000cba0  74 62 79 74 65 3d 32 2b  63 6f 75 6e 74 0d 3f a2  |tbyte=2+count.?.|
0000cbb0  15 20 4d 4f 56 20 52 37  2c 52 30 2c 4c 53 4c 20  |. MOV R7,R0,LSL |
0000cbc0  23 33 0d 3f ac 13 20 53  54 52 20 52 37 2c 6c 61  |#3.?.. STR R7,la|
0000cbd0  73 74 62 69 74 0d 3f b6  0e 20 4d 4f 56 20 52 30  |stbit.?.. MOV R0|
0000cbe0  2c 23 34 0d 3f c0 18 20  41 44 44 20 52 32 2c 52  |,#4.?.. ADD R2,R|
0000cbf0  38 2c 23 32 20 3b 62 75  66 2b 32 0d 3f ca 12 20  |8,#2 ;buf+2.?.. |
0000cc00  53 57 49 20 22 4f 53 5f  47 42 50 42 22 0d 3f d4  |SWI "OS_GBPB".?.|
0000cc10  10 2e 73 69 6d 70 6c 65  63 6f 64 65 31 0d 3f de  |..simplecode1.?.|
0000cc20  1a 20 4c 44 4d 46 44 20  53 50 20 21 2c 7b 52 32  |. LDMFD SP !,{R2|
0000cc30  2c 52 33 2c 52 34 7d 0d  3f e8 11 20 42 20 73 69  |,R3,R4}.?.. B si|
0000cc40  6d 70 6c 65 63 6f 64 65  0d 3f f2 11 2e 63 75 72  |mplecode.?...cur|
0000cc50  62 69 74 20 44 43 44 20  30 0d 3f fc 12 2e 6c 61  |bit DCD 0.?...la|
0000cc60  73 74 62 69 74 20 44 43  44 20 30 0d 40 06 11 2e  |stbit DCD 0.@...|
0000cc70  62 75 66 20 44 43 44 20  62 75 66 25 0d 40 10 06  |buf DCD buf%.@..|
0000cc80  20 5d 0d 40 1a 05 cd 0d  40 24 0d e7 72 61 6e 67  | ].@....@$..rang|
0000cc90  65 25 20 8c 0d 40 2e 0a  5b 4f 50 54 20 5a 0d 40  |e% ..@..[OPT Z.@|
0000cca0  38 21 3b d6 20 6d 61 78  6d 69 6e 25 2c 61 25 28  |8!;. maxmin%,a%(|
0000ccb0  31 2c 30 29 2c 74 6f 74  61 6c 76 61 6c 73 25 0d  |1,0),totalvals%.|
0000ccc0  40 42 0c 2e 6d 61 78 6d  69 6e 25 0d 40 4c 28 20  |@B..maxmin%.@L( |
0000ccd0  4c 44 52 20 52 30 2c 5b  52 39 5d 3a 4c 44 52 20  |LDR R0,[R9]:LDR |
0000cce0  52 30 2c 5b 52 30 5d 20  3b 74 6f 74 61 6c 76 61  |R0,[R0] ;totalva|
0000ccf0  6c 73 25 0d 40 56 19 20  4c 44 52 20 52 31 2c 5b  |ls%.@V. LDR R1,[|
0000cd00  52 39 2c 23 38 5d 20 3b  61 25 28 29 0d 40 60 0f  |R9,#8] ;a%().@`.|
0000cd10  20 4c 44 52 20 52 32 2c  6d 69 6e 0d 40 6a 0f 20  | LDR R2,min.@j. |
0000cd20  4c 44 52 20 52 33 2c 6d  61 78 0d 40 74 0d 2e 6d  |LDR R3,max.@t..m|
0000cd30  61 78 6d 69 6e 6c 70 0d  40 7e 13 20 4c 44 52 20  |axminlp.@~. LDR |
0000cd40  52 34 2c 5b 52 31 5d 2c  23 34 0d 40 88 2c 20 43  |R4,[R1],#4.@., C|
0000cd50  4d 50 20 52 34 2c 52 33  3a 4d 4f 56 43 53 20 52  |MP R4,R3:MOVCS R|
0000cd60  33 2c 52 34 20 3b 69 66  20 72 34 3e 6d 61 78 20  |3,R4 ;if r4>max |
0000cd70  6d 61 78 3d 72 34 0d 40  92 2c 20 43 4d 50 20 52  |max=r4.@., CMP R|
0000cd80  34 2c 52 32 3a 4d 4f 56  43 43 20 52 32 2c 52 34  |4,R2:MOVCC R2,R4|
0000cd90  20 3b 69 66 20 72 34 3c  6d 69 6e 20 6d 69 6e 3d  | ;if r4<min min=|
0000cda0  72 34 0d 40 9c 1f 20 53  55 42 53 20 52 30 2c 52  |r4.@.. SUBS R0,R|
0000cdb0  30 2c 23 31 3a 42 4e 45  20 6d 61 78 6d 69 6e 6c  |0,#1:BNE maxminl|
0000cdc0  70 0d 40 a6 0f 20 53 54  52 20 52 32 2c 6d 69 6e  |p.@.. STR R2,min|
0000cdd0  0d 40 b0 0f 20 53 54 52  20 52 33 2c 6d 61 78 0d  |.@.. STR R3,max.|
0000cde0  40 ba 10 20 4d 4f 56 53  20 50 43 2c 52 31 34 0d  |@.. MOVS PC,R14.|
0000cdf0  40 c4 0e 2e 6d 69 6e 20  44 43 44 20 46 0d 40 ce  |@...min DCD F.@.|
0000ce00  0e 2e 6d 61 78 20 44 43  44 20 30 0d 40 d8 14 2e  |..max DCD 0.@...|
0000ce10  66 69 74 6d 75 6c 6c 6f  63 20 44 43 44 20 30 0d  |fitmulloc DCD 0.|
0000ce20  40 e2 21 3b d6 20 72 61  6e 67 65 72 25 2c 61 25  |@.!;. ranger%,a%|
0000ce30  28 31 2c 30 29 2c 74 6f  74 61 6c 76 61 6c 73 25  |(1,0),totalvals%|
0000ce40  0d 40 ec 0c 2e 72 61 6e  67 65 72 25 0d 40 f6 10  |.@...ranger%.@..|
0000ce50  20 4c 44 52 20 52 30 2c  5b 52 39 5d 0d 41 00 1c  | LDR R0,[R9].A..|
0000ce60  20 4c 44 52 20 52 30 2c  5b 52 30 5d 20 3b 74 6f  | LDR R0,[R0] ;to|
0000ce70  74 61 6c 76 61 6c 73 25  0d 41 0a 19 20 4c 44 52  |talvals%.A.. LDR|
0000ce80  20 52 31 2c 5b 52 39 2c  23 38 5d 20 3b 61 25 28  | R1,[R9,#8] ;a%(|
0000ce90  29 0d 41 14 0f 20 4c 44  52 20 52 32 2c 6d 69 6e  |).A.. LDR R2,min|
0000cea0  0d 41 1e 15 20 4c 44 52  20 52 33 2c 66 69 74 6d  |.A.. LDR R3,fitm|
0000ceb0  75 6c 6c 6f 63 0d 41 28  16 20 4d 4f 56 20 52 34  |ulloc.A(. MOV R4|
0000cec0  2c 52 33 2c 4c 53 52 20  23 31 36 0d 41 32 17 20  |,R3,LSR #16.A2. |
0000ced0  82 20 52 33 2c 52 33 2c  52 34 2c 4c 53 4c 20 23  |. R3,R3,R4,LSL #|
0000cee0  31 36 0d 41 3c 0c 2e 72  61 6e 67 65 6c 70 0d 41  |16.A<..rangelp.A|
0000cef0  46 10 20 4c 44 52 20 52  35 2c 5b 52 31 5d 0d 41  |F. LDR R5,[R1].A|
0000cf00  50 11 20 53 55 42 20 52  35 2c 52 35 2c 52 32 0d  |P. SUB R5,R5,R2.|
0000cf10  41 5a 16 20 4d 4f 56 20  52 36 2c 52 35 2c 4c 53  |AZ. MOV R6,R5,LS|
0000cf20  52 20 23 31 36 0d 41 64  17 20 82 20 52 35 2c 52  |R #16.Ad. . R5,R|
0000cf30  35 2c 52 36 2c 4c 53 4c  20 23 31 36 0d 41 6e 11  |5,R6,LSL #16.An.|
0000cf40  20 4d 55 4c 20 52 37 2c  52 33 2c 52 35 0d 41 78  | MUL R7,R3,R5.Ax|
0000cf50  11 20 4d 55 4c 20 52 35  2c 52 34 2c 52 35 0d 41  |. MUL R5,R4,R5.A|
0000cf60  82 11 20 4d 55 4c 20 52  38 2c 52 36 2c 52 33 0d  |.. MUL R8,R6,R3.|
0000cf70  41 8c 11 20 4d 55 4c 20  52 36 2c 52 34 2c 52 36  |A.. MUL R6,R4,R6|
0000cf80  0d 41 96 12 20 41 44 44  53 20 52 38 2c 52 35 2c  |.A.. ADDS R8,R5,|
0000cf90  52 38 0d 41 a0 18 20 41  44 44 43 53 20 52 36 2c  |R8.A.. ADDCS R6,|
0000cfa0  52 36 2c 23 26 31 30 30  30 30 0d 41 aa 1a 20 41  |R6,#&10000.A.. A|
0000cfb0  44 44 53 20 52 37 2c 52  37 2c 52 38 2c 4c 53 4c  |DDS R7,R7,R8,LSL|
0000cfc0  20 23 31 36 0d 41 b4 19  20 41 44 43 20 52 36 2c  | #16.A.. ADC R6,|
0000cfd0  52 36 2c 52 38 2c 4c 53  52 20 23 31 36 0d 41 be  |R6,R8,LSR #16.A.|
0000cfe0  1b 20 4d 4f 56 20 52 36  2c 52 36 2c 4c 53 4c 20  |. MOV R6,R6,LSL |
0000cff0  23 28 33 32 2d 32 38 29  0d 41 c8 19 20 84 52 53  |#(32-28).A.. .RS|
0000d000  20 52 36 2c 52 36 2c 52  37 2c 4c 53 52 20 23 32  | R6,R6,R7,LSR #2|
0000d010  38 0d 41 d2 2d 20 41 44  44 43 53 20 52 36 2c 52  |8.A.- ADDCS R6,R|
0000d020  36 2c 23 31 20 3b 63 61  72 72 79 20 69 73 20 73  |6,#1 ;carry is s|
0000d030  68 69 66 74 65 64 20 6f  75 74 20 62 69 74 0d 41  |hifted out bit.A|
0000d040  dc 0e 20 43 4d 50 20 52  36 2c 23 46 0d 41 e6 10  |.. CMP R6,#F.A..|
0000d050  20 4d 4f 56 43 53 20 52  36 2c 23 46 0d 41 f0 13  | MOVCS R6,#F.A..|
0000d060  20 53 54 52 20 52 36 2c  5b 52 31 5d 2c 23 34 0d  | STR R6,[R1],#4.|
0000d070  41 fa 12 20 53 55 42 53  20 52 30 2c 52 30 2c 23  |A.. SUBS R0,R0,#|
0000d080  31 0d 42 04 10 20 42 4e  45 20 72 61 6e 67 65 6c  |1.B.. BNE rangel|
0000d090  70 0d 42 0e 10 20 4d 4f  56 53 20 50 43 2c 52 31  |p.B.. MOVS PC,R1|
0000d0a0  34 0d 42 18 06 20 5d 0d  42 22 05 cd 0d 42 2c 0f  |4.B.. ].B"...B,.|
0000d0b0  e7 73 68 61 72 70 65 6e  25 20 8c 0d 42 36 39 73  |.sharpen% ..B69s|
0000d0c0  68 61 72 70 3d 28 63 6f  6c 2b 31 29 2a 34 3a e7  |harp=(col+1)*4:.|
0000d0d0  73 68 61 72 70 65 6e 25  3c 3e 38 20 73 68 61 72  |sharpen%<>8 shar|
0000d0e0  70 6d 75 6c 25 3d 46 2f  28 73 68 61 72 70 65 6e  |pmul%=F/(sharpen|
0000d0f0  25 2d 38 29 0d 42 40 0a  5b 4f 50 54 20 5a 0d 42  |%-8).B@.[OPT Z.B|
0000d100  4a 3d 3b d6 20 73 68 61  72 70 25 2c 7a 25 28 31  |J=;. sharp%,z%(1|
0000d110  2c 30 29 2c 72 6d 25 28  31 2c 30 29 2c 72 6d 31  |,0),rm%(1,0),rm1|
0000d120  25 28 31 2c 30 29 2c 72  6d 32 25 28 31 2c 30 29  |%(1,0),rm2%(1,0)|
0000d130  2c 74 6f 74 61 6c 76 61  6c 73 25 0d 42 54 0b 2e  |,totalvals%.BT..|
0000d140  73 68 61 72 70 25 0d 42  5e 10 20 4c 44 52 20 52  |sharp%.B^. LDR R|
0000d150  30 2c 5b 52 39 5d 0d 42  68 15 20 4c 44 52 20 52  |0,[R9].Bh. LDR R|
0000d160  30 2c 5b 52 30 5d 20 3b  73 78 25 0d 42 72 1b 20  |0,[R0] ;sx%.Br. |
0000d170  4c 44 52 20 52 31 2c 5b  52 39 2c 23 38 5d 20 3b  |LDR R1,[R9,#8] ;|
0000d180  72 6d 32 25 28 29 0d 42  7c 1c 20 4c 44 52 20 52  |rm2%().B|. LDR R|
0000d190  32 2c 5b 52 39 2c 23 31  36 5d 20 3b 72 6d 31 25  |2,[R9,#16] ;rm1%|
0000d1a0  28 29 0d 42 86 1b 20 4c  44 52 20 52 33 2c 5b 52  |().B.. LDR R3,[R|
0000d1b0  39 2c 23 32 34 5d 20 3b  72 6d 25 28 29 0d 42 90  |9,#24] ;rm%().B.|
0000d1c0  1a 20 4c 44 52 20 52 34  2c 5b 52 39 2c 23 33 32  |. LDR R4,[R9,#32|
0000d1d0  5d 20 3b 7a 25 28 29 0d  42 9a 06 20 5d 0d 42 a4  |] ;z%().B.. ].B.|
0000d1e0  11 c8 8e 20 73 68 61 72  70 65 6e 25 20 ca 0d 42  |... sharpen% ..B|
0000d1f0  ae 12 c9 20 38 2c 39 2c  31 32 2c 31 36 2c 32 34  |... 8,9,12,16,24|
0000d200  0d 42 b8 05 7f 0d 42 c2  0a 5b 4f 50 54 20 5a 0d  |.B....B..[OPT Z.|
0000d210  42 cc 1c 20 4d 4f 56 20  52 38 2c 23 73 68 61 72  |B.. MOV R8,#shar|
0000d220  70 6d 75 6c 25 20 80 20  26 46 46 0d 42 d6 20 20  |pmul% . &FF.B.  |
0000d230  84 52 20 52 38 2c 52 38  2c 23 73 68 61 72 70 6d  |.R R8,R8,#sharpm|
0000d240  75 6c 25 20 80 20 26 46  46 30 30 0d 42 e0 24 20  |ul% . &FF00.B.$ |
0000d250  4d 4f 56 20 52 39 2c 23  28 73 68 61 72 70 6d 75  |MOV R9,#(sharpmu|
0000d260  6c 25 20 3e 3e 20 31 36  29 20 80 20 26 46 46 0d  |l% >> 16) . &FF.|
0000d270  42 ea 28 20 84 52 20 52  39 2c 52 39 2c 23 28 73  |B.( .R R9,R9,#(s|
0000d280  68 61 72 70 6d 75 6c 25  20 3e 3e 20 31 36 29 20  |harpmul% >> 16) |
0000d290  80 20 26 46 46 30 30 0d  42 f4 06 20 5d 0d 42 fe  |. &FF00.B.. ].B.|
0000d2a0  05 cb 0d 43 08 0a 5b 4f  50 54 20 5a 0d 43 12 0c  |...C..[OPT Z.C..|
0000d2b0  2e 73 68 61 72 70 6c 70  0d 43 1c 18 20 4c 44 52  |.sharplp.C.. LDR|
0000d2c0  20 52 35 2c 5b 52 31 2c  23 2d 73 68 61 72 70 5d  | R5,[R1,#-sharp]|
0000d2d0  0d 43 26 17 20 4c 44 52  20 52 36 2c 5b 52 31 2c  |.C&. LDR R6,[R1,|
0000d2e0  23 73 68 61 72 70 5d 0d  43 30 11 20 41 44 44 20  |#sharp].C0. ADD |
0000d2f0  52 35 2c 52 35 2c 52 36  0d 43 3a 13 20 4c 44 52  |R5,R5,R6.C:. LDR|
0000d300  20 52 36 2c 5b 52 31 5d  2c 23 34 0d 43 44 11 20  | R6,[R1],#4.CD. |
0000d310  41 44 44 20 52 35 2c 52  35 2c 52 36 0d 43 4e 18  |ADD R5,R5,R6.CN.|
0000d320  20 4c 44 52 20 52 36 2c  5b 52 33 2c 23 2d 73 68  | LDR R6,[R3,#-sh|
0000d330  61 72 70 5d 0d 43 58 11  20 41 44 44 20 52 35 2c  |arp].CX. ADD R5,|
0000d340  52 35 2c 52 36 0d 43 62  17 20 4c 44 52 20 52 36  |R5,R6.Cb. LDR R6|
0000d350  2c 5b 52 33 2c 23 73 68  61 72 70 5d 0d 43 6c 11  |,[R3,#sharp].Cl.|
0000d360  20 41 44 44 20 52 35 2c  52 35 2c 52 36 0d 43 76  | ADD R5,R5,R6.Cv|
0000d370  13 20 4c 44 52 20 52 36  2c 5b 52 33 5d 2c 23 34  |. LDR R6,[R3],#4|
0000d380  0d 43 80 11 20 41 44 44  20 52 35 2c 52 35 2c 52  |.C.. ADD R5,R5,R|
0000d390  36 0d 43 8a 18 20 4c 44  52 20 52 36 2c 5b 52 32  |6.C.. LDR R6,[R2|
0000d3a0  2c 23 2d 73 68 61 72 70  5d 0d 43 94 11 20 41 44  |,#-sharp].C.. AD|
0000d3b0  44 20 52 35 2c 52 35 2c  52 36 0d 43 9e 17 20 4c  |D R5,R5,R6.C.. L|
0000d3c0  44 52 20 52 36 2c 5b 52  32 2c 23 73 68 61 72 70  |DR R6,[R2,#sharp|
0000d3d0  5d 0d 43 a8 2d 20 41 44  44 20 52 35 2c 52 35 2c  |].C.- ADD R5,R5,|
0000d3e0  52 36 20 3b 75 6e 73 69  67 6e 65 64 20 74 6f 74  |R6 ;unsigned tot|
0000d3f0  61 6c 20 74 6f 20 73 75  62 74 72 61 63 74 0d 43  |al to subtract.C|
0000d400  b2 1b 20 4c 44 52 20 52  36 2c 5b 52 32 5d 2c 23  |.. LDR R6,[R2],#|
0000d410  34 20 3b 63 65 6e 74 72  65 0d 43 bc 15 20 4d 4f  |4 ;centre.C.. MO|
0000d420  56 20 52 36 2c 52 36 2c  4c 53 52 20 23 31 0d 43  |V R6,R6,LSR #1.C|
0000d430  c6 15 20 4d 4f 56 20 52  37 2c 23 73 68 61 72 70  |.. MOV R7,#sharp|
0000d440  65 6e 25 0d 43 d0 42 20  4d 55 4c 20 52 37 2c 52  |en%.C.B MUL R7,R|
0000d450  36 2c 52 37 20 3b 61 76  6f 69 64 20 64 75 70 6c  |6,R7 ;avoid dupl|
0000d460  69 63 61 74 65 20 72 65  67 69 73 74 65 72 20 77  |icate register w|
0000d470  68 69 6c 65 20 6b 65 65  70 69 6e 67 20 52 73 20  |hile keeping Rs |
0000d480  73 6d 61 6c 6c 0d 43 da  19 20 53 55 42 53 20 52  |small.C.. SUBS R|
0000d490  35 2c 52 37 2c 52 35 2c  4c 53 52 20 23 31 0d 43  |5,R7,R5,LSR #1.C|
0000d4a0  e4 25 20 4d 4f 56 43 43  20 52 35 2c 23 30 20 3b  |.% MOVCC R5,#0 ;|
0000d4b0  75 6e 64 65 72 66 6c 6f  77 20 74 6f 20 30 20 6e  |underflow to 0 n|
0000d4c0  6f 77 21 0d 43 ee 06 20  5d 0d 43 f8 11 c8 8e 20  |ow!.C.. ].C.... |
0000d4d0  73 68 61 72 70 65 6e 25  20 ca 0d 44 02 09 c9 20  |sharpen% ..D... |
0000d4e0  38 2c 39 0d 44 0c 0a 5b  4f 50 54 20 5a 0d 44 16  |8,9.D..[OPT Z.D.|
0000d4f0  15 20 4d 4f 56 20 52 36  2c 52 35 2c 4c 53 4c 20  |. MOV R6,R5,LSL |
0000d500  23 31 0d 44 20 06 20 5d  0d 44 2a 08 c9 20 31 30  |#1.D . ].D*.. 10|
0000d510  0d 44 34 0a 5b 4f 50 54  20 5a 0d 44 3e 0e 20 4d  |.D4.[OPT Z.D>. M|
0000d520  4f 56 20 52 36 2c 52 35  0d 44 48 06 20 5d 0d 44  |OV R6,R5.DH. ].D|
0000d530  52 08 c9 20 31 32 0d 44  5c 0a 5b 4f 50 54 20 5a  |R.. 12.D\.[OPT Z|
0000d540  0d 44 66 15 20 4d 4f 56  20 52 36 2c 52 35 2c 4c  |.Df. MOV R6,R5,L|
0000d550  53 52 20 23 31 0d 44 70  06 20 5d 0d 44 7a 08 c9  |SR #1.Dp. ].Dz..|
0000d560  20 31 36 0d 44 84 0a 5b  4f 50 54 20 5a 0d 44 8e  | 16.D..[OPT Z.D.|
0000d570  15 20 4d 4f 56 20 52 36  2c 52 35 2c 4c 53 52 20  |. MOV R6,R5,LSR |
0000d580  23 32 0d 44 98 06 20 5d  0d 44 a2 08 c9 20 32 34  |#2.D.. ].D... 24|
0000d590  0d 44 ac 0a 5b 4f 50 54  20 5a 0d 44 b6 15 20 4d  |.D..[OPT Z.D.. M|
0000d5a0  4f 56 20 52 36 2c 52 35  2c 4c 53 52 20 23 33 0d  |OV R6,R5,LSR #3.|
0000d5b0  44 c0 06 20 5d 0d 44 ca  05 7f 0d 44 d4 0a 5b 4f  |D.. ].D....D..[O|
0000d5c0  50 54 20 5a 0d 44 de 16  20 4d 4f 56 20 52 36 2c  |PT Z.D.. MOV R6,|
0000d5d0  52 35 2c 4c 53 52 20 23  31 36 0d 44 e8 17 20 82  |R5,LSR #16.D.. .|
0000d5e0  20 52 35 2c 52 35 2c 52  36 2c 4c 53 4c 20 23 31  | R5,R5,R6,LSL #1|
0000d5f0  36 0d 44 f2 11 20 4d 55  4c 20 52 37 2c 52 38 2c  |6.D.. MUL R7,R8,|
0000d600  52 35 0d 44 fc 11 20 4d  55 4c 20 52 35 2c 52 39  |R5.D.. MUL R5,R9|
0000d610  2c 52 35 0d 45 06 12 20  4d 55 4c 20 52 31 30 2c  |,R5.E.. MUL R10,|
0000d620  52 36 2c 52 38 0d 45 10  11 20 4d 55 4c 20 52 36  |R6,R8.E.. MUL R6|
0000d630  2c 52 39 2c 52 36 0d 45  1a 14 20 41 44 44 53 20  |,R9,R6.E.. ADDS |
0000d640  52 31 30 2c 52 35 2c 52  31 30 0d 45 24 18 20 41  |R10,R5,R10.E$. A|
0000d650  44 44 43 53 20 52 36 2c  52 36 2c 23 26 31 30 30  |DDCS R6,R6,#&100|
0000d660  30 30 0d 45 2e 1b 20 41  44 44 53 20 52 37 2c 52  |00.E.. ADDS R7,R|
0000d670  37 2c 52 31 30 2c 4c 53  4c 20 23 31 36 0d 45 38  |7,R10,LSL #16.E8|
0000d680  1a 20 41 44 43 20 52 36  2c 52 36 2c 52 31 30 2c  |. ADC R6,R6,R10,|
0000d690  4c 53 52 20 23 31 36 0d  45 42 1b 20 4d 4f 56 20  |LSR #16.EB. MOV |
0000d6a0  52 36 2c 52 36 2c 4c 53  4c 20 23 28 33 32 2d 32  |R6,R6,LSL #(32-2|
0000d6b0  37 29 0d 45 4c 19 20 84  52 53 20 52 36 2c 52 36  |7).EL. .RS R6,R6|
0000d6c0  2c 52 37 2c 4c 53 52 20  23 32 37 0d 45 56 2d 20  |,R7,LSR #27.EV- |
0000d6d0  41 44 44 43 53 20 52 36  2c 52 36 2c 23 31 20 3b  |ADDCS R6,R6,#1 ;|
0000d6e0  63 61 72 72 79 20 69 73  20 73 68 69 66 74 65 64  |carry is shifted|
0000d6f0  20 6f 75 74 20 62 69 74  0d 45 60 06 20 5d 0d 45  | out bit.E`. ].E|
0000d700  6a 05 cb 0d 45 74 0a 5b  4f 50 54 20 5a 0d 45 7e  |j...Et.[OPT Z.E~|
0000d710  0e 20 43 4d 50 20 52 36  2c 23 46 0d 45 88 10 20  |. CMP R6,#F.E.. |
0000d720  4d 4f 56 43 53 20 52 36  2c 23 46 0d 45 92 13 20  |MOVCS R6,#F.E.. |
0000d730  53 54 52 20 52 36 2c 5b  52 34 5d 2c 23 34 0d 45  |STR R6,[R4],#4.E|
0000d740  9c 12 20 53 55 42 53 20  52 30 2c 52 30 2c 23 31  |.. SUBS R0,R0,#1|
0000d750  0d 45 a6 10 20 42 4e 45  20 73 68 61 72 70 6c 70  |.E.. BNE sharplp|
0000d760  0d 45 b0 10 20 4d 4f 56  53 20 50 43 2c 52 31 34  |.E.. MOVS PC,R14|
0000d770  0d 45 ba 06 20 5d 0d 45  c4 05 cd 0d 45 ce 13 e7  |.E.. ].E....E...|
0000d780  68 69 73 74 25 84 65 71  75 61 6c 25 20 8c 0d 45  |hist%.equal% ..E|
0000d790  d8 0a 5b 4f 50 54 20 5a  0d 45 e2 23 3b d6 68 69  |..[OPT Z.E.#;.hi|
0000d7a0  73 74 6f 25 2c 7a 25 28  31 2c 30 29 2c 76 61 6c  |sto%,z%(1,0),val|
0000d7b0  73 25 28 30 2c 30 29 2c  73 78 25 0d 45 ec 0b 2e  |s%(0,0),sx%.E...|
0000d7c0  68 69 73 74 6f 25 0d 45  f6 10 20 4c 44 52 20 52  |histo%.E.. LDR R|
0000d7d0  30 2c 5b 52 39 5d 0d 46  00 15 20 4c 44 52 20 52  |0,[R9].F.. LDR R|
0000d7e0  30 2c 5b 52 30 5d 20 3b  73 78 25 0d 46 0a 1c 20  |0,[R0] ;sx%.F.. |
0000d7f0  4c 44 52 20 52 31 2c 5b  52 39 2c 23 38 5d 20 3b  |LDR R1,[R9,#8] ;|
0000d800  76 61 6c 73 25 28 29 0d  46 14 14 20 4c 44 52 20  |vals%().F.. LDR |
0000d810  52 32 2c 5b 52 39 2c 23  31 36 5d 0d 46 1e 0b 2e  |R2,[R9,#16].F...|
0000d820  68 69 73 74 6c 70 0d 46  28 06 20 5d 0d 46 32 0c  |histlp.F(. ].F2.|
0000d830  e7 63 6f 6c 3d 30 20 8c  0d 46 3c 0a 5b 4f 50 54  |.col=0 ..F<.[OPT|
0000d840  20 5a 0d 46 46 13 20 4c  44 52 20 52 33 2c 5b 52  | Z.FF. LDR R3,[R|
0000d850  32 5d 2c 23 34 0d 46 50  0e 20 43 4d 50 20 52 33  |2],#4.FP. CMP R3|
0000d860  2c 23 46 0d 46 5a 10 20  4d 4f 56 43 53 20 52 33  |,#F.FZ. MOVCS R3|
0000d870  2c 23 46 0d 46 64 1a 20  4d 4f 56 20 52 33 2c 52  |,#F.Fd. MOV R3,R|
0000d880  33 2c 4c 53 52 20 23 62  69 74 73 2d 38 0d 46 6e  |3,LSR #bits-8.Fn|
0000d890  1a 20 4c 44 52 20 52 34  2c 5b 52 31 2c 52 33 2c  |. LDR R4,[R1,R3,|
0000d8a0  4c 53 4c 20 23 32 5d 0d  46 78 11 20 41 44 44 20  |LSL #2].Fx. ADD |
0000d8b0  52 34 2c 52 34 2c 23 31  0d 46 82 1a 20 53 54 52  |R4,R4,#1.F.. STR|
0000d8c0  20 52 34 2c 5b 52 31 2c  52 33 2c 4c 53 4c 20 23  | R4,[R1,R3,LSL #|
0000d8d0  32 5d 0d 46 8c 06 20 5d  0d 46 96 05 cc 0d 46 a0  |2].F.. ].F....F.|
0000d8e0  0a 5b 4f 50 54 20 5a 0d  46 aa 13 20 4c 44 52 20  |.[OPT Z.F.. LDR |
0000d8f0  52 33 2c 5b 52 32 5d 2c  23 34 0d 46 b4 0e 20 43  |R3,[R2],#4.F.. C|
0000d900  4d 50 20 52 33 2c 23 46  0d 46 be 10 20 4d 4f 56  |MP R3,#F.F.. MOV|
0000d910  43 53 20 52 33 2c 23 46  0d 46 c8 1a 20 4d 4f 56  |CS R3,#F.F.. MOV|
0000d920  20 52 33 2c 52 33 2c 4c  53 52 20 23 62 69 74 73  | R3,R3,LSR #bits|
0000d930  2d 38 0d 46 d2 18 20 41  44 44 20 52 33 2c 52 33  |-8.F.. ADD R3,R3|
0000d940  2c 52 33 2c 4c 53 4c 20  23 31 0d 46 dc 1a 20 4c  |,R3,LSL #1.F.. L|
0000d950  44 52 20 52 34 2c 5b 52  31 2c 52 33 2c 4c 53 4c  |DR R4,[R1,R3,LSL|
0000d960  20 23 32 5d 0d 46 e6 11  20 41 44 44 20 52 34 2c  | #2].F.. ADD R4,|
0000d970  52 34 2c 23 31 0d 46 f0  1a 20 53 54 52 20 52 34  |R4,#1.F.. STR R4|
0000d980  2c 5b 52 31 2c 52 33 2c  4c 53 4c 20 23 32 5d 0d  |,[R1,R3,LSL #2].|
0000d990  46 fa 13 20 4c 44 52 20  52 33 2c 5b 52 32 5d 2c  |F.. LDR R3,[R2],|
0000d9a0  23 34 0d 47 04 0e 20 43  4d 50 20 52 33 2c 23 46  |#4.G.. CMP R3,#F|
0000d9b0  0d 47 0e 10 20 4d 4f 56  43 53 20 52 33 2c 23 46  |.G.. MOVCS R3,#F|
0000d9c0  0d 47 18 1a 20 4d 4f 56  20 52 33 2c 52 33 2c 4c  |.G.. MOV R3,R3,L|
0000d9d0  53 52 20 23 62 69 74 73  2d 38 0d 47 22 18 20 41  |SR #bits-8.G". A|
0000d9e0  44 44 20 52 33 2c 52 33  2c 52 33 2c 4c 53 4c 20  |DD R3,R3,R3,LSL |
0000d9f0  23 31 0d 47 2c 11 20 41  44 44 20 52 33 2c 52 33  |#1.G,. ADD R3,R3|
0000da00  2c 23 31 0d 47 36 1a 20  4c 44 52 20 52 34 2c 5b  |,#1.G6. LDR R4,[|
0000da10  52 31 2c 52 33 2c 4c 53  4c 20 23 32 5d 0d 47 40  |R1,R3,LSL #2].G@|
0000da20  11 20 41 44 44 20 52 34  2c 52 34 2c 23 31 0d 47  |. ADD R4,R4,#1.G|
0000da30  4a 1a 20 53 54 52 20 52  34 2c 5b 52 31 2c 52 33  |J. STR R4,[R1,R3|
0000da40  2c 4c 53 4c 20 23 32 5d  0d 47 54 13 20 4c 44 52  |,LSL #2].GT. LDR|
0000da50  20 52 33 2c 5b 52 32 5d  2c 23 34 0d 47 5e 0e 20  | R3,[R2],#4.G^. |
0000da60  43 4d 50 20 52 33 2c 23  46 0d 47 68 10 20 4d 4f  |CMP R3,#F.Gh. MO|
0000da70  56 43 53 20 52 33 2c 23  46 0d 47 72 1a 20 4d 4f  |VCS R3,#F.Gr. MO|
0000da80  56 20 52 33 2c 52 33 2c  4c 53 52 20 23 62 69 74  |V R3,R3,LSR #bit|
0000da90  73 2d 38 0d 47 7c 18 20  41 44 44 20 52 33 2c 52  |s-8.G|. ADD R3,R|
0000daa0  33 2c 52 33 2c 4c 53 4c  20 23 31 0d 47 86 11 20  |3,R3,LSL #1.G.. |
0000dab0  41 44 44 20 52 33 2c 52  33 2c 23 32 0d 47 90 1a  |ADD R3,R3,#2.G..|
0000dac0  20 4c 44 52 20 52 34 2c  5b 52 31 2c 52 33 2c 4c  | LDR R4,[R1,R3,L|
0000dad0  53 4c 20 23 32 5d 0d 47  9a 11 20 41 44 44 20 52  |SL #2].G.. ADD R|
0000dae0  34 2c 52 34 2c 23 31 0d  47 a4 1a 20 53 54 52 20  |4,R4,#1.G.. STR |
0000daf0  52 34 2c 5b 52 31 2c 52  33 2c 4c 53 4c 20 23 32  |R4,[R1,R3,LSL #2|
0000db00  5d 0d 47 ae 06 20 5d 0d  47 b8 05 cd 0d 47 c2 0a  |].G.. ].G....G..|
0000db10  5b 4f 50 54 20 5a 0d 47  cc 12 20 53 55 42 53 20  |[OPT Z.G.. SUBS |
0000db20  52 30 2c 52 30 2c 23 31  0d 47 d6 0f 20 42 4e 45  |R0,R0,#1.G.. BNE|
0000db30  20 68 69 73 74 6c 70 0d  47 e0 10 20 4d 4f 56 53  | histlp.G.. MOVS|
0000db40  20 50 43 2c 52 31 34 0d  47 ea 06 20 5d 0d 47 f4  | PC,R14.G.. ].G.|
0000db50  05 cd 0d 47 fe 0d e7 65  71 75 61 6c 25 20 8c 0d  |...G...equal% ..|
0000db60  48 08 0a 5b 4f 50 54 20  5a 0d 48 12 24 3b d6 68  |H..[OPT Z.H.$;.h|
0000db70  69 73 74 65 71 75 61 6c  25 2c 7a 25 28 31 2c 30  |istequal%,z%(1,0|
0000db80  29 2c 6e 65 77 25 28 30  29 2c 73 78 25 0d 48 1c  |),new%(0),sx%.H.|
0000db90  0f 2e 68 69 73 74 65 71  75 61 6c 25 0d 48 26 10  |..histequal%.H&.|
0000dba0  20 4c 44 52 20 52 30 2c  5b 52 39 5d 0d 48 30 15  | LDR R0,[R9].H0.|
0000dbb0  20 4c 44 52 20 52 30 2c  5b 52 30 5d 20 3b 73 78  | LDR R0,[R0] ;sx|
0000dbc0  25 0d 48 3a 1b 20 4c 44  52 20 52 31 2c 5b 52 39  |%.H:. LDR R1,[R9|
0000dbd0  2c 23 38 5d 20 3b 6e 65  77 25 28 29 0d 48 44 1a  |,#8] ;new%().HD.|
0000dbe0  20 4c 44 52 20 52 32 2c  5b 52 39 2c 23 31 36 5d  | LDR R2,[R9,#16]|
0000dbf0  20 3b 7a 25 28 29 0d 48  4e 0c 2e 65 71 75 61 6c  | ;z%().HN..equal|
0000dc00  6c 70 0d 48 58 06 20 5d  0d 48 62 0c e7 63 6f 6c  |lp.HX. ].Hb..col|
0000dc10  3d 30 20 8c 0d 48 6c 0a  5b 4f 50 54 20 5a 0d 48  |=0 ..Hl.[OPT Z.H|
0000dc20  76 10 20 4c 44 52 20 52  33 2c 5b 52 32 5d 0d 48  |v. LDR R3,[R2].H|
0000dc30  80 0e 20 43 4d 50 20 52  33 2c 23 46 0d 48 8a 10  |.. CMP R3,#F.H..|
0000dc40  20 4d 4f 56 43 53 20 52  33 2c 23 46 0d 48 94 1a  | MOVCS R3,#F.H..|
0000dc50  20 4d 4f 56 20 52 33 2c  52 33 2c 4c 53 52 20 23  | MOV R3,R3,LSR #|
0000dc60  62 69 74 73 2d 38 0d 48  9e 1a 20 4c 44 52 20 52  |bits-8.H.. LDR R|
0000dc70  34 2c 5b 52 31 2c 52 33  2c 4c 53 4c 20 23 32 5d  |4,[R1,R3,LSL #2]|
0000dc80  0d 48 a8 13 20 53 54 52  20 52 34 2c 5b 52 32 5d  |.H.. STR R4,[R2]|
0000dc90  2c 23 34 0d 48 b2 06 20  5d 0d 48 bc 05 cc 0d 48  |,#4.H.. ].H....H|
0000dca0  c6 0a 5b 4f 50 54 20 5a  0d 48 d0 10 20 4c 44 52  |..[OPT Z.H.. LDR|
0000dcb0  20 52 33 2c 5b 52 32 5d  0d 48 da 0e 20 43 4d 50  | R3,[R2].H.. CMP|
0000dcc0  20 52 33 2c 23 46 0d 48  e4 10 20 4d 4f 56 43 53  | R3,#F.H.. MOVCS|
0000dcd0  20 52 33 2c 23 46 0d 48  ee 1a 20 4d 4f 56 20 52  | R3,#F.H.. MOV R|
0000dce0  33 2c 52 33 2c 4c 53 52  20 23 62 69 74 73 2d 38  |3,R3,LSR #bits-8|
0000dcf0  0d 48 f8 18 20 41 44 44  20 52 33 2c 52 33 2c 52  |.H.. ADD R3,R3,R|
0000dd00  33 2c 4c 53 4c 20 23 31  0d 49 02 1a 20 4c 44 52  |3,LSL #1.I.. LDR|
0000dd10  20 52 34 2c 5b 52 31 2c  52 33 2c 4c 53 4c 20 23  | R4,[R1,R3,LSL #|
0000dd20  32 5d 0d 49 0c 13 20 53  54 52 20 52 34 2c 5b 52  |2].I.. STR R4,[R|
0000dd30  32 5d 2c 23 34 0d 49 16  10 20 4c 44 52 20 52 33  |2],#4.I.. LDR R3|
0000dd40  2c 5b 52 32 5d 0d 49 20  0e 20 43 4d 50 20 52 33  |,[R2].I . CMP R3|
0000dd50  2c 23 46 0d 49 2a 10 20  4d 4f 56 43 53 20 52 33  |,#F.I*. MOVCS R3|
0000dd60  2c 23 46 0d 49 34 1a 20  4d 4f 56 20 52 33 2c 52  |,#F.I4. MOV R3,R|
0000dd70  33 2c 4c 53 52 20 23 62  69 74 73 2d 38 0d 49 3e  |3,LSR #bits-8.I>|
0000dd80  18 20 41 44 44 20 52 33  2c 52 33 2c 52 33 2c 4c  |. ADD R3,R3,R3,L|
0000dd90  53 4c 20 23 31 0d 49 48  11 20 41 44 44 20 52 33  |SL #1.IH. ADD R3|
0000dda0  2c 52 33 2c 23 31 0d 49  52 1a 20 4c 44 52 20 52  |,R3,#1.IR. LDR R|
0000ddb0  34 2c 5b 52 31 2c 52 33  2c 4c 53 4c 20 23 32 5d  |4,[R1,R3,LSL #2]|
0000ddc0  0d 49 5c 13 20 53 54 52  20 52 34 2c 5b 52 32 5d  |.I\. STR R4,[R2]|
0000ddd0  2c 23 34 0d 49 66 10 20  4c 44 52 20 52 33 2c 5b  |,#4.If. LDR R3,[|
0000dde0  52 32 5d 0d 49 70 0e 20  43 4d 50 20 52 33 2c 23  |R2].Ip. CMP R3,#|
0000ddf0  46 0d 49 7a 10 20 4d 4f  56 43 53 20 52 33 2c 23  |F.Iz. MOVCS R3,#|
0000de00  46 0d 49 84 1a 20 4d 4f  56 20 52 33 2c 52 33 2c  |F.I.. MOV R3,R3,|
0000de10  4c 53 52 20 23 62 69 74  73 2d 38 0d 49 8e 18 20  |LSR #bits-8.I.. |
0000de20  41 44 44 20 52 33 2c 52  33 2c 52 33 2c 4c 53 4c  |ADD R3,R3,R3,LSL|
0000de30  20 23 31 0d 49 98 11 20  41 44 44 20 52 33 2c 52  | #1.I.. ADD R3,R|
0000de40  33 2c 23 32 0d 49 a2 1a  20 4c 44 52 20 52 34 2c  |3,#2.I.. LDR R4,|
0000de50  5b 52 31 2c 52 33 2c 4c  53 4c 20 23 32 5d 0d 49  |[R1,R3,LSL #2].I|
0000de60  ac 13 20 53 54 52 20 52  34 2c 5b 52 32 5d 2c 23  |.. STR R4,[R2],#|
0000de70  34 0d 49 b6 06 20 5d 0d  49 c0 05 cd 0d 49 ca 0a  |4.I.. ].I....I..|
0000de80  5b 4f 50 54 20 5a 0d 49  d4 12 20 53 55 42 53 20  |[OPT Z.I.. SUBS |
0000de90  52 30 2c 52 30 2c 23 31  0d 49 de 10 20 42 4e 45  |R0,R0,#1.I.. BNE|
0000dea0  20 65 71 75 61 6c 6c 70  0d 49 e8 10 20 4d 4f 56  | equallp.I.. MOV|
0000deb0  53 20 50 43 2c 52 31 34  0d 49 f2 06 20 5d 0d 49  |S PC,R14.I.. ].I|
0000dec0  fc 05 cd 0d 4a 06 0a 5b  4f 50 54 20 5a 0d 4a 10  |....J..[OPT Z.J.|
0000ded0  2e 3b d6 20 72 6c 65 78  70 61 6e 64 25 2c 6c 69  |.;. rlexpand%,li|
0000dee0  6d 69 74 25 2c 64 65 63  72 25 2c 63 6f 6c 6f 75  |mit%,decr%,colou|
0000def0  72 25 2c 61 64 64 72 65  73 73 25 0d 4a 1a 45 3b  |r%,address%.J.E;|
0000df00  e7 64 65 63 72 25 3e 31  20 f5 3f 61 64 64 72 65  |.decr%>1 .?addre|
0000df10  73 73 25 2b 2b 3d 63 6f  6c 6f 75 72 25 3b 64 65  |ss%++=colour%;de|
0000df20  63 72 25 2d 2d 3b fd 64  65 63 72 25 3c 31 20 84  |cr%--;.decr%<1 .|
0000df30  20 61 64 64 72 65 73 73  25 3d 6c 69 6d 69 74 25  | address%=limit%|
0000df40  0d 4a 24 0e 2e 72 6c 65  78 70 61 6e 64 25 0d 4a  |.J$..rlexpand%.J|
0000df50  2e 21 20 4c 44 52 20 52  30 2c 5b 52 39 5d 20 3b  |.! LDR R0,[R9] ;|
0000df60  61 64 72 20 6f 66 20 61  64 64 72 65 73 73 25 0d  |adr of address%.|
0000df70  4a 38 1a 20 4c 44 52 20  52 31 2c 5b 52 30 5d 20  |J8. LDR R1,[R0] |
0000df80  3b 61 64 64 72 65 73 73  25 0d 4a 42 13 20 4c 44  |;address%.JB. LD|
0000df90  52 20 52 32 2c 5b 52 39  2c 23 38 5d 0d 4a 4c 19  |R R2,[R9,#8].JL.|
0000dfa0  20 4c 44 52 20 52 32 2c  5b 52 32 5d 20 3b 63 6f  | LDR R2,[R2] ;co|
0000dfb0  6c 6f 75 72 25 0d 4a 56  22 20 4c 44 52 20 52 33  |lour%.JV" LDR R3|
0000dfc0  2c 5b 52 39 2c 23 31 36  5d 20 3b 61 64 72 20 6f  |,[R9,#16] ;adr o|
0000dfd0  66 20 64 65 63 72 25 0d  4a 60 17 20 4c 44 52 20  |f decr%.J`. LDR |
0000dfe0  52 34 2c 5b 52 33 5d 20  3b 64 65 63 72 25 0d 4a  |R4,[R3] ;decr%.J|
0000dff0  6a 0e 20 43 4d 50 20 52  34 2c 23 31 0d 4a 74 12  |j. CMP R4,#1.Jt.|
0000e000  20 4d 4f 56 4c 54 53 20  50 43 2c 52 31 34 0d 4a  | MOVLTS PC,R14.J|
0000e010  7e 14 20 4c 44 52 20 52  35 2c 5b 52 39 2c 23 32  |~. LDR R5,[R9,#2|
0000e020  34 5d 0d 4a 88 18 20 4c  44 52 20 52 35 2c 5b 52  |4].J.. LDR R5,[R|
0000e030  35 5d 20 3b 6c 69 6d 69  74 25 0d 4a 92 18 2e 72  |5] ;limit%.J...r|
0000e040  6c 65 20 53 54 52 42 20  52 32 2c 5b 52 31 5d 2c  |le STRB R2,[R1],|
0000e050  23 31 0d 4a 9c 11 20 53  55 42 20 52 34 2c 52 34  |#1.J.. SUB R4,R4|
0000e060  2c 23 31 0d 4a a6 0e 20  43 4d 50 20 52 31 2c 52  |,#1.J.. CMP R1,R|
0000e070  35 0d 4a b0 10 20 54 45  51 4e 45 20 52 34 2c 23  |5.J.. TEQNE R4,#|
0000e080  30 0d 4a ba 0c 20 42 4e  45 20 72 6c 65 0d 4a c4  |0.J.. BNE rle.J.|
0000e090  28 2e 72 6c 65 78 69 74  20 53 54 52 20 52 31 2c  |(.rlexit STR R1,|
0000e0a0  5b 52 30 5d 20 3b 75 70  64 61 74 65 20 61 64 64  |[R0] ;update add|
0000e0b0  72 65 73 73 25 0d 4a ce  1e 20 53 54 52 20 52 34  |ress%.J.. STR R4|
0000e0c0  2c 5b 52 33 5d 20 3b 75  70 64 61 74 65 20 64 65  |,[R3] ;update de|
0000e0d0  63 72 25 0d 4a d8 10 20  4d 4f 56 53 20 50 43 2c  |cr%.J.. MOVS PC,|
0000e0e0  52 31 34 0d 4a e2 06 20  5d 0d 4a ec 0f e7 70 6c  |R14.J.. ].J...pl|
0000e0f0  61 6e 61 72 3c 30 20 8c  0d 4a f6 0a 5b 4f 50 54  |anar<0 ..J..[OPT|
0000e100  20 5a 0d 4b 00 30 2e 70  6c 61 6e 63 6e 76 25 20  | Z.K.0.plancnv% |
0000e110  3b d6 70 6c 61 6e 63 6e  76 25 2c 73 74 25 28 31  |;.plancnv%,st%(1|
0000e120  29 2c 71 75 61 6e 74 25  2c 62 75 66 66 25 2c 73  |),quant%,buff%,s|
0000e130  78 25 0d 4b 0a 21 20 4c  44 52 20 52 30 2c 5b 52  |x%.K.! LDR R0,[R|
0000e140  39 5d 3a 4c 44 52 20 52  30 2c 5b 52 30 5d 20 3b  |9]:LDR R0,[R0] ;|
0000e150  73 78 25 0d 4b 14 26 20  4c 44 52 20 52 31 2c 5b  |sx%.K.& LDR R1,[|
0000e160  52 39 2c 23 38 5d 3a 4c  44 52 20 52 31 2c 5b 52  |R9,#8]:LDR R1,[R|
0000e170  31 5d 20 3b 62 75 66 66  25 0d 4b 1e 28 20 4c 44  |1] ;buff%.K.( LD|
0000e180  52 20 52 32 2c 5b 52 39  2c 23 31 36 5d 3a 4c 44  |R R2,[R9,#16]:LD|
0000e190  52 20 52 32 2c 5b 52 32  5d 20 3b 71 75 61 6e 74  |R R2,[R2] ;quant|
0000e1a0  25 0d 4b 28 22 20 4c 44  52 20 52 33 2c 5b 52 39  |%.K(" LDR R3,[R9|
0000e1b0  2c 23 32 34 5d 20 3b 61  64 72 20 6f 66 20 73 74  |,#24] ;adr of st|
0000e1c0  25 28 29 0d 4b 32 0e 20  4d 4f 56 20 52 34 2c 23  |%().K2. MOV R4,#|
0000e1d0  37 0d 4b 3c 0e 20 4d 4f  56 20 52 35 2c 23 30 0d  |7.K<. MOV R5,#0.|
0000e1e0  4b 46 0e 20 4d 4f 56 20  52 36 2c 23 30 0d 4b 50  |KF. MOV R6,#0.KP|
0000e1f0  0c 2e 70 6c 61 6e 65 6c  70 0d 4b 5a 0e 20 4d 4f  |..planelp.KZ. MO|
0000e200  56 20 52 37 2c 23 30 0d  4b 64 11 20 53 55 42 20  |V R7,#0.Kd. SUB |
0000e210  52 38 2c 52 32 2c 23 31  0d 4b 6e 0f 2e 70 6c 61  |R8,R2,#1.Kn..pla|
0000e220  6e 65 70 69 78 6c 70 0d  4b 78 1a 20 4c 44 52 20  |nepixlp.Kx. LDR |
0000e230  52 39 2c 5b 52 33 2c 52  38 2c 4c 53 4c 20 23 32  |R9,[R3,R8,LSL #2|
0000e240  5d 0d 4b 82 14 20 4c 44  52 42 20 52 39 2c 5b 52  |].K.. LDRB R9,[R|
0000e250  39 2c 52 35 5d 0d 4b 8c  15 20 4d 4f 56 20 52 39  |9,R5].K.. MOV R9|
0000e260  2c 52 39 2c 4c 53 52 20  52 34 0d 4b 96 0f 20 80  |,R9,LSR R4.K.. .|
0000e270  20 52 39 2c 52 39 2c 23  31 0d 4b a0 17 20 84 52  | R9,R9,#1.K.. .R|
0000e280  20 52 37 2c 52 37 2c 52  39 2c 4c 53 4c 20 52 38  | R7,R7,R9,LSL R8|
0000e290  0d 4b aa 21 20 53 55 42  53 20 52 38 2c 52 38 2c  |.K.! SUBS R8,R8,|
0000e2a0  23 31 3a 42 50 4c 20 70  6c 61 6e 65 70 69 78 6c  |#1:BPL planepixl|
0000e2b0  70 0d 4b b4 14 20 53 54  52 42 20 52 37 2c 5b 52  |p.K.. STRB R7,[R|
0000e2c0  31 5d 2c 23 31 0d 4b be  2d 20 53 55 42 53 20 52  |1],#1.K.- SUBS R|
0000e2d0  34 2c 52 34 2c 23 31 3a  4d 4f 56 4d 49 20 52 34  |4,R4,#1:MOVMI R4|
0000e2e0  2c 23 37 3a 41 44 44 4d  49 20 52 35 2c 52 35 2c  |,#7:ADDMI R5,R5,|
0000e2f0  23 31 0d 4b c8 1e 20 53  55 42 53 20 52 30 2c 52  |#1.K.. SUBS R0,R|
0000e300  30 2c 23 31 3a 42 4e 45  20 70 6c 61 6e 65 6c 70  |0,#1:BNE planelp|
0000e310  0d 4b d2 10 20 4d 4f 56  53 20 50 43 2c 52 31 34  |.K.. MOVS PC,R14|
0000e320  0d 4b dc 06 20 5d 0d 4b  e6 05 cd 0d 4b f0 05 ed  |.K.. ].K....K...|
0000e330  0d 4b fa 10 68 6f 75 72  25 3d 26 34 30 36 63 34  |.K..hour%=&406c4|
0000e340  0d 4c 04 0d c8 8e 20 6e  63 6f 6c 20 ca 0d 4c 0e  |.L.... ncol ..L.|
0000e350  11 c9 20 32 35 35 3a 73  69 7a 65 25 3d 31 0d 4c  |.. 255:size%=1.L|
0000e360  18 10 c9 20 36 33 3a 73  69 7a 65 25 3d 31 0d 4c  |... 63:size%=1.L|
0000e370  22 10 c9 20 31 35 3a 73  69 7a 65 25 3d 32 0d 4c  |".. 15:size%=2.L|
0000e380  2c 0f c9 20 33 3a 73 69  7a 65 25 3d 34 0d 4c 36  |,.. 3:size%=4.L6|
0000e390  1f c9 20 31 3a 73 69 7a  65 25 3d 38 3a e7 6d 24  |.. 1:size%=8:.m$|
0000e3a0  3d 22 43 22 20 73 69 7a  65 25 3d 32 0d 4c 40 05  |="C" size%=2.L@.|
0000e3b0  cb 0d 4c 4a 32 f4 20 66  69 78 75 70 20 69 6d 61  |..LJ2. fixup ima|
0000e3c0  67 65 73 20 74 68 61 74  20 63 61 6e 27 74 20 62  |ges that can't b|
0000e3d0  65 20 72 65 61 64 20 69  6e 20 72 6f 77 20 6f 72  |e read in row or|
0000e3e0  64 65 72 0d 4c 54 0d c8  8e 20 66 6c 61 67 20 ca  |der.LT... flag .|
0000e3f0  0d 4c 5e 09 c9 20 35 30  31 0d 4c 68 24 e7 69 6e  |.L^.. 501.Lh$.in|
0000e400  66 6f 25 20 f1 22 52 65  61 64 69 6e 67 20 69 6e  |fo% ."Reading in|
0000e410  74 65 72 6c 61 63 65 64  20 47 49 46 22 0d 4c 72  |terlaced GIF".Lr|
0000e420  33 73 7a 25 3d 73 78 25  2a 73 79 25 3a 74 62 75  |3sz%=sx%*sy%:tbu|
0000e430  66 66 25 3d a4 64 69 6d  28 73 7a 25 2b 31 30 30  |ff%=.dim(sz%+100|
0000e440  29 3a 6f 74 62 75 66 66  25 3d 74 62 75 66 66 25  |):otbuff%=tbuff%|
0000e450  0d 4c 7c 47 e3 59 25 3d  30 b8 73 79 25 2d 31 88  |.L|G.Y%=0.sy%-1.|
0000e460  38 3a 58 25 3d 74 62 75  66 66 25 2b 59 25 2a 73  |8:X%=tbuff%+Y%*s|
0000e470  78 25 3a d6 20 4c 5a 57  64 65 63 6f 64 65 25 2c  |x%:. LZWdecode%,|
0000e480  74 61 62 6c 65 25 28 30  2c 30 29 2c 63 25 2c 58  |table%(0,0),c%,X|
0000e490  25 2c 73 78 25 3a ed 0d  4c 86 47 e3 59 25 3d 34  |%,sx%:..L.G.Y%=4|
0000e4a0  b8 73 79 25 2d 31 88 38  3a 58 25 3d 74 62 75 66  |.sy%-1.8:X%=tbuf|
0000e4b0  66 25 2b 59 25 2a 73 78  25 3a d6 20 4c 5a 57 64  |f%+Y%*sx%:. LZWd|
0000e4c0  65 63 6f 64 65 25 2c 74  61 62 6c 65 25 28 30 2c  |ecode%,table%(0,|
0000e4d0  30 29 2c 63 25 2c 58 25  2c 73 78 25 3a ed 0d 4c  |0),c%,X%,sx%:..L|
0000e4e0  90 47 e3 59 25 3d 32 b8  73 79 25 2d 31 88 34 3a  |.G.Y%=2.sy%-1.4:|
0000e4f0  58 25 3d 74 62 75 66 66  25 2b 59 25 2a 73 78 25  |X%=tbuff%+Y%*sx%|
0000e500  3a d6 20 4c 5a 57 64 65  63 6f 64 65 25 2c 74 61  |:. LZWdecode%,ta|
0000e510  62 6c 65 25 28 30 2c 30  29 2c 63 25 2c 58 25 2c  |ble%(0,0),c%,X%,|
0000e520  73 78 25 3a ed 0d 4c 9a  47 e3 59 25 3d 31 b8 73  |sx%:..L.G.Y%=1.s|
0000e530  79 25 2d 31 88 32 3a 58  25 3d 74 62 75 66 66 25  |y%-1.2:X%=tbuff%|
0000e540  2b 59 25 2a 73 78 25 3a  d6 20 4c 5a 57 64 65 63  |+Y%*sx%:. LZWdec|
0000e550  6f 64 65 25 2c 74 61 62  6c 65 25 28 30 2c 30 29  |ode%,table%(0,0)|
0000e560  2c 63 25 2c 58 25 2c 73  78 25 3a ed 0d 4c a4 22  |,c%,X%,sx%:..L."|
0000e570  e3 59 25 3d 30 b8 73 79  25 2d 31 3a c8 99 68 6f  |.Y%=0.sy%-1:..ho|
0000e580  75 72 25 2c 59 25 2a 31  30 30 81 73 79 25 0d 4c  |ur%,Y%*100.sy%.L|
0000e590  ae 0d 20 e7 76 72 65 70  25 20 8c 0d 4c b8 1b 20  |.. .vrep% ..L.. |
0000e5a0  20 76 72 65 70 25 2d 3d  31 3a e3 58 25 3d 31 b8  | vrep%-=1:.X%=1.|
0000e5b0  71 75 61 6e 74 25 0d 4c  c2 3f 20 20 20 46 25 3d  |quant%.L.?   F%=|
0000e5c0  73 74 25 28 58 25 29 2b  59 25 2a 72 73 78 25 3a  |st%(X%)+Y%*rsx%:|
0000e5d0  43 25 3d 46 25 2d 72 73  78 25 3a e3 45 25 3d 30  |C%=F%-rsx%:.E%=0|
0000e5e0  b8 72 73 78 25 2d 31 3a  46 25 3f 45 25 3d 43 25  |.rsx%-1:F%?E%=C%|
0000e5f0  3f 45 25 3a ed 0d 4c cc  07 20 20 ed 0d 4c d6 06  |?E%:..L..  ..L..|
0000e600  20 cc 0d 4c e0 12 20 20  e3 58 25 3d 31 b8 71 75  | ..L..  .X%=1.qu|
0000e610  61 6e 74 25 0d 4c ea 36  20 20 20 46 25 3d 73 74  |ant%.L.6   F%=st|
0000e620  25 28 58 25 29 2b 59 25  2a 72 73 78 25 3a 47 25  |%(X%)+Y%*rsx%:G%|
0000e630  3d 46 25 2b 72 73 78 25  3a f5 20 43 25 3d 9a 23  |=F%+rsx%:. C%=.#|
0000e640  63 25 3a e7 43 25 3d 30  20 8c 0d 4c f4 17 20 20  |c%:.C%=0 ..L..  |
0000e650  20 20 43 25 3d 9a 23 63  25 3a e7 43 25 3d 30 20  |  C%=.#c%:.C%=0 |
0000e660  8c 0d 4c fe 1d 20 20 20  20 20 43 25 3d 9a 23 63  |..L..     C%=.#c|
0000e670  25 3a 76 72 65 70 25 3d  9a 23 63 25 2d 31 0d 4d  |%:vrep%=.#c%-1.M|
0000e680  08 09 20 20 20 20 cc 0d  4d 12 37 20 20 20 20 20  |..    ..M.7     |
0000e690  44 25 3d 46 25 3a e3 45  25 3d 30 b8 70 61 74 6c  |D%=F%:.E%=0.patl|
0000e6a0  65 6e 25 2d 31 3a 46 25  3f 45 25 3d 9a 23 63 25  |en%-1:F%?E%=.#c%|
0000e6b0  3a ed 3a 46 25 2b 3d 70  61 74 6c 65 6e 25 0d 4d  |:.:F%+=patlen%.M|
0000e6c0  1c 43 20 20 20 20 20 e7  43 25 3e 31 20 e3 49 25  |.C     .C%>1 .I%|
0000e6d0  3d 32 b8 43 25 3a e3 45  25 3d 30 b8 70 61 74 6c  |=2.C%:.E%=0.patl|
0000e6e0  65 6e 25 2d 31 3a 46 25  3f 45 25 3d 44 25 3f 45  |en%-1:F%?E%=D%?E|
0000e6f0  25 3a ed 3a 46 25 2b 3d  70 61 74 6c 65 6e 25 3a  |%:.:F%+=patlen%:|
0000e700  ed 0d 4d 26 09 20 20 20  20 cd 0d 4d 30 08 20 20  |..M&.    ..M0.  |
0000e710  20 cc 0d 4d 3a 11 20 20  20 20 e7 43 25 3d 31 32  | ..M:.    .C%=12|
0000e720  38 20 8c 0d 4d 44 2f 20  20 20 20 20 43 25 3d 9a  |8 ..MD/     C%=.|
0000e730  23 63 25 3a e3 45 25 3d  30 b8 43 25 2d 31 3a 46  |#c%:.E%=0.C%-1:F|
0000e740  25 3f 45 25 3d 9a 23 63  25 3a ed 3a 46 25 2b 3d  |%?E%=.#c%:.:F%+=|
0000e750  43 25 0d 4d 4e 09 20 20  20 20 cc 0d 4d 58 3c 20  |C%.MN.    ..MX< |
0000e760  20 20 20 20 3f 46 25 3d  28 43 25 80 26 38 30 29  |    ?F%=(C%.&80)|
0000e770  3c 3e 30 3a e3 45 25 3d  31 b8 43 25 80 26 37 46  |<>0:.E%=1.C%.&7F|
0000e780  3a 46 25 3f 45 25 3d 3f  46 25 3a ed 3a 46 25 2b  |:F%?E%=?F%:.:F%+|
0000e790  3d 43 25 80 26 37 46 0d  4d 62 09 20 20 20 20 cd  |=C%.&7F.Mb.    .|
0000e7a0  0d 4d 6c 08 20 20 20 cd  0d 4d 76 0e 20 20 20 fd  |.Ml.   ..Mv.   .|
0000e7b0  46 25 3e 3d 47 25 0d 4d  80 07 20 20 ed 0d 4d 8a  |F%>=G%.M..  ..M.|
0000e7c0  06 20 cd 0d 4d 94 05 ed  0d 4d 9e 05 cb 0d 4d a8  |. ..M....M....M.|
0000e7d0  40 f4 20 69 66 20 69 6d  61 67 65 20 70 72 6f 63  |@. if image proc|
0000e7e0  65 73 73 69 6e 67 20 74  68 65 20 69 6e 70 75 74  |essing the input|
0000e7f0  20 73 74 72 65 61 6d 20  74 6f 20 6d 61 78 69 6d  | stream to maxim|
0000e800  69 73 65 20 6c 75 6d 69  6e 61 6e 63 65 0d 4d b2  |ise luminance.M.|
0000e810  0d e7 72 61 6e 67 65 25  20 8c 0d 4d bc 3f 20 e7  |..range% ..M.? .|
0000e820  69 6e 66 6f 25 20 f1 22  53 63 61 6e 6e 69 6e 67  |info% ."Scanning|
0000e830  20 64 61 74 61 20 74 6f  20 63 6f 6d 70 75 74 65  | data to compute|
0000e840  20 70 61 72 61 6d 65 74  65 72 73 20 66 6f 72 20  | parameters for |
0000e850  27 2d 72 61 6e 67 65 27  22 0d 4d c6 0e 20 e7 6f  |'-range'".M.. .o|
0000e860  72 64 65 72 25 20 8c 0d  4d d0 1f 20 20 59 25 3d  |rder% ..M..  Y%=|
0000e870  30 3a f5 20 c8 99 68 6f  75 72 25 2c 59 25 2a 31  |0:. ..hour%,Y%*1|
0000e880  30 30 81 73 79 25 0d 4d  da 38 20 20 20 f2 69 70  |00.sy%.M.8   .ip|
0000e890  72 6f 77 28 78 70 25 28  29 29 3a d6 6d 61 78 6d  |row(xp%()):.maxm|
0000e8a0  69 6e 25 2c 78 70 25 28  31 2c 30 29 2c 74 6f 74  |in%,xp%(1,0),tot|
0000e8b0  61 6c 76 61 6c 73 32 25  3a 59 25 2b 3d 31 0d 4d  |alvals2%:Y%+=1.M|
0000e8c0  e4 26 20 20 fd 59 25 3d  73 79 25 20 84 20 21 6d  |.&  .Y%=sy% . !m|
0000e8d0  69 6e 3c 32 35 35 20 80  20 21 6d 61 78 2b 32 35  |in<255 . !max+25|
0000e8e0  35 3e 3d 46 0d 4d ee 06  20 cc 0d 4d f8 27 20 20  |5>=F.M.. ..M.'  |
0000e8f0  59 25 3d 30 3a 79 73 61  6d 70 25 3d 31 3a f5 20  |Y%=0:ysamp%=1:. |
0000e900  c8 99 68 6f 75 72 25 2c  59 25 2a 31 30 30 81 79  |..hour%,Y%*100.y|
0000e910  25 0d 4e 02 40 20 20 20  f2 73 63 61 6c 65 64 70  |%.N.@   .scaledp|
0000e920  69 78 65 6c 72 6f 77 28  63 6c 25 28 29 29 3a d6  |ixelrow(cl%()):.|
0000e930  6d 61 78 6d 69 6e 25 2c  63 6c 25 28 31 2c 30 29  |maxmin%,cl%(1,0)|
0000e940  2c 74 6f 74 61 6c 76 61  6c 73 25 3a 59 25 2b 3d  |,totalvals%:Y%+=|
0000e950  31 0d 4e 0c 25 20 20 fd  59 25 3d 79 25 20 84 20  |1.N.%  .Y%=y% . |
0000e960  21 6d 69 6e 3c 32 35 35  20 80 20 21 6d 61 78 2b  |!min<255 . !max+|
0000e970  32 35 35 3e 3d 46 0d 4e  16 06 20 cd 0d 4e 20 27  |255>=F.N.. ..N '|
0000e980  20 21 66 69 74 6d 75 6c  6c 6f 63 3d 46 2f 28 21  | !fitmulloc=F/(!|
0000e990  6d 61 78 2d 21 6d 69 6e  29 2a 46 3a f2 72 65 77  |max-!min)*F:.rew|
0000e9a0  69 6e 64 0d 4e 2a 50 20  e7 21 6d 61 78 2b 32 35  |ind.N*P .!max+25|
0000e9b0  35 3e 3d 46 20 80 21 6d  69 6e 3c 32 35 35 20 72  |5>=F .!min<255 r|
0000e9c0  61 6e 67 65 25 3d a3 3a  72 61 6e 67 65 24 3d 22  |ange%=.:range$="|
0000e9d0  4e 6f 20 70 6f 69 6e 74  20 69 6e 20 27 2d 72 61  |No point in '-ra|
0000e9e0  6e 67 65 27 20 6f 6e 20  74 68 69 73 20 69 6d 61  |nge' on this ima|
0000e9f0  67 65 22 0d 4e 34 57 20  e7 72 61 6e 67 65 25 20  |ge".N4W .range% |
0000ea00  72 61 6e 67 65 24 3d 22  49 6e 70 75 74 20 69 6d  |range$="Input im|
0000ea10  61 67 65 20 6d 61 78 69  6d 75 6d 20 22 2b c3 28  |age maximum "+.(|
0000ea20  21 6d 61 78 2f 46 2a 31  30 30 29 2b 22 25 20 6d  |!max/F*100)+"% m|
0000ea30  69 6e 69 6d 75 6d 20 22  2b c3 28 21 6d 69 6e 2f  |inimum "+.(!min/|
0000ea40  46 2a 31 30 30 29 2b 22  25 22 0d 4e 3e 13 20 e7  |F*100)+"%".N>. .|
0000ea50  69 6e 66 6f 25 20 f1 72  61 6e 67 65 24 0d 4e 48  |info% .range$.NH|
0000ea60  05 cd 0d 4e 52 13 e7 68  69 73 74 25 84 65 71 75  |...NR..hist%.equ|
0000ea70  61 6c 25 20 8c 0d 4e 5c  47 20 e7 65 71 75 61 6c  |al% ..N\G .equal|
0000ea80  25 20 e7 69 6e 66 6f 25  20 f1 22 53 63 61 6e 6e  |% .info% ."Scann|
0000ea90  69 6e 67 20 64 61 74 61  20 74 6f 20 63 6f 6d 70  |ing data to comp|
0000eaa0  75 74 65 20 70 61 72 61  6d 65 74 65 72 73 20 66  |ute parameters f|
0000eab0  6f 72 20 27 2d 65 71 75  61 6c 27 22 0d 4e 66 0e  |or '-equal'".Nf.|
0000eac0  20 e7 6f 72 64 65 72 25  20 8c 0d 4e 70 26 20 20  | .order% ..Np&  |
0000ead0  e3 79 72 25 3d 30 b8 73  79 25 2d 31 3a c8 99 68  |.yr%=0.sy%-1:..h|
0000eae0  6f 75 72 25 2c 79 72 25  2a 31 30 30 81 73 79 25  |our%,yr%*100.sy%|
0000eaf0  0d 4e 7a 34 20 20 20 f2  69 70 72 6f 77 28 78 70  |.Nz4   .iprow(xp|
0000eb00  25 28 29 29 3a d6 68 69  73 74 6f 25 2c 78 70 25  |%()):.histo%,xp%|
0000eb10  28 31 2c 30 29 2c 76 61  6c 73 25 28 30 2c 30 29  |(1,0),vals%(0,0)|
0000eb20  2c 73 78 25 0d 4e 84 07  20 20 ed 0d 4e 8e 06 20  |,sx%.N..  ..N.. |
0000eb30  cc 0d 4e 98 2f 20 20 79  73 61 6d 70 25 3d 31 3a  |..N./  ysamp%=1:|
0000eb40  e3 79 72 25 3d 30 20 b8  20 79 25 2d 31 3a c8 99  |.yr%=0 . y%-1:..|
0000eb50  68 6f 75 72 25 2c 79 72  25 2a 31 30 30 81 79 25  |hour%,yr%*100.y%|
0000eb60  0d 4e a2 3c 20 20 20 f2  73 63 61 6c 65 64 70 69  |.N.<   .scaledpi|
0000eb70  78 65 6c 72 6f 77 28 63  6c 25 28 29 29 3a d6 68  |xelrow(cl%()):.h|
0000eb80  69 73 74 6f 25 2c 63 6c  25 28 31 2c 30 29 2c 76  |isto%,cl%(1,0),v|
0000eb90  61 6c 73 25 28 30 2c 30  29 2c 78 25 0d 4e ac 07  |als%(0,0),x%.N..|
0000eba0  20 20 ed 0d 4e b6 06 20  cd 0d 4e c0 2f 20 e7 69  |  ..N.. ..N./ .i|
0000ebb0  6e 66 6f 25 20 f1 22 44  6f 6e 65 2e 20 4e 6f 77  |nfo% ."Done. Now|
0000ebc0  20 70 72 6f 63 65 73 73  69 6e 67 20 74 68 65 20  | processing the |
0000ebd0  70 69 63 74 75 72 65 22  0d 4e ca 05 cd 0d 4e d4  |picture".N....N.|
0000ebe0  0c e7 68 69 73 74 25 20  8c 0d 4e de 1a 20 4d 25  |..hist% ..N.. M%|
0000ebf0  3d 30 3a 5a 4d 25 3d 2d  31 3a e3 43 25 3d 30 b8  |=0:ZM%=-1:.C%=0.|
0000ec00  63 6f 6c 0d 4e e8 37 20  20 e3 5a 25 3d 30 b8 32  |col.N.7  .Z%=0.2|
0000ec10  35 36 3a e7 76 61 6c 73  25 28 5a 25 2c 43 25 29  |56:.vals%(Z%,C%)|
0000ec20  3e 4d 25 20 4d 25 3d 76  61 6c 73 25 28 5a 25 2c  |>M% M%=vals%(Z%,|
0000ec30  43 25 29 3a 5a 4d 25 3d  5a 25 0d 4e f2 08 20 ed  |C%):ZM%=Z%.N.. .|
0000ec40  3a ed 0d 4e fc 1e 20 e7  5a 4d 25 3d 2d 31 20 84  |:..N.. .ZM%=-1 .|
0000ec50  20 6f 75 74 70 75 74 25  3d 30 20 8c 3d 31 30 30  | output%=0 .=100|
0000ec60  0d 4f 06 3c 20 e7 20 63  6f 6c 3e 30 20 eb 36 36  |.O.< . col>0 .66|
0000ec70  3a 68 74 3d 35 30 30 3a  86 30 2c 36 2c 32 30 30  |:ht=500:.0,6,200|
0000ec80  30 2c 36 20 8b 20 eb 31  38 3a 68 74 3d 34 30 30  |0,6 . .18:ht=400|
0000ec90  3a 86 30 2c 36 2c 31 30  32 34 2c 36 0d 4f 10 24  |:.0,6,1024,6.O.$|
0000eca0  20 4d 3d 4d 25 2f 28 68  74 2a 32 2d 38 29 3a e3  | M=M%/(ht*2-8):.|
0000ecb0  43 25 3d 30 b8 63 6f 6c  3a c8 8e 20 43 25 20 ca  |C%=0.col:.. C% .|
0000ecc0  0d 4f 1a 0c 20 20 c9 20  30 3a e6 31 0d 4f 24 0c  |.O..  . 0:.1.O$.|
0000ecd0  20 20 c9 20 31 3a e6 32  0d 4f 2e 0c 20 20 c9 20  |  . 1:.2.O..  . |
0000ece0  32 3a e6 34 0d 4f 38 07  20 20 cb 0d 4f 42 0f 20  |2:.4.O8.  ..OB. |
0000ecf0  20 e7 20 63 6f 6c 3e 30  20 8c 0d 4f 4c 46 20 20  | . col>0 ..OLF  |
0000ed00  20 e3 5a 25 3d 30 b8 32  35 36 3a e7 76 61 6c 73  | .Z%=0.256:.vals|
0000ed10  25 28 5a 25 2c 43 25 29  20 58 25 3d 5a 25 2a 33  |%(Z%,C%) X%=Z%*3|
0000ed20  2b 43 25 3c 3c 31 3a 86  58 25 2c 38 2c 58 25 2c  |+C%<<1:.X%,8,X%,|
0000ed30  76 61 6c 73 25 28 5a 25  2c 43 25 29 2f 4d 2b 38  |vals%(Z%,C%)/M+8|
0000ed40  0d 4f 56 08 20 20 20 ed  0d 4f 60 07 20 20 cc 0d  |.OV.   ..O`.  ..|
0000ed50  4f 6a 42 20 20 20 e3 5a  25 3d 30 b8 32 35 36 3a  |OjB   .Z%=0.256:|
0000ed60  e7 76 61 6c 73 25 28 5a  25 2c 43 25 29 20 58 25  |.vals%(Z%,C%) X%|
0000ed70  3d 5a 25 3c 3c 32 3a c8  93 20 c8 90 58 25 2c 38  |=Z%<<2:.. ..X%,8|
0000ed80  2c 32 2c 76 61 6c 73 25  28 5a 25 2c 43 25 29 2f  |,2,vals%(Z%,C%)/|
0000ed90  4d 0d 4f 74 08 20 20 20  ed 0d 4f 7e 07 20 20 cd  |M.Ot.   ..O~.  .|
0000eda0  0d 4f 88 06 20 ed 0d 4f  92 12 20 e7 63 25 20 d9  |.O.. ..O.. .c% .|
0000edb0  23 63 25 3a 63 25 3d 30  0d 4f 9c 15 20 e7 63 63  |#c%:c%=0.O.. .cc|
0000edc0  25 20 d9 23 63 63 25 3a  63 63 25 3d 30 0d 4f a6  |% .#cc%:cc%=0.O.|
0000edd0  18 20 e7 63 63 63 25 20  d9 23 63 63 63 25 3a 63  |. .ccc% .#ccc%:c|
0000ede0  63 63 25 3d 30 0d 4f b0  16 20 c8 99 22 48 6f 75  |cc%=0.O.. .."Hou|
0000edf0  72 67 6c 61 73 73 5f 4f  66 66 22 0d 4f ba 09 20  |rglass_Off".O.. |
0000ee00  3d 31 30 30 0d 4f c4 05  cd 0d 4f ce 2c 6f 6e 61  |=100.O....O.,ona|
0000ee10  6d 65 24 3d 22 70 69 63  22 2b c3 6d 2b 22 5f 22  |me$="pic"+.m+"_"|
0000ee20  3a e7 72 61 6e 67 65 25  20 6f 6e 61 6d 65 24 2b  |:.range% oname$+|
0000ee30  3d 22 72 5f 22 0d 4f d8  18 e7 65 71 75 61 6c 25  |="r_".O...equal%|
0000ee40  20 6f 6e 61 6d 65 24 2b  3d 22 65 5f 22 0d 4f e2  | oname$+="e_".O.|
0000ee50  27 e7 73 68 61 72 70 65  6e 25 20 6f 6e 61 6d 65  |'.sharpen% oname|
0000ee60  24 2b 3d 22 73 22 2b c3  73 68 61 72 70 65 6e 25  |$+="s"+.sharpen%|
0000ee70  2b 22 5f 22 0d 4f ec 13  6f 6e 61 6d 65 24 3d c0  |+"_".O..oname$=.|
0000ee80  6f 6e 61 6d 65 24 29 0d  4f f6 0a c8 8e 20 6d 20  |oname$).O.... m |
0000ee90  ca 0d 50 00 22 c9 20 2d  31 3a 78 77 6f 72 64 73  |..P.". -1:xwords|
0000eea0  25 3d 78 25 3a 73 7a 25  3d 78 77 6f 72 64 73 25  |%=x%:sz%=xwords%|
0000eeb0  2a 79 25 0d 50 0a 37 20  e7 73 70 72 69 74 65 61  |*y%.P.7 .spritea|
0000eec0  72 65 61 25 3c 30 20 8c  20 72 61 6d 25 3d a4 64  |rea%<0 . ram%=.d|
0000eed0  69 6d 28 73 7a 25 29 20  8b 20 72 61 6d 25 3d 73  |im(sz%) . ram%=s|
0000eee0  70 72 69 74 65 61 72 65  61 25 0d 50 14 0f 20 62  |pritearea%.P.. b|
0000eef0  61 73 65 25 3d 72 61 6d  25 0d 50 1e 2f 7f 3a 78  |ase%=ram%.P./.:x|
0000ef00  77 6f 72 64 73 25 3d 78  25 2f 73 69 7a 65 25 2b  |words%=x%/size%+|
0000ef10  33 2e 39 39 39 39 80 ac  33 3a 73 7a 25 3d 78 77  |3.9999..3:sz%=xw|
0000ef20  6f 72 64 73 25 2a 79 25  0d 50 28 4c 20 e7 6e 63  |ords%*y%.P(L .nc|
0000ef30  6f 6c 3d 31 20 e7 6d 24  3d 22 43 22 20 21 71 75  |ol=1 .m$="C" !qu|
0000ef40  61 72 74 65 72 72 6f 77  69 6e 63 3d 78 77 6f 72  |arterrowinc=xwor|
0000ef50  64 73 25 3a 78 77 6f 72  64 73 25 3d 78 77 6f 72  |ds%:xwords%=xwor|
0000ef60  64 73 25 2a 34 3a 73 7a  25 3d 78 77 6f 72 64 73  |ds%*4:sz%=xwords|
0000ef70  25 2a 79 25 0d 50 32 3c  20 e7 73 70 72 69 74 65  |%*y%.P2< .sprite|
0000ef80  61 72 65 61 25 3c 30 20  8c 20 72 61 6d 25 3d a4  |area%<0 . ram%=.|
0000ef90  64 69 6d 28 73 7a 25 2b  31 30 32 34 29 20 8b 20  |dim(sz%+1024) . |
0000efa0  72 61 6d 25 3d 73 70 72  69 74 65 61 72 65 61 25  |ram%=spritearea%|
0000efb0  0d 50 3c 41 20 21 72 61  6d 25 3d 73 7a 25 2b 31  |.P<A !ram%=sz%+1|
0000efc0  30 32 34 3a 72 61 6d 25  21 34 3d 30 3a 72 61 6d  |024:ram%!4=0:ram|
0000efd0  25 21 38 3d 31 36 3a 72  61 6d 25 21 31 32 3d 31  |%!8=16:ram%!12=1|
0000efe0  36 3a c8 99 26 32 65 2c  26 31 30 39 2c 72 61 6d  |6:..&2e,&109,ram|
0000eff0  25 0d 50 46 66 20 e7 6e  63 6f 6c 3d 31 20 80 6d  |%.PFf .ncol=1 .m|
0000f000  24 3d 22 43 22 20 c8 99  26 32 65 2c 26 31 30 66  |$="C" ..&2e,&10f|
0000f010  2c 72 61 6d 25 2c 6f 6e  61 6d 65 24 2c 31 2c 78  |,ram%,oname$,1,x|
0000f020  25 2a 34 2c 79 25 2a 34  2c 6d 20 8b 20 c8 99 26  |%*4,y%*4,m . ..&|
0000f030  32 65 2c 26 31 30 66 2c  72 61 6d 25 2c 6f 6e 61  |2e,&10f,ram%,ona|
0000f040  6d 65 24 2c 28 6e 63 6f  6c 3c 36 33 29 80 31 2c  |me$,(ncol<63).1,|
0000f050  78 25 2c 79 25 2c 6d 0d  50 50 2a 20 62 61 73 65  |x%,y%,m.PP* base|
0000f060  25 3d 72 61 6d 25 2b 72  61 6d 25 21 26 33 30 2b  |%=ram%+ram%!&30+|
0000f070  26 31 30 3a 70 61 6c 25  3d 72 61 6d 25 2b 26 33  |&10:pal%=ram%+&3|
0000f080  63 0d 50 5a 0e 20 c8 8e  20 6e 63 6f 6c 20 ca 0d  |c.PZ. .. ncol ..|
0000f090  50 64 0a 20 c9 20 31 35  3a 0d 50 6e 0c 20 c8 8e  |Pd. . 15:.Pn. ..|
0000f0a0  20 6d 24 20 ca 0d 50 78  0b 20 20 c9 20 22 44 22  | m$ ..Px.  . "D"|
0000f0b0  0d 50 82 21 20 20 20 e3  5a 25 3d 30 b8 37 3a 59  |.P.!   .Z%=0.7:Y|
0000f0c0  25 3d 30 3a e7 5a 25 80  31 20 59 25 2b 3d 26 46  |%=0:.Z%.1 Y%+=&F|
0000f0d0  30 0d 50 8c 16 20 20 20  e7 5a 25 80 32 20 59 25  |0.P..   .Z%.2 Y%|
0000f0e0  2b 3d 26 46 30 30 30 0d  50 96 18 20 20 20 e7 5a  |+=&F000.P..   .Z|
0000f0f0  25 80 34 20 59 25 2b 3d  26 46 30 30 30 30 30 0d  |%.4 Y%+=&F00000.|
0000f100  50 a0 14 20 20 20 f2 63  6f 6c 28 5a 25 2c 59 25  |P..   .col(Z%,Y%|
0000f110  29 3a ed 0d 50 aa 0b 20  20 c9 20 22 43 22 0d 50  |):..P..  . "C".P|
0000f120  b4 22 20 20 20 e3 5a 25  3d 30 b8 31 35 3a 59 25  |."   .Z%=0.15:Y%|
0000f130  3d 30 3a e7 5a 25 80 34  20 59 25 2b 3d 26 46 30  |=0:.Z%.4 Y%+=&F0|
0000f140  0d 50 be 47 20 20 20 e7  5a 25 80 33 20 59 25 2b  |.P.G   .Z%.3 Y%+|
0000f150  3d 28 5a 25 80 33 29 2a  35 3c 3c 31 32 3a e7 28  |=(Z%.3)*5<<12:.(|
0000f160  5a 25 80 33 29 3d 31 20  59 25 2b 3d 26 31 30 30  |Z%.3)=1 Y%+=&100|
0000f170  30 3a f4 20 47 61 6d 6d  61 20 63 6f 72 72 65 63  |0:. Gamma correc|
0000f180  74 20 67 20 6c 6f 77 0d  50 c8 18 20 20 20 e7 5a  |t g low.P..   .Z|
0000f190  25 80 38 20 59 25 2b 3d  26 46 30 30 30 30 30 0d  |%.8 Y%+=&F00000.|
0000f1a0  50 d2 14 20 20 20 f2 63  6f 6c 28 5a 25 2c 59 25  |P..   .col(Z%,Y%|
0000f1b0  29 3a ed 0d 50 dc 0b 20  20 c9 20 22 54 22 0d 50  |):..P..  . "T".P|
0000f1c0  e6 33 20 20 20 e3 5a 25  3d 30 b8 31 35 3a 59 25  |.3   .Z%=0.15:Y%|
0000f1d0  3d 5a 25 3c 3c 34 3a f2  63 6f 6c 28 5a 25 2c 59  |=Z%<<4:.col(Z%,Y|
0000f1e0  25 84 59 25 3c 3c 38 84  59 25 3c 3c 31 36 29 3a  |%.Y%<<8.Y%<<16):|
0000f1f0  ed 0d 50 f0 0a 20 20 c9  20 22 22 0d 50 fa 3f 20  |..P..  . "".P.? |
0000f200  20 20 e3 5a 25 3d 30 b8  31 35 3a 59 25 3d 28 5a  |  .Z%=0.15:Y%=(Z|
0000f210  25 80 37 29 2f 37 2a 31  35 2b 2e 32 3c 3c 34 3a  |%.7)/7*15+.2<<4:|
0000f220  f2 63 6f 6c 28 5a 25 2c  59 25 84 59 25 3c 3c 38  |.col(Z%,Y%.Y%<<8|
0000f230  84 59 25 3c 3c 31 36 29  3a ed 0d 51 04 07 20 20  |.Y%<<16):..Q..  |
0000f240  cb 0d 51 0e 08 20 c9 20  33 0d 51 18 0f 20 20 e7  |..Q.. . 3.Q..  .|
0000f250  6d 24 3d 22 43 22 20 8c  0d 51 22 3e 20 20 20 f2  |m$="C" ..Q">   .|
0000f260  63 6f 6c 28 30 2c 30 29  3a f2 63 6f 6c 28 31 2c  |col(0,0):.col(1,|
0000f270  26 46 30 46 30 30 30 29  3a f2 63 6f 6c 28 32 2c  |&F0F000):.col(2,|
0000f280  26 46 30 30 30 46 30 29  3a f2 63 6f 6c 28 33 2c  |&F000F0):.col(3,|
0000f290  26 46 30 46 30 29 0d 51  2c 07 20 20 cc 0d 51 36  |&F0F0).Q,.  ..Q6|
0000f2a0  34 20 20 20 e3 5a 25 3d  30 b8 33 3a 59 25 3d 5a  |4   .Z%=0.3:Y%=Z|
0000f2b0  25 2a 35 3c 3c 34 3a f2  63 6f 6c 28 5a 25 2c 59  |%*5<<4:.col(Z%,Y|
0000f2c0  25 84 59 25 3c 3c 38 84  59 25 3c 3c 31 36 29 3a  |%.Y%<<8.Y%<<16):|
0000f2d0  ed 0d 51 40 07 20 20 cd  0d 51 4a 22 20 c9 20 31  |..Q@.  ..QJ" . 1|
0000f2e0  3a f2 63 6f 6c 28 30 2c  30 29 3a f2 63 6f 6c 28  |:.col(0,0):.col(|
0000f2f0  31 2c 26 46 30 46 30 46  30 29 0d 51 54 06 20 cb  |1,&F0F0F0).QT. .|
0000f300  0d 51 5e 05 cb 0d 51 68  07 ea 20 85 0d 51 72 3e  |.Q^...Qh.. ..Qr>|
0000f310  ee 20 85 20 ea 3a f7 20  85 3a f2 53 61 76 65 3a  |. . .:. .:.Save:|
0000f320  85 20 9f 2c f6 24 2b 22  20 69 6e 74 65 72 6e 61  |. .,.$+" interna|
0000f330  6c 20 28 22 2b c3 9e 2b  22 29 22 3a f4 20 45 72  |l ("+..+")":. Er|
0000f340  72 6f 72 20 52 65 74 75  72 6e 0d 51 7c 41 c8 99  |ror Return.Q|A..|
0000f350  22 48 6f 75 72 67 6c 61  73 73 5f 4c 45 44 73 22  |"Hourglass_LEDs"|
0000f360  2c 33 3a 79 73 61 6d 70  25 3d 31 3a 6e 6c 25 28  |,3:ysamp%=1:nl%(|
0000f370  29 3d 30 3a 73 74 65 70  25 3d 31 32 3a e7 63 6f  |)=0:step%=12:.co|
0000f380  6c 3d 30 20 73 74 65 70  25 3d 34 0d 51 86 39 e7  |l=0 step%=4.Q.9.|
0000f390  73 79 25 3d 79 25 20 80  20 73 78 25 3d 78 25 20  |sy%=y% . sx%=x% |
0000f3a0  80 20 72 61 6e 67 65 25  3d a3 20 80 20 73 68 61  |. range%=. . sha|
0000f3b0  72 70 65 6e 25 3d a3 20  80 20 65 71 75 61 6c 25  |rpen%=. . equal%|
0000f3c0  3d a3 20 8c 0d 51 90 11  e3 79 72 25 3d 30 20 b8  |=. ..Q...yr%=0 .|
0000f3d0  20 79 25 2d 31 0d 51 9a  25 20 c8 99 68 6f 75 72  | y%-1.Q.% ..hour|
0000f3e0  25 2c 79 72 25 2a 31 30  30 81 79 25 3a f2 69 70  |%,yr%*100.y%:.ip|
0000f3f0  72 6f 77 28 63 6c 25 28  29 29 0d 51 a4 41 20 63  |row(cl%()).Q.A c|
0000f400  6c 25 28 29 3d 63 6c 25  28 29 2b 6e 6c 25 28 29  |l%()=cl%()+nl%()|
0000f410  3a 6e 6c 25 28 29 3d 30  3a 42 25 3d 78 25 3a 41  |:nl%()=0:B%=x%:A|
0000f420  25 3d 28 62 61 73 65 25  2b 79 72 25 2a 78 77 6f  |%=(base%+yr%*xwo|
0000f430  72 64 73 25 29 2a 73 69  7a 65 25 0d 51 ae 0d 20  |rds%)*size%.Q.. |
0000f440  e7 79 72 25 80 31 20 8c  0d 51 b8 2e 20 20 49 25  |.yr%.1 ..Q..  I%|
0000f450  3d 73 74 65 70 25 3a d6  66 73 25 2c 63 6c 25 28  |=step%:.fs%,cl%(|
0000f460  31 2c 30 29 2c 6e 6c 25  28 31 2c 30 29 2c 41 25  |1,0),nl%(1,0),A%|
0000f470  2c 49 25 2c 42 25 0d 51  c2 06 20 cc 0d 51 cc 3a  |,I%,B%.Q.. ..Q.:|
0000f480  20 20 49 25 3d 2d 73 74  65 70 25 3a 41 25 2b 3d  |  I%=-step%:A%+=|
0000f490  78 25 2d 31 3a d6 66 73  25 2c 63 6c 25 28 78 25  |x%-1:.fs%,cl%(x%|
0000f4a0  2c 30 29 2c 6e 6c 25 28  78 25 2c 30 29 2c 41 25  |,0),nl%(x%,0),A%|
0000f4b0  2c 49 25 2c 42 25 0d 51  d6 06 20 cd 0d 51 e0 05  |,I%,B%.Q.. ..Q..|
0000f4c0  ed 0d 51 ea 05 cc 0d 51  f4 0d e7 65 71 75 61 6c  |..Q....Q...equal|
0000f4d0  25 20 8c 0d 51 fe 43 20  f2 72 65 77 69 6e 64 3a  |% ..Q.C .rewind:|
0000f4e0  72 61 6e 67 65 25 3d b9  3a 48 61 76 67 25 3d c6  |range%=.:Havg%=.|
0000f4f0  8e 28 76 61 6c 73 25 28  29 29 2f 32 35 36 2f 28  |.(vals%())/256/(|
0000f500  63 6f 6c 2b 31 29 3a de  20 6e 65 77 25 28 32 35  |col+1):. new%(25|
0000f510  36 2c 63 6f 6c 29 0d 52  08 3f 20 e3 42 25 3d 30  |6,col).R.? .B%=0|
0000f520  b8 63 6f 6c 3a 52 25 3d  30 3a 48 69 6e 74 25 3d  |.col:R%=0:Hint%=|
0000f530  30 3a e3 5a 25 3d 30 b8  32 35 36 3a 4c 25 3d 52  |0:.Z%=0.256:L%=R|
0000f540  25 3a 48 69 6e 74 25 2b  3d 76 61 6c 73 25 28 5a  |%:Hint%+=vals%(Z|
0000f550  25 2c 42 25 29 0d 52 12  28 20 20 c8 95 48 69 6e  |%,B%).R.(  ..Hin|
0000f560  74 25 3e 48 61 76 67 25  3a 48 69 6e 74 25 2d 3d  |t%>Havg%:Hint%-=|
0000f570  48 61 76 67 25 3a 52 25  2b 3d 31 3a ce 0d 52 1c  |Havg%:R%+=1:..R.|
0000f580  21 20 20 6e 65 77 25 28  5a 25 2c 42 25 29 3d 28  |!  new%(Z%,B%)=(|
0000f590  4c 25 2b 52 25 29 2f 32  2a 46 2f 32 35 36 0d 52  |L%+R%)/2*F/256.R|
0000f5a0  26 08 20 ed 3a ed 0d 52  30 05 cd 0d 52 3a 0f e7  |&. .:..R0...R:..|
0000f5b0  73 68 61 72 70 65 6e 25  20 8c 0d 52 44 0e 20 e7  |sharpen% ..RD. .|
0000f5c0  6f 72 64 65 72 25 20 8c  0d 52 4e 37 20 20 79 72  |order% ..RN7  yr|
0000f5d0  65 61 64 25 3d 73 79 25  2d 31 3a f2 69 70 72 6f  |ead%=sy%-1:.ipro|
0000f5e0  77 28 72 6d 31 25 28 29  29 3a e7 72 61 6e 67 65  |w(rm1%()):.range|
0000f5f0  25 20 f2 66 69 74 32 28  72 6d 31 25 28 29 29 0d  |% .fit2(rm1%()).|
0000f600  52 58 43 20 20 e3 42 25  3d 30 b8 63 6f 6c 3a 72  |RXC  .B%=0.col:r|
0000f610  6d 31 25 28 30 2c 42 25  29 3d 72 6d 31 25 28 31  |m1%(0,B%)=rm1%(1|
0000f620  2c 42 25 29 3a 72 6d 31  25 28 73 78 25 2b 31 2c  |,B%):rm1%(sx%+1,|
0000f630  42 25 29 3d 72 6d 31 25  28 73 78 25 2c 42 25 29  |B%)=rm1%(sx%,B%)|
0000f640  3a ed 0d 52 62 06 20 cc  0d 52 6c 3e 20 20 79 72  |:..Rb. ..Rl>  yr|
0000f650  65 61 64 25 3d 79 25 2d  31 3a f2 73 63 61 6c 65  |ead%=y%-1:.scale|
0000f660  64 70 69 78 65 6c 72 6f  77 28 72 6d 31 25 28 29  |dpixelrow(rm1%()|
0000f670  29 3a e7 72 61 6e 67 65  25 20 f2 66 69 74 28 72  |):.range% .fit(r|
0000f680  6d 31 25 28 29 29 0d 52  76 41 20 20 e3 42 25 3d  |m1%()).RvA  .B%=|
0000f690  30 b8 63 6f 6c 3a 72 6d  31 25 28 30 2c 42 25 29  |0.col:rm1%(0,B%)|
0000f6a0  3d 72 6d 31 25 28 31 2c  42 25 29 3a 72 6d 31 25  |=rm1%(1,B%):rm1%|
0000f6b0  28 78 25 2b 31 2c 42 25  29 3d 72 6d 31 25 28 78  |(x%+1,B%)=rm1%(x|
0000f6c0  25 2c 42 25 29 3a ed 0d  52 80 06 20 cd 0d 52 8a  |%,B%):..R.. ..R.|
0000f6d0  12 20 72 6d 32 25 28 29  3d 72 6d 31 25 28 29 0d  |. rm2%()=rm1%().|
0000f6e0  52 94 05 cd 0d 52 9e 0d  e7 6f 72 64 65 72 25 20  |R....R...order% |
0000f6f0  8c 0d 52 a8 11 e3 79 72  25 3d 30 20 b8 20 79 25  |..R...yr%=0 . y%|
0000f700  2d 31 0d 52 b2 17 20 c8  99 68 6f 75 72 25 2c 79  |-1.R.. ..hour%,y|
0000f710  72 25 2a 31 30 30 81 79  25 0d 52 bc 0e 20 e7 73  |r%*100.y%.R.. .s|
0000f720  79 25 3d 79 25 20 8c 0d  52 c6 1b 20 20 f2 73 68  |y%=y% ..R..  .sh|
0000f730  61 72 70 70 69 78 65 6c  72 6f 77 28 63 6c 25 28  |arppixelrow(cl%(|
0000f740  29 29 0d 52 d0 06 20 cc  0d 52 da 3c 20 20 79 73  |)).R.. ..R.<  ys|
0000f750  61 6d 70 25 2d 3d 31 3a  e7 79 73 61 6d 70 25 3d  |amp%-=1:.ysamp%=|
0000f760  30 20 f2 73 68 61 72 70  70 69 78 65 6c 72 6f 77  |0 .sharppixelrow|
0000f770  28 78 6c 25 28 29 29 3a  79 73 61 6d 70 25 3d 79  |(xl%()):ysamp%=y|
0000f780  6d 75 6c 25 0d 52 e4 1c  20 20 63 6c 25 28 29 3d  |mul%.R..  cl%()=|
0000f790  78 6c 25 28 29 3a e7 79  64 69 76 25 3e 31 20 8c  |xl%():.ydiv%>1 .|
0000f7a0  0d 52 ee 49 20 20 20 e3  59 25 3d 32 b8 79 64 69  |.R.I   .Y%=2.ydi|
0000f7b0  76 25 3a 79 73 61 6d 70  25 2d 3d 31 3a e7 79 73  |v%:ysamp%-=1:.ys|
0000f7c0  61 6d 70 25 3d 30 20 f2  73 68 61 72 70 70 69 78  |amp%=0 .sharppix|
0000f7d0  65 6c 72 6f 77 28 78 6c  25 28 29 29 3a 79 73 61  |elrow(xl%()):ysa|
0000f7e0  6d 70 25 3d 79 6d 75 6c  25 0d 52 f8 28 20 20 20  |mp%=ymul%.R.(   |
0000f7f0  20 d6 61 64 64 68 61 6c  66 25 2c 78 6c 25 28 30  | .addhalf%,xl%(0|
0000f800  2c 30 29 2c 63 6c 25 28  30 2c 30 29 2c 78 25 3a  |,0),cl%(0,0),x%:|
0000f810  ed 0d 53 02 07 20 20 cd  0d 53 0c 06 20 cd 0d 53  |..S..  ..S.. ..S|
0000f820  16 41 20 63 6c 25 28 29  3d 63 6c 25 28 29 2b 6e  |.A cl%()=cl%()+n|
0000f830  6c 25 28 29 3a 6e 6c 25  28 29 3d 30 3a 42 25 3d  |l%():nl%()=0:B%=|
0000f840  78 25 3a 41 25 3d 28 62  61 73 65 25 2b 79 72 25  |x%:A%=(base%+yr%|
0000f850  2a 78 77 6f 72 64 73 25  29 2a 73 69 7a 65 25 0d  |*xwords%)*size%.|
0000f860  53 20 0d 20 e7 79 72 25  80 31 20 8c 0d 53 2a 2e  |S . .yr%.1 ..S*.|
0000f870  20 20 49 25 3d 73 74 65  70 25 3a d6 66 73 25 2c  |  I%=step%:.fs%,|
0000f880  63 6c 25 28 31 2c 30 29  2c 6e 6c 25 28 31 2c 30  |cl%(1,0),nl%(1,0|
0000f890  29 2c 41 25 2c 49 25 2c  42 25 0d 53 34 06 20 cc  |),A%,I%,B%.S4. .|
0000f8a0  0d 53 3e 3a 20 20 49 25  3d 2d 73 74 65 70 25 3a  |.S>:  I%=-step%:|
0000f8b0  41 25 2b 3d 78 25 2d 31  3a d6 66 73 25 2c 63 6c  |A%+=x%-1:.fs%,cl|
0000f8c0  25 28 78 25 2c 30 29 2c  6e 6c 25 28 78 25 2c 30  |%(x%,0),nl%(x%,0|
0000f8d0  29 2c 41 25 2c 49 25 2c  42 25 0d 53 48 06 20 cd  |),A%,I%,B%.SH. .|
0000f8e0  0d 53 52 05 ed 0d 53 5c  05 cc 0d 53 66 11 e3 79  |.SR...S\...Sf..y|
0000f8f0  72 25 3d 30 20 b8 20 79  25 2d 31 0d 53 70 17 20  |r%=0 . y%-1.Sp. |
0000f900  c8 99 68 6f 75 72 25 2c  79 72 25 2a 31 30 30 81  |..hour%,yr%*100.|
0000f910  79 25 0d 53 7a 10 20 e7  73 68 61 72 70 65 6e 25  |y%.Sz. .sharpen%|
0000f920  20 8c 0d 53 84 42 20 20  e7 79 72 65 61 64 25 20  | ..S.B  .yread% |
0000f930  79 72 65 61 64 25 2d 3d  31 3a f2 73 63 61 6c 65  |yread%-=1:.scale|
0000f940  64 70 69 78 65 6c 72 6f  77 28 72 6d 25 28 29 29  |dpixelrow(rm%())|
0000f950  3a e7 72 61 6e 67 65 25  20 f2 66 69 74 28 72 6d  |:.range% .fit(rm|
0000f960  25 28 29 29 0d 53 8e 3d  20 20 e3 42 25 3d 30 b8  |%()).S.=  .B%=0.|
0000f970  63 6f 6c 3a 72 6d 25 28  30 2c 42 25 29 3d 72 6d  |col:rm%(0,B%)=rm|
0000f980  25 28 31 2c 42 25 29 3a  72 6d 25 28 78 25 2b 31  |%(1,B%):rm%(x%+1|
0000f990  2c 42 25 29 3d 72 6d 25  28 78 25 2c 42 25 29 3a  |,B%)=rm%(x%,B%):|
0000f9a0  ed 0d 53 98 3f 20 20 d6  20 73 68 61 72 70 25 2c  |..S.?  . sharp%,|
0000f9b0  63 6c 25 28 31 2c 30 29  2c 72 6d 25 28 31 2c 30  |cl%(1,0),rm%(1,0|
0000f9c0  29 2c 72 6d 31 25 28 31  2c 30 29 2c 72 6d 32 25  |),rm1%(1,0),rm2%|
0000f9d0  28 31 2c 30 29 2c 74 6f  74 61 6c 76 61 6c 73 25  |(1,0),totalvals%|
0000f9e0  0d 53 a2 23 20 20 c8 94  20 72 6d 32 25 28 29 2c  |.S.#  .. rm2%(),|
0000f9f0  72 6d 31 25 28 29 3a 72  6d 31 25 28 29 3d 72 6d  |rm1%():rm1%()=rm|
0000fa00  25 28 29 0d 53 ac 06 20  cc 0d 53 b6 30 20 20 f2  |%().S.. ..S.0  .|
0000fa10  73 63 61 6c 65 64 70 69  78 65 6c 72 6f 77 28 63  |scaledpixelrow(c|
0000fa20  6c 25 28 29 29 3a e7 72  61 6e 67 65 25 20 f2 66  |l%()):.range% .f|
0000fa30  69 74 28 63 6c 25 28 29  29 0d 53 c0 06 20 cd 0d  |it(cl%()).S.. ..|
0000fa40  53 ca 41 20 63 6c 25 28  29 3d 63 6c 25 28 29 2b  |S.A cl%()=cl%()+|
0000fa50  6e 6c 25 28 29 3a 6e 6c  25 28 29 3d 30 3a 42 25  |nl%():nl%()=0:B%|
0000fa60  3d 78 25 3a 41 25 3d 28  62 61 73 65 25 2b 79 72  |=x%:A%=(base%+yr|
0000fa70  25 2a 78 77 6f 72 64 73  25 29 2a 73 69 7a 65 25  |%*xwords%)*size%|
0000fa80  0d 53 d4 0d 20 e7 79 72  25 80 31 20 8c 0d 53 de  |.S.. .yr%.1 ..S.|
0000fa90  2e 20 20 49 25 3d 73 74  65 70 25 3a d6 66 73 25  |.  I%=step%:.fs%|
0000faa0  2c 63 6c 25 28 31 2c 30  29 2c 6e 6c 25 28 31 2c  |,cl%(1,0),nl%(1,|
0000fab0  30 29 2c 41 25 2c 49 25  2c 42 25 0d 53 e8 06 20  |0),A%,I%,B%.S.. |
0000fac0  cc 0d 53 f2 3a 20 20 49  25 3d 2d 73 74 65 70 25  |..S.:  I%=-step%|
0000fad0  3a 41 25 2b 3d 78 25 2d  31 3a d6 66 73 25 2c 63  |:A%+=x%-1:.fs%,c|
0000fae0  6c 25 28 78 25 2c 30 29  2c 6e 6c 25 28 78 25 2c  |l%(x%,0),nl%(x%,|
0000faf0  30 29 2c 41 25 2c 49 25  2c 42 25 0d 53 fc 06 20  |0),A%,I%,B%.S.. |
0000fb00  cd 0d 54 06 05 ed 0d 54  10 05 cd 0d 54 1a 05 cd  |..T....T....T...|
0000fb10  0d 54 24 09 f2 53 61 76  65 0d 54 2e 11 3d 30 3a  |.T$..Save.T..=0:|
0000fb20  f4 20 53 75 63 63 65 73  73 21 0d 54 38 0b dd 20  |. Success!.T8.. |
0000fb30  f2 53 61 76 65 0d 54 42  11 e7 63 25 20 d9 23 63  |.Save.TB..c% .#c|
0000fb40  25 3a 63 25 3d 30 0d 54  4c 14 e7 63 63 25 20 d9  |%:c%=0.TL..cc% .|
0000fb50  23 63 63 25 3a 63 63 25  3d 30 0d 54 56 17 e7 63  |#cc%:cc%=0.TV..c|
0000fb60  63 63 25 20 d9 23 63 63  63 25 3a 63 63 63 25 3d  |cc% .#ccc%:ccc%=|
0000fb70  30 0d 54 60 0a c8 8e 20  6d 20 ca 0d 54 6a 45 20  |0.T`... m ..TjE |
0000fb80  c9 20 2d 31 3a e7 73 70  72 69 74 65 61 72 65 61  |. -1:.spritearea|
0000fb90  25 3c 30 20 e7 73 61 76  65 25 20 c8 99 22 4f 53  |%<0 .save% .."OS|
0000fba0  5f 46 69 6c 65 22 2c 31  30 2c 66 24 2c 26 30 30  |_File",10,f$,&00|
0000fbb0  34 2c 2c 72 61 6d 25 2c  72 61 6d 25 2b 73 7a 25  |4,,ram%,ram%+sz%|
0000fbc0  0d 54 74 06 20 7f 0d 54  7e 25 20 e7 76 66 6c 69  |.Tt. ..T~% .vfli|
0000fbd0  70 25 20 c8 99 26 32 65  2c 32 35 36 2b 33 33 2c  |p% ..&2e,256+33,|
0000fbe0  72 61 6d 25 2c 6f 6e 61  6d 65 24 0d 54 88 25 20  |ram%,oname$.T.% |
0000fbf0  e7 68 66 6c 69 70 25 20  c8 99 26 32 65 2c 32 35  |.hflip% ..&2e,25|
0000fc00  36 2b 34 37 2c 72 61 6d  25 2c 6f 6e 61 6d 65 24  |6+47,ram%,oname$|
0000fc10  0d 54 92 2d 20 e7 73 70  72 69 74 65 61 72 65 61  |.T.- .spritearea|
0000fc20  25 3c 30 20 e7 73 61 76  65 25 20 c8 99 26 32 65  |%<0 .save% ..&2e|
0000fc30  2c 26 31 30 63 2c 72 61  6d 25 2c 66 24 0d 54 9c  |,&10c,ram%,f$.T.|
0000fc40  05 cb 0d 54 a6 15 c8 99  22 48 6f 75 72 67 6c 61  |...T...."Hourgla|
0000fc50  73 73 5f 4f 66 66 22 0d  54 b0 05 e1 0d 54 ba 0c  |ss_Off".T....T..|
0000fc60  dd f2 64 65 66 70 61 6c  0d 54 c4 0d e3 43 25 3d  |..defpal.T...C%=|
0000fc70  30 b8 32 35 35 0d 54 ce  24 20 72 25 28 43 25 29  |0.255.T.$ r%(C%)|
0000fc80  3d 28 43 25 80 37 20 84  20 28 43 25 80 31 36 29  |=(C%.7 . (C%.16)|
0000fc90  3e 3e 31 29 2f 31 35 2a  46 0d 54 d8 25 20 67 25  |>>1)/15*F.T.% g%|
0000fca0  28 43 25 29 3d 28 43 25  80 33 20 84 20 28 43 25  |(C%)=(C%.3 . (C%|
0000fcb0  80 26 36 30 29 3e 3e 33  29 2f 31 35 2a 46 0d 54  |.&60)>>3)/15*F.T|
0000fcc0  e2 31 20 62 25 28 43 25  29 3d 28 43 25 80 33 20  |.1 b%(C%)=(C%.3 |
0000fcd0  84 20 28 43 25 80 38 29  3e 3e 31 20 84 20 28 43  |. (C%.8)>>1 . (C|
0000fce0  25 80 31 32 38 29 3e 3e  34 29 2f 31 35 2a 46 0d  |%.128)>>4)/15*F.|
0000fcf0  54 ec 05 ed 0d 54 f6 05  e1 0d 55 00 0d dd f2 64  |T....T....U....d|
0000fd00  65 66 70 61 6c 32 0d 55  0a 1b 72 25 28 30 29 3d  |efpal2.U..r%(0)=|
0000fd10  46 3a 67 25 28 30 29 3d  46 3a 62 25 28 30 29 3d  |F:g%(0)=F:b%(0)=|
0000fd20  46 0d 55 14 05 e1 0d 55  1e 0d dd f2 64 65 66 70  |F.U....U....defp|
0000fd30  61 6c 34 0d 55 28 2f 72  25 28 29 3d 31 35 2c 31  |al4.U(/r%()=15,1|
0000fd40  30 2c 35 2c 30 3a e3 43  25 3d 30 b8 33 3a 72 25  |0,5,0:.C%=0.3:r%|
0000fd50  28 43 25 29 3d 72 25 28  43 25 29 2f 31 35 2a 46  |(C%)=r%(C%)/15*F|
0000fd60  3a ed 0d 55 32 17 67 25  28 29 3d 72 25 28 29 3a  |:..U2.g%()=r%():|
0000fd70  62 25 28 29 3d 72 25 28  29 0d 55 3c 05 e1 0d 55  |b%()=r%().U<...U|
0000fd80  46 0e dd f2 64 65 66 70  61 6c 31 36 0d 55 50 31  |F...defpal16.UP1|
0000fd90  72 25 28 29 3d 31 35 2c  31 33 2c 31 31 2c 39 2c  |r%()=15,13,11,9,|
0000fda0  37 2c 35 2c 33 2c 30 2c  30 2c 31 34 2c 20 30 2c  |7,5,3,0,0,14, 0,|
0000fdb0  31 33 2c 31 34 2c 35 2c  31 35 2c 20 30 0d 55 5a  |13,14,5,15, 0.UZ|
0000fdc0  31 67 25 28 29 3d 31 35  2c 31 33 2c 31 31 2c 39  |1g%()=15,13,11,9|
0000fdd0  2c 37 2c 35 2c 33 2c 30  2c 34 2c 31 34 2c 31 32  |,7,5,3,0,4,14,12|
0000fde0  2c 20 30 2c 31 34 2c 38  2c 31 31 2c 31 30 0d 55  |, 0,14,8,11,10.U|
0000fdf0  64 31 62 25 28 29 3d 31  35 2c 31 33 2c 31 31 2c  |d1b%()=15,13,11,|
0000fe00  39 2c 37 2c 35 2c 33 2c  30 2c 39 2c 20 30 2c 20  |9,7,5,3,0,9, 0, |
0000fe10  30 2c 20 30 2c 31 31 2c  30 2c 20 30 2c 31 35 0d  |0, 0,11,0, 0,15.|
0000fe20  55 6e 47 e3 43 25 3d 30  b8 31 35 3a 72 25 28 43  |UnG.C%=0.15:r%(C|
0000fe30  25 29 3d 72 25 28 43 25  29 2f 31 35 2a 46 3a 67  |%)=r%(C%)/15*F:g|
0000fe40  25 28 43 25 29 3d 67 25  28 43 25 29 2f 31 35 2a  |%(C%)=g%(C%)/15*|
0000fe50  46 3a 62 25 28 43 25 29  3d 62 25 28 43 25 29 2f  |F:b%(C%)=b%(C%)/|
0000fe60  31 35 2a 46 3a ed 0d 55  78 05 e1 0d 55 82 0c dd  |15*F:..Ux...U...|
0000fe70  f2 69 70 61 6c 36 33 0d  55 8c 2c cf 23 63 25 3d  |.ipal63.U.,.#c%=|
0000fe80  26 33 38 3a de 20 72 70  61 6c 25 28 31 35 29 2c  |&38:. rpal%(15),|
0000fe90  67 70 61 6c 25 28 31 35  29 2c 62 70 61 6c 25 28  |gpal%(15),bpal%(|
0000fea0  31 35 29 0d 55 96 14 e3  43 25 3d 30 b8 31 35 3a  |15).U...C%=0.15:|
0000feb0  44 25 3d 9a 23 63 25 0d  55 a0 1a 20 72 70 61 6c  |D%=.#c%.U.. rpal|
0000fec0  25 28 43 25 29 3d 9a 23  63 25 3e 3e 34 20 80 20  |%(C%)=.#c%>>4 . |
0000fed0  37 0d 55 aa 1a 20 67 70  61 6c 25 28 43 25 29 3d  |7.U.. gpal%(C%)=|
0000fee0  9a 23 63 25 3e 3e 34 20  80 20 33 0d 55 b4 1a 20  |.#c%>>4 . 3.U.. |
0000fef0  62 70 61 6c 25 28 43 25  29 3d 9a 23 63 25 3e 3e  |bpal%(C%)=.#c%>>|
0000ff00  34 20 80 20 37 0d 55 be  0b 44 25 3d a4 57 3a ed  |4 . 7.U..D%=.W:.|
0000ff10  0d 55 c8 0d e3 43 25 3d  30 b8 32 35 35 0d 55 d2  |.U...C%=0.255.U.|
0000ff20  2a 20 72 25 28 43 25 29  3d 28 72 70 61 6c 25 28  |* r%(C%)=(rpal%(|
0000ff30  43 25 80 31 35 29 84 28  43 25 80 31 36 29 3e 3e  |C%.15).(C%.16)>>|
0000ff40  31 29 2f 31 35 2a 46 0d  55 dc 2b 20 67 25 28 43  |1)/15*F.U.+ g%(C|
0000ff50  25 29 3d 28 67 70 61 6c  25 28 43 25 80 31 35 29  |%)=(gpal%(C%.15)|
0000ff60  84 28 43 25 80 26 36 30  29 3e 3e 33 29 2f 31 35  |.(C%.&60)>>3)/15|
0000ff70  2a 46 0d 55 e6 2b 20 62  25 28 43 25 29 3d 28 62  |*F.U.+ b%(C%)=(b|
0000ff80  70 61 6c 25 28 43 25 80  31 35 29 84 28 43 25 80  |pal%(C%.15).(C%.|
0000ff90  31 32 38 29 3e 3e 34 29  2f 31 35 2a 46 0d 55 f0  |128)>>4)/15*F.U.|
0000ffa0  05 ed 0d 55 fa 05 e1 0d  56 04 0e dd f2 69 70 61  |...U....V....ipa|
0000ffb0  6c 28 44 25 29 0d 56 0e  0c cf 23 63 25 3d 26 33  |l(D%).V...#c%=&3|
0000ffc0  38 0d 56 18 16 e3 43 25  3d 30 b8 44 25 2d 31 3a  |8.V...C%=0.D%-1:|
0000ffd0  44 25 3d 9a 23 63 25 0d  56 22 1a 20 72 25 28 43  |D%=.#c%.V". r%(C|
0000ffe0  25 29 3d 28 9a 23 63 25  3e 3e 34 29 2f 31 35 2a  |%)=(.#c%>>4)/15*|
0000fff0  46 0d 56 2c 1a 20 67 25  28 43 25 29 3d 28 9a 23  |F.V,. g%(C%)=(.#|
00010000  63 25 3e 3e 34 29 2f 31  35 2a 46 0d 56 36 1a 20  |c%>>4)/15*F.V6. |
00010010  62 25 28 43 25 29 3d 28  9a 23 63 25 3e 3e 34 29  |b%(C%)=(.#c%>>4)|
00010020  2f 31 35 2a 46 0d 56 40  0b 44 25 3d a4 57 3a ed  |/15*F.V@.D%=.W:.|
00010030  0d 56 4a 05 e1 0d 56 54  0c dd 20 f2 6e 6f 70 61  |.VJ...VT.. .nopa|
00010040  6c 0d 56 5e 33 e3 43 25  3d 30 b8 32 35 35 3a 72  |l.V^3.C%=0.255:r|
00010050  25 28 43 25 29 3d 43 25  2f 32 35 35 2a 46 3a ed  |%(C%)=C%/255*F:.|
00010060  3a 67 25 28 29 3d 72 25  28 29 3a 62 25 28 29 3d  |:g%()=r%():b%()=|
00010070  72 25 28 29 0d 56 68 05  e1 0d 56 72 11 dd 20 f2  |r%().Vh...Vr.. .|
00010080  63 6f 6c 28 41 25 2c 42  25 29 0d 56 7c 36 42 25  |col(A%,B%).V|6B%|
00010090  3d 42 25 3c 3c 38 84 42  25 3c 3c 34 84 26 31 30  |=B%<<8.B%<<4.&10|
000100a0  3a 70 61 6c 25 21 28 41  25 2a 38 29 3d 42 25 3a  |:pal%!(A%*8)=B%:|
000100b0  70 61 6c 25 21 28 41 25  2a 38 2b 34 29 3d 42 25  |pal%!(A%*8+4)=B%|
000100c0  0d 56 86 05 e1 0d 56 90  0d dd 20 a4 75 63 28 61  |.V....V... .uc(a|
000100d0  24 29 0d 56 9a 0d ea 5a  25 2c 7a 24 2c 62 24 0d  |$).V...Z%,z$,b$.|
000100e0  56 a4 0d e3 5a 25 3d 31  b8 a9 61 24 0d 56 ae 10  |V...Z%=1..a$.V..|
000100f0  7a 24 3d c1 61 24 2c 5a  25 2c 31 29 0d 56 b8 21  |z$=.a$,Z%,1).V.!|
00010100  e7 7a 24 3e 3d 22 61 22  e7 7a 24 3c 3d 22 7a 22  |.z$>="a".z$<="z"|
00010110  20 7a 24 3d bd 28 97 7a  24 2d 33 32 29 0d 56 c2  | z$=.(.z$-32).V.|
00010120  0c 62 24 2b 3d 7a 24 3a  ed 0d 56 cc 07 3d 62 24  |.b$+=z$:..V..=b$|
00010130  0d 56 d6 0e dd 20 a4 64  69 6d 28 41 25 29 0d 56  |.V... .dim(A%).V|
00010140  e0 08 ea 20 42 25 0d 56  ea 0c e7 66 6c 65 78 25  |... B%.V...flex%|
00010150  20 8c 0d 56 f4 35 20 42  25 3d 6e 65 78 74 6c 6f  | ..V.5 B%=nextlo|
00010160  63 61 74 69 6f 6e 25 3a  41 25 3d 41 25 2b 33 80  |cation%:A%=A%+3.|
00010170  ac 33 3a 6e 65 78 74 6c  6f 63 61 74 69 6f 6e 25  |.3:nextlocation%|
00010180  2b 3d 41 25 2b 31 36 0d  56 fe 3f 20 c8 99 22 57  |+=A%+16.V.? .."W|
00010190  69 6d 70 5f 53 6c 6f 74  53 69 7a 65 22 2c 2d 31  |imp_SlotSize",-1|
000101a0  2c 2d 31 20 b8 20 63 75  72 72 65 6e 74 73 6c 6f  |,-1 . currentslo|
000101b0  74 25 2c 6e 65 78 74 73  6c 6f 74 25 2c 66 72 65  |t%,nextslot%,fre|
000101c0  65 73 6c 6f 74 25 0d 57  08 4f 20 e7 6e 65 78 74  |eslot%.W.O .next|
000101d0  73 6c 6f 74 25 2b 66 72  65 65 73 6c 6f 74 25 3c  |slot%+freeslot%<|
000101e0  41 25 20 85 20 34 32 2c  22 43 61 6e 6e 6f 74 20  |A% . 42,"Cannot |
000101f0  63 6c 61 69 6d 20 65 6e  6f 75 67 68 20 6d 65 6d  |claim enough mem|
00010200  6f 72 79 20 74 6f 20 70  72 6f 63 65 73 73 20 69  |ory to process i|
00010210  6d 61 67 65 22 0d 57 12  38 20 63 75 72 72 65 6e  |mage".W.8 curren|
00010220  74 73 6c 6f 74 25 2b 3d  41 25 3a c8 99 20 22 57  |tslot%+=A%:.. "W|
00010230  69 6d 70 5f 53 6c 6f 74  53 69 7a 65 22 2c 63 75  |imp_SlotSize",cu|
00010240  72 72 65 6e 74 73 6c 6f  74 25 2c 2d 31 0d 57 1c  |rrentslot%,-1.W.|
00010250  05 cc 0d 57 26 14 20 e7  77 6f 72 6b 73 70 61 63  |...W&. .workspac|
00010260  65 25 3c 30 20 8c 0d 57  30 0d 20 20 de 20 42 25  |e%<0 ..W0.  . B%|
00010270  20 41 25 0d 57 3a 06 20  cc 0d 57 44 59 20 20 42  | A%.W:. ..WDY  B|
00010280  25 3d 77 6f 72 6b 73 70  61 63 65 25 3a 77 6f 72  |%=workspace%:wor|
00010290  6b 73 70 61 63 65 25 2b  3d 41 25 2b 33 80 ac 33  |kspace%+=A%+3..3|
000102a0  3a e7 77 6f 72 6b 73 70  61 63 65 25 3e 77 6f 72  |:.workspace%>wor|
000102b0  6b 6c 69 6d 69 74 25 20  85 34 32 2c 22 4e 6f 74  |klimit% .42,"Not|
000102c0  20 65 6e 6f 75 67 68 20  77 6f 72 6b 73 70 61 63  | enough workspac|
000102d0  65 22 0d 57 4e 06 20 cd  0d 57 58 05 cd 0d 57 62  |e".WN. ..WX...Wb|
000102e0  07 3d 42 25 0d 57 6c 24  f4 20 72 65 61 64 20 6c  |.=B%.Wl$. read l|
000102f0  69 74 74 6c 65 20 65 6e  64 69 61 6e 20 33 32 20  |ittle endian 32 |
00010300  62 69 74 20 77 6f 72 64  0d 57 76 10 dd 20 a4 57  |bit word.Wv.. .W|
00010310  3d a4 57 31 28 63 25 29  0d 57 80 32 dd 20 a4 57  |=.W1(c%).W.2. .W|
00010320  31 28 63 25 29 3d 9a 23  63 25 20 84 20 9a 23 63  |1(c%)=.#c% . .#c|
00010330  25 3c 3c 38 20 84 20 9a  23 63 25 3c 3c 31 36 20  |%<<8 . .#c%<<16 |
00010340  84 20 9a 23 63 25 3c 3c  32 34 0d 57 8a 24 f4 20  |. .#c%<<24.W.$. |
00010350  72 65 61 64 20 6c 69 74  74 6c 65 20 65 6e 64 69  |read little endi|
00010360  61 6e 20 31 36 20 62 69  74 20 77 6f 72 64 0d 57  |an 16 bit word.W|
00010370  94 18 dd 20 a4 48 57 3d  9a 23 63 25 20 84 20 9a  |... .HW=.#c% . .|
00010380  23 63 25 3c 3c 38 0d 57  9e 21 f4 20 72 65 61 64  |#c%<<8.W.!. read|
00010390  20 62 69 67 20 65 6e 64  69 61 6e 20 31 36 20 62  | big endian 16 b|
000103a0  69 74 20 77 6f 72 64 0d  57 a8 1a dd 20 a4 62 65  |it word.W... .be|
000103b0  48 57 3d 9a 23 63 25 3c  3c 38 20 84 20 9a 23 63  |HW=.#c%<<8 . .#c|
000103c0  25 0d 57 b2 21 f4 20 72  65 61 64 20 62 69 67 20  |%.W.!. read big |
000103d0  65 6e 64 69 61 6e 20 33  32 20 62 69 74 20 77 6f  |endian 32 bit wo|
000103e0  72 64 0d 57 bc 2f dd 20  a4 62 65 57 3d 9a 23 63  |rd.W./. .beW=.#c|
000103f0  25 3c 3c 32 34 20 84 20  9a 23 63 25 3c 3c 31 36  |%<<24 . .#c%<<16|
00010400  20 84 20 9a 23 63 25 3c  3c 38 20 84 20 9a 23 63  | . .#c%<<8 . .#c|
00010410  25 0d 57 c6 16 f4 20 72  65 61 64 20 61 20 54 49  |%.W... read a TI|
00010420  46 46 20 74 79 70 65 0d  57 d0 0f dd 20 a4 74 69  |FF type.W... .ti|
00010430  66 66 28 54 25 29 0d 57  da 0b c8 8e 20 54 25 20  |ff(T%).W.... T% |
00010440  ca 0d 57 e4 0d c9 20 31  3a 3d 9a 23 63 25 0d 57  |..W... 1:=.#c%.W|
00010450  ee 2a c9 20 32 3a ea 73  24 2c 74 24 3a f5 73 24  |.*. 2:.s$,t$:.s$|
00010460  2b 3d 74 24 3a 74 24 3d  bd 9a 23 63 25 3a fd 74  |+=t$:t$=..#c%:.t|
00010470  24 3d bd 30 3a 3d 73 24  0d 57 f8 34 c9 20 33 3a  |$=.0:=s$.W.4. 3:|
00010480  e7 62 69 67 65 6e 64 69  61 6e 20 8c 3d 9a 23 63  |.bigendian .=.#c|
00010490  25 3c 3c 38 20 84 20 9a  23 63 25 20 8b 3d 9a 23  |%<<8 . .#c% .=.#|
000104a0  63 25 20 84 20 9a 23 63  25 3c 3c 38 0d 58 02 23  |c% . .#c%<<8.X.#|
000104b0  c9 20 34 3a e7 62 69 67  65 6e 64 69 61 6e 20 8c  |. 4:.bigendian .|
000104c0  3d a4 62 65 57 20 8b 3d  a4 57 31 28 63 25 29 0d  |=.beW .=.W1(c%).|
000104d0  58 0c 05 cb 0d 58 16 1e  85 20 34 32 2c 22 53 69  |X....X... 42,"Si|
000104e0  6c 6c 79 20 54 49 46 46  20 74 61 67 3a 22 2b c3  |lly TIFF tag:"+.|
000104f0  54 25 0d 58 20 14 dd 20  f2 54 49 46 46 6e 65 78  |T%.X .. .TIFFnex|
00010500  74 73 74 72 69 70 0d 58  2a 1a 54 49 46 46 72 65  |tstrip.X*.TIFFre|
00010510  61 64 25 3d 72 6f 77 73  70 65 72 73 74 72 69 70  |ad%=rowsperstrip|
00010520  0d 58 34 20 54 49 46 46  70 74 72 2b 3d 31 3a cf  |.X4 TIFFptr+=1:.|
00010530  23 63 25 3d 73 74 25 28  54 49 46 46 70 74 72 29  |#c%=st%(TIFFptr)|
00010540  0d 58 3e 05 e1 0d 58 48  0e dd 20 f2 69 66 66 28  |.X>...XH.. .iff(|
00010550  41 25 29 0d 58 52 0a 49  25 3d 30 3a f5 0d 58 5c  |A%).XR.I%=0:..X\|
00010560  16 20 43 25 3d 9a 23 63  25 3a e7 43 25 3e 31 32  |. C%=.#c%:.C%>12|
00010570  37 20 8c 0d 58 66 48 20  20 e7 43 25 3e 31 32 38  |7 ..XfH  .C%>128|
00010580  20 41 25 3f 49 25 3d 9a  23 63 25 3a e3 4a 25 3d  | A%?I%=.#c%:.J%=|
00010590  41 25 2b 49 25 2b 31 b8  41 25 2b 49 25 2b 32 35  |A%+I%+1.A%+I%+25|
000105a0  36 2d 43 25 3a 3f 4a 25  3d 41 25 3f 49 25 3a ed  |6-C%:?J%=A%?I%:.|
000105b0  3a 49 25 2b 3d 32 35 37  2d 43 25 0d 58 70 06 20  |:I%+=257-C%.Xp. |
000105c0  cc 0d 58 7a 2c 20 20 e3  4a 25 3d 41 25 2b 49 25  |..Xz,  .J%=A%+I%|
000105d0  b8 41 25 2b 49 25 2b 43  25 3a 3f 4a 25 3d 9a 23  |.A%+I%+C%:?J%=.#|
000105e0  63 25 3a ed 3a 49 25 2b  3d 43 25 2b 31 0d 58 84  |c%:.:I%+=C%+1.X.|
000105f0  06 20 cd 0d 58 8e 0f fd  49 25 3e 3d 72 73 78 25  |. ..X...I%>=rsx%|
00010600  2d 31 0d 58 98 05 e1 0d  58 a2 30 f4 20 73 74 61  |-1.X....X.0. sta|
00010610  6e 64 61 72 64 20 73 69  7a 65 20 63 6f 72 72 65  |ndard size corre|
00010620  63 74 6f 72 20 66 6f 72  20 75 6e 6b 6e 6f 77 6e  |ctor for unknown|
00010630  20 69 6d 61 67 65 73 0d  58 ac 0b dd 20 f2 73 69  | images.X... .si|
00010640  7a 65 0d 58 b6 0d e7 73  63 61 6c 65 25 20 8c 0d  |ze.X...scale% ..|
00010650  58 c0 20 20 f4 20 73 6d  61 6c 6c 20 69 6d 61 67  |X.  . small imag|
00010660  65 73 20 67 65 74 20 65  6e 6c 61 72 67 65 64 0d  |es get enlarged.|
00010670  58 ca 35 20 e7 73 78 25  3c 3d 33 32 30 20 e7 20  |X.5 .sx%<=320 . |
00010680  73 79 25 3c 3d 32 35 36  20 78 6d 75 6c 25 3d 78  |sy%<=256 xmul%=x|
00010690  6d 75 6c 25 2a 32 3a 79  6d 75 6c 25 3d 79 6d 75  |mul%*2:ymul%=ymu|
000106a0  6c 25 2a 32 0d 58 d4 2c  20 f4 20 68 6f 70 65 66  |l%*2.X., . hopef|
000106b0  75 6c 6c 79 20 61 20 6e  6f 6e 2d 73 71 75 61 72  |ully a non-squar|
000106c0  65 20 6f 72 69 67 69 6e  61 6c 20 70 69 78 65 6c  |e original pixel|
000106d0  0d 58 de 1e 20 e7 73 79  25 3c 3d 73 78 25 2f 32  |.X.. .sy%<=sx%/2|
000106e0  20 79 6d 75 6c 25 3d 79  6d 75 6c 25 2a 32 0d 58  | ymul%=ymul%*2.X|
000106f0  e8 05 cd 0d 58 f2 05 e1  0d 58 fc 18 dd 20 f2 72  |....X....X... .r|
00010700  65 64 75 63 65 28 f8 20  41 25 2c f8 20 42 25 29  |educe(. A%,. B%)|
00010710  0d 59 06 17 ea 20 43 25  2c 44 25 3a 43 25 3d 41  |.Y... C%,D%:C%=A|
00010720  25 3a 44 25 3d 42 25 0d  59 10 15 f5 20 e7 43 25  |%:D%=B%.Y... .C%|
00010730  3c 44 25 20 c8 94 20 43  25 2c 44 25 0d 59 1a 0d  |<D% .. C%,D%.Y..|
00010740  20 43 25 3d 43 25 83 44  25 0d 59 24 09 fd 43 25  | C%=C%.D%.Y$..C%|
00010750  3d 30 0d 59 2e 15 41 25  3d 41 25 81 44 25 3a 42  |=0.Y..A%=A%.D%:B|
00010760  25 3d 42 25 81 44 25 0d  59 38 05 e1 0d 59 42 19  |%=B%.D%.Y8...YB.|
00010770  dd 20 f2 72 65 61 64 70  69 78 65 6c 72 6f 77 28  |. .readpixelrow(|
00010780  7a 25 28 29 29 0d 59 4c  0c e7 72 6f 77 73 25 20  |z%()).YL..rows% |
00010790  8c 0d 59 56 17 20 72 6f  77 73 25 2d 3d 31 3a e7  |..YV. rows%-=1:.|
000107a0  73 78 25 3d 78 25 20 8c  0d 59 60 12 20 20 f2 69  |sx%=x% ..Y`.  .i|
000107b0  70 72 6f 77 28 7a 25 28  29 29 0d 59 6a 06 20 cc  |prow(z%()).Yj. .|
000107c0  0d 59 74 3d 20 20 f2 69  70 72 6f 77 28 78 70 25  |.Yt=  .iprow(xp%|
000107d0  28 29 29 3a d6 78 73 61  6d 70 6c 65 25 2c 78 6d  |()):.xsample%,xm|
000107e0  75 6c 25 2c 78 64 69 76  25 2c 7a 25 28 31 2c 30  |ul%,xdiv%,z%(1,0|
000107f0  29 2c 78 70 25 28 31 2c  30 29 2c 78 25 0d 59 7e  |),xp%(1,0),x%.Y~|
00010800  06 20 cd 0d 59 88 05 cc  0d 59 92 0b 20 7a 25 28  |. ..Y....Y.. z%(|
00010810  29 3d 30 0d 59 9c 05 cd  0d 59 a6 05 e1 0d 59 b0  |)=0.Y....Y....Y.|
00010820  1a dd 20 f2 73 68 61 72  70 70 69 78 65 6c 72 6f  |.. .sharppixelro|
00010830  77 28 7a 25 28 29 29 0d  59 ba 0c e7 72 6f 77 73  |w(z%()).Y...rows|
00010840  25 20 8c 0d 59 c4 17 20  72 6f 77 73 25 2d 3d 31  |% ..Y.. rows%-=1|
00010850  3a e7 73 78 25 3d 78 25  20 8c 0d 59 ce 3f 20 20  |:.sx%=x% ..Y.?  |
00010860  e7 73 68 61 72 70 65 6e  25 20 f2 73 68 61 72 70  |.sharpen% .sharp|
00010870  28 7a 25 28 29 29 20 8b  20 f2 69 70 72 6f 77 28  |(z%()) . .iprow(|
00010880  7a 25 28 29 29 3a e7 72  61 6e 67 65 25 20 f2 66  |z%()):.range% .f|
00010890  69 74 32 28 7a 25 28 29  29 0d 59 d8 06 20 cc 0d  |it2(z%()).Y.. ..|
000108a0  59 e2 42 20 20 e7 73 68  61 72 70 65 6e 25 20 f2  |Y.B  .sharpen% .|
000108b0  73 68 61 72 70 28 78 70  25 28 29 29 20 8b 20 f2  |sharp(xp%()) . .|
000108c0  69 70 72 6f 77 28 78 70  25 28 29 29 3a e7 72 61  |iprow(xp%()):.ra|
000108d0  6e 67 65 25 20 f2 66 69  74 32 28 78 70 25 28 29  |nge% .fit2(xp%()|
000108e0  29 0d 59 ec 2f 20 20 d6  78 73 61 6d 70 6c 65 25  |).Y./  .xsample%|
000108f0  2c 78 6d 75 6c 25 2c 78  64 69 76 25 2c 7a 25 28  |,xmul%,xdiv%,z%(|
00010900  31 2c 30 29 2c 78 70 25  28 31 2c 30 29 2c 78 25  |1,0),xp%(1,0),x%|
00010910  0d 59 f6 06 20 cd 0d 5a  00 05 cc 0d 5a 0a 0b 20  |.Y.. ..Z....Z.. |
00010920  7a 25 28 29 3d 30 0d 5a  14 05 cd 0d 5a 1e 05 e1  |z%()=0.Z....Z...|
00010930  0d 5a 28 12 dd 20 f2 73  68 61 72 70 28 7a 25 28  |.Z(.. .sharp(z%(|
00010940  29 29 0d 5a 32 38 79 72  65 61 64 25 2d 3d 31 3a  |)).Z28yread%-=1:|
00010950  e7 79 72 65 61 64 25 20  f2 69 70 72 6f 77 28 72  |.yread% .iprow(r|
00010960  6d 25 28 29 29 3a e7 72  61 6e 67 65 25 20 f2 66  |m%()):.range% .f|
00010970  69 74 32 28 72 6d 25 28  29 29 0d 5a 3c 3d e3 42  |it2(rm%()).Z<=.B|
00010980  25 3d 30 b8 63 6f 6c 3a  72 6d 25 28 30 2c 42 25  |%=0.col:rm%(0,B%|
00010990  29 3d 72 6d 25 28 31 2c  42 25 29 3a 72 6d 25 28  |)=rm%(1,B%):rm%(|
000109a0  73 78 25 2b 31 2c 42 25  29 3d 72 6d 25 28 73 78  |sx%+1,B%)=rm%(sx|
000109b0  25 2c 42 25 29 3a ed 0d  5a 46 3d d6 20 73 68 61  |%,B%):..ZF=. sha|
000109c0  72 70 25 2c 7a 25 28 31  2c 30 29 2c 72 6d 25 28  |rp%,z%(1,0),rm%(|
000109d0  31 2c 30 29 2c 72 6d 31  25 28 31 2c 30 29 2c 72  |1,0),rm1%(1,0),r|
000109e0  6d 32 25 28 31 2c 30 29  2c 74 6f 74 61 6c 76 61  |m2%(1,0),totalva|
000109f0  6c 73 32 25 0d 5a 50 21  c8 94 20 72 6d 32 25 28  |ls2%.ZP!.. rm2%(|
00010a00  29 2c 72 6d 31 25 28 29  3a 72 6d 31 25 28 29 3d  |),rm1%():rm1%()=|
00010a10  72 6d 25 28 29 0d 5a 5a  05 e1 0d 5a 64 1b dd 20  |rm%().ZZ...Zd.. |
00010a20  f2 73 63 61 6c 65 64 70  69 78 65 6c 72 6f 77 28  |.scaledpixelrow(|
00010a30  7a 25 28 29 29 0d 5a 6e  0d e7 73 79 25 3d 79 25  |z%()).Zn..sy%=y%|
00010a40  20 8c 0d 5a 78 18 20 f2  72 65 61 64 70 69 78 65  | ..Zx. .readpixe|
00010a50  6c 72 6f 77 28 7a 25 28  29 29 0d 5a 82 05 cc 0d  |lrow(z%()).Z....|
00010a60  5a 8c 3a 20 79 73 61 6d  70 25 2d 3d 31 3a e7 79  |Z.: ysamp%-=1:.y|
00010a70  73 61 6d 70 25 3d 30 20  f2 72 65 61 64 70 69 78  |samp%=0 .readpix|
00010a80  65 6c 72 6f 77 28 78 6c  25 28 29 29 3a 79 73 61  |elrow(xl%()):ysa|
00010a90  6d 70 25 3d 79 6d 75 6c  25 0d 5a 96 1a 20 7a 25  |mp%=ymul%.Z.. z%|
00010aa0  28 29 3d 78 6c 25 28 29  3a e7 79 64 69 76 25 3e  |()=xl%():.ydiv%>|
00010ab0  31 20 8c 0d 5a a0 15 20  20 ea 59 25 3a e3 59 25  |1 ..Z..  .Y%:.Y%|
00010ac0  3d 32 b8 79 64 69 76 25  0d 5a aa 3c 20 20 20 79  |=2.ydiv%.Z.<   y|
00010ad0  73 61 6d 70 25 2d 3d 31  3a e7 79 73 61 6d 70 25  |samp%-=1:.ysamp%|
00010ae0  3d 30 20 f2 72 65 61 64  70 69 78 65 6c 72 6f 77  |=0 .readpixelrow|
00010af0  28 78 6c 25 28 29 29 3a  79 73 61 6d 70 25 3d 79  |(xl%()):ysamp%=y|
00010b00  6d 75 6c 25 0d 5a b4 25  20 20 d6 61 64 64 68 61  |mul%.Z.%  .addha|
00010b10  6c 66 25 2c 78 6c 25 28  30 2c 30 29 2c 7a 25 28  |lf%,xl%(0,0),z%(|
00010b20  30 2c 30 29 2c 78 25 3a  ed 0d 5a be 06 20 cd 0d  |0,0),x%:..Z.. ..|
00010b30  5a c8 05 cd 0d 5a d2 05  e1 0d 5a dc 10 dd 20 f2  |Z....Z....Z... .|
00010b40  66 69 74 28 7a 25 28 29  29 0d 5a e6 0d e7 65 71  |fit(z%()).Z...eq|
00010b50  75 61 6c 25 20 8c 0d 5a  f0 25 20 d6 68 69 73 74  |ual% ..Z.% .hist|
00010b60  65 71 75 61 6c 25 2c 7a  25 28 31 2c 30 29 2c 6e  |equal%,z%(1,0),n|
00010b70  65 77 25 28 30 2c 30 29  2c 78 25 0d 5a fa 05 cc  |ew%(0,0),x%.Z...|
00010b80  0d 5b 04 20 20 d6 72 61  6e 67 65 72 25 2c 7a 25  |.[.  .ranger%,z%|
00010b90  28 31 2c 30 29 2c 74 6f  74 61 6c 76 61 6c 73 25  |(1,0),totalvals%|
00010ba0  0d 5b 0e 05 cd 0d 5b 18  05 e1 0d 5b 22 11 dd 20  |.[....[....[".. |
00010bb0  f2 66 69 74 32 28 7a 25  28 29 29 0d 5b 2c 0d e7  |.fit2(z%()).[,..|
00010bc0  65 71 75 61 6c 25 20 8c  0d 5b 36 26 20 d6 68 69  |equal% ..[6& .hi|
00010bd0  73 74 65 71 75 61 6c 25  2c 7a 25 28 31 2c 30 29  |stequal%,z%(1,0)|
00010be0  2c 6e 65 77 25 28 30 2c  30 29 2c 73 78 25 0d 5b  |,new%(0,0),sx%.[|
00010bf0  40 05 cc 0d 5b 4a 21 20  d6 72 61 6e 67 65 72 25  |@...[J! .ranger%|
00010c00  2c 7a 25 28 31 2c 30 29  2c 74 6f 74 61 6c 76 61  |,z%(1,0),totalva|
00010c10  6c 73 32 25 0d 5b 54 05  cd 0d 5b 5e 05 e1 0d 5b  |ls2%.[T...[^...[|
00010c20  68 12 dd 20 f2 69 70 72  6f 77 28 7a 25 28 29 29  |h.. .iprow(z%())|
00010c30  0d 5b 72 0d c8 8e 20 66  6c 61 67 20 ca 0d 5b 7c  |.[r... flag ..[||
00010c40  48 c9 20 30 3a c8 99 31  32 2c 34 2c 63 25 2c 62  |H. 0:..12,4,c%,b|
00010c50  75 66 66 25 2c 73 78 25  3a d6 6d 61 70 70 69 78  |uff%,sx%:.mappix|
00010c60  25 2c 7a 25 28 31 2c 30  29 2c 72 25 28 30 29 2c  |%,z%(1,0),r%(0),|
00010c70  67 25 28 30 29 2c 62 25  28 30 29 2c 62 75 66 66  |g%(0),b%(0),buff|
00010c80  25 2c 73 78 25 0d 5b 86  4d c9 20 33 3a c8 99 31  |%,sx%.[.M. 3:..1|
00010c90  32 2c 34 2c 63 25 2c 62  75 66 66 25 2c 73 78 25  |2,4,c%,buff%,sx%|
00010ca0  2b 31 3e 3e 31 3a d6 6d  61 70 70 69 78 25 2c 7a  |+1>>1:.mappix%,z|
00010cb0  25 28 31 2c 30 29 2c 72  25 28 30 29 2c 67 25 28  |%(1,0),r%(0),g%(|
00010cc0  30 29 2c 62 25 28 30 29  2c 62 75 66 66 25 2c 73  |0),b%(0),buff%,s|
00010cd0  78 25 0d 5b 90 4d c9 20  36 3a c8 99 31 32 2c 34  |x%.[.M. 6:..12,4|
00010ce0  2c 63 25 2c 62 75 66 66  25 2c 73 78 25 2b 33 3e  |,c%,buff%,sx%+3>|
00010cf0  3e 32 3a d6 6d 61 70 70  69 78 25 2c 7a 25 28 31  |>2:.mappix%,z%(1|
00010d00  2c 30 29 2c 72 25 28 30  29 2c 67 25 28 30 29 2c  |,0),r%(0),g%(0),|
00010d10  62 25 28 30 29 2c 62 75  66 66 25 2c 73 78 25 0d  |b%(0),buff%,sx%.|
00010d20  5b 9a 4d c9 20 39 3a c8  99 31 32 2c 34 2c 63 25  |[.M. 9:..12,4,c%|
00010d30  2c 62 75 66 66 25 2c 73  78 25 2b 37 3e 3e 33 3a  |,buff%,sx%+7>>3:|
00010d40  d6 6d 61 70 70 69 78 25  2c 7a 25 28 31 2c 30 29  |.mappix%,z%(1,0)|
00010d50  2c 72 25 28 30 29 2c 67  25 28 30 29 2c 62 25 28  |,r%(0),g%(0),b%(|
00010d60  30 29 2c 62 75 66 66 25  2c 73 78 25 0d 5b a4 30  |0),buff%,sx%.[.0|
00010d70  c9 20 31 30 30 3a 6c 25  3d 9a 23 63 25 2b 9a 23  |. 100:l%=.#c%+.#|
00010d80  63 25 2a 32 35 36 3a c8  99 31 32 2c 34 2c 63 25  |c%*256:..12,4,c%|
00010d90  2c 62 75 66 66 25 2c 73  78 25 2a 33 0d 5b ae 0e  |,buff%,sx%*3.[..|
00010da0  20 e7 20 63 6f 6c 3d 32  20 8c 0d 5b b8 38 20 20  | . col=2 ..[.8  |
00010db0  d6 6d 61 70 70 69 78 25  2c 7a 25 28 31 2c 30 29  |.mappix%,z%(1,0)|
00010dc0  2c 72 25 28 30 29 2c 67  25 28 30 29 2c 62 25 28  |,r%(0),g%(0),b%(|
00010dd0  30 29 2c 72 62 25 2c 67  62 25 2c 62 62 25 2c 73  |0),rb%,gb%,bb%,s|
00010de0  78 25 0d 5b c2 06 20 cc  0d 5b cc 47 20 20 e3 58  |x%.[.. ..[.G  .X|
00010df0  25 3d 31 b8 73 78 25 3a  7a 25 28 58 25 2c 30 29  |%=1.sx%:z%(X%,0)|
00010e00  3d 72 25 28 72 62 25 3f  58 25 29 2a 72 77 74 2b  |=r%(rb%?X%)*rwt+|
00010e10  67 25 28 67 62 25 3f 58  25 29 2a 67 77 74 2b 62  |g%(gb%?X%)*gwt+b|
00010e20  25 28 62 62 25 3f 58 25  29 2a 62 77 74 3a ed 0d  |%(bb%?X%)*bwt:..|
00010e30  5b d6 06 20 cd 0d 5b e0  4a c9 20 32 30 30 3a c8  |[.. ..[.J. 200:.|
00010e40  99 31 32 2c 34 2c 63 25  2c 62 75 66 66 25 2c 73  |.12,4,c%,buff%,s|
00010e50  78 25 3a d6 6d 61 70 70  69 78 25 2c 7a 25 28 31  |x%:.mappix%,z%(1|
00010e60  2c 30 29 2c 72 25 28 30  29 2c 67 25 28 30 29 2c  |,0),r%(0),g%(0),|
00010e70  62 25 28 30 29 2c 62 75  66 66 25 2c 73 78 25 0d  |b%(0),buff%,sx%.|
00010e80  5b ea 14 c9 20 32 30 31  3a 58 25 3d 62 75 66 66  |[... 201:X%=buff|
00010e90  25 3a f5 0d 5b f4 43 20  20 d6 72 6c 65 78 70 61  |%:..[.C  .rlexpa|
00010ea0  6e 64 25 2c 63 61 73 78  25 2c 63 61 70 69 78 25  |nd%,casx%,capix%|
00010eb0  2c 4a 25 2c 58 25 3a e7  63 61 70 69 78 25 3d 30  |,J%,X%:.capix%=0|
00010ec0  20 63 61 70 69 78 25 3d  9a 23 63 25 2b 31 3a 4a  | capix%=.#c%+1:J|
00010ed0  25 3d 9a 23 63 25 0d 5b  fe 3b 20 fd 58 25 3d 63  |%=.#c%.[.; .X%=c|
00010ee0  61 73 78 25 3a d6 6d 61  70 70 69 78 25 2c 7a 25  |asx%:.mappix%,z%|
00010ef0  28 31 2c 30 29 2c 72 25  28 30 29 2c 67 25 28 30  |(1,0),r%(0),g%(0|
00010f00  29 2c 62 25 28 30 29 2c  62 75 66 66 25 2c 73 78  |),b%(0),buff%,sx|
00010f10  25 0d 5c 08 3c c9 20 33  30 30 3a c8 99 31 32 2c  |%.\.<. 300:..12,|
00010f20  34 2c 63 25 2c 62 75 66  66 25 2c 73 78 25 3a 58  |4,c%,buff%,sx%:X|
00010f30  25 3d 62 75 66 66 25 2b  73 78 25 3a c8 99 31 32  |%=buff%+sx%:..12|
00010f40  2c 34 2c 63 63 25 2c 58  25 2c 73 78 25 0d 5c 12  |,4,cc%,X%,sx%.\.|
00010f50  0e 20 e7 20 63 6f 6c 3d  32 20 8c 0d 5c 1c 32 20  |. . col=2 ..\.2 |
00010f60  20 d6 6d 61 70 70 69 78  25 2c 7a 25 28 31 2c 30  | .mappix%,z%(1,0|
00010f70  29 2c 72 25 28 30 29 2c  67 25 28 30 29 2c 62 25  |),r%(0),g%(0),b%|
00010f80  28 30 29 2c 62 75 66 66  25 2c 73 78 25 0d 5c 26  |(0),buff%,sx%.\&|
00010f90  49 20 20 d6 6d 61 70 70  69 78 25 2c 7a 32 25 28  |I  .mappix%,z2%(|
00010fa0  31 2c 30 29 2c 72 70 61  6c 25 28 30 29 2c 67 70  |1,0),rpal%(0),gp|
00010fb0  61 6c 25 28 30 29 2c 62  70 61 6c 25 28 30 29 2c  |al%(0),bpal%(0),|
00010fc0  58 25 2c 73 78 25 3a 7a  25 28 29 3d 7a 25 28 29  |X%,sx%:z%()=z%()|
00010fd0  2b 7a 32 25 28 29 0d 5c  30 06 20 cc 0d 5c 3a 77  |+z2%().\0. ..\:w|
00010fe0  20 20 e3 58 25 3d 31 b8  73 78 25 3a 7a 25 28 58  |  .X%=1.sx%:z%(X|
00010ff0  25 2c 30 29 3d 28 72 25  28 61 62 25 3f 58 25 29  |%,0)=(r%(ab%?X%)|
00011000  2b 72 70 61 6c 25 28 62  62 25 3f 58 25 29 29 2a  |+rpal%(bb%?X%))*|
00011010  72 77 74 2b 28 67 25 28  61 62 25 3f 58 25 29 2b  |rwt+(g%(ab%?X%)+|
00011020  67 70 61 6c 25 28 62 62  25 3f 58 25 29 29 2a 67  |gpal%(bb%?X%))*g|
00011030  77 74 2b 28 62 25 28 61  62 25 3f 58 25 29 2b 62  |wt+(b%(ab%?X%)+b|
00011040  70 61 6c 25 28 62 62 25  3f 58 25 29 29 2a 62 77  |pal%(bb%?X%))*bw|
00011050  74 3a ed 0d 5c 44 06 20  cd 0d 5c 4e 10 c9 20 34  |t:..\D. ..\N.. 4|
00011060  30 30 3a 58 25 3d 30 3a  f5 0d 5c 58 52 20 20 e7  |00:X%=0:..\XR  .|
00011070  72 74 70 69 78 25 3e 30  20 f5 58 25 3f 72 62 25  |rtpix%>0 .X%?rb%|
00011080  3d 72 4a 25 3a 58 25 3f  67 62 25 3d 67 4a 25 3a  |=rJ%:X%?gb%=gJ%:|
00011090  58 25 3f 62 62 25 3d 62  4a 25 3a 58 25 2b 3d 31  |X%?bb%=bJ%:X%+=1|
000110a0  3a 72 74 70 69 78 25 2d  3d 31 3a fd 72 74 70 69  |:rtpix%-=1:.rtpi|
000110b0  78 25 3d 30 84 58 25 3d  73 78 25 0d 5c 62 38 20  |x%=0.X%=sx%.\b8 |
000110c0  20 e7 72 74 70 69 78 25  3d 30 20 72 4a 25 3d 9a  | .rtpix%=0 rJ%=.|
000110d0  23 63 25 3a 67 4a 25 3d  9a 23 63 25 3a 62 4a 25  |#c%:gJ%=.#c%:bJ%|
000110e0  3d 9a 23 63 25 3a 72 74  70 69 78 25 3d 9a 23 63  |=.#c%:rtpix%=.#c|
000110f0  25 2b 31 0d 5c 6c 0c 20  fd 58 25 3d 73 78 25 0d  |%+1.\l. .X%=sx%.|
00011100  5c 76 0e 20 e7 20 63 6f  6c 3d 32 20 8c 0d 5c 80  |\v. . col=2 ..\.|
00011110  38 20 20 d6 6d 61 70 70  69 78 25 2c 7a 25 28 31  |8  .mappix%,z%(1|
00011120  2c 30 29 2c 72 25 28 30  29 2c 67 25 28 30 29 2c  |,0),r%(0),g%(0),|
00011130  62 25 28 30 29 2c 72 62  25 2c 67 62 25 2c 62 62  |b%(0),rb%,gb%,bb|
00011140  25 2c 73 78 25 0d 5c 8a  06 20 cc 0d 5c 94 47 20  |%,sx%.\.. ..\.G |
00011150  20 e3 58 25 3d 31 b8 73  78 25 3a 7a 25 28 58 25  | .X%=1.sx%:z%(X%|
00011160  2c 30 29 3d 72 25 28 72  62 25 3f 58 25 29 2a 72  |,0)=r%(rb%?X%)*r|
00011170  77 74 2b 67 25 28 67 62  25 3f 58 25 29 2a 67 77  |wt+g%(gb%?X%)*gw|
00011180  74 2b 62 25 28 62 62 25  3f 58 25 29 2a 62 77 74  |t+b%(bb%?X%)*bwt|
00011190  3a ed 0d 5c 9e 06 20 cd  0d 5c a8 5c c9 20 35 30  |:..\.. ..\.\. 50|
000111a0  30 3a d6 20 4c 5a 57 64  65 63 6f 64 65 25 2c 74  |0:. LZWdecode%,t|
000111b0  61 62 6c 65 25 28 30 2c  30 29 2c 63 25 2c 62 75  |able%(0,0),c%,bu|
000111c0  66 66 25 2c 73 78 25 3a  d6 6d 61 70 70 69 78 25  |ff%,sx%:.mappix%|
000111d0  2c 7a 25 28 31 2c 30 29  2c 72 25 28 30 29 2c 67  |,z%(1,0),r%(0),g|
000111e0  25 28 30 29 2c 62 25 28  30 29 2c 62 75 66 66 25  |%(0),b%(0),buff%|
000111f0  2c 73 78 25 0d 5c b2 43  c9 20 35 30 31 3a d6 6d  |,sx%.\.C. 501:.m|
00011200  61 70 70 69 78 25 2c 7a  25 28 31 2c 30 29 2c 72  |appix%,z%(1,0),r|
00011210  25 28 30 29 2c 67 25 28  30 29 2c 62 25 28 30 29  |%(0),g%(0),b%(0)|
00011220  2c 74 62 75 66 66 25 2c  73 78 25 3a 74 62 75 66  |,tbuff%,sx%:tbuf|
00011230  66 25 2b 3d 73 78 25 0d  5c bc 4a c9 20 36 30 30  |f%+=sx%.\.J. 600|
00011240  3a c8 99 31 32 2c 34 2c  63 25 2c 62 75 66 66 25  |:..12,4,c%,buff%|
00011250  2c 73 78 25 3a d6 6d 61  70 70 69 78 25 2c 7a 25  |,sx%:.mappix%,z%|
00011260  28 31 2c 30 29 2c 72 25  28 30 29 2c 67 25 28 30  |(1,0),r%(0),g%(0|
00011270  29 2c 62 25 28 30 29 2c  62 75 66 66 25 2c 73 78  |),b%(0),buff%,sx|
00011280  25 0d 5c c6 1f c9 20 37  30 30 3a c8 99 31 32 2c  |%.\... 700:..12,|
00011290  34 2c 63 25 2c 62 75 66  66 25 2c 73 78 25 2a 33  |4,c%,buff%,sx%*3|
000112a0  0d 5c d0 0e 20 e7 20 63  6f 6c 3d 32 20 8c 0d 5c  |.\.. . col=2 ..\|
000112b0  da 38 20 20 d6 6d 61 70  70 69 78 25 2c 7a 25 28  |.8  .mappix%,z%(|
000112c0  31 2c 30 29 2c 72 25 28  30 29 2c 67 25 28 30 29  |1,0),r%(0),g%(0)|
000112d0  2c 62 25 28 30 29 2c 72  62 25 2c 67 62 25 2c 62  |,b%(0),rb%,gb%,b|
000112e0  62 25 2c 73 78 25 0d 5c  e4 06 20 cc 0d 5c ee 4d  |b%,sx%.\.. ..\.M|
000112f0  20 20 e3 58 25 3d 31 b8  73 78 25 2a 33 88 33 3a  |  .X%=1.sx%*3.3:|
00011300  7a 25 28 58 25 81 33 2c  30 29 3d 72 25 28 72 62  |z%(X%.3,0)=r%(rb|
00011310  25 3f 58 25 29 2a 72 77  74 2b 67 25 28 67 62 25  |%?X%)*rwt+g%(gb%|
00011320  3f 58 25 29 2a 67 77 74  2b 62 25 28 62 62 25 3f  |?X%)*gwt+b%(bb%?|
00011330  58 25 29 2a 62 77 74 3a  ed 0d 5c f8 06 20 cd 0d  |X%)*bwt:..\.. ..|
00011340  5d 02 31 c9 20 38 30 30  3a 58 25 3d 62 75 66 66  |].1. 800:X%=buff|
00011350  25 3a d6 72 6c 65 78 70  61 6e 64 25 2c 77 74 73  |%:.rlexpand%,wts|
00011360  78 25 2c 77 74 70 69 78  25 2c 77 74 25 2c 58 25  |x%,wtpix%,wt%,X%|
00011370  0d 5d 0c 19 20 f5 20 43  25 3d 9a 23 63 25 3a c8  |.].. . C%=.#c%:.|
00011380  8e 20 43 25 3e 3e 36 20  ca 0d 5d 16 1e 20 20 20  |. C%>>6 ..]..   |
00011390  c9 20 30 3a 3f 58 25 3d  43 25 3a 58 25 2b 3d 31  |. 0:?X%=C%:X%+=1|
000113a0  3a 77 74 25 3d 43 25 0d  5d 20 3d 20 20 20 c9 20  |:wt%=C%.] =   . |
000113b0  31 3a 77 74 25 2d 3d 31  3a 77 74 70 69 78 25 3d  |1:wt%-=1:wtpix%=|
000113c0  43 25 80 36 33 3a d6 72  6c 65 78 70 61 6e 64 25  |C%.63:.rlexpand%|
000113d0  2c 77 74 73 78 25 2c 77  74 70 69 78 25 2c 77 74  |,wtsx%,wtpix%,wt|
000113e0  25 2c 58 25 0d 5d 2a 36  20 20 20 c9 20 32 3a 77  |%,X%.]*6   . 2:w|
000113f0  74 70 69 78 25 3d 43 25  80 36 33 3a d6 72 6c 65  |tpix%=C%.63:.rle|
00011400  78 70 61 6e 64 25 2c 77  74 73 78 25 2c 77 74 70  |xpand%,wtsx%,wtp|
00011410  69 78 25 2c 77 74 25 2c  58 25 0d 5d 34 3d 20 20  |ix%,wt%,X%.]4=  |
00011420  20 c9 20 33 3a 77 74 25  2b 3d 31 3a 77 74 70 69  | . 3:wt%+=1:wtpi|
00011430  78 25 3d 43 25 80 36 33  3a d6 72 6c 65 78 70 61  |x%=C%.63:.rlexpa|
00011440  6e 64 25 2c 77 74 73 78  25 2c 77 74 70 69 78 25  |nd%,wtsx%,wtpix%|
00011450  2c 77 74 25 2c 58 25 0d  5d 3e 07 20 20 cb 0d 5d  |,wt%,X%.]>.  ..]|
00011460  48 3b 20 fd 58 25 3d 77  74 73 78 25 3a d6 6d 61  |H; .X%=wtsx%:.ma|
00011470  70 70 69 78 25 2c 7a 25  28 31 2c 30 29 2c 72 25  |ppix%,z%(1,0),r%|
00011480  28 30 29 2c 67 25 28 30  29 2c 62 25 28 30 29 2c  |(0),g%(0),b%(0),|
00011490  62 75 66 66 25 2c 73 78  25 0d 5d 52 34 c9 20 38  |buff%,sx%.]R4. 8|
000114a0  30 31 3a 58 25 3d 62 75  66 66 25 3a d6 72 6c 65  |01:X%=buff%:.rle|
000114b0  78 70 61 6e 64 25 2c 77  74 73 78 31 25 2c 77 74  |xpand%,wtsx1%,wt|
000114c0  70 69 78 31 25 2c 77 74  31 25 2c 58 25 0d 5d 5c  |pix1%,wt1%,X%.]\|
000114d0  19 20 f5 20 43 25 3d 9a  23 63 25 3a c8 8e 20 43  |. . C%=.#c%:.. C|
000114e0  25 3e 3e 36 20 ca 0d 5d  66 1f 20 20 20 c9 20 30  |%>>6 ..]f.   . 0|
000114f0  3a 3f 58 25 3d 43 25 3a  58 25 2b 3d 31 3a 77 74  |:?X%=C%:X%+=1:wt|
00011500  31 25 3d 43 25 0d 5d 70  42 20 20 20 c9 20 31 3a  |1%=C%.]pB   . 1:|
00011510  77 74 31 25 2d 3d 31 3a  77 74 70 69 78 31 25 3d  |wt1%-=1:wtpix1%=|
00011520  43 25 80 36 33 3a d6 72  6c 65 78 70 61 6e 64 25  |C%.63:.rlexpand%|
00011530  2c 77 74 73 78 31 25 2c  77 74 70 69 78 31 25 2c  |,wtsx1%,wtpix1%,|
00011540  77 74 31 25 2c 58 25 0d  5d 7a 3a 20 20 20 c9 20  |wt1%,X%.]z:   . |
00011550  32 3a 77 74 70 69 78 31  25 3d 43 25 80 36 33 3a  |2:wtpix1%=C%.63:|
00011560  d6 72 6c 65 78 70 61 6e  64 25 2c 77 74 73 78 31  |.rlexpand%,wtsx1|
00011570  25 2c 77 74 70 69 78 31  25 2c 77 74 31 25 2c 58  |%,wtpix1%,wt1%,X|
00011580  25 0d 5d 84 42 20 20 20  c9 20 33 3a 77 74 31 25  |%.].B   . 3:wt1%|
00011590  2b 3d 31 3a 77 74 70 69  78 31 25 3d 43 25 80 36  |+=1:wtpix1%=C%.6|
000115a0  33 3a d6 72 6c 65 78 70  61 6e 64 25 2c 77 74 73  |3:.rlexpand%,wts|
000115b0  78 31 25 2c 77 74 70 69  78 31 25 2c 77 74 31 25  |x1%,wtpix1%,wt1%|
000115c0  2c 58 25 0d 5d 8e 07 20  20 cb 0d 5d 98 0f 20 fd  |,X%.]..  ..].. .|
000115d0  58 25 3d 77 74 73 78 31  25 0d 5d a2 26 20 d6 72  |X%=wtsx1%.].& .r|
000115e0  6c 65 78 70 61 6e 64 25  2c 77 74 73 78 32 25 2c  |lexpand%,wtsx2%,|
000115f0  77 74 70 69 78 32 25 2c  77 74 32 25 2c 58 25 0d  |wtpix2%,wt2%,X%.|
00011600  5d ac 1a 20 f5 20 43 25  3d 9a 23 63 63 25 3a c8  |].. . C%=.#cc%:.|
00011610  8e 20 43 25 3e 3e 36 20  ca 0d 5d b6 1f 20 20 20  |. C%>>6 ..]..   |
00011620  c9 20 30 3a 3f 58 25 3d  43 25 3a 58 25 2b 3d 31  |. 0:?X%=C%:X%+=1|
00011630  3a 77 74 32 25 3d 43 25  0d 5d c0 42 20 20 20 c9  |:wt2%=C%.].B   .|
00011640  20 31 3a 77 74 32 25 2d  3d 31 3a 77 74 70 69 78  | 1:wt2%-=1:wtpix|
00011650  32 25 3d 43 25 80 36 33  3a d6 72 6c 65 78 70 61  |2%=C%.63:.rlexpa|
00011660  6e 64 25 2c 77 74 73 78  32 25 2c 77 74 70 69 78  |nd%,wtsx2%,wtpix|
00011670  32 25 2c 77 74 32 25 2c  58 25 0d 5d ca 3a 20 20  |2%,wt2%,X%.].:  |
00011680  20 c9 20 32 3a 77 74 70  69 78 32 25 3d 43 25 80  | . 2:wtpix2%=C%.|
00011690  36 33 3a d6 72 6c 65 78  70 61 6e 64 25 2c 77 74  |63:.rlexpand%,wt|
000116a0  73 78 32 25 2c 77 74 70  69 78 32 25 2c 77 74 32  |sx2%,wtpix2%,wt2|
000116b0  25 2c 58 25 0d 5d d4 42  20 20 20 c9 20 33 3a 77  |%,X%.].B   . 3:w|
000116c0  74 32 25 2b 3d 31 3a 77  74 70 69 78 32 25 3d 43  |t2%+=1:wtpix2%=C|
000116d0  25 80 36 33 3a d6 72 6c  65 78 70 61 6e 64 25 2c  |%.63:.rlexpand%,|
000116e0  77 74 73 78 32 25 2c 77  74 70 69 78 32 25 2c 77  |wtsx2%,wtpix2%,w|
000116f0  74 32 25 2c 58 25 0d 5d  de 07 20 20 cb 0d 5d e8  |t2%,X%.]..  ..].|
00011700  0f 20 fd 58 25 3d 77 74  73 78 32 25 0d 5d f2 26  |. .X%=wtsx2%.].&|
00011710  20 d6 72 6c 65 78 70 61  6e 64 25 2c 77 74 73 78  | .rlexpand%,wtsx|
00011720  33 25 2c 77 74 70 69 78  33 25 2c 77 74 33 25 2c  |3%,wtpix3%,wt3%,|
00011730  58 25 0d 5d fc 1b 20 f5  20 43 25 3d 9a 23 63 63  |X%.].. . C%=.#cc|
00011740  63 25 3a c8 8e 20 43 25  3e 3e 36 20 ca 0d 5e 06  |c%:.. C%>>6 ..^.|
00011750  1f 20 20 20 c9 20 30 3a  3f 58 25 3d 43 25 3a 58  |.   . 0:?X%=C%:X|
00011760  25 2b 3d 31 3a 77 74 33  25 3d 43 25 0d 5e 10 42  |%+=1:wt3%=C%.^.B|
00011770  20 20 20 c9 20 31 3a 77  74 33 25 2d 3d 31 3a 77  |   . 1:wt3%-=1:w|
00011780  74 70 69 78 33 25 3d 43  25 80 36 33 3a d6 72 6c  |tpix3%=C%.63:.rl|
00011790  65 78 70 61 6e 64 25 2c  77 74 73 78 33 25 2c 77  |expand%,wtsx3%,w|
000117a0  74 70 69 78 33 25 2c 77  74 33 25 2c 58 25 0d 5e  |tpix3%,wt3%,X%.^|
000117b0  1a 3a 20 20 20 c9 20 32  3a 77 74 70 69 78 33 25  |.:   . 2:wtpix3%|
000117c0  3d 43 25 80 36 33 3a d6  72 6c 65 78 70 61 6e 64  |=C%.63:.rlexpand|
000117d0  25 2c 77 74 73 78 33 25  2c 77 74 70 69 78 33 25  |%,wtsx3%,wtpix3%|
000117e0  2c 77 74 33 25 2c 58 25  0d 5e 24 42 20 20 20 c9  |,wt3%,X%.^$B   .|
000117f0  20 33 3a 77 74 33 25 2b  3d 31 3a 77 74 70 69 78  | 3:wt3%+=1:wtpix|
00011800  33 25 3d 43 25 80 36 33  3a d6 72 6c 65 78 70 61  |3%=C%.63:.rlexpa|
00011810  6e 64 25 2c 77 74 73 78  33 25 2c 77 74 70 69 78  |nd%,wtsx3%,wtpix|
00011820  33 25 2c 77 74 33 25 2c  58 25 0d 5e 2e 07 20 20  |3%,wt3%,X%.^..  |
00011830  cb 0d 5e 38 0f 20 fd 58  25 3d 77 74 73 78 33 25  |..^8. .X%=wtsx3%|
00011840  0d 5e 42 0e 20 e7 20 63  6f 6c 3d 32 20 8c 0d 5e  |.^B. . col=2 ..^|
00011850  4c 38 20 20 d6 6d 61 70  70 69 78 25 2c 7a 25 28  |L8  .mappix%,z%(|
00011860  31 2c 30 29 2c 72 25 28  30 29 2c 67 25 28 30 29  |1,0),r%(0),g%(0)|
00011870  2c 62 25 28 30 29 2c 72  62 25 2c 67 62 25 2c 62  |,b%(0),rb%,gb%,b|
00011880  62 25 2c 73 78 25 0d 5e  56 06 20 cc 0d 5e 60 47  |b%,sx%.^V. ..^`G|
00011890  20 20 e3 58 25 3d 31 b8  73 78 25 3a 7a 25 28 58  |  .X%=1.sx%:z%(X|
000118a0  25 2c 30 29 3d 72 25 28  72 62 25 3f 58 25 29 2a  |%,0)=r%(rb%?X%)*|
000118b0  72 77 74 2b 67 25 28 67  62 25 3f 58 25 29 2a 67  |rwt+g%(gb%?X%)*g|
000118c0  77 74 2b 62 25 28 62 62  25 3f 58 25 29 2a 62 77  |wt+b%(bb%?X%)*bw|
000118d0  74 3a ed 0d 5e 6a 06 20  cd 0d 5e 74 4a c9 20 39  |t:..^j. ..^tJ. 9|
000118e0  30 30 3a c8 99 31 32 2c  34 2c 63 25 2c 62 75 66  |00:..12,4,c%,buf|
000118f0  66 25 2c 73 78 25 3a d6  6d 61 70 70 69 78 25 2c  |f%,sx%:.mappix%,|
00011900  7a 25 28 31 2c 30 29 2c  72 25 28 30 29 2c 67 25  |z%(1,0),r%(0),g%|
00011910  28 30 29 2c 62 25 28 30  29 2c 62 75 66 66 25 2c  |(0),b%(0),buff%,|
00011920  73 78 25 0d 5e 7e 52 c9  20 39 30 31 3a c8 99 31  |sx%.^~R. 901:..1|
00011930  32 2c 34 2c 63 25 2c 62  75 66 66 25 2c 73 78 25  |2,4,c%,buff%,sx%|
00011940  3a c8 99 31 32 2c 34 2c  63 63 25 2c 62 75 66 66  |:..12,4,cc%,buff|
00011950  25 2b 73 78 25 2c 73 78  25 3a c8 99 31 32 2c 34  |%+sx%,sx%:..12,4|
00011960  2c 63 63 63 25 2c 62 75  66 66 25 2b 73 78 25 2a  |,ccc%,buff%+sx%*|
00011970  32 2c 73 78 25 0d 5e 88  0e 20 e7 20 63 6f 6c 3d  |2,sx%.^.. . col=|
00011980  32 20 8c 0d 5e 92 38 20  20 d6 6d 61 70 70 69 78  |2 ..^.8  .mappix|
00011990  25 2c 7a 25 28 31 2c 30  29 2c 72 25 28 30 29 2c  |%,z%(1,0),r%(0),|
000119a0  67 25 28 30 29 2c 62 25  28 30 29 2c 72 62 25 2c  |g%(0),b%(0),rb%,|
000119b0  67 62 25 2c 62 62 25 2c  73 78 25 0d 5e 9c 06 20  |gb%,bb%,sx%.^.. |
000119c0  cc 0d 5e a6 47 20 20 e3  58 25 3d 31 b8 73 78 25  |..^.G  .X%=1.sx%|
000119d0  3a 7a 25 28 58 25 2c 30  29 3d 72 25 28 72 62 25  |:z%(X%,0)=r%(rb%|
000119e0  3f 58 25 29 2a 72 77 74  2b 67 25 28 67 62 25 3f  |?X%)*rwt+g%(gb%?|
000119f0  58 25 29 2a 67 77 74 2b  62 25 28 62 62 25 3f 58  |X%)*gwt+b%(bb%?X|
00011a00  25 29 2a 62 77 74 3a ed  0d 5e b0 06 20 cd 0d 5e  |%)*bwt:..^.. ..^|
00011a10  ba 4a c9 20 31 30 30 30  3a 58 25 3d 62 75 66 66  |.J. 1000:X%=buff|
00011a20  25 3a e7 70 61 70 69 78  25 3e 30 20 43 25 3d 3f  |%:.papix%>0 C%=?|
00011a30  70 61 25 3a d6 72 6c 65  78 70 61 6e 64 25 2c 70  |pa%:.rlexpand%,p|
00011a40  61 73 78 25 2c 70 61 70  69 78 25 2c 43 25 2c 58  |asx%,papix%,C%,X|
00011a50  25 3a 70 61 25 2b 3d 31  0d 5e c4 3d 20 e7 70 61  |%:pa%+=1.^.= .pa|
00011a60  70 69 78 32 25 3e 30 20  43 25 3d 3f 70 61 25 3a  |pix2%>0 C%=?pa%:|
00011a70  d6 72 6c 65 78 70 61 6e  64 25 2c 70 61 73 78 25  |.rlexpand%,pasx%|
00011a80  2c 70 61 70 69 78 32 25  2c 43 25 2c 58 25 3a 70  |,papix2%,C%,X%:p|
00011a90  61 25 2b 3d 31 0d 5e ce  16 20 f5 20 43 25 3d 9a  |a%+=1.^.. . C%=.|
00011aa0  23 63 25 3a e7 43 25 3d  30 20 8c 0d 5e d8 49 20  |#c%:.C%=0 ..^.I |
00011ab0  20 20 70 61 70 69 78 25  3d 9a 23 63 25 3a 43 25  |  papix%=.#c%:C%|
00011ac0  3d 3f 70 61 25 3a d6 72  6c 65 78 70 61 6e 64 25  |=?pa%:.rlexpand%|
00011ad0  2c 70 61 73 78 25 2c 70  61 70 69 78 25 2c 43 25  |,pasx%,papix%,C%|
00011ae0  2c 58 25 3a e7 70 61 70  69 78 25 3d 30 20 70 61  |,X%:.papix%=0 pa|
00011af0  25 2b 3d 31 0d 5e e2 07  20 20 cc 0d 5e ec 62 20  |%+=1.^..  ..^.b |
00011b00  20 20 70 61 70 69 78 32  25 3d 43 25 80 31 35 3a  |  papix2%=C%.15:|
00011b10  70 61 70 69 78 25 3d 43  25 3e 3e 34 3a e7 70 61  |papix%=C%>>4:.pa|
00011b20  70 69 78 25 3e 30 20 43  25 3d 3f 70 61 25 3a d6  |pix%>0 C%=?pa%:.|
00011b30  72 6c 65 78 70 61 6e 64  25 2c 70 61 73 78 25 2c  |rlexpand%,pasx%,|
00011b40  70 61 70 69 78 25 2c 43  25 2c 58 25 3a e7 70 61  |papix%,C%,X%:.pa|
00011b50  70 69 78 25 3d 30 20 70  61 25 2b 3d 31 0d 5e f6  |pix%=0 pa%+=1.^.|
00011b60  54 20 20 20 e7 58 25 3c  70 61 73 78 25 20 e7 70  |T   .X%<pasx% .p|
00011b70  61 70 69 78 32 25 3e 30  20 43 25 3d 3f 70 61 25  |apix2%>0 C%=?pa%|
00011b80  3a d6 72 6c 65 78 70 61  6e 64 25 2c 70 61 73 78  |:.rlexpand%,pasx|
00011b90  25 2c 70 61 70 69 78 32  25 2c 43 25 2c 58 25 3a  |%,papix2%,C%,X%:|
00011ba0  e7 70 61 70 69 78 32 25  3d 30 20 70 61 25 2b 3d  |.papix2%=0 pa%+=|
00011bb0  31 0d 5f 00 07 20 20 cd  0d 5f 0a 3b 20 fd 58 25  |1._..  .._.; .X%|
00011bc0  3d 70 61 73 78 25 3a d6  6d 61 70 70 69 78 25 2c  |=pasx%:.mappix%,|
00011bd0  7a 25 28 31 2c 30 29 2c  72 25 28 30 29 2c 67 25  |z%(1,0),r%(0),g%|
00011be0  28 30 29 2c 62 25 28 30  29 2c 62 75 66 66 25 2c  |(0),b%(0),buff%,|
00011bf0  73 78 25 0d 5f 14 4a c9  20 31 30 30 31 3a 58 25  |sx%._.J. 1001:X%|
00011c00  3d 62 75 66 66 25 3a e7  70 61 70 69 78 25 3e 30  |=buff%:.papix%>0|
00011c10  20 43 25 3d 3f 70 61 25  3a d6 72 6c 65 78 70 61  | C%=?pa%:.rlexpa|
00011c20  6e 64 25 2c 70 61 73 78  25 2c 70 61 70 69 78 25  |nd%,pasx%,papix%|
00011c30  2c 43 25 2c 58 25 3a 70  61 25 2b 3d 31 0d 5f 1e  |,C%,X%:pa%+=1._.|
00011c40  49 20 f5 20 70 61 70 69  78 25 3d 9a 23 63 25 3a  |I . papix%=.#c%:|
00011c50  43 25 3d 3f 70 61 25 3a  d6 72 6c 65 78 70 61 6e  |C%=?pa%:.rlexpan|
00011c60  64 25 2c 70 61 73 78 25  2c 70 61 70 69 78 25 2c  |d%,pasx%,papix%,|
00011c70  43 25 2c 58 25 3a e7 70  61 70 69 78 25 3d 30 20  |C%,X%:.papix%=0 |
00011c80  70 61 25 2b 3d 31 0d 5f  28 3b 20 fd 58 25 3d 70  |pa%+=1._(; .X%=p|
00011c90  61 73 78 25 3a d6 6d 61  70 70 69 78 25 2c 7a 25  |asx%:.mappix%,z%|
00011ca0  28 31 2c 30 29 2c 72 25  28 30 29 2c 67 25 28 30  |(1,0),r%(0),g%(0|
00011cb0  29 2c 62 25 28 30 29 2c  62 75 66 66 25 2c 73 78  |),b%(0),buff%,sx|
00011cc0  25 0d 5f 32 50 c9 20 31  31 30 30 3a c8 99 31 32  |%._2P. 1100:..12|
00011cd0  2c 34 2c 63 25 2c 62 75  66 66 25 2c 73 78 25 2b  |,4,c%,buff%,sx%+|
00011ce0  37 3e 3e 33 3a d6 6d 61  70 70 69 78 25 2c 7a 25  |7>>3:.mappix%,z%|
00011cf0  28 31 2c 30 29 2c 72 25  28 30 29 2c 67 25 28 30  |(1,0),r%(0),g%(0|
00011d00  29 2c 62 25 28 30 29 2c  62 75 66 66 25 2c 73 78  |),b%(0),buff%,sx|
00011d10  25 0d 5f 3c 4b c9 20 31  32 30 30 3a c8 99 31 32  |%._<K. 1200:..12|
00011d20  2c 34 2c 63 25 2c 62 75  66 66 25 2c 73 78 25 3a  |,4,c%,buff%,sx%:|
00011d30  d6 6d 61 70 70 69 78 25  2c 7a 25 28 31 2c 30 29  |.mappix%,z%(1,0)|
00011d40  2c 72 25 28 30 29 2c 67  25 28 30 29 2c 62 25 28  |,r%(0),g%(0),b%(|
00011d50  30 29 2c 62 75 66 66 25  2c 73 78 25 0d 5f 46 4b  |0),buff%,sx%._FK|
00011d60  c9 20 31 33 30 30 3a c8  99 31 32 2c 34 2c 63 25  |. 1300:..12,4,c%|
00011d70  2c 62 75 66 66 25 2c 73  78 25 3a d6 6d 61 70 70  |,buff%,sx%:.mapp|
00011d80  69 78 25 2c 7a 25 28 31  2c 30 29 2c 72 25 28 30  |ix%,z%(1,0),r%(0|
00011d90  29 2c 67 25 28 30 29 2c  62 25 28 30 29 2c 62 75  |),g%(0),b%(0),bu|
00011da0  66 66 25 2c 73 78 25 0d  5f 50 55 c9 20 31 33 30  |ff%,sx%._PU. 130|
00011db0  31 3a c8 99 31 32 2c 34  2c 63 25 2c 62 75 66 66  |1:..12,4,c%,buff|
00011dc0  25 2c 73 78 25 3a c8 99  31 32 2c 34 2c 63 63 25  |%,sx%:..12,4,cc%|
00011dd0  2c 62 75 66 66 25 2b 73  78 25 2c 73 78 25 3a c8  |,buff%+sx%,sx%:.|
00011de0  99 31 32 2c 34 2c 63 63  63 25 2c 62 75 66 66 25  |.12,4,ccc%,buff%|
00011df0  2b 73 78 25 2b 73 78 25  2c 73 78 25 0d 5f 5a 0e  |+sx%+sx%,sx%._Z.|
00011e00  20 e7 20 63 6f 6c 3d 32  20 8c 0d 5f 64 38 20 20  | . col=2 .._d8  |
00011e10  d6 6d 61 70 70 69 78 25  2c 7a 25 28 31 2c 30 29  |.mappix%,z%(1,0)|
00011e20  2c 72 25 28 30 29 2c 67  25 28 30 29 2c 62 25 28  |,r%(0),g%(0),b%(|
00011e30  30 29 2c 72 62 25 2c 67  62 25 2c 62 62 25 2c 73  |0),rb%,gb%,bb%,s|
00011e40  78 25 0d 5f 6e 06 20 cc  0d 5f 78 47 20 20 e3 58  |x%._n. .._xG  .X|
00011e50  25 3d 31 b8 73 78 25 3a  7a 25 28 58 25 2c 30 29  |%=1.sx%:z%(X%,0)|
00011e60  3d 72 25 28 72 62 25 3f  58 25 29 2a 72 77 74 2b  |=r%(rb%?X%)*rwt+|
00011e70  67 25 28 67 62 25 3f 58  25 29 2a 67 77 74 2b 62  |g%(gb%?X%)*gwt+b|
00011e80  25 28 62 62 25 3f 58 25  29 2a 62 77 74 3a ed 0d  |%(bb%?X%)*bwt:..|
00011e90  5f 82 06 20 cd 0d 5f 8c  13 c9 20 31 34 30 30 3a  |_.. .._... 1400:|
00011ea0  e7 76 72 65 70 25 20 8c  0d 5f 96 0e 20 20 76 72  |.vrep% .._..  vr|
00011eb0  65 70 25 2d 3d 31 0d 5f  a0 06 20 cc 0d 5f aa 12  |ep%-=1._.. .._..|
00011ec0  20 20 e3 58 25 3d 31 b8  71 75 61 6e 74 25 0d 5f  |  .X%=1.quant%._|
00011ed0  b4 2e 20 20 20 46 25 3d  73 74 25 28 58 25 29 3a  |..   F%=st%(X%):|
00011ee0  47 25 3d 46 25 2b 72 73  78 25 3a f5 20 43 25 3d  |G%=F%+rsx%:. C%=|
00011ef0  9a 23 63 25 3a e7 43 25  3d 30 20 8c 0d 5f be 17  |.#c%:.C%=0 .._..|
00011f00  20 20 20 20 43 25 3d 9a  23 63 25 3a e7 43 25 3d  |    C%=.#c%:.C%=|
00011f10  30 20 8c 0d 5f c8 1d 20  20 20 20 20 43 25 3d 9a  |0 .._..     C%=.|
00011f20  23 63 25 3a 76 72 65 70  25 3d 9a 23 63 25 2d 31  |#c%:vrep%=.#c%-1|
00011f30  0d 5f d2 09 20 20 20 20  cc 0d 5f dc 37 20 20 20  |._..    .._.7   |
00011f40  20 20 44 25 3d 46 25 3a  e3 45 25 3d 30 b8 70 61  |  D%=F%:.E%=0.pa|
00011f50  74 6c 65 6e 25 2d 31 3a  46 25 3f 45 25 3d 9a 23  |tlen%-1:F%?E%=.#|
00011f60  63 25 3a ed 3a 46 25 2b  3d 70 61 74 6c 65 6e 25  |c%:.:F%+=patlen%|
00011f70  0d 5f e6 43 20 20 20 20  20 e7 43 25 3e 31 20 e3  |._.C     .C%>1 .|
00011f80  49 25 3d 32 b8 43 25 3a  e3 45 25 3d 30 b8 70 61  |I%=2.C%:.E%=0.pa|
00011f90  74 6c 65 6e 25 2d 31 3a  46 25 3f 45 25 3d 44 25  |tlen%-1:F%?E%=D%|
00011fa0  3f 45 25 3a ed 3a 46 25  2b 3d 70 61 74 6c 65 6e  |?E%:.:F%+=patlen|
00011fb0  25 3a ed 0d 5f f0 09 20  20 20 20 cd 0d 5f fa 08  |%:.._..    .._..|
00011fc0  20 20 20 cc 0d 60 04 11  20 20 20 20 e7 43 25 3d  |   ..`..    .C%=|
00011fd0  31 32 38 20 8c 0d 60 0e  2f 20 20 20 20 20 43 25  |128 ..`./     C%|
00011fe0  3d 9a 23 63 25 3a e3 45  25 3d 30 b8 43 25 2d 31  |=.#c%:.E%=0.C%-1|
00011ff0  3a 46 25 3f 45 25 3d 9a  23 63 25 3a ed 3a 46 25  |:F%?E%=.#c%:.:F%|
00012000  2b 3d 43 25 0d 60 18 09  20 20 20 20 cc 0d 60 22  |+=C%.`..    ..`"|
00012010  3c 20 20 20 20 20 3f 46  25 3d 28 43 25 80 26 38  |<     ?F%=(C%.&8|
00012020  30 29 3c 3e 30 3a e3 45  25 3d 31 b8 43 25 80 26  |0)<>0:.E%=1.C%.&|
00012030  37 46 3a 46 25 3f 45 25  3d 3f 46 25 3a ed 3a 46  |7F:F%?E%=?F%:.:F|
00012040  25 2b 3d 43 25 80 26 37  46 0d 60 2c 09 20 20 20  |%+=C%.&7F.`,.   |
00012050  20 cd 0d 60 36 08 20 20  20 cd 0d 60 40 0e 20 20  | ..`6.   ..`@.  |
00012060  20 fd 46 25 3e 3d 47 25  0d 60 4a 07 20 20 ed 0d  | .F%>=G%.`J.  ..|
00012070  60 54 27 20 20 d6 70 6c  61 6e 63 6e 76 25 2c 73  |`T'  .plancnv%,s|
00012080  74 25 28 31 29 2c 71 75  61 6e 74 25 2c 62 75 66  |t%(1),quant%,buf|
00012090  66 25 2c 73 78 25 0d 60  5e 06 20 cd 0d 60 68 31  |f%,sx%.`^. ..`h1|
000120a0  20 d6 6d 61 70 70 69 78  25 2c 7a 25 28 31 2c 30  | .mappix%,z%(1,0|
000120b0  29 2c 72 25 28 30 29 2c  67 25 28 30 29 2c 62 25  |),r%(0),g%(0),b%|
000120c0  28 30 29 2c 62 75 66 66  25 2c 73 78 25 0d 60 72  |(0),buff%,sx%.`r|
000120d0  4c c9 20 31 35 30 30 3a  c8 99 31 32 2c 34 2c 63  |L. 1500:..12,4,c|
000120e0  25 2c 62 75 66 66 25 2c  6e 73 78 25 3a d6 6d 61  |%,buff%,nsx%:.ma|
000120f0  70 70 69 78 25 2c 7a 25  28 31 2c 30 29 2c 72 25  |ppix%,z%(1,0),r%|
00012100  28 30 29 2c 67 25 28 30  29 2c 62 25 28 30 29 2c  |(0),g%(0),b%(0),|
00012110  62 75 66 66 25 2c 73 78  25 0d 60 7c 2d 20 54 49  |buff%,sx%.`|- TI|
00012120  46 46 72 65 61 64 25 2d  3d 31 3a e7 54 49 46 46  |FFread%-=1:.TIFF|
00012130  72 65 61 64 25 3d 30 20  f2 54 49 46 46 6e 65 78  |read%=0 .TIFFnex|
00012140  74 73 74 72 69 70 0d 60  86 49 c9 20 31 36 30 30  |tstrip.`.I. 1600|
00012150  3a e3 58 25 3d 31 b8 71  75 61 6e 74 25 3a c8 99  |:.X%=1.quant%:..|
00012160  31 32 2c 34 2c 63 25 2c  73 74 25 28 58 25 29 2c  |12,4,c%,st%(X%),|
00012170  72 73 78 25 3a ed 3a e7  6d 61 73 6b 69 6e 67 25  |rsx%:.:.masking%|
00012180  20 8f 23 63 25 3d 8f 23  63 25 2b 72 73 78 25 0d  | .#c%=.#c%+rsx%.|
00012190  60 90 26 20 d6 70 6c 61  6e 63 6e 76 25 2c 73 74  |`.& .plancnv%,st|
000121a0  25 28 31 29 2c 71 75 61  6e 74 25 2c 62 75 66 66  |%(1),quant%,buff|
000121b0  25 2c 73 78 25 0d 60 9a  31 20 d6 6d 61 70 70 69  |%,sx%.`.1 .mappi|
000121c0  78 25 2c 7a 25 28 31 2c  30 29 2c 72 25 28 30 29  |x%,z%(1,0),r%(0)|
000121d0  2c 67 25 28 30 29 2c 62  25 28 30 29 2c 62 75 66  |,g%(0),b%(0),buf|
000121e0  66 25 2c 73 78 25 0d 60  a4 3d c9 20 31 36 30 31  |f%,sx%.`.=. 1601|
000121f0  3a e3 58 25 3d 31 b8 71  75 61 6e 74 25 3a f2 69  |:.X%=1.quant%:.i|
00012200  66 66 28 73 74 25 28 58  25 29 29 3a ed 3a e7 6d  |ff(st%(X%)):.:.m|
00012210  61 73 6b 69 6e 67 25 20  f2 69 66 66 28 62 75 66  |asking% .iff(buf|
00012220  66 25 29 0d 60 ae 6f 20  4a 25 3d 37 3a 4b 25 3d  |f%).`.o J%=7:K%=|
00012230  30 3a e3 49 25 3d 30 b8  73 78 25 2d 31 3a 45 25  |0:.I%=0.sx%-1:E%|
00012240  3d 30 3a e3 58 25 3d 31  b8 71 75 61 6e 74 25 3a  |=0:.X%=1.quant%:|
00012250  45 25 2b 3d 28 4b 25 3f  73 74 25 28 58 25 29 3e  |E%+=(K%?st%(X%)>|
00012260  3e 4a 25 80 31 29 3c 3c  58 25 3a ed 3a 62 75 66  |>J%.1)<<X%:.:buf|
00012270  66 25 3f 49 25 3d 45 25  3e 3e 31 3a 4a 25 2d 3d  |f%?I%=E%>>1:J%-=|
00012280  31 3a e7 4a 25 3c 30 20  4a 25 3d 37 3a 4b 25 2b  |1:.J%<0 J%=7:K%+|
00012290  3d 31 0d 60 b8 06 20 ed  0d 60 c2 31 20 d6 6d 61  |=1.`.. ..`.1 .ma|
000122a0  70 70 69 78 25 2c 7a 25  28 31 2c 30 29 2c 72 25  |ppix%,z%(1,0),r%|
000122b0  28 30 29 2c 67 25 28 30  29 2c 62 25 28 30 29 2c  |(0),g%(0),b%(0),|
000122c0  62 75 66 66 25 2c 73 78  25 0d 60 cc 05 cb 0d 60  |buff%,sx%.`....`|
000122d0  d6 05 e1 0d 60 e0 0d dd  20 f2 72 65 77 69 6e 64  |....`... .rewind|
000122e0  0d 60 ea 17 72 6f 77 73  25 3d 73 79 25 3a c8 8e  |.`..rows%=sy%:..|
000122f0  20 66 6c 61 67 20 ca 0d  60 f4 16 c9 20 30 2c 33  | flag ..`... 0,3|
00012300  2c 36 2c 39 3a cf 23 63  25 3d 73 74 25 0d 60 fe  |,6,9:.#c%=st%.`.|
00012310  10 c9 20 31 30 30 3a cf  23 63 25 3d 30 0d 61 08  |.. 100:.#c%=0.a.|
00012320  13 c9 20 32 30 30 3a cf  23 63 25 3d 26 36 30 30  |.. 200:.#c%=&600|
00012330  0d 61 12 1c c9 20 32 30  31 3a cf 23 63 25 3d 26  |.a... 201:.#c%=&|
00012340  36 30 30 3a 63 61 70 69  78 25 3d 30 0d 61 1c 1e  |600:capix%=0.a..|
00012350  c9 20 33 30 30 3a cf 23  63 25 3d 73 74 25 3a cf  |. 300:.#c%=st%:.|
00012360  23 63 63 25 3d 73 74 63  63 25 0d 61 26 19 c9 20  |#cc%=stcc%.a&.. |
00012370  34 30 30 3a cf 23 63 25  3d 30 3a 72 74 70 69 78  |400:.#c%=0:rtpix|
00012380  25 3d 30 0d 61 30 42 c9  20 35 30 30 3a 74 61 62  |%=0.a0B. 500:tab|
00012390  6c 65 25 28 29 3d 30 3a  e3 49 25 3d 30 b8 63 6c  |le%()=0:.I%=0.cl|
000123a0  65 61 72 63 6f 64 65 25  2d 31 3a 74 61 62 6c 65  |earcode%-1:table|
000123b0  25 28 49 25 2c 31 29 3d  49 25 3a ed 3a cf 23 63  |%(I%,1)=I%:.:.#c|
000123c0  25 3d 73 74 25 0d 61 3a  47 20 21 66 69 72 73 74  |%=st%.a:G !first|
000123d0  63 6f 64 65 3d 30 3a 21  6f 6c 64 63 6f 64 65 3d  |code=0:!oldcode=|
000123e0  30 3a 21 63 6f 64 65 73  69 7a 65 3d 73 65 74 63  |0:!codesize=setc|
000123f0  6f 64 65 73 25 2b 31 3a  21 73 74 61 63 6b 3d 73  |odes%+1:!stack=s|
00012400  74 6b 25 3a 21 73 70 3d  73 74 6b 25 0d 61 44 49  |tk%:!sp=stk%.aDI|
00012410  20 21 6d 61 78 63 6f 64  65 3d 63 6c 65 61 72 63  | !maxcode=clearc|
00012420  6f 64 65 25 2b 32 3a 21  6d 61 78 63 6f 64 65 73  |ode%+2:!maxcodes|
00012430  69 7a 65 3d 32 2a 63 6c  65 61 72 63 6f 64 65 25  |ize=2*clearcode%|
00012440  3a 21 63 75 72 62 69 74  3d 30 3a 21 6c 61 73 74  |:!curbit=0:!last|
00012450  62 69 74 3d 30 0d 61 4e  18 c9 20 35 30 31 3a 74  |bit=0.aN.. 501:t|
00012460  62 75 66 66 25 3d 6f 74  62 75 66 66 25 0d 61 58  |buff%=otbuff%.aX|
00012470  13 c9 20 36 30 30 3a cf  23 63 25 3d 26 33 38 30  |.. 600:.#c%=&380|
00012480  0d 61 62 19 c9 20 37 30  30 3a cf 23 63 25 3d 30  |.ab.. 700:.#c%=0|
00012490  3a e7 be 23 63 25 3d 22  22 0d 61 6c 1f c9 20 38  |:..#c%="".al.. 8|
000124a0  30 30 3a cf 23 63 25 3d  30 3a 77 74 70 69 78 25  |00:.#c%=0:wtpix%|
000124b0  3d 30 3a 77 74 25 3d 30  0d 61 76 54 c9 20 38 30  |=0:wt%=0.avT. 80|
000124c0  31 3a cf 23 63 25 3d 30  3a cf 23 63 63 25 3d 30  |1:.#c%=0:.#cc%=0|
000124d0  3a cf 23 63 63 63 25 3d  30 3a 77 74 70 69 78 31  |:.#ccc%=0:wtpix1|
000124e0  25 3d 30 3a 77 74 31 25  3d 30 3a 77 74 70 69 78  |%=0:wt1%=0:wtpix|
000124f0  32 25 3d 30 3a 77 74 32  25 3d 30 3a 77 74 70 69  |2%=0:wt2%=0:wtpi|
00012500  78 33 25 3d 30 3a 77 74  33 25 3d 30 0d 61 80 10  |x3%=0:wt3%=0.a..|
00012510  c9 20 39 30 30 3a cf 23  63 25 3d 30 0d 61 8a 21  |. 900:.#c%=0.a.!|
00012520  c9 20 39 30 31 3a cf 23  63 25 3d 30 3a cf 23 63  |. 901:.#c%=0:.#c|
00012530  63 25 3d 30 3a cf 23 63  63 63 25 3d 30 0d 61 94  |c%=0:.#ccc%=0.a.|
00012540  37 c9 20 31 30 30 30 2c  31 30 30 31 3a cf 23 63  |7. 1000,1001:.#c|
00012550  25 3d 73 74 25 3a 70 61  25 3d 63 74 61 62 6c 65  |%=st%:pa%=ctable|
00012560  25 3a 70 61 70 69 78 25  3d 30 3a 70 61 70 69 78  |%:papix%=0:papix|
00012570  32 25 3d 30 0d 61 9e 12  c9 20 31 31 30 30 3a cf  |2%=0.a... 1100:.|
00012580  23 63 25 3d 33 32 0d 61  a8 14 c9 20 31 32 30 30  |#c%=32.a... 1200|
00012590  3a cf 23 63 25 3d 31 36  30 30 0d 61 b2 11 c9 20  |:.#c%=1600.a... |
000125a0  31 33 30 30 3a cf 23 63  25 3d 30 0d 61 bc 22 c9  |1300:.#c%=0.a.".|
000125b0  20 31 33 30 31 3a cf 23  63 25 3d 30 3a cf 23 63  | 1301:.#c%=0:.#c|
000125c0  63 25 3d 30 3a cf 23 63  63 63 25 3d 30 0d 61 c6  |c%=0:.#ccc%=0.a.|
000125d0  1b c9 20 31 34 30 30 3a  cf 23 63 25 3d 73 74 25  |.. 1400:.#c%=st%|
000125e0  3a 76 72 65 70 25 3d 30  0d 61 d0 37 c9 20 31 35  |:vrep%=0.a.7. 15|
000125f0  30 30 3a cf 23 63 25 3d  73 74 25 28 30 29 3a 54  |00:.#c%=st%(0):T|
00012600  49 46 46 72 65 61 64 25  3d 72 6f 77 73 70 65 72  |IFFread%=rowsper|
00012610  73 74 72 69 70 3a 54 49  46 46 70 74 72 3d 30 0d  |strip:TIFFptr=0.|
00012620  61 da 18 c9 20 31 36 30  30 2c 31 36 30 31 3a cf  |a... 1600,1601:.|
00012630  23 63 25 3d 73 74 25 0d  61 e4 05 cb 0d 61 ee 05  |#c%=st%.a....a..|
00012640  e1 0d ff                                          |...|
00012643