Home » Archimedes archive » Archimedes World » AW-1991-06.adf » June91 » !AWJun91/Goodies/ProgARM/draw

!AWJun91/Goodies/ProgARM/draw

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-1991-06.adf » June91
Filename: !AWJun91/Goodies/ProgARM/draw
Read OK:
File size: 2943 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >$.draw
   20
   30MODE 12
   40
   50
   60INPUT"Enter name of draw file:"file$
   70
   80REM === Manifest constants
   90
  100draw_magic%     = &77617244
  110
  120maxFonts%        = 255
  130maxVersion%      = 201
  140
  150js_join%         = 0
  160js_endcap%       = 1
  170js_startcap%     = 2
  180js_reserv00%     = 3
  190js_mitrelim%     = 4
  200js_endtri%       = 8
  210js_starttri%     =12
  220
  230vbit%      = 1
  240
  250renderblocksize%= &744
  260RE_transform% = 0
  270RE_jointspec% = 24
  280RE_bbox%      = 40
  290RE_xscale%    = 56
  300RE_yscale%    = 60
  310RE_pxt1%      = &044
  320RE_pxt2%      = &144
  330RE_palette%   = &244
  340RE_fontn%     = &344
  341
  350DIM rblk% renderblocksize%
  360
  370REM === Now go and draw it
  380
  390file_handle%=OPENIN(file$)
  400IF file_handle%<>0 THEN
  410  file_len%   =EXT#file_handle%
  420  CLOSE#file_handle%
  430  DIM mem% file_len%
  440  OSCLI"LOAD "+file$+" "+STR$~(mem%)
  450  PROCrender_drawfile(mem%,mem%+file_len%,rblk%,0,0,1280,1024)
  460ENDIF
  470
  480END
  490
  500DEF PROCrender_drawfile(curptr%,endptr%,rblk%,x0%,y0%,x1%,y1%)
  510LOCAL rb_x0%,rb_y0%,rb_x1%,rb_y1%
  520LOCAL rmx%,rmy%
  530LOCAL xsize%,ysize%
  540LOCAL block% ,box%
  550
  560block%=curptr%
  570curptr%+= 40
  580
  590REM Check the magic tag words
  600REM and give an error if they
  610REM are no good
  620
  630IF block%!0 <> draw_magic% THEN
  640  REM Check that it is a draw file
  650  PROCerror(&11)
  660ENDIF
  670IF block%!4 > maxVersion% THEN
  680  REM make sure its a version of draw we know
  690  PROCerror(&12)
  700ENDIF
  710
  720box% = block%+24
  730
  740REM extract the bounding box of the
  750REM overall file
  760
  770rb_x0% = box%!0
  780rb_y0% = box%!4
  790rb_x1% = box%!8
  800rb_y1% = box%!12
  810
  820REM deduce the size
  830
  840xsize%=rb_x1%-rb_x0%
  850ysize%=rb_y1%-rb_y0%
  860
  870REM calculate scale factors to fit
  880REM the size of the draw file (draw units)
  890REM into the required screen rectangle (gr.units)
  900
  910rblk%!RE_xscale%=ABS(x1%-x0%)/xsize%*&01000000
  920rblk%!RE_yscale%=ABS(y1%-y0%)/ysize%*&01000000
  930
  940REM Calculate the translation factor by scaling
  950
  960rmx%=rb_x0%*ABS(x1%-x0%)/xsize%
  970rmy%=rb_y0%*ABS(y1%-y0%)/ysize%
  980
  990REM Build up the transform matrix
 1000REM giving the scle factors
 1010REM and the translations
 1020
 1030rblk%!(RE_transform%+0 )=rblk%!RE_xscale%
 1040rblk%!(RE_transform%+4 )=0
 1050rblk%!(RE_transform%+8 )=0
 1060rblk%!(RE_transform%+12)=rblk%!RE_yscale%
 1070rblk%!(RE_transform%+16)=(x0%<<8)-(rmx%<<8)
 1080rblk%!(RE_transform%+20)=(y0%<<8)-(rmy%<<8)
 1090
 1100REM record the bounding box information
 1110REM in the rblk area for ease of access
 1120
 1130rblk%!(RE_bbox%+0) =rb_x0%
 1140rblk%!(RE_bbox%+4) =rb_y0%
 1150rblk%!(RE_bbox%+8) =rb_x1%
 1160rblk%!(RE_bbox%+12)=rb_y1%
 1170
 1180REM While there are more objects left
 1190REM do one
 1200
 1210WHILE curptr% < endptr%
 1220  block%     = curptr%
 1230  curptr% = block%+block%!4
 1240  PROCdecodeObject(block%, box%,rblk%)
 1250ENDWHILE
 1260
 1270ENDPROC
 1280
 1290REM check whether an object lies within the system bounding box
 1300REM FALSE if the object is completely out of it.
 1310REM Uses the cached bounding box info from rblk.
 1320
 1330DEFFNcheckBBox(oBox%,rblk%)
 1340IF oBox%!0 > rblk%!(RE_bbox%+8) THEN
 1350  =FALSE
 1360ELSE
 1370  IF oBox%!8 < rblk%!(RE_bbox%+0) THEN
 1380    =FALSE
 1390  ELSE
 1400    IF oBox%!4 > rblk%!(RE_bbox%+12) THEN
 1410      =FALSE
 1420    ELSE
 1430      IF oBox%!12 < rblk%!(RE_bbox%+4) THEN
 1440        =FALSE
 1450      ENDIF
 1460    ENDIF
 1470  ENDIF
 1480ENDIF
 1490= TRUE
 1500
 1510REM Extract the textual name of a font
 1520
 1530DEFFNfontname(number%,rblk%)
 1540LOCALfontn%
 1550fontn%=rblk%+RE_fontn%
 1560IF fontn%!(number%*4)<=0 THEN =""
 1570=FNstring0(fontn%!(number%*4))
 1580
 1590REM Record the name of a font
 1600
 1610DEFPROCfontObject(base%, size%, box%,rblk%)
 1620LOCAL I%,fontref%,endptr%,exit%
 1630LOCALfontn%
 1640fontn%=rblk%+RE_fontn%
 1650FOR I%=1 TO maxFonts%
 1660  fontn%!(I%*4)=0
 1670NEXT
 1680endptr%=base%+size%
 1690exit%=FALSE
 1700WHILE base%<endptr% AND NOT exit%
 1710  fontref%=base%?0
 1720  IF fontref%=0 THEN
 1730    exit%=TRUE
 1740  ELSE
 1750    base%+=1
 1760    fontn%!(fontref%*4)=base%
 1770    base%+=LEN(FNfontname(fontref%,rblk%))+1
 1780  ENDIF
 1790ENDWHILE
 1800ENDPROC
 1810
 1820REM Deal with text objects
 1830
 1840DEFPROCtextObject(base%,box%,rblk%)
 1850LOCAL text_colour%,tbac_colour%
 1860LOCAL text_x%,text_y%
 1870LOCAL font%
 1880LOCAL nomSizeX%, nomSizeY%, textLength%, offset%
 1890LOCAL R0%,flg%,fonthandle%
 1900LOCAL dx%,dy%,coToPixX%,coToPixY%
 1910LOCAL transform%
 1920LOCAL xsc%,ysc%
 1930LOCAL pmfx0%,pmfx1%,pmfy0%,pmfy1%
 1940transform%=rblk%+RE_transform%
 1950xsc%= rblk%!RE_xscale%
 1960ysc%= rblk%!RE_yscale%
 1970
 1980SYS "WimpManager_ModeInfo",0 TO ,,dx%,dy%
 1990coToPixX% = dx%*256
 2000coToPixY% = dy%*256
 2010
 2020text_colour%  = base%!0
 2030IF text_colour%<>-1 THEN
 2040  tbac_colour%  = base%!4
 2050  font%         = base%?8
 2060  nomSizeX%     =(base%!12 )  / &10000*xsc%
 2070  nomSizeY%     =(base%!16 )  / &10000*ysc%
 2080  text_x%       = base%!20
 2090  text_y%       = base%!24
 2100
 2110  IF font%<>0 THEN
 2120    SYS "XFont_FindFont",,FNfontname(font%,rblk%),nomSizeX%/40,nomSizeY%/40 TO R0%;flg%
 2130    IF (flg% AND vbit%)=0 THEN
 2140      fonthandle% = R0%
 2150      SYS "XFont_SetFont",fonthandle% TO ;flg%
 2160      IF (flg% AND vbit%)=0 THEN
 2170        SYS "XColourTrans_SetFontColours",fonthandle%,tbac_colour%,text_colour%,14 TO ;flg%
 2180      ENDIF
 2190
 2200      IF (flg% AND vbit%)=0 THEN
 2210        text_x%=( text_x% /&10000*xsc%) +(transform%!16)
 2220        text_y%=( text_y% /&10000*ysc%) +(transform%!20)
 2230        SYS "XFont_Paint",,base%+28,&10,text_x%>>8,text_y%>>8 TO ;flg%
 2240      ENDIF
 2250      SYS "XFont_LoseFont",fonthandle%
 2260      IF (flg% AND vbit%)=0 THEN
 2270        ENDPROC
 2280      ENDIF
 2290    ENDIF
 2300  ENDIF
 2310
 2320  REM Either was a system font or an unavialable fancy font
 2330  REM as indicated by font=0
 2340  REM
 2350  REM Fudge the width if it was an unavailable fancy font
 2360  REM to 60% of the normal width!
 2370
 2380  IF font%<>0 THEN
 2390    nomSizeX% = (nomSizeX%*4) DIV (coToPixX%*10)
 2400    nomSizeY% = (nomSizeY%*12) DIV (coToPixY%*13)
 2410  ELSE
 2420    nomSizeX% = nomSizeX% DIV coToPixX%
 2430    nomSizeY% =nomSizeY% DIV coToPixY%
 2440  ENDIF
 2450
 2460  SYS "WimpManager_ReadVduVariables",162 TO pmfx0%,pmfy0%,pmfx1%,pmfy1%
 2470
 2480  VDU 23,17,7,2,nomSizeX%;nomSizeY%;0;
 2490  VDU 23,17,7,4,nomSizeX%;nomSizeY%;0;
 2500  SYS "XColourTrans_SetGCOL",text_colour%
 2510  text_x%=  ( text_x%                /&10000*xsc%) +(transform%!16)
 2520  IF font%<>0 THEN
 2530    text_y%=((text_y%+(base%!16)*6/8)/&10000*ysc%) +(transform%!20)
 2540  ELSE
 2550    text_y%=((text_y%+(base%!16)*7/8)/&10000*ysc%) +(transform%!20)
 2560  ENDIF
 2570
 2580  MOVE text_x%>>8,text_y%>>8
 2590
 2600  SYS "OS_Write0",base%+28
 2610
 2620  VDU 23,17,7,2,pmfx0%;pmfy0%;0;
 2630  VDU 23,17,7,4,pmfx1%;pmfy1%;0;
 2640
 2650ENDIF
 2660ENDPROC
 2670
 2680DEFPROCspriteObject(base%, box%,rblk%)
 2690LOCAL pixelWidth%, pixelHeight%, defMode%, XEig%, YEig%
 2700LOCAL sx0%,sy0%,sx1%,sy1%
 2710LOCAL r7%,r6%,l2bpp%
 2720LOCAL xsc%,ysc%
 2730LOCAL transform%
 2740LOCAL pixtab1%,pixtab2%,palette%,usep%
 2750
 2760transform%=rblk%+RE_transform%
 2770pixtab1%  =rblk%+RE_pxt1%
 2780pixtab2%  =rblk%+RE_pxt2%
 2790palette%  =rblk%+RE_palette%
 2800
 2810xsc%= rblk%!RE_xscale%
 2820ysc%= rblk%!RE_yscale%
 2830
 2840r6%=pixtab1%
 2850r7%=pixtab2%
 2860
 2870sx0%=box%!0
 2880sy0%=box%!4
 2890sx1%=box%!8
 2900sy1%=box%!12
 2910
 2920REM Get definition size in pixels
 2930SYS "OS_SpriteOp",&228,&FF,base% TO ,,,pixelWidth%,pixelHeight%,,defMode%
 2940
 2950REM Get info about the mode
 2960SYS "OS_ReadModeVariable", MODE, 4 TO ,,XEig%
 2970SYS "OS_ReadModeVariable", MODE, 5 TO ,,YEig%
 2980SYS "OS_ReadModeVariable", defMode%,9 TO ,,l2bpp%
 2990
 3000pixtab1%!0  = (((sx1%-sx0%)>>8)/&10000)*xsc%
 3010pixtab1%!4  = (((sy1%-sy0%)>>8)/&10000)*ysc%
 3020pixtab1%!8  = (pixelWidth% << XEig% )
 3030pixtab1%!12 = (pixelHeight% << YEig%)
 3040
 3050IF FNread_sprite_paletteA(base%,palette%,l2bpp%) THEN
 3060  usep%=palette%
 3070ELSE
 3080  usep%=0
 3090ENDIF
 3100SYS "ColourTrans_SelectTable",defMode%,usep%,-1,-1,r7%
 3110sx0%=  (sx0%/&10000*xsc%) +(transform%!16)
 3120sy0%=  (sy0%/&10000*ysc%) +(transform%!20)
 3130
 3140REM Plot the sprite scaled to fit
 3150REM (use &FF as the area pointer)
 3160SYS "OS_SpriteOp",&234,&FF,base%,sx0%>>8,sy0%>>8,8,r6%,r7%
 3170ENDPROC
 3180
 3190DEFPROCpathObject(base%, box%,rblk%)
 3200LOCAL ddelem%,dash%,winding%,style%,path%
 3210LOCAL fillColour%
 3220LOCAL outlineColour%
 3230LOCAL outlineWidth%
 3240LOCAL jointspec%,transform%
 3250jointspec%=rblk%+RE_jointspec%
 3260transform%=rblk%+RE_transform%
 3270fillColour%    = base%!0
 3280outlineColour% = base%!4
 3290outlineWidth%  = base%!8
 3300path%  = base%+16
 3310style% = base%!12
 3320jointspec%?js_join%     =  style%       AND 3
 3330jointspec%?js_endcap%   = (style% >> 2) AND 3
 3340jointspec%?js_startcap% = (style% >> 4) AND 3
 3350jointspec%?js_reserv00% =  0
 3360jointspec%!js_mitrelim% =  &A0000 :REM ie 10.0 postscript default!
 3370jointspec%!js_endtri% = ((style%>>12)AND&FF0)OR(((style%>>20)AND&FF0)<<16)
 3380jointspec%!js_starttri% =  jointspec%!js_endtri%
 3390winding%                = (style% >> 5)AND 2
 3400IF (style% AND &80 )<>0 THEN
 3410  ddelem%=path%!4
 3420  dash%=path%
 3430  path%=path%+ddelem%*4+8
 3440ELSE
 3450  dash%=0
 3460  path%=path%
 3470ENDIF
 3480IF fillColour% <> -1 THEN
 3490  SYS "XColourTrans_SetGCOL",fillColour%
 3500  SYS "XDraw_Fill",path%,winding% OR &30,transform%
 3510ENDIF
 3520IF outlineColour% <> -1 THEN
 3530  SYS "XColourTrans_SetGCOL",outlineColour%
 3540  SYS "XDraw_Stroke",path%,&38,transform%,,outlineWidth%,jointspec%,dash%
 3550ENDIF
 3560ENDPROC
 3570
 3580DEFPROCgroupObject(base%, size%, box%,rblk%)
 3590LOCAL offset%,newsize%
 3600offset% = 12
 3610WHILE offset% < size%
 3620  newsize%=base%!(offset%+4)
 3630  PROCdecodeObject(base%+offset%, box%,rblk%)
 3640  offset% +=newsize%
 3650ENDWHILE
 3660ENDPROC
 3670
 3680DEFPROCtaggedObject(base%,box%,rblk%)
 3690PROCdecodeObject(base%+4, box%,rblk%)
 3700ENDPROC
 3710
 3720DEFPROCdecodeObject(base%, bbox%,rblk%)
 3730LOCAL obj%, type%, size%, offset%
 3740type% = base%!0
 3750size% = base%!4
 3760IF type% = 0 THEN
 3770  REM font table (no bounding box)
 3780  offset% = 8
 3790  PROCfontObject(base%+offset%,size%-offset%,base%+8,rblk%)
 3800ELSE
 3810  IF FNcheckBBox(base%+8,rblk%) THEN
 3820    offset% = 24
 3830    CASE type% OF
 3840    WHEN 1: PROCtextObject(base%+offset%  ,base%+8,rblk%)
 3850    WHEN 2: PROCpathObject(base%+offset%  ,base%+8,rblk%)
 3860    WHEN 5: PROCspriteObject(base%+offset%,base%+8,rblk%)
 3870    WHEN 7: PROCtaggedObject(base%+offset%,base%+8,rblk%)
 3880    WHEN 6: PROCgroupObject(base%+offset% ,size%-offset%,base%+8,rblk%)
 3890    REM WHEN 9  :REM textarea
 3900    REM WHEN 10 :REM textcol
 3910    ENDCASE
 3920  ENDIF
 3930ENDIF
 3940ENDPROC
 3950
 3960DEFPROCerror(a%)
 3970ERROR a%,"Draw file rendering error"
 3980ENDPROC
 3990
 4000DEF FNstring0(s%)
 4010LOCAL I%,n$
 4020I%=0:n$=STRING$(200," "):n$=""
 4030WHILE s%?I%>31 AND I%<254
 4040  n$+=CHR$(s%?I%)
 4050  I%+=1
 4060ENDWHILE
 4070=n$
 4080
 4090REM Get hold of the palette of a sprite
 4100REM and return TRUE/FALSE to indicate
 4110REM its presence or not
 4120
 4130DEF FNread_sprite_paletteA(addr%,palette%,l2bpp%)
 4140LOCAL I%,pal%,entry%,entries%,res%,mask%
 4150res%=FALSE
 4160IF addr%<>-1 THEN
 4170  CASE l2bpp% OF
 4180  WHEN 0,1,2
 4190    entries%=1<<(1<<l2bpp%)
 4200    mask%=-1
 4210  WHEN 3
 4220    entries%=16
 4230    mask%=&70307000
 4240  ENDCASE
 4250  pal%=addr%+4*(12-1)
 4260  IF addr%!(4*(9-1))<>4*(12-1) THEN
 4270    FORI%=0 TO (entries%-1)*4 STEP4
 4280      entry%=(pal%!(I%*2)) AND mask%
 4290      palette%!I%= entry%
 4300    NEXT
 4310    res%=TRUE
 4320  ENDIF
 4330ENDIF
 4340=res%

� >$.draw

� 12
(
2
<$�"Enter name of draw file:"file$
F
P� === Manifest constants
Z
ddraw_magic%     = &77617244
n
xmaxFonts%        = 255
�maxVersion%      = 201
�
�js_join%         = 0
�js_endcap%       = 1
�js_startcap%     = 2
�js_reserv00%     = 3
�js_mitrelim%     = 4
�js_endtri%       = 8
�js_starttri%     =12
�
�vbit%      = 1
�
�renderblocksize%= &744
RE_transform% = 0
RE_jointspec% = 24
RE_bbox%      = 40
"RE_xscale%    = 56
,RE_yscale%    = 60
6RE_pxt1%      = &044
@RE_pxt2%      = &144
JRE_palette%   = &244
TRE_fontn%     = &344
U
^� rblk% renderblocksize%
h
r� === Now go and draw it
|
�file_handle%=�(file$)
�� file_handle%<>0 �
�!  file_len%   =�#file_handle%
�  �#file_handle%
�  � mem% file_len%
�!  �"LOAD "+file$+" "+�~(mem%)
�?  �render_drawfile(mem%,mem%+file_len%,rblk%,0,0,1280,1024)
��
�
��
�
�=� �render_drawfile(curptr%,endptr%,rblk%,x0%,y0%,x1%,y1%)
�!� rb_x0%,rb_y0%,rb_x1%,rb_y1%
� rmx%,rmy%
� xsize%,ysize%
� block% ,box%
&
0block%=curptr%
:curptr%+= 40
D
N� Check the magic tag words
X� and give an error if they
b� are no good
l
v� block%!0 <> draw_magic% �
�$  � Check that it is a draw file
�  �error(&11)
��
�� block%!4 > maxVersion% �
�/  � make sure its a version of draw we know
�  �error(&12)
��
�
�box% = block%+24
�
�%� extract the bounding box of the
�� overall file
�
rb_x0% = box%!0
rb_y0% = box%!4
rb_x1% = box%!8
 rb_y1% = box%!12
*
4� deduce the size
>
Hxsize%=rb_x1%-rb_x0%
Rysize%=rb_y1%-rb_y0%
\
f$� calculate scale factors to fit
p,� the size of the draw file (draw units)
z3� into the required screen rectangle (gr.units)
�
�0rblk%!RE_xscale%=�(x1%-x0%)/xsize%*&01000000
�0rblk%!RE_yscale%=�(y1%-y0%)/ysize%*&01000000
�
�1� Calculate the translation factor by scaling
�
�!rmx%=rb_x0%*�(x1%-x0%)/xsize%
�!rmy%=rb_y0%*�(y1%-y0%)/ysize%
�
�#� Build up the transform matrix
�� giving the scle factors
�� and the translations
�
-rblk%!(RE_transform%+0 )=rblk%!RE_xscale%
rblk%!(RE_transform%+4 )=0
rblk%!(RE_transform%+8 )=0
$-rblk%!(RE_transform%+12)=rblk%!RE_yscale%
./rblk%!(RE_transform%+16)=(x0%<<8)-(rmx%<<8)
8/rblk%!(RE_transform%+20)=(y0%<<8)-(rmy%<<8)
B
L)� record the bounding box information
V)� in the rblk area for ease of access
`
jrblk%!(RE_bbox%+0) =rb_x0%
trblk%!(RE_bbox%+4) =rb_y0%
~rblk%!(RE_bbox%+8) =rb_x1%
�rblk%!(RE_bbox%+12)=rb_y1%
�
�'� While there are more objects left
�� do one
�
�ȕ curptr% < endptr%
�  block%     = curptr%
�  curptr% = block%+block%!4
�'  �decodeObject(block%, box%,rblk%)
��
�
��


A� check whether an object lies within the system bounding box
2� FALSE if the object is completely out of it.
2� Uses the cached bounding box info from rblk.
(
2ݤcheckBBox(oBox%,rblk%)
<$� oBox%!0 > rblk%!(RE_bbox%+8) �
F  =�
P�
Z&  � oBox%!8 < rblk%!(RE_bbox%+0) �
d
    =�
n  �
x)    � oBox%!4 > rblk%!(RE_bbox%+12) �
�      =�
�	    �
�+      � oBox%!12 < rblk%!(RE_bbox%+4) �
�        =�
�      �
�	    �
�  �
��
�= �
�
�(� Extract the textual name of a font
�
�ݤfontname(number%,rblk%)
�fontn%
fontn%=rblk%+RE_fontn%
!� fontn%!(number%*4)<=0 � =""
"!=�string0(fontn%!(number%*4))
,
6� Record the name of a font
@
J*��fontObject(base%, size%, box%,rblk%)
T� I%,fontref%,endptr%,exit%
^�fontn%
hfontn%=rblk%+RE_fontn%
r� I%=1 � maxFonts%
|  fontn%!(I%*4)=0
��
�endptr%=base%+size%
�exit%=�
�ȕ base%<endptr% � � exit%
�  fontref%=base%?0
�  � fontref%=0 �
�    exit%=�
�  �
�    base%+=1
�!    fontn%!(fontref%*4)=base%
�-    base%+=�(�fontname(fontref%,rblk%))+1
�  �
��
�

� Deal with text objects
&
0"��textObject(base%,box%,rblk%)
:� text_colour%,tbac_colour%
D� text_x%,text_y%
N� font%
X0� nomSizeX%, nomSizeY%, textLength%, offset%
b� R0%,flg%,fonthandle%
l!� dx%,dy%,coToPixX%,coToPixY%
v� transform%
�� xsc%,ysc%
�!� pmfx0%,pmfx1%,pmfy0%,pmfy1%
�"transform%=rblk%+RE_transform%
�xsc%= rblk%!RE_xscale%
�ysc%= rblk%!RE_yscale%
�
�+ș "WimpManager_ModeInfo",0 � ,,dx%,dy%
�coToPixX% = dx%*256
�coToPixY% = dy%*256
�
�text_colour%  = base%!0
�� text_colour%<>-1 �
�  tbac_colour%  = base%!4
  font%         = base%?8
/  nomSizeX%     =(base%!12 )  / &10000*xsc%
/  nomSizeY%     =(base%!16 )  / &10000*ysc%
   text_x%       = base%!20
*  text_y%       = base%!24
4
>  � font%<>0 �
HX    ș "XFont_FindFont",,�fontname(font%,rblk%),nomSizeX%/40,nomSizeY%/40 � R0%;flg%
R    � (flg% � vbit%)=0 �
\      fonthandle% = R0%
f0      ș "XFont_SetFont",fonthandle% � ;flg%
p      � (flg% � vbit%)=0 �
z]        ș "XColourTrans_SetFontColours",fonthandle%,tbac_colour%,text_colour%,14 � ;flg%
�      �
�
�      � (flg% � vbit%)=0 �
�<        text_x%=( text_x% /&10000*xsc%) +(transform%!16)
�<        text_y%=( text_y% /&10000*ysc%) +(transform%!20)
�H        ș "XFont_Paint",,base%+28,&10,text_x%>>8,text_y%>>8 � ;flg%
�      �
�)      ș "XFont_LoseFont",fonthandle%
�      � (flg% � vbit%)=0 �
�
        �
�      �
�	    �
�  �
	
	=  � Either was a system font or an unavialable fancy font
	  � as indicated by font=0
	$  �
	.;  � Fudge the width if it was an unavailable fancy font
	8#  � to 60% of the normal width!
	B
	L  � font%<>0 �
	V2    nomSizeX% = (nomSizeX%*4) � (coToPixX%*10)
	`3    nomSizeY% = (nomSizeY%*12) � (coToPixY%*13)
	j  �
	t)    nomSizeX% = nomSizeX% � coToPixX%
	~(    nomSizeY% =nomSizeY% � coToPixY%
	�  �
	�
	�I  ș "WimpManager_ReadVduVariables",162 � pmfx0%,pmfy0%,pmfx1%,pmfy1%
	�
	�(  � 23,17,7,2,nomSizeX%;nomSizeY%;0;
	�(  � 23,17,7,4,nomSizeX%;nomSizeY%;0;
	�,  ș "XColourTrans_SetGCOL",text_colour%
	�G  text_x%=  ( text_x%                /&10000*xsc%) +(transform%!16)
	�  � font%<>0 �
	�G    text_y%=((text_y%+(base%!16)*6/8)/&10000*ysc%) +(transform%!20)
	�  �
	�G    text_y%=((text_y%+(base%!16)*7/8)/&10000*ysc%) +(transform%!20)
  �


  � text_x%>>8,text_y%>>8

(  ș "OS_Write0",base%+28
2
<"  � 23,17,7,2,pmfx0%;pmfy0%;0;
F"  � 23,17,7,4,pmfx1%;pmfy1%;0;
P
Z�
d�
n
x%��spriteObject(base%, box%,rblk%)
�7� pixelWidth%, pixelHeight%, defMode%, XEig%, YEig%
�� sx0%,sy0%,sx1%,sy1%
�� r7%,r6%,l2bpp%
�� xsc%,ysc%
�� transform%
�&� pixtab1%,pixtab2%,palette%,usep%
�
�"transform%=rblk%+RE_transform%
�pixtab1%  =rblk%+RE_pxt1%
�pixtab2%  =rblk%+RE_pxt2%
� palette%  =rblk%+RE_palette%
�
�xsc%= rblk%!RE_xscale%
ysc%= rblk%!RE_yscale%

r6%=pixtab1%
"r7%=pixtab2%
,
6sx0%=box%!0
@sy0%=box%!4
Jsx1%=box%!8
Tsy1%=box%!12
^
h#� Get definition size in pixels
rKș "OS_SpriteOp",&228,&FF,base% � ,,,pixelWidth%,pixelHeight%,,defMode%
|
�� Get info about the mode
�,ș "OS_ReadModeVariable", �, 4 � ,,XEig%
�,ș "OS_ReadModeVariable", �, 5 � ,,YEig%
�3ș "OS_ReadModeVariable", defMode%,9 � ,,l2bpp%
�
�0pixtab1%!0  = (((sx1%-sx0%)>>8)/&10000)*xsc%
�0pixtab1%!4  = (((sy1%-sy0%)>>8)/&10000)*ysc%
�)pixtab1%!8  = (pixelWidth% << XEig% )
�)pixtab1%!12 = (pixelHeight% << YEig%)
�
�4� �read_sprite_paletteA(base%,palette%,l2bpp%) �
�  usep%=palette%
��

  usep%=0
�
9ș "ColourTrans_SelectTable",defMode%,usep%,-1,-1,r7%
&.sx0%=  (sx0%/&10000*xsc%) +(transform%!16)
0.sy0%=  (sy0%/&10000*ysc%) +(transform%!20)
:
D#� Plot the sprite scaled to fit
N#� (use &FF as the area pointer)
X=ș "OS_SpriteOp",&234,&FF,base%,sx0%>>8,sy0%>>8,8,r6%,r7%
b�
l
v#��pathObject(base%, box%,rblk%)
�)� ddelem%,dash%,winding%,style%,path%
�� fillColour%
�� outlineColour%
�� outlineWidth%
�� jointspec%,transform%
�"jointspec%=rblk%+RE_jointspec%
�"transform%=rblk%+RE_transform%
�fillColour%    = base%!0
�outlineColour% = base%!4
�outlineWidth%  = base%!8
�path%  = base%+16
�style% = base%!12
�/jointspec%?js_join%     =  style%       � 3

/jointspec%?js_endcap%   = (style% >> 2) � 3

/jointspec%?js_startcap% = (style% >> 4) � 3

 jointspec%?js_reserv00% =  0

 Djointspec%!js_mitrelim% =  &A0000 :� ie 10.0 postscript default!

*Ijointspec%!js_endtri% = ((style%>>12)�&FF0)�(((style%>>20)�&FF0)<<16)

44jointspec%!js_starttri% =  jointspec%!js_endtri%

>.winding%                = (style% >> 5)� 2

H� (style% � &80 )<>0 �

R  ddelem%=path%!4

\  dash%=path%

f  path%=path%+ddelem%*4+8

p�

z
  dash%=0

�  path%=path%

��

�� fillColour% <> -1 �

�+  ș "XColourTrans_SetGCOL",fillColour%

�5  ș "XDraw_Fill",path%,winding% � &30,transform%

��

�� outlineColour% <> -1 �

�.  ș "XColourTrans_SetGCOL",outlineColour%

�L  ș "XDraw_Stroke",path%,&38,transform%,,outlineWidth%,jointspec%,dash%

��

��

�

�+��groupObject(base%, size%, box%,rblk%)
� offset%,newsize%
offset% = 12
ȕ offset% < size%
$   newsize%=base%!(offset%+4)
..  �decodeObject(base%+offset%, box%,rblk%)
8  offset% +=newsize%
B�
L�
V
`$��taggedObject(base%,box%,rblk%)
j&�decodeObject(base%+4, box%,rblk%)
t�
~
�&��decodeObject(base%, bbox%,rblk%)
�!� obj%, type%, size%, offset%
�type% = base%!0
�size% = base%!4
�� type% = 0 �
�$  � font table (no bounding box)
�  offset% = 8
�<  �fontObject(base%+offset%,size%-offset%,base%+8,rblk%)
��
�#  � �checkBBox(base%+8,rblk%) �
�    offset% = 24
�    Ȏ type% �
7    � 1: �textObject(base%+offset%  ,base%+8,rblk%)

7    � 2: �pathObject(base%+offset%  ,base%+8,rblk%)
7    � 5: �spriteObject(base%+offset%,base%+8,rblk%)
7    � 7: �taggedObject(base%+offset%,base%+8,rblk%)
(E    � 6: �groupObject(base%+offset% ,size%-offset%,base%+8,rblk%)
2    � WHEN 9  :REM textarea
<    � WHEN 10 :REM textcol
F	    �
P  �
Z�
d�
n
x��error(a%)
�$� a%,"Draw file rendering error"
��
�
�� �string0(s%)
�� I%,n$
�I%=0:n$=�200," "):n$=""
�ȕ s%?I%>31 � I%<254
�  n$+=�(s%?I%)
�  I%+=1
��
�=n$
�
�)� Get hold of the palette of a sprite
'� and return TRUE/FALSE to indicate
� its presence or not

"2� �read_sprite_paletteA(addr%,palette%,l2bpp%)
,(� I%,pal%,entry%,entries%,res%,mask%
6
res%=�
@� addr%<>-1 �
J  Ȏ l2bpp% �
T
  � 0,1,2
^    entries%=1<<(1<<l2bpp%)
h    mask%=-1
r	  � 3
|    entries%=16
�    mask%=&70307000
�  �
�  pal%=addr%+4*(12-1)
�#  � addr%!(4*(9-1))<>4*(12-1) �
�!    �I%=0 � (entries%-1)*4 �4
�&      entry%=(pal%!(I%*2)) � mask%
�      palette%!I%= entry%
�	    �
�    res%=�
�  �
��
�	=res%
�
00000000  0d 00 0a 0d f4 20 3e 24  2e 64 72 61 77 0d 00 14  |..... >$.draw...|
00000010  04 0d 00 1e 08 eb 20 31  32 0d 00 28 04 0d 00 32  |...... 12..(...2|
00000020  04 0d 00 3c 24 e8 22 45  6e 74 65 72 20 6e 61 6d  |...<$."Enter nam|
00000030  65 20 6f 66 20 64 72 61  77 20 66 69 6c 65 3a 22  |e of draw file:"|
00000040  66 69 6c 65 24 0d 00 46  04 0d 00 50 1c f4 20 3d  |file$..F...P.. =|
00000050  3d 3d 20 4d 61 6e 69 66  65 73 74 20 63 6f 6e 73  |== Manifest cons|
00000060  74 61 6e 74 73 0d 00 5a  04 0d 00 64 1f 64 72 61  |tants..Z...d.dra|
00000070  77 5f 6d 61 67 69 63 25  20 20 20 20 20 3d 20 26  |w_magic%     = &|
00000080  37 37 36 31 37 32 34 34  0d 00 6e 04 0d 00 78 1a  |77617244..n...x.|
00000090  6d 61 78 46 6f 6e 74 73  25 20 20 20 20 20 20 20  |maxFonts%       |
000000a0  20 3d 20 32 35 35 0d 00  82 1a 6d 61 78 56 65 72  | = 255....maxVer|
000000b0  73 69 6f 6e 25 20 20 20  20 20 20 3d 20 32 30 31  |sion%      = 201|
000000c0  0d 00 8c 04 0d 00 96 18  6a 73 5f 6a 6f 69 6e 25  |........js_join%|
000000d0  20 20 20 20 20 20 20 20  20 3d 20 30 0d 00 a0 18  |         = 0....|
000000e0  6a 73 5f 65 6e 64 63 61  70 25 20 20 20 20 20 20  |js_endcap%      |
000000f0  20 3d 20 31 0d 00 aa 18  6a 73 5f 73 74 61 72 74  | = 1....js_start|
00000100  63 61 70 25 20 20 20 20  20 3d 20 32 0d 00 b4 18  |cap%     = 2....|
00000110  6a 73 5f 72 65 73 65 72  76 30 30 25 20 20 20 20  |js_reserv00%    |
00000120  20 3d 20 33 0d 00 be 18  6a 73 5f 6d 69 74 72 65  | = 3....js_mitre|
00000130  6c 69 6d 25 20 20 20 20  20 3d 20 34 0d 00 c8 18  |lim%     = 4....|
00000140  6a 73 5f 65 6e 64 74 72  69 25 20 20 20 20 20 20  |js_endtri%      |
00000150  20 3d 20 38 0d 00 d2 18  6a 73 5f 73 74 61 72 74  | = 8....js_start|
00000160  74 72 69 25 20 20 20 20  20 3d 31 32 0d 00 dc 04  |tri%     =12....|
00000170  0d 00 e6 12 76 62 69 74  25 20 20 20 20 20 20 3d  |....vbit%      =|
00000180  20 31 0d 00 f0 04 0d 00  fa 1a 72 65 6e 64 65 72  | 1........render|
00000190  62 6c 6f 63 6b 73 69 7a  65 25 3d 20 26 37 34 34  |blocksize%= &744|
000001a0  0d 01 04 15 52 45 5f 74  72 61 6e 73 66 6f 72 6d  |....RE_transform|
000001b0  25 20 3d 20 30 0d 01 0e  16 52 45 5f 6a 6f 69 6e  |% = 0....RE_join|
000001c0  74 73 70 65 63 25 20 3d  20 32 34 0d 01 18 16 52  |tspec% = 24....R|
000001d0  45 5f 62 62 6f 78 25 20  20 20 20 20 20 3d 20 34  |E_bbox%      = 4|
000001e0  30 0d 01 22 16 52 45 5f  78 73 63 61 6c 65 25 20  |0..".RE_xscale% |
000001f0  20 20 20 3d 20 35 36 0d  01 2c 16 52 45 5f 79 73  |   = 56..,.RE_ys|
00000200  63 61 6c 65 25 20 20 20  20 3d 20 36 30 0d 01 36  |cale%    = 60..6|
00000210  18 52 45 5f 70 78 74 31  25 20 20 20 20 20 20 3d  |.RE_pxt1%      =|
00000220  20 26 30 34 34 0d 01 40  18 52 45 5f 70 78 74 32  | &044..@.RE_pxt2|
00000230  25 20 20 20 20 20 20 3d  20 26 31 34 34 0d 01 4a  |%      = &144..J|
00000240  18 52 45 5f 70 61 6c 65  74 74 65 25 20 20 20 3d  |.RE_palette%   =|
00000250  20 26 32 34 34 0d 01 54  18 52 45 5f 66 6f 6e 74  | &244..T.RE_font|
00000260  6e 25 20 20 20 20 20 3d  20 26 33 34 34 0d 01 55  |n%     = &344..U|
00000270  04 0d 01 5e 1c de 20 72  62 6c 6b 25 20 72 65 6e  |...^.. rblk% ren|
00000280  64 65 72 62 6c 6f 63 6b  73 69 7a 65 25 0d 01 68  |derblocksize%..h|
00000290  04 0d 01 72 1c f4 20 3d  3d 3d 20 4e 6f 77 20 67  |...r.. === Now g|
000002a0  6f 20 61 6e 64 20 64 72  61 77 20 69 74 0d 01 7c  |o and draw it..||
000002b0  04 0d 01 86 19 66 69 6c  65 5f 68 61 6e 64 6c 65  |.....file_handle|
000002c0  25 3d 8e 28 66 69 6c 65  24 29 0d 01 90 17 e7 20  |%=.(file$)..... |
000002d0  66 69 6c 65 5f 68 61 6e  64 6c 65 25 3c 3e 30 20  |file_handle%<>0 |
000002e0  8c 0d 01 9a 21 20 20 66  69 6c 65 5f 6c 65 6e 25  |....!  file_len%|
000002f0  20 20 20 3d a2 23 66 69  6c 65 5f 68 61 6e 64 6c  |   =.#file_handl|
00000300  65 25 0d 01 a4 14 20 20  d9 23 66 69 6c 65 5f 68  |e%....  .#file_h|
00000310  61 6e 64 6c 65 25 0d 01  ae 16 20 20 de 20 6d 65  |andle%....  . me|
00000320  6d 25 20 66 69 6c 65 5f  6c 65 6e 25 0d 01 b8 21  |m% file_len%...!|
00000330  20 20 ff 22 4c 4f 41 44  20 22 2b 66 69 6c 65 24  |  ."LOAD "+file$|
00000340  2b 22 20 22 2b c3 7e 28  6d 65 6d 25 29 0d 01 c2  |+" "+.~(mem%)...|
00000350  3f 20 20 f2 72 65 6e 64  65 72 5f 64 72 61 77 66  |?  .render_drawf|
00000360  69 6c 65 28 6d 65 6d 25  2c 6d 65 6d 25 2b 66 69  |ile(mem%,mem%+fi|
00000370  6c 65 5f 6c 65 6e 25 2c  72 62 6c 6b 25 2c 30 2c  |le_len%,rblk%,0,|
00000380  30 2c 31 32 38 30 2c 31  30 32 34 29 0d 01 cc 05  |0,1280,1024)....|
00000390  cd 0d 01 d6 04 0d 01 e0  05 e0 0d 01 ea 04 0d 01  |................|
000003a0  f4 3d dd 20 f2 72 65 6e  64 65 72 5f 64 72 61 77  |.=. .render_draw|
000003b0  66 69 6c 65 28 63 75 72  70 74 72 25 2c 65 6e 64  |file(curptr%,end|
000003c0  70 74 72 25 2c 72 62 6c  6b 25 2c 78 30 25 2c 79  |ptr%,rblk%,x0%,y|
000003d0  30 25 2c 78 31 25 2c 79  31 25 29 0d 01 fe 21 ea  |0%,x1%,y1%)...!.|
000003e0  20 72 62 5f 78 30 25 2c  72 62 5f 79 30 25 2c 72  | rb_x0%,rb_y0%,r|
000003f0  62 5f 78 31 25 2c 72 62  5f 79 31 25 0d 02 08 0f  |b_x1%,rb_y1%....|
00000400  ea 20 72 6d 78 25 2c 72  6d 79 25 0d 02 12 13 ea  |. rmx%,rmy%.....|
00000410  20 78 73 69 7a 65 25 2c  79 73 69 7a 65 25 0d 02  | xsize%,ysize%..|
00000420  1c 12 ea 20 62 6c 6f 63  6b 25 20 2c 62 6f 78 25  |... block% ,box%|
00000430  0d 02 26 04 0d 02 30 12  62 6c 6f 63 6b 25 3d 63  |..&...0.block%=c|
00000440  75 72 70 74 72 25 0d 02  3a 10 63 75 72 70 74 72  |urptr%..:.curptr|
00000450  25 2b 3d 20 34 30 0d 02  44 04 0d 02 4e 1f f4 20  |%+= 40..D...N.. |
00000460  43 68 65 63 6b 20 74 68  65 20 6d 61 67 69 63 20  |Check the magic |
00000470  74 61 67 20 77 6f 72 64  73 0d 02 58 1f f4 20 61  |tag words..X.. a|
00000480  6e 64 20 67 69 76 65 20  61 6e 20 65 72 72 6f 72  |nd give an error|
00000490  20 69 66 20 74 68 65 79  0d 02 62 11 f4 20 61 72  | if they..b.. ar|
000004a0  65 20 6e 6f 20 67 6f 6f  64 0d 02 6c 04 0d 02 76  |e no good..l...v|
000004b0  1f e7 20 62 6c 6f 63 6b  25 21 30 20 3c 3e 20 64  |.. block%!0 <> d|
000004c0  72 61 77 5f 6d 61 67 69  63 25 20 8c 0d 02 80 24  |raw_magic% ....$|
000004d0  20 20 f4 20 43 68 65 63  6b 20 74 68 61 74 20 69  |  . Check that i|
000004e0  74 20 69 73 20 61 20 64  72 61 77 20 66 69 6c 65  |t is a draw file|
000004f0  0d 02 8a 11 20 20 f2 65  72 72 6f 72 28 26 31 31  |....  .error(&11|
00000500  29 0d 02 94 05 cd 0d 02  9e 1e e7 20 62 6c 6f 63  |).......... bloc|
00000510  6b 25 21 34 20 3e 20 6d  61 78 56 65 72 73 69 6f  |k%!4 > maxVersio|
00000520  6e 25 20 8c 0d 02 a8 2f  20 20 f4 20 6d 61 6b 65  |n% ..../  . make|
00000530  20 73 75 72 65 20 69 74  73 20 61 20 76 65 72 73  | sure its a vers|
00000540  69 6f 6e 20 6f 66 20 64  72 61 77 20 77 65 20 6b  |ion of draw we k|
00000550  6e 6f 77 0d 02 b2 11 20  20 f2 65 72 72 6f 72 28  |now....  .error(|
00000560  26 31 32 29 0d 02 bc 05  cd 0d 02 c6 04 0d 02 d0  |&12)............|
00000570  14 62 6f 78 25 20 3d 20  62 6c 6f 63 6b 25 2b 32  |.box% = block%+2|
00000580  34 0d 02 da 04 0d 02 e4  25 f4 20 65 78 74 72 61  |4.......%. extra|
00000590  63 74 20 74 68 65 20 62  6f 75 6e 64 69 6e 67 20  |ct the bounding |
000005a0  62 6f 78 20 6f 66 20 74  68 65 0d 02 ee 12 f4 20  |box of the..... |
000005b0  6f 76 65 72 61 6c 6c 20  66 69 6c 65 0d 02 f8 04  |overall file....|
000005c0  0d 03 02 13 72 62 5f 78  30 25 20 3d 20 62 6f 78  |....rb_x0% = box|
000005d0  25 21 30 0d 03 0c 13 72  62 5f 79 30 25 20 3d 20  |%!0....rb_y0% = |
000005e0  62 6f 78 25 21 34 0d 03  16 13 72 62 5f 78 31 25  |box%!4....rb_x1%|
000005f0  20 3d 20 62 6f 78 25 21  38 0d 03 20 14 72 62 5f  | = box%!8.. .rb_|
00000600  79 31 25 20 3d 20 62 6f  78 25 21 31 32 0d 03 2a  |y1% = box%!12..*|
00000610  04 0d 03 34 15 f4 20 64  65 64 75 63 65 20 74 68  |...4.. deduce th|
00000620  65 20 73 69 7a 65 0d 03  3e 04 0d 03 48 18 78 73  |e size..>...H.xs|
00000630  69 7a 65 25 3d 72 62 5f  78 31 25 2d 72 62 5f 78  |ize%=rb_x1%-rb_x|
00000640  30 25 0d 03 52 18 79 73  69 7a 65 25 3d 72 62 5f  |0%..R.ysize%=rb_|
00000650  79 31 25 2d 72 62 5f 79  30 25 0d 03 5c 04 0d 03  |y1%-rb_y0%..\...|
00000660  66 24 f4 20 63 61 6c 63  75 6c 61 74 65 20 73 63  |f$. calculate sc|
00000670  61 6c 65 20 66 61 63 74  6f 72 73 20 74 6f 20 66  |ale factors to f|
00000680  69 74 0d 03 70 2c f4 20  74 68 65 20 73 69 7a 65  |it..p,. the size|
00000690  20 6f 66 20 74 68 65 20  64 72 61 77 20 66 69 6c  | of the draw fil|
000006a0  65 20 28 64 72 61 77 20  75 6e 69 74 73 29 0d 03  |e (draw units)..|
000006b0  7a 33 f4 20 69 6e 74 6f  20 74 68 65 20 72 65 71  |z3. into the req|
000006c0  75 69 72 65 64 20 73 63  72 65 65 6e 20 72 65 63  |uired screen rec|
000006d0  74 61 6e 67 6c 65 20 28  67 72 2e 75 6e 69 74 73  |tangle (gr.units|
000006e0  29 0d 03 84 04 0d 03 8e  30 72 62 6c 6b 25 21 52  |).......0rblk%!R|
000006f0  45 5f 78 73 63 61 6c 65  25 3d 94 28 78 31 25 2d  |E_xscale%=.(x1%-|
00000700  78 30 25 29 2f 78 73 69  7a 65 25 2a 26 30 31 30  |x0%)/xsize%*&010|
00000710  30 30 30 30 30 0d 03 98  30 72 62 6c 6b 25 21 52  |00000...0rblk%!R|
00000720  45 5f 79 73 63 61 6c 65  25 3d 94 28 79 31 25 2d  |E_yscale%=.(y1%-|
00000730  79 30 25 29 2f 79 73 69  7a 65 25 2a 26 30 31 30  |y0%)/ysize%*&010|
00000740  30 30 30 30 30 0d 03 a2  04 0d 03 ac 31 f4 20 43  |00000.......1. C|
00000750  61 6c 63 75 6c 61 74 65  20 74 68 65 20 74 72 61  |alculate the tra|
00000760  6e 73 6c 61 74 69 6f 6e  20 66 61 63 74 6f 72 20  |nslation factor |
00000770  62 79 20 73 63 61 6c 69  6e 67 0d 03 b6 04 0d 03  |by scaling......|
00000780  c0 21 72 6d 78 25 3d 72  62 5f 78 30 25 2a 94 28  |.!rmx%=rb_x0%*.(|
00000790  78 31 25 2d 78 30 25 29  2f 78 73 69 7a 65 25 0d  |x1%-x0%)/xsize%.|
000007a0  03 ca 21 72 6d 79 25 3d  72 62 5f 79 30 25 2a 94  |..!rmy%=rb_y0%*.|
000007b0  28 79 31 25 2d 79 30 25  29 2f 79 73 69 7a 65 25  |(y1%-y0%)/ysize%|
000007c0  0d 03 d4 04 0d 03 de 23  f4 20 42 75 69 6c 64 20  |.......#. Build |
000007d0  75 70 20 74 68 65 20 74  72 61 6e 73 66 6f 72 6d  |up the transform|
000007e0  20 6d 61 74 72 69 78 0d  03 e8 1d f4 20 67 69 76  | matrix..... giv|
000007f0  69 6e 67 20 74 68 65 20  73 63 6c 65 20 66 61 63  |ing the scle fac|
00000800  74 6f 72 73 0d 03 f2 1a  f4 20 61 6e 64 20 74 68  |tors..... and th|
00000810  65 20 74 72 61 6e 73 6c  61 74 69 6f 6e 73 0d 03  |e translations..|
00000820  fc 04 0d 04 06 2d 72 62  6c 6b 25 21 28 52 45 5f  |.....-rblk%!(RE_|
00000830  74 72 61 6e 73 66 6f 72  6d 25 2b 30 20 29 3d 72  |transform%+0 )=r|
00000840  62 6c 6b 25 21 52 45 5f  78 73 63 61 6c 65 25 0d  |blk%!RE_xscale%.|
00000850  04 10 1e 72 62 6c 6b 25  21 28 52 45 5f 74 72 61  |...rblk%!(RE_tra|
00000860  6e 73 66 6f 72 6d 25 2b  34 20 29 3d 30 0d 04 1a  |nsform%+4 )=0...|
00000870  1e 72 62 6c 6b 25 21 28  52 45 5f 74 72 61 6e 73  |.rblk%!(RE_trans|
00000880  66 6f 72 6d 25 2b 38 20  29 3d 30 0d 04 24 2d 72  |form%+8 )=0..$-r|
00000890  62 6c 6b 25 21 28 52 45  5f 74 72 61 6e 73 66 6f  |blk%!(RE_transfo|
000008a0  72 6d 25 2b 31 32 29 3d  72 62 6c 6b 25 21 52 45  |rm%+12)=rblk%!RE|
000008b0  5f 79 73 63 61 6c 65 25  0d 04 2e 2f 72 62 6c 6b  |_yscale%.../rblk|
000008c0  25 21 28 52 45 5f 74 72  61 6e 73 66 6f 72 6d 25  |%!(RE_transform%|
000008d0  2b 31 36 29 3d 28 78 30  25 3c 3c 38 29 2d 28 72  |+16)=(x0%<<8)-(r|
000008e0  6d 78 25 3c 3c 38 29 0d  04 38 2f 72 62 6c 6b 25  |mx%<<8)..8/rblk%|
000008f0  21 28 52 45 5f 74 72 61  6e 73 66 6f 72 6d 25 2b  |!(RE_transform%+|
00000900  32 30 29 3d 28 79 30 25  3c 3c 38 29 2d 28 72 6d  |20)=(y0%<<8)-(rm|
00000910  79 25 3c 3c 38 29 0d 04  42 04 0d 04 4c 29 f4 20  |y%<<8)..B...L). |
00000920  72 65 63 6f 72 64 20 74  68 65 20 62 6f 75 6e 64  |record the bound|
00000930  69 6e 67 20 62 6f 78 20  69 6e 66 6f 72 6d 61 74  |ing box informat|
00000940  69 6f 6e 0d 04 56 29 f4  20 69 6e 20 74 68 65 20  |ion..V). in the |
00000950  72 62 6c 6b 20 61 72 65  61 20 66 6f 72 20 65 61  |rblk area for ea|
00000960  73 65 20 6f 66 20 61 63  63 65 73 73 0d 04 60 04  |se of access..`.|
00000970  0d 04 6a 1e 72 62 6c 6b  25 21 28 52 45 5f 62 62  |..j.rblk%!(RE_bb|
00000980  6f 78 25 2b 30 29 20 3d  72 62 5f 78 30 25 0d 04  |ox%+0) =rb_x0%..|
00000990  74 1e 72 62 6c 6b 25 21  28 52 45 5f 62 62 6f 78  |t.rblk%!(RE_bbox|
000009a0  25 2b 34 29 20 3d 72 62  5f 79 30 25 0d 04 7e 1e  |%+4) =rb_y0%..~.|
000009b0  72 62 6c 6b 25 21 28 52  45 5f 62 62 6f 78 25 2b  |rblk%!(RE_bbox%+|
000009c0  38 29 20 3d 72 62 5f 78  31 25 0d 04 88 1e 72 62  |8) =rb_x1%....rb|
000009d0  6c 6b 25 21 28 52 45 5f  62 62 6f 78 25 2b 31 32  |lk%!(RE_bbox%+12|
000009e0  29 3d 72 62 5f 79 31 25  0d 04 92 04 0d 04 9c 27  |)=rb_y1%.......'|
000009f0  f4 20 57 68 69 6c 65 20  74 68 65 72 65 20 61 72  |. While there ar|
00000a00  65 20 6d 6f 72 65 20 6f  62 6a 65 63 74 73 20 6c  |e more objects l|
00000a10  65 66 74 0d 04 a6 0c f4  20 64 6f 20 6f 6e 65 0d  |eft..... do one.|
00000a20  04 b0 04 0d 04 ba 18 c8  95 20 63 75 72 70 74 72  |......... curptr|
00000a30  25 20 3c 20 65 6e 64 70  74 72 25 0d 04 c4 1a 20  |% < endptr%.... |
00000a40  20 62 6c 6f 63 6b 25 20  20 20 20 20 3d 20 63 75  | block%     = cu|
00000a50  72 70 74 72 25 0d 04 ce  1f 20 20 63 75 72 70 74  |rptr%....  curpt|
00000a60  72 25 20 3d 20 62 6c 6f  63 6b 25 2b 62 6c 6f 63  |r% = block%+bloc|
00000a70  6b 25 21 34 0d 04 d8 27  20 20 f2 64 65 63 6f 64  |k%!4...'  .decod|
00000a80  65 4f 62 6a 65 63 74 28  62 6c 6f 63 6b 25 2c 20  |eObject(block%, |
00000a90  62 6f 78 25 2c 72 62 6c  6b 25 29 0d 04 e2 05 ce  |box%,rblk%).....|
00000aa0  0d 04 ec 04 0d 04 f6 05  e1 0d 05 00 04 0d 05 0a  |................|
00000ab0  41 f4 20 63 68 65 63 6b  20 77 68 65 74 68 65 72  |A. check whether|
00000ac0  20 61 6e 20 6f 62 6a 65  63 74 20 6c 69 65 73 20  | an object lies |
00000ad0  77 69 74 68 69 6e 20 74  68 65 20 73 79 73 74 65  |within the syste|
00000ae0  6d 20 62 6f 75 6e 64 69  6e 67 20 62 6f 78 0d 05  |m bounding box..|
00000af0  14 32 f4 20 46 41 4c 53  45 20 69 66 20 74 68 65  |.2. FALSE if the|
00000b00  20 6f 62 6a 65 63 74 20  69 73 20 63 6f 6d 70 6c  | object is compl|
00000b10  65 74 65 6c 79 20 6f 75  74 20 6f 66 20 69 74 2e  |etely out of it.|
00000b20  0d 05 1e 32 f4 20 55 73  65 73 20 74 68 65 20 63  |...2. Uses the c|
00000b30  61 63 68 65 64 20 62 6f  75 6e 64 69 6e 67 20 62  |ached bounding b|
00000b40  6f 78 20 69 6e 66 6f 20  66 72 6f 6d 20 72 62 6c  |ox info from rbl|
00000b50  6b 2e 0d 05 28 04 0d 05  32 1c dd a4 63 68 65 63  |k...(...2...chec|
00000b60  6b 42 42 6f 78 28 6f 42  6f 78 25 2c 72 62 6c 6b  |kBBox(oBox%,rblk|
00000b70  25 29 0d 05 3c 24 e7 20  6f 42 6f 78 25 21 30 20  |%)..<$. oBox%!0 |
00000b80  3e 20 72 62 6c 6b 25 21  28 52 45 5f 62 62 6f 78  |> rblk%!(RE_bbox|
00000b90  25 2b 38 29 20 8c 0d 05  46 08 20 20 3d a3 0d 05  |%+8) ...F.  =...|
00000ba0  50 05 cc 0d 05 5a 26 20  20 e7 20 6f 42 6f 78 25  |P....Z&  . oBox%|
00000bb0  21 38 20 3c 20 72 62 6c  6b 25 21 28 52 45 5f 62  |!8 < rblk%!(RE_b|
00000bc0  62 6f 78 25 2b 30 29 20  8c 0d 05 64 0a 20 20 20  |box%+0) ...d.   |
00000bd0  20 3d a3 0d 05 6e 07 20  20 cc 0d 05 78 29 20 20  | =...n.  ...x)  |
00000be0  20 20 e7 20 6f 42 6f 78  25 21 34 20 3e 20 72 62  |  . oBox%!4 > rb|
00000bf0  6c 6b 25 21 28 52 45 5f  62 62 6f 78 25 2b 31 32  |lk%!(RE_bbox%+12|
00000c00  29 20 8c 0d 05 82 0c 20  20 20 20 20 20 3d a3 0d  |) .....      =..|
00000c10  05 8c 09 20 20 20 20 cc  0d 05 96 2b 20 20 20 20  |...    ....+    |
00000c20  20 20 e7 20 6f 42 6f 78  25 21 31 32 20 3c 20 72  |  . oBox%!12 < r|
00000c30  62 6c 6b 25 21 28 52 45  5f 62 62 6f 78 25 2b 34  |blk%!(RE_bbox%+4|
00000c40  29 20 8c 0d 05 a0 0e 20  20 20 20 20 20 20 20 3d  |) .....        =|
00000c50  a3 0d 05 aa 0b 20 20 20  20 20 20 cd 0d 05 b4 09  |.....      .....|
00000c60  20 20 20 20 cd 0d 05 be  07 20 20 cd 0d 05 c8 05  |    .....  .....|
00000c70  cd 0d 05 d2 07 3d 20 b9  0d 05 dc 04 0d 05 e6 28  |.....= ........(|
00000c80  f4 20 45 78 74 72 61 63  74 20 74 68 65 20 74 65  |. Extract the te|
00000c90  78 74 75 61 6c 20 6e 61  6d 65 20 6f 66 20 61 20  |xtual name of a |
00000ca0  66 6f 6e 74 0d 05 f0 04  0d 05 fa 1d dd a4 66 6f  |font..........fo|
00000cb0  6e 74 6e 61 6d 65 28 6e  75 6d 62 65 72 25 2c 72  |ntname(number%,r|
00000cc0  62 6c 6b 25 29 0d 06 04  0b ea 66 6f 6e 74 6e 25  |blk%).....fontn%|
00000cd0  0d 06 0e 1a 66 6f 6e 74  6e 25 3d 72 62 6c 6b 25  |....fontn%=rblk%|
00000ce0  2b 52 45 5f 66 6f 6e 74  6e 25 0d 06 18 21 e7 20  |+RE_fontn%...!. |
00000cf0  66 6f 6e 74 6e 25 21 28  6e 75 6d 62 65 72 25 2a  |fontn%!(number%*|
00000d00  34 29 3c 3d 30 20 8c 20  3d 22 22 0d 06 22 21 3d  |4)<=0 . ="".."!=|
00000d10  a4 73 74 72 69 6e 67 30  28 66 6f 6e 74 6e 25 21  |.string0(fontn%!|
00000d20  28 6e 75 6d 62 65 72 25  2a 34 29 29 0d 06 2c 04  |(number%*4))..,.|
00000d30  0d 06 36 1f f4 20 52 65  63 6f 72 64 20 74 68 65  |..6.. Record the|
00000d40  20 6e 61 6d 65 20 6f 66  20 61 20 66 6f 6e 74 0d  | name of a font.|
00000d50  06 40 04 0d 06 4a 2a dd  f2 66 6f 6e 74 4f 62 6a  |.@...J*..fontObj|
00000d60  65 63 74 28 62 61 73 65  25 2c 20 73 69 7a 65 25  |ect(base%, size%|
00000d70  2c 20 62 6f 78 25 2c 72  62 6c 6b 25 29 0d 06 54  |, box%,rblk%)..T|
00000d80  1f ea 20 49 25 2c 66 6f  6e 74 72 65 66 25 2c 65  |.. I%,fontref%,e|
00000d90  6e 64 70 74 72 25 2c 65  78 69 74 25 0d 06 5e 0b  |ndptr%,exit%..^.|
00000da0  ea 66 6f 6e 74 6e 25 0d  06 68 1a 66 6f 6e 74 6e  |.fontn%..h.fontn|
00000db0  25 3d 72 62 6c 6b 25 2b  52 45 5f 66 6f 6e 74 6e  |%=rblk%+RE_fontn|
00000dc0  25 0d 06 72 16 e3 20 49  25 3d 31 20 b8 20 6d 61  |%..r.. I%=1 . ma|
00000dd0  78 46 6f 6e 74 73 25 0d  06 7c 15 20 20 66 6f 6e  |xFonts%..|.  fon|
00000de0  74 6e 25 21 28 49 25 2a  34 29 3d 30 0d 06 86 05  |tn%!(I%*4)=0....|
00000df0  ed 0d 06 90 17 65 6e 64  70 74 72 25 3d 62 61 73  |.....endptr%=bas|
00000e00  65 25 2b 73 69 7a 65 25  0d 06 9a 0b 65 78 69 74  |e%+size%....exit|
00000e10  25 3d a3 0d 06 a4 1e c8  95 20 62 61 73 65 25 3c  |%=....... base%<|
00000e20  65 6e 64 70 74 72 25 20  80 20 ac 20 65 78 69 74  |endptr% . . exit|
00000e30  25 0d 06 ae 16 20 20 66  6f 6e 74 72 65 66 25 3d  |%....  fontref%=|
00000e40  62 61 73 65 25 3f 30 0d  06 b8 14 20 20 e7 20 66  |base%?0....  . f|
00000e50  6f 6e 74 72 65 66 25 3d  30 20 8c 0d 06 c2 0f 20  |ontref%=0 ..... |
00000e60  20 20 20 65 78 69 74 25  3d b9 0d 06 cc 07 20 20  |   exit%=.....  |
00000e70  cc 0d 06 d6 10 20 20 20  20 62 61 73 65 25 2b 3d  |.....    base%+=|
00000e80  31 0d 06 e0 21 20 20 20  20 66 6f 6e 74 6e 25 21  |1...!    fontn%!|
00000e90  28 66 6f 6e 74 72 65 66  25 2a 34 29 3d 62 61 73  |(fontref%*4)=bas|
00000ea0  65 25 0d 06 ea 2d 20 20  20 20 62 61 73 65 25 2b  |e%...-    base%+|
00000eb0  3d a9 28 a4 66 6f 6e 74  6e 61 6d 65 28 66 6f 6e  |=.(.fontname(fon|
00000ec0  74 72 65 66 25 2c 72 62  6c 6b 25 29 29 2b 31 0d  |tref%,rblk%))+1.|
00000ed0  06 f4 07 20 20 cd 0d 06  fe 05 ce 0d 07 08 05 e1  |...  ...........|
00000ee0  0d 07 12 04 0d 07 1c 1c  f4 20 44 65 61 6c 20 77  |......... Deal w|
00000ef0  69 74 68 20 74 65 78 74  20 6f 62 6a 65 63 74 73  |ith text objects|
00000f00  0d 07 26 04 0d 07 30 22  dd f2 74 65 78 74 4f 62  |..&...0"..textOb|
00000f10  6a 65 63 74 28 62 61 73  65 25 2c 62 6f 78 25 2c  |ject(base%,box%,|
00000f20  72 62 6c 6b 25 29 0d 07  3a 1f ea 20 74 65 78 74  |rblk%)..:.. text|
00000f30  5f 63 6f 6c 6f 75 72 25  2c 74 62 61 63 5f 63 6f  |_colour%,tbac_co|
00000f40  6c 6f 75 72 25 0d 07 44  15 ea 20 74 65 78 74 5f  |lour%..D.. text_|
00000f50  78 25 2c 74 65 78 74 5f  79 25 0d 07 4e 0b ea 20  |x%,text_y%..N.. |
00000f60  66 6f 6e 74 25 0d 07 58  30 ea 20 6e 6f 6d 53 69  |font%..X0. nomSi|
00000f70  7a 65 58 25 2c 20 6e 6f  6d 53 69 7a 65 59 25 2c  |zeX%, nomSizeY%,|
00000f80  20 74 65 78 74 4c 65 6e  67 74 68 25 2c 20 6f 66  | textLength%, of|
00000f90  66 73 65 74 25 0d 07 62  1a ea 20 52 30 25 2c 66  |fset%..b.. R0%,f|
00000fa0  6c 67 25 2c 66 6f 6e 74  68 61 6e 64 6c 65 25 0d  |lg%,fonthandle%.|
00000fb0  07 6c 21 ea 20 64 78 25  2c 64 79 25 2c 63 6f 54  |.l!. dx%,dy%,coT|
00000fc0  6f 50 69 78 58 25 2c 63  6f 54 6f 50 69 78 59 25  |oPixX%,coToPixY%|
00000fd0  0d 07 76 10 ea 20 74 72  61 6e 73 66 6f 72 6d 25  |..v.. transform%|
00000fe0  0d 07 80 0f ea 20 78 73  63 25 2c 79 73 63 25 0d  |..... xsc%,ysc%.|
00000ff0  07 8a 21 ea 20 70 6d 66  78 30 25 2c 70 6d 66 78  |..!. pmfx0%,pmfx|
00001000  31 25 2c 70 6d 66 79 30  25 2c 70 6d 66 79 31 25  |1%,pmfy0%,pmfy1%|
00001010  0d 07 94 22 74 72 61 6e  73 66 6f 72 6d 25 3d 72  |..."transform%=r|
00001020  62 6c 6b 25 2b 52 45 5f  74 72 61 6e 73 66 6f 72  |blk%+RE_transfor|
00001030  6d 25 0d 07 9e 1a 78 73  63 25 3d 20 72 62 6c 6b  |m%....xsc%= rblk|
00001040  25 21 52 45 5f 78 73 63  61 6c 65 25 0d 07 a8 1a  |%!RE_xscale%....|
00001050  79 73 63 25 3d 20 72 62  6c 6b 25 21 52 45 5f 79  |ysc%= rblk%!RE_y|
00001060  73 63 61 6c 65 25 0d 07  b2 04 0d 07 bc 2b c8 99  |scale%.......+..|
00001070  20 22 57 69 6d 70 4d 61  6e 61 67 65 72 5f 4d 6f  | "WimpManager_Mo|
00001080  64 65 49 6e 66 6f 22 2c  30 20 b8 20 2c 2c 64 78  |deInfo",0 . ,,dx|
00001090  25 2c 64 79 25 0d 07 c6  17 63 6f 54 6f 50 69 78  |%,dy%....coToPix|
000010a0  58 25 20 3d 20 64 78 25  2a 32 35 36 0d 07 d0 17  |X% = dx%*256....|
000010b0  63 6f 54 6f 50 69 78 59  25 20 3d 20 64 79 25 2a  |coToPixY% = dy%*|
000010c0  32 35 36 0d 07 da 04 0d  07 e4 1b 74 65 78 74 5f  |256........text_|
000010d0  63 6f 6c 6f 75 72 25 20  20 3d 20 62 61 73 65 25  |colour%  = base%|
000010e0  21 30 0d 07 ee 18 e7 20  74 65 78 74 5f 63 6f 6c  |!0..... text_col|
000010f0  6f 75 72 25 3c 3e 2d 31  20 8c 0d 07 f8 1d 20 20  |our%<>-1 .....  |
00001100  74 62 61 63 5f 63 6f 6c  6f 75 72 25 20 20 3d 20  |tbac_colour%  = |
00001110  62 61 73 65 25 21 34 0d  08 02 1d 20 20 66 6f 6e  |base%!4....  fon|
00001120  74 25 20 20 20 20 20 20  20 20 20 3d 20 62 61 73  |t%         = bas|
00001130  65 25 3f 38 0d 08 0c 2f  20 20 6e 6f 6d 53 69 7a  |e%?8.../  nomSiz|
00001140  65 58 25 20 20 20 20 20  3d 28 62 61 73 65 25 21  |eX%     =(base%!|
00001150  31 32 20 29 20 20 2f 20  26 31 30 30 30 30 2a 78  |12 )  / &10000*x|
00001160  73 63 25 0d 08 16 2f 20  20 6e 6f 6d 53 69 7a 65  |sc%.../  nomSize|
00001170  59 25 20 20 20 20 20 3d  28 62 61 73 65 25 21 31  |Y%     =(base%!1|
00001180  36 20 29 20 20 2f 20 26  31 30 30 30 30 2a 79 73  |6 )  / &10000*ys|
00001190  63 25 0d 08 20 1e 20 20  74 65 78 74 5f 78 25 20  |c%.. .  text_x% |
000011a0  20 20 20 20 20 20 3d 20  62 61 73 65 25 21 32 30  |      = base%!20|
000011b0  0d 08 2a 1e 20 20 74 65  78 74 5f 79 25 20 20 20  |..*.  text_y%   |
000011c0  20 20 20 20 3d 20 62 61  73 65 25 21 32 34 0d 08  |    = base%!24..|
000011d0  34 04 0d 08 3e 12 20 20  e7 20 66 6f 6e 74 25 3c  |4...>.  . font%<|
000011e0  3e 30 20 8c 0d 08 48 58  20 20 20 20 c8 99 20 22  |>0 ...HX    .. "|
000011f0  58 46 6f 6e 74 5f 46 69  6e 64 46 6f 6e 74 22 2c  |XFont_FindFont",|
00001200  2c a4 66 6f 6e 74 6e 61  6d 65 28 66 6f 6e 74 25  |,.fontname(font%|
00001210  2c 72 62 6c 6b 25 29 2c  6e 6f 6d 53 69 7a 65 58  |,rblk%),nomSizeX|
00001220  25 2f 34 30 2c 6e 6f 6d  53 69 7a 65 59 25 2f 34  |%/40,nomSizeY%/4|
00001230  30 20 b8 20 52 30 25 3b  66 6c 67 25 0d 08 52 1c  |0 . R0%;flg%..R.|
00001240  20 20 20 20 e7 20 28 66  6c 67 25 20 80 20 76 62  |    . (flg% . vb|
00001250  69 74 25 29 3d 30 20 8c  0d 08 5c 1b 20 20 20 20  |it%)=0 ...\.    |
00001260  20 20 66 6f 6e 74 68 61  6e 64 6c 65 25 20 3d 20  |  fonthandle% = |
00001270  52 30 25 0d 08 66 30 20  20 20 20 20 20 c8 99 20  |R0%..f0      .. |
00001280  22 58 46 6f 6e 74 5f 53  65 74 46 6f 6e 74 22 2c  |"XFont_SetFont",|
00001290  66 6f 6e 74 68 61 6e 64  6c 65 25 20 b8 20 3b 66  |fonthandle% . ;f|
000012a0  6c 67 25 0d 08 70 1e 20  20 20 20 20 20 e7 20 28  |lg%..p.      . (|
000012b0  66 6c 67 25 20 80 20 76  62 69 74 25 29 3d 30 20  |flg% . vbit%)=0 |
000012c0  8c 0d 08 7a 5d 20 20 20  20 20 20 20 20 c8 99 20  |...z]        .. |
000012d0  22 58 43 6f 6c 6f 75 72  54 72 61 6e 73 5f 53 65  |"XColourTrans_Se|
000012e0  74 46 6f 6e 74 43 6f 6c  6f 75 72 73 22 2c 66 6f  |tFontColours",fo|
000012f0  6e 74 68 61 6e 64 6c 65  25 2c 74 62 61 63 5f 63  |nthandle%,tbac_c|
00001300  6f 6c 6f 75 72 25 2c 74  65 78 74 5f 63 6f 6c 6f  |olour%,text_colo|
00001310  75 72 25 2c 31 34 20 b8  20 3b 66 6c 67 25 0d 08  |ur%,14 . ;flg%..|
00001320  84 0b 20 20 20 20 20 20  cd 0d 08 8e 04 0d 08 98  |..      ........|
00001330  1e 20 20 20 20 20 20 e7  20 28 66 6c 67 25 20 80  |.      . (flg% .|
00001340  20 76 62 69 74 25 29 3d  30 20 8c 0d 08 a2 3c 20  | vbit%)=0 ....< |
00001350  20 20 20 20 20 20 20 74  65 78 74 5f 78 25 3d 28  |       text_x%=(|
00001360  20 74 65 78 74 5f 78 25  20 2f 26 31 30 30 30 30  | text_x% /&10000|
00001370  2a 78 73 63 25 29 20 2b  28 74 72 61 6e 73 66 6f  |*xsc%) +(transfo|
00001380  72 6d 25 21 31 36 29 0d  08 ac 3c 20 20 20 20 20  |rm%!16)...<     |
00001390  20 20 20 74 65 78 74 5f  79 25 3d 28 20 74 65 78  |   text_y%=( tex|
000013a0  74 5f 79 25 20 2f 26 31  30 30 30 30 2a 79 73 63  |t_y% /&10000*ysc|
000013b0  25 29 20 2b 28 74 72 61  6e 73 66 6f 72 6d 25 21  |%) +(transform%!|
000013c0  32 30 29 0d 08 b6 48 20  20 20 20 20 20 20 20 c8  |20)...H        .|
000013d0  99 20 22 58 46 6f 6e 74  5f 50 61 69 6e 74 22 2c  |. "XFont_Paint",|
000013e0  2c 62 61 73 65 25 2b 32  38 2c 26 31 30 2c 74 65  |,base%+28,&10,te|
000013f0  78 74 5f 78 25 3e 3e 38  2c 74 65 78 74 5f 79 25  |xt_x%>>8,text_y%|
00001400  3e 3e 38 20 b8 20 3b 66  6c 67 25 0d 08 c0 0b 20  |>>8 . ;flg%.... |
00001410  20 20 20 20 20 cd 0d 08  ca 29 20 20 20 20 20 20  |     ....)      |
00001420  c8 99 20 22 58 46 6f 6e  74 5f 4c 6f 73 65 46 6f  |.. "XFont_LoseFo|
00001430  6e 74 22 2c 66 6f 6e 74  68 61 6e 64 6c 65 25 0d  |nt",fonthandle%.|
00001440  08 d4 1e 20 20 20 20 20  20 e7 20 28 66 6c 67 25  |...      . (flg%|
00001450  20 80 20 76 62 69 74 25  29 3d 30 20 8c 0d 08 de  | . vbit%)=0 ....|
00001460  0d 20 20 20 20 20 20 20  20 e1 0d 08 e8 0b 20 20  |.        .....  |
00001470  20 20 20 20 cd 0d 08 f2  09 20 20 20 20 cd 0d 08  |    .....    ...|
00001480  fc 07 20 20 cd 0d 09 06  04 0d 09 10 3d 20 20 f4  |..  ........=  .|
00001490  20 45 69 74 68 65 72 20  77 61 73 20 61 20 73 79  | Either was a sy|
000014a0  73 74 65 6d 20 66 6f 6e  74 20 6f 72 20 61 6e 20  |stem font or an |
000014b0  75 6e 61 76 69 61 6c 61  62 6c 65 20 66 61 6e 63  |unavialable fanc|
000014c0  79 20 66 6f 6e 74 0d 09  1a 1e 20 20 f4 20 61 73  |y font....  . as|
000014d0  20 69 6e 64 69 63 61 74  65 64 20 62 79 20 66 6f  | indicated by fo|
000014e0  6e 74 3d 30 0d 09 24 07  20 20 f4 0d 09 2e 3b 20  |nt=0..$.  ....; |
000014f0  20 f4 20 46 75 64 67 65  20 74 68 65 20 77 69 64  | . Fudge the wid|
00001500  74 68 20 69 66 20 69 74  20 77 61 73 20 61 6e 20  |th if it was an |
00001510  75 6e 61 76 61 69 6c 61  62 6c 65 20 66 61 6e 63  |unavailable fanc|
00001520  79 20 66 6f 6e 74 0d 09  38 23 20 20 f4 20 74 6f  |y font..8#  . to|
00001530  20 36 30 25 20 6f 66 20  74 68 65 20 6e 6f 72 6d  | 60% of the norm|
00001540  61 6c 20 77 69 64 74 68  21 0d 09 42 04 0d 09 4c  |al width!..B...L|
00001550  12 20 20 e7 20 66 6f 6e  74 25 3c 3e 30 20 8c 0d  |.  . font%<>0 ..|
00001560  09 56 32 20 20 20 20 6e  6f 6d 53 69 7a 65 58 25  |.V2    nomSizeX%|
00001570  20 3d 20 28 6e 6f 6d 53  69 7a 65 58 25 2a 34 29  | = (nomSizeX%*4)|
00001580  20 81 20 28 63 6f 54 6f  50 69 78 58 25 2a 31 30  | . (coToPixX%*10|
00001590  29 0d 09 60 33 20 20 20  20 6e 6f 6d 53 69 7a 65  |)..`3    nomSize|
000015a0  59 25 20 3d 20 28 6e 6f  6d 53 69 7a 65 59 25 2a  |Y% = (nomSizeY%*|
000015b0  31 32 29 20 81 20 28 63  6f 54 6f 50 69 78 59 25  |12) . (coToPixY%|
000015c0  2a 31 33 29 0d 09 6a 07  20 20 cc 0d 09 74 29 20  |*13)..j.  ...t) |
000015d0  20 20 20 6e 6f 6d 53 69  7a 65 58 25 20 3d 20 6e  |   nomSizeX% = n|
000015e0  6f 6d 53 69 7a 65 58 25  20 81 20 63 6f 54 6f 50  |omSizeX% . coToP|
000015f0  69 78 58 25 0d 09 7e 28  20 20 20 20 6e 6f 6d 53  |ixX%..~(    nomS|
00001600  69 7a 65 59 25 20 3d 6e  6f 6d 53 69 7a 65 59 25  |izeY% =nomSizeY%|
00001610  20 81 20 63 6f 54 6f 50  69 78 59 25 0d 09 88 07  | . coToPixY%....|
00001620  20 20 cd 0d 09 92 04 0d  09 9c 49 20 20 c8 99 20  |  ........I  .. |
00001630  22 57 69 6d 70 4d 61 6e  61 67 65 72 5f 52 65 61  |"WimpManager_Rea|
00001640  64 56 64 75 56 61 72 69  61 62 6c 65 73 22 2c 31  |dVduVariables",1|
00001650  36 32 20 b8 20 70 6d 66  78 30 25 2c 70 6d 66 79  |62 . pmfx0%,pmfy|
00001660  30 25 2c 70 6d 66 78 31  25 2c 70 6d 66 79 31 25  |0%,pmfx1%,pmfy1%|
00001670  0d 09 a6 04 0d 09 b0 28  20 20 ef 20 32 33 2c 31  |.......(  . 23,1|
00001680  37 2c 37 2c 32 2c 6e 6f  6d 53 69 7a 65 58 25 3b  |7,7,2,nomSizeX%;|
00001690  6e 6f 6d 53 69 7a 65 59  25 3b 30 3b 0d 09 ba 28  |nomSizeY%;0;...(|
000016a0  20 20 ef 20 32 33 2c 31  37 2c 37 2c 34 2c 6e 6f  |  . 23,17,7,4,no|
000016b0  6d 53 69 7a 65 58 25 3b  6e 6f 6d 53 69 7a 65 59  |mSizeX%;nomSizeY|
000016c0  25 3b 30 3b 0d 09 c4 2c  20 20 c8 99 20 22 58 43  |%;0;...,  .. "XC|
000016d0  6f 6c 6f 75 72 54 72 61  6e 73 5f 53 65 74 47 43  |olourTrans_SetGC|
000016e0  4f 4c 22 2c 74 65 78 74  5f 63 6f 6c 6f 75 72 25  |OL",text_colour%|
000016f0  0d 09 ce 47 20 20 74 65  78 74 5f 78 25 3d 20 20  |...G  text_x%=  |
00001700  28 20 74 65 78 74 5f 78  25 20 20 20 20 20 20 20  |( text_x%       |
00001710  20 20 20 20 20 20 20 20  20 2f 26 31 30 30 30 30  |         /&10000|
00001720  2a 78 73 63 25 29 20 2b  28 74 72 61 6e 73 66 6f  |*xsc%) +(transfo|
00001730  72 6d 25 21 31 36 29 0d  09 d8 12 20 20 e7 20 66  |rm%!16)....  . f|
00001740  6f 6e 74 25 3c 3e 30 20  8c 0d 09 e2 47 20 20 20  |ont%<>0 ....G   |
00001750  20 74 65 78 74 5f 79 25  3d 28 28 74 65 78 74 5f  | text_y%=((text_|
00001760  79 25 2b 28 62 61 73 65  25 21 31 36 29 2a 36 2f  |y%+(base%!16)*6/|
00001770  38 29 2f 26 31 30 30 30  30 2a 79 73 63 25 29 20  |8)/&10000*ysc%) |
00001780  2b 28 74 72 61 6e 73 66  6f 72 6d 25 21 32 30 29  |+(transform%!20)|
00001790  0d 09 ec 07 20 20 cc 0d  09 f6 47 20 20 20 20 74  |....  ....G    t|
000017a0  65 78 74 5f 79 25 3d 28  28 74 65 78 74 5f 79 25  |ext_y%=((text_y%|
000017b0  2b 28 62 61 73 65 25 21  31 36 29 2a 37 2f 38 29  |+(base%!16)*7/8)|
000017c0  2f 26 31 30 30 30 30 2a  79 73 63 25 29 20 2b 28  |/&10000*ysc%) +(|
000017d0  74 72 61 6e 73 66 6f 72  6d 25 21 32 30 29 0d 0a  |transform%!20)..|
000017e0  00 07 20 20 cd 0d 0a 0a  04 0d 0a 14 1d 20 20 ec  |..  .........  .|
000017f0  20 74 65 78 74 5f 78 25  3e 3e 38 2c 74 65 78 74  | text_x%>>8,text|
00001800  5f 79 25 3e 3e 38 0d 0a  1e 04 0d 0a 28 1d 20 20  |_y%>>8......(.  |
00001810  c8 99 20 22 4f 53 5f 57  72 69 74 65 30 22 2c 62  |.. "OS_Write0",b|
00001820  61 73 65 25 2b 32 38 0d  0a 32 04 0d 0a 3c 22 20  |ase%+28..2...<" |
00001830  20 ef 20 32 33 2c 31 37  2c 37 2c 32 2c 70 6d 66  | . 23,17,7,2,pmf|
00001840  78 30 25 3b 70 6d 66 79  30 25 3b 30 3b 0d 0a 46  |x0%;pmfy0%;0;..F|
00001850  22 20 20 ef 20 32 33 2c  31 37 2c 37 2c 34 2c 70  |"  . 23,17,7,4,p|
00001860  6d 66 78 31 25 3b 70 6d  66 79 31 25 3b 30 3b 0d  |mfx1%;pmfy1%;0;.|
00001870  0a 50 04 0d 0a 5a 05 cd  0d 0a 64 05 e1 0d 0a 6e  |.P...Z....d....n|
00001880  04 0d 0a 78 25 dd f2 73  70 72 69 74 65 4f 62 6a  |...x%..spriteObj|
00001890  65 63 74 28 62 61 73 65  25 2c 20 62 6f 78 25 2c  |ect(base%, box%,|
000018a0  72 62 6c 6b 25 29 0d 0a  82 37 ea 20 70 69 78 65  |rblk%)...7. pixe|
000018b0  6c 57 69 64 74 68 25 2c  20 70 69 78 65 6c 48 65  |lWidth%, pixelHe|
000018c0  69 67 68 74 25 2c 20 64  65 66 4d 6f 64 65 25 2c  |ight%, defMode%,|
000018d0  20 58 45 69 67 25 2c 20  59 45 69 67 25 0d 0a 8c  | XEig%, YEig%...|
000018e0  19 ea 20 73 78 30 25 2c  73 79 30 25 2c 73 78 31  |.. sx0%,sy0%,sx1|
000018f0  25 2c 73 79 31 25 0d 0a  96 14 ea 20 72 37 25 2c  |%,sy1%..... r7%,|
00001900  72 36 25 2c 6c 32 62 70  70 25 0d 0a a0 0f ea 20  |r6%,l2bpp%..... |
00001910  78 73 63 25 2c 79 73 63  25 0d 0a aa 10 ea 20 74  |xsc%,ysc%..... t|
00001920  72 61 6e 73 66 6f 72 6d  25 0d 0a b4 26 ea 20 70  |ransform%...&. p|
00001930  69 78 74 61 62 31 25 2c  70 69 78 74 61 62 32 25  |ixtab1%,pixtab2%|
00001940  2c 70 61 6c 65 74 74 65  25 2c 75 73 65 70 25 0d  |,palette%,usep%.|
00001950  0a be 04 0d 0a c8 22 74  72 61 6e 73 66 6f 72 6d  |......"transform|
00001960  25 3d 72 62 6c 6b 25 2b  52 45 5f 74 72 61 6e 73  |%=rblk%+RE_trans|
00001970  66 6f 72 6d 25 0d 0a d2  1d 70 69 78 74 61 62 31  |form%....pixtab1|
00001980  25 20 20 3d 72 62 6c 6b  25 2b 52 45 5f 70 78 74  |%  =rblk%+RE_pxt|
00001990  31 25 0d 0a dc 1d 70 69  78 74 61 62 32 25 20 20  |1%....pixtab2%  |
000019a0  3d 72 62 6c 6b 25 2b 52  45 5f 70 78 74 32 25 0d  |=rblk%+RE_pxt2%.|
000019b0  0a e6 20 70 61 6c 65 74  74 65 25 20 20 3d 72 62  |.. palette%  =rb|
000019c0  6c 6b 25 2b 52 45 5f 70  61 6c 65 74 74 65 25 0d  |lk%+RE_palette%.|
000019d0  0a f0 04 0d 0a fa 1a 78  73 63 25 3d 20 72 62 6c  |.......xsc%= rbl|
000019e0  6b 25 21 52 45 5f 78 73  63 61 6c 65 25 0d 0b 04  |k%!RE_xscale%...|
000019f0  1a 79 73 63 25 3d 20 72  62 6c 6b 25 21 52 45 5f  |.ysc%= rblk%!RE_|
00001a00  79 73 63 61 6c 65 25 0d  0b 0e 04 0d 0b 18 10 72  |yscale%........r|
00001a10  36 25 3d 70 69 78 74 61  62 31 25 0d 0b 22 10 72  |6%=pixtab1%..".r|
00001a20  37 25 3d 70 69 78 74 61  62 32 25 0d 0b 2c 04 0d  |7%=pixtab2%..,..|
00001a30  0b 36 0f 73 78 30 25 3d  62 6f 78 25 21 30 0d 0b  |.6.sx0%=box%!0..|
00001a40  40 0f 73 79 30 25 3d 62  6f 78 25 21 34 0d 0b 4a  |@.sy0%=box%!4..J|
00001a50  0f 73 78 31 25 3d 62 6f  78 25 21 38 0d 0b 54 10  |.sx1%=box%!8..T.|
00001a60  73 79 31 25 3d 62 6f 78  25 21 31 32 0d 0b 5e 04  |sy1%=box%!12..^.|
00001a70  0d 0b 68 23 f4 20 47 65  74 20 64 65 66 69 6e 69  |..h#. Get defini|
00001a80  74 69 6f 6e 20 73 69 7a  65 20 69 6e 20 70 69 78  |tion size in pix|
00001a90  65 6c 73 0d 0b 72 4b c8  99 20 22 4f 53 5f 53 70  |els..rK.. "OS_Sp|
00001aa0  72 69 74 65 4f 70 22 2c  26 32 32 38 2c 26 46 46  |riteOp",&228,&FF|
00001ab0  2c 62 61 73 65 25 20 b8  20 2c 2c 2c 70 69 78 65  |,base% . ,,,pixe|
00001ac0  6c 57 69 64 74 68 25 2c  70 69 78 65 6c 48 65 69  |lWidth%,pixelHei|
00001ad0  67 68 74 25 2c 2c 64 65  66 4d 6f 64 65 25 0d 0b  |ght%,,defMode%..|
00001ae0  7c 04 0d 0b 86 1d f4 20  47 65 74 20 69 6e 66 6f  ||...... Get info|
00001af0  20 61 62 6f 75 74 20 74  68 65 20 6d 6f 64 65 0d  | about the mode.|
00001b00  0b 90 2c c8 99 20 22 4f  53 5f 52 65 61 64 4d 6f  |..,.. "OS_ReadMo|
00001b10  64 65 56 61 72 69 61 62  6c 65 22 2c 20 eb 2c 20  |deVariable", ., |
00001b20  34 20 b8 20 2c 2c 58 45  69 67 25 0d 0b 9a 2c c8  |4 . ,,XEig%...,.|
00001b30  99 20 22 4f 53 5f 52 65  61 64 4d 6f 64 65 56 61  |. "OS_ReadModeVa|
00001b40  72 69 61 62 6c 65 22 2c  20 eb 2c 20 35 20 b8 20  |riable", ., 5 . |
00001b50  2c 2c 59 45 69 67 25 0d  0b a4 33 c8 99 20 22 4f  |,,YEig%...3.. "O|
00001b60  53 5f 52 65 61 64 4d 6f  64 65 56 61 72 69 61 62  |S_ReadModeVariab|
00001b70  6c 65 22 2c 20 64 65 66  4d 6f 64 65 25 2c 39 20  |le", defMode%,9 |
00001b80  b8 20 2c 2c 6c 32 62 70  70 25 0d 0b ae 04 0d 0b  |. ,,l2bpp%......|
00001b90  b8 30 70 69 78 74 61 62  31 25 21 30 20 20 3d 20  |.0pixtab1%!0  = |
00001ba0  28 28 28 73 78 31 25 2d  73 78 30 25 29 3e 3e 38  |(((sx1%-sx0%)>>8|
00001bb0  29 2f 26 31 30 30 30 30  29 2a 78 73 63 25 0d 0b  |)/&10000)*xsc%..|
00001bc0  c2 30 70 69 78 74 61 62  31 25 21 34 20 20 3d 20  |.0pixtab1%!4  = |
00001bd0  28 28 28 73 79 31 25 2d  73 79 30 25 29 3e 3e 38  |(((sy1%-sy0%)>>8|
00001be0  29 2f 26 31 30 30 30 30  29 2a 79 73 63 25 0d 0b  |)/&10000)*ysc%..|
00001bf0  cc 29 70 69 78 74 61 62  31 25 21 38 20 20 3d 20  |.)pixtab1%!8  = |
00001c00  28 70 69 78 65 6c 57 69  64 74 68 25 20 3c 3c 20  |(pixelWidth% << |
00001c10  58 45 69 67 25 20 29 0d  0b d6 29 70 69 78 74 61  |XEig% )...)pixta|
00001c20  62 31 25 21 31 32 20 3d  20 28 70 69 78 65 6c 48  |b1%!12 = (pixelH|
00001c30  65 69 67 68 74 25 20 3c  3c 20 59 45 69 67 25 29  |eight% << YEig%)|
00001c40  0d 0b e0 04 0d 0b ea 34  e7 20 a4 72 65 61 64 5f  |.......4. .read_|
00001c50  73 70 72 69 74 65 5f 70  61 6c 65 74 74 65 41 28  |sprite_paletteA(|
00001c60  62 61 73 65 25 2c 70 61  6c 65 74 74 65 25 2c 6c  |base%,palette%,l|
00001c70  32 62 70 70 25 29 20 8c  0d 0b f4 14 20 20 75 73  |2bpp%) .....  us|
00001c80  65 70 25 3d 70 61 6c 65  74 74 65 25 0d 0b fe 05  |ep%=palette%....|
00001c90  cc 0d 0c 08 0d 20 20 75  73 65 70 25 3d 30 0d 0c  |.....  usep%=0..|
00001ca0  12 05 cd 0d 0c 1c 39 c8  99 20 22 43 6f 6c 6f 75  |......9.. "Colou|
00001cb0  72 54 72 61 6e 73 5f 53  65 6c 65 63 74 54 61 62  |rTrans_SelectTab|
00001cc0  6c 65 22 2c 64 65 66 4d  6f 64 65 25 2c 75 73 65  |le",defMode%,use|
00001cd0  70 25 2c 2d 31 2c 2d 31  2c 72 37 25 0d 0c 26 2e  |p%,-1,-1,r7%..&.|
00001ce0  73 78 30 25 3d 20 20 28  73 78 30 25 2f 26 31 30  |sx0%=  (sx0%/&10|
00001cf0  30 30 30 2a 78 73 63 25  29 20 2b 28 74 72 61 6e  |000*xsc%) +(tran|
00001d00  73 66 6f 72 6d 25 21 31  36 29 0d 0c 30 2e 73 79  |sform%!16)..0.sy|
00001d10  30 25 3d 20 20 28 73 79  30 25 2f 26 31 30 30 30  |0%=  (sy0%/&1000|
00001d20  30 2a 79 73 63 25 29 20  2b 28 74 72 61 6e 73 66  |0*ysc%) +(transf|
00001d30  6f 72 6d 25 21 32 30 29  0d 0c 3a 04 0d 0c 44 23  |orm%!20)..:...D#|
00001d40  f4 20 50 6c 6f 74 20 74  68 65 20 73 70 72 69 74  |. Plot the sprit|
00001d50  65 20 73 63 61 6c 65 64  20 74 6f 20 66 69 74 0d  |e scaled to fit.|
00001d60  0c 4e 23 f4 20 28 75 73  65 20 26 46 46 20 61 73  |.N#. (use &FF as|
00001d70  20 74 68 65 20 61 72 65  61 20 70 6f 69 6e 74 65  | the area pointe|
00001d80  72 29 0d 0c 58 3d c8 99  20 22 4f 53 5f 53 70 72  |r)..X=.. "OS_Spr|
00001d90  69 74 65 4f 70 22 2c 26  32 33 34 2c 26 46 46 2c  |iteOp",&234,&FF,|
00001da0  62 61 73 65 25 2c 73 78  30 25 3e 3e 38 2c 73 79  |base%,sx0%>>8,sy|
00001db0  30 25 3e 3e 38 2c 38 2c  72 36 25 2c 72 37 25 0d  |0%>>8,8,r6%,r7%.|
00001dc0  0c 62 05 e1 0d 0c 6c 04  0d 0c 76 23 dd f2 70 61  |.b....l...v#..pa|
00001dd0  74 68 4f 62 6a 65 63 74  28 62 61 73 65 25 2c 20  |thObject(base%, |
00001de0  62 6f 78 25 2c 72 62 6c  6b 25 29 0d 0c 80 29 ea  |box%,rblk%)...).|
00001df0  20 64 64 65 6c 65 6d 25  2c 64 61 73 68 25 2c 77  | ddelem%,dash%,w|
00001e00  69 6e 64 69 6e 67 25 2c  73 74 79 6c 65 25 2c 70  |inding%,style%,p|
00001e10  61 74 68 25 0d 0c 8a 11  ea 20 66 69 6c 6c 43 6f  |ath%..... fillCo|
00001e20  6c 6f 75 72 25 0d 0c 94  14 ea 20 6f 75 74 6c 69  |lour%..... outli|
00001e30  6e 65 43 6f 6c 6f 75 72  25 0d 0c 9e 13 ea 20 6f  |neColour%..... o|
00001e40  75 74 6c 69 6e 65 57 69  64 74 68 25 0d 0c a8 1b  |utlineWidth%....|
00001e50  ea 20 6a 6f 69 6e 74 73  70 65 63 25 2c 74 72 61  |. jointspec%,tra|
00001e60  6e 73 66 6f 72 6d 25 0d  0c b2 22 6a 6f 69 6e 74  |nsform%..."joint|
00001e70  73 70 65 63 25 3d 72 62  6c 6b 25 2b 52 45 5f 6a  |spec%=rblk%+RE_j|
00001e80  6f 69 6e 74 73 70 65 63  25 0d 0c bc 22 74 72 61  |ointspec%..."tra|
00001e90  6e 73 66 6f 72 6d 25 3d  72 62 6c 6b 25 2b 52 45  |nsform%=rblk%+RE|
00001ea0  5f 74 72 61 6e 73 66 6f  72 6d 25 0d 0c c6 1c 66  |_transform%....f|
00001eb0  69 6c 6c 43 6f 6c 6f 75  72 25 20 20 20 20 3d 20  |illColour%    = |
00001ec0  62 61 73 65 25 21 30 0d  0c d0 1c 6f 75 74 6c 69  |base%!0....outli|
00001ed0  6e 65 43 6f 6c 6f 75 72  25 20 3d 20 62 61 73 65  |neColour% = base|
00001ee0  25 21 34 0d 0c da 1c 6f  75 74 6c 69 6e 65 57 69  |%!4....outlineWi|
00001ef0  64 74 68 25 20 20 3d 20  62 61 73 65 25 21 38 0d  |dth%  = base%!8.|
00001f00  0c e4 15 70 61 74 68 25  20 20 3d 20 62 61 73 65  |...path%  = base|
00001f10  25 2b 31 36 0d 0c ee 15  73 74 79 6c 65 25 20 3d  |%+16....style% =|
00001f20  20 62 61 73 65 25 21 31  32 0d 0c f8 2f 6a 6f 69  | base%!12.../joi|
00001f30  6e 74 73 70 65 63 25 3f  6a 73 5f 6a 6f 69 6e 25  |ntspec%?js_join%|
00001f40  20 20 20 20 20 3d 20 20  73 74 79 6c 65 25 20 20  |     =  style%  |
00001f50  20 20 20 20 20 80 20 33  0d 0d 02 2f 6a 6f 69 6e  |     . 3.../join|
00001f60  74 73 70 65 63 25 3f 6a  73 5f 65 6e 64 63 61 70  |tspec%?js_endcap|
00001f70  25 20 20 20 3d 20 28 73  74 79 6c 65 25 20 3e 3e  |%   = (style% >>|
00001f80  20 32 29 20 80 20 33 0d  0d 0c 2f 6a 6f 69 6e 74  | 2) . 3.../joint|
00001f90  73 70 65 63 25 3f 6a 73  5f 73 74 61 72 74 63 61  |spec%?js_startca|
00001fa0  70 25 20 3d 20 28 73 74  79 6c 65 25 20 3e 3e 20  |p% = (style% >> |
00001fb0  34 29 20 80 20 33 0d 0d  16 20 6a 6f 69 6e 74 73  |4) . 3... joints|
00001fc0  70 65 63 25 3f 6a 73 5f  72 65 73 65 72 76 30 30  |pec%?js_reserv00|
00001fd0  25 20 3d 20 20 30 0d 0d  20 44 6a 6f 69 6e 74 73  |% =  0.. Djoints|
00001fe0  70 65 63 25 21 6a 73 5f  6d 69 74 72 65 6c 69 6d  |pec%!js_mitrelim|
00001ff0  25 20 3d 20 20 26 41 30  30 30 30 20 3a f4 20 69  |% =  &A0000 :. i|
00002000  65 20 31 30 2e 30 20 70  6f 73 74 73 63 72 69 70  |e 10.0 postscrip|
00002010  74 20 64 65 66 61 75 6c  74 21 0d 0d 2a 49 6a 6f  |t default!..*Ijo|
00002020  69 6e 74 73 70 65 63 25  21 6a 73 5f 65 6e 64 74  |intspec%!js_endt|
00002030  72 69 25 20 3d 20 28 28  73 74 79 6c 65 25 3e 3e  |ri% = ((style%>>|
00002040  31 32 29 80 26 46 46 30  29 84 28 28 28 73 74 79  |12).&FF0).(((sty|
00002050  6c 65 25 3e 3e 32 30 29  80 26 46 46 30 29 3c 3c  |le%>>20).&FF0)<<|
00002060  31 36 29 0d 0d 34 34 6a  6f 69 6e 74 73 70 65 63  |16)..44jointspec|
00002070  25 21 6a 73 5f 73 74 61  72 74 74 72 69 25 20 3d  |%!js_starttri% =|
00002080  20 20 6a 6f 69 6e 74 73  70 65 63 25 21 6a 73 5f  |  jointspec%!js_|
00002090  65 6e 64 74 72 69 25 0d  0d 3e 2e 77 69 6e 64 69  |endtri%..>.windi|
000020a0  6e 67 25 20 20 20 20 20  20 20 20 20 20 20 20 20  |ng%             |
000020b0  20 20 20 3d 20 28 73 74  79 6c 65 25 20 3e 3e 20  |   = (style% >> |
000020c0  35 29 80 20 32 0d 0d 48  1a e7 20 28 73 74 79 6c  |5). 2..H.. (styl|
000020d0  65 25 20 80 20 26 38 30  20 29 3c 3e 30 20 8c 0d  |e% . &80 )<>0 ..|
000020e0  0d 52 15 20 20 64 64 65  6c 65 6d 25 3d 70 61 74  |.R.  ddelem%=pat|
000020f0  68 25 21 34 0d 0d 5c 11  20 20 64 61 73 68 25 3d  |h%!4..\.  dash%=|
00002100  70 61 74 68 25 0d 0d 66  1d 20 20 70 61 74 68 25  |path%..f.  path%|
00002110  3d 70 61 74 68 25 2b 64  64 65 6c 65 6d 25 2a 34  |=path%+ddelem%*4|
00002120  2b 38 0d 0d 70 05 cc 0d  0d 7a 0d 20 20 64 61 73  |+8..p....z.  das|
00002130  68 25 3d 30 0d 0d 84 11  20 20 70 61 74 68 25 3d  |h%=0....  path%=|
00002140  70 61 74 68 25 0d 0d 8e  05 cd 0d 0d 98 19 e7 20  |path%.......... |
00002150  66 69 6c 6c 43 6f 6c 6f  75 72 25 20 3c 3e 20 2d  |fillColour% <> -|
00002160  31 20 8c 0d 0d a2 2b 20  20 c8 99 20 22 58 43 6f  |1 ....+  .. "XCo|
00002170  6c 6f 75 72 54 72 61 6e  73 5f 53 65 74 47 43 4f  |lourTrans_SetGCO|
00002180  4c 22 2c 66 69 6c 6c 43  6f 6c 6f 75 72 25 0d 0d  |L",fillColour%..|
00002190  ac 35 20 20 c8 99 20 22  58 44 72 61 77 5f 46 69  |.5  .. "XDraw_Fi|
000021a0  6c 6c 22 2c 70 61 74 68  25 2c 77 69 6e 64 69 6e  |ll",path%,windin|
000021b0  67 25 20 84 20 26 33 30  2c 74 72 61 6e 73 66 6f  |g% . &30,transfo|
000021c0  72 6d 25 0d 0d b6 05 cd  0d 0d c0 1c e7 20 6f 75  |rm%.......... ou|
000021d0  74 6c 69 6e 65 43 6f 6c  6f 75 72 25 20 3c 3e 20  |tlineColour% <> |
000021e0  2d 31 20 8c 0d 0d ca 2e  20 20 c8 99 20 22 58 43  |-1 .....  .. "XC|
000021f0  6f 6c 6f 75 72 54 72 61  6e 73 5f 53 65 74 47 43  |olourTrans_SetGC|
00002200  4f 4c 22 2c 6f 75 74 6c  69 6e 65 43 6f 6c 6f 75  |OL",outlineColou|
00002210  72 25 0d 0d d4 4c 20 20  c8 99 20 22 58 44 72 61  |r%...L  .. "XDra|
00002220  77 5f 53 74 72 6f 6b 65  22 2c 70 61 74 68 25 2c  |w_Stroke",path%,|
00002230  26 33 38 2c 74 72 61 6e  73 66 6f 72 6d 25 2c 2c  |&38,transform%,,|
00002240  6f 75 74 6c 69 6e 65 57  69 64 74 68 25 2c 6a 6f  |outlineWidth%,jo|
00002250  69 6e 74 73 70 65 63 25  2c 64 61 73 68 25 0d 0d  |intspec%,dash%..|
00002260  de 05 cd 0d 0d e8 05 e1  0d 0d f2 04 0d 0d fc 2b  |...............+|
00002270  dd f2 67 72 6f 75 70 4f  62 6a 65 63 74 28 62 61  |..groupObject(ba|
00002280  73 65 25 2c 20 73 69 7a  65 25 2c 20 62 6f 78 25  |se%, size%, box%|
00002290  2c 72 62 6c 6b 25 29 0d  0e 06 16 ea 20 6f 66 66  |,rblk%)..... off|
000022a0  73 65 74 25 2c 6e 65 77  73 69 7a 65 25 0d 0e 10  |set%,newsize%...|
000022b0  10 6f 66 66 73 65 74 25  20 3d 20 31 32 0d 0e 1a  |.offset% = 12...|
000022c0  16 c8 95 20 6f 66 66 73  65 74 25 20 3c 20 73 69  |... offset% < si|
000022d0  7a 65 25 0d 0e 24 20 20  20 6e 65 77 73 69 7a 65  |ze%..$   newsize|
000022e0  25 3d 62 61 73 65 25 21  28 6f 66 66 73 65 74 25  |%=base%!(offset%|
000022f0  2b 34 29 0d 0e 2e 2e 20  20 f2 64 65 63 6f 64 65  |+4)....  .decode|
00002300  4f 62 6a 65 63 74 28 62  61 73 65 25 2b 6f 66 66  |Object(base%+off|
00002310  73 65 74 25 2c 20 62 6f  78 25 2c 72 62 6c 6b 25  |set%, box%,rblk%|
00002320  29 0d 0e 38 18 20 20 6f  66 66 73 65 74 25 20 2b  |)..8.  offset% +|
00002330  3d 6e 65 77 73 69 7a 65  25 0d 0e 42 05 ce 0d 0e  |=newsize%..B....|
00002340  4c 05 e1 0d 0e 56 04 0d  0e 60 24 dd f2 74 61 67  |L....V...`$..tag|
00002350  67 65 64 4f 62 6a 65 63  74 28 62 61 73 65 25 2c  |gedObject(base%,|
00002360  62 6f 78 25 2c 72 62 6c  6b 25 29 0d 0e 6a 26 f2  |box%,rblk%)..j&.|
00002370  64 65 63 6f 64 65 4f 62  6a 65 63 74 28 62 61 73  |decodeObject(bas|
00002380  65 25 2b 34 2c 20 62 6f  78 25 2c 72 62 6c 6b 25  |e%+4, box%,rblk%|
00002390  29 0d 0e 74 05 e1 0d 0e  7e 04 0d 0e 88 26 dd f2  |)..t....~....&..|
000023a0  64 65 63 6f 64 65 4f 62  6a 65 63 74 28 62 61 73  |decodeObject(bas|
000023b0  65 25 2c 20 62 62 6f 78  25 2c 72 62 6c 6b 25 29  |e%, bbox%,rblk%)|
000023c0  0d 0e 92 21 ea 20 6f 62  6a 25 2c 20 74 79 70 65  |...!. obj%, type|
000023d0  25 2c 20 73 69 7a 65 25  2c 20 6f 66 66 73 65 74  |%, size%, offset|
000023e0  25 0d 0e 9c 13 74 79 70  65 25 20 3d 20 62 61 73  |%....type% = bas|
000023f0  65 25 21 30 0d 0e a6 13  73 69 7a 65 25 20 3d 20  |e%!0....size% = |
00002400  62 61 73 65 25 21 34 0d  0e b0 11 e7 20 74 79 70  |base%!4..... typ|
00002410  65 25 20 3d 20 30 20 8c  0d 0e ba 24 20 20 f4 20  |e% = 0 ....$  . |
00002420  66 6f 6e 74 20 74 61 62  6c 65 20 28 6e 6f 20 62  |font table (no b|
00002430  6f 75 6e 64 69 6e 67 20  62 6f 78 29 0d 0e c4 11  |ounding box)....|
00002440  20 20 6f 66 66 73 65 74  25 20 3d 20 38 0d 0e ce  |  offset% = 8...|
00002450  3c 20 20 f2 66 6f 6e 74  4f 62 6a 65 63 74 28 62  |<  .fontObject(b|
00002460  61 73 65 25 2b 6f 66 66  73 65 74 25 2c 73 69 7a  |ase%+offset%,siz|
00002470  65 25 2d 6f 66 66 73 65  74 25 2c 62 61 73 65 25  |e%-offset%,base%|
00002480  2b 38 2c 72 62 6c 6b 25  29 0d 0e d8 05 cc 0d 0e  |+8,rblk%).......|
00002490  e2 23 20 20 e7 20 a4 63  68 65 63 6b 42 42 6f 78  |.#  . .checkBBox|
000024a0  28 62 61 73 65 25 2b 38  2c 72 62 6c 6b 25 29 20  |(base%+8,rblk%) |
000024b0  8c 0d 0e ec 14 20 20 20  20 6f 66 66 73 65 74 25  |.....    offset%|
000024c0  20 3d 20 32 34 0d 0e f6  12 20 20 20 20 c8 8e 20  | = 24....    .. |
000024d0  74 79 70 65 25 20 ca 0d  0f 00 37 20 20 20 20 c9  |type% ....7    .|
000024e0  20 31 3a 20 f2 74 65 78  74 4f 62 6a 65 63 74 28  | 1: .textObject(|
000024f0  62 61 73 65 25 2b 6f 66  66 73 65 74 25 20 20 2c  |base%+offset%  ,|
00002500  62 61 73 65 25 2b 38 2c  72 62 6c 6b 25 29 0d 0f  |base%+8,rblk%)..|
00002510  0a 37 20 20 20 20 c9 20  32 3a 20 f2 70 61 74 68  |.7    . 2: .path|
00002520  4f 62 6a 65 63 74 28 62  61 73 65 25 2b 6f 66 66  |Object(base%+off|
00002530  73 65 74 25 20 20 2c 62  61 73 65 25 2b 38 2c 72  |set%  ,base%+8,r|
00002540  62 6c 6b 25 29 0d 0f 14  37 20 20 20 20 c9 20 35  |blk%)...7    . 5|
00002550  3a 20 f2 73 70 72 69 74  65 4f 62 6a 65 63 74 28  |: .spriteObject(|
00002560  62 61 73 65 25 2b 6f 66  66 73 65 74 25 2c 62 61  |base%+offset%,ba|
00002570  73 65 25 2b 38 2c 72 62  6c 6b 25 29 0d 0f 1e 37  |se%+8,rblk%)...7|
00002580  20 20 20 20 c9 20 37 3a  20 f2 74 61 67 67 65 64  |    . 7: .tagged|
00002590  4f 62 6a 65 63 74 28 62  61 73 65 25 2b 6f 66 66  |Object(base%+off|
000025a0  73 65 74 25 2c 62 61 73  65 25 2b 38 2c 72 62 6c  |set%,base%+8,rbl|
000025b0  6b 25 29 0d 0f 28 45 20  20 20 20 c9 20 36 3a 20  |k%)..(E    . 6: |
000025c0  f2 67 72 6f 75 70 4f 62  6a 65 63 74 28 62 61 73  |.groupObject(bas|
000025d0  65 25 2b 6f 66 66 73 65  74 25 20 2c 73 69 7a 65  |e%+offset% ,size|
000025e0  25 2d 6f 66 66 73 65 74  25 2c 62 61 73 65 25 2b  |%-offset%,base%+|
000025f0  38 2c 72 62 6c 6b 25 29  0d 0f 32 1f 20 20 20 20  |8,rblk%)..2.    |
00002600  f4 20 57 48 45 4e 20 39  20 20 3a 52 45 4d 20 74  |. WHEN 9  :REM t|
00002610  65 78 74 61 72 65 61 0d  0f 3c 1e 20 20 20 20 f4  |extarea..<.    .|
00002620  20 57 48 45 4e 20 31 30  20 3a 52 45 4d 20 74 65  | WHEN 10 :REM te|
00002630  78 74 63 6f 6c 0d 0f 46  09 20 20 20 20 cb 0d 0f  |xtcol..F.    ...|
00002640  50 07 20 20 cd 0d 0f 5a  05 cd 0d 0f 64 05 e1 0d  |P.  ...Z....d...|
00002650  0f 6e 04 0d 0f 78 0f dd  f2 65 72 72 6f 72 28 61  |.n...x...error(a|
00002660  25 29 0d 0f 82 24 85 20  61 25 2c 22 44 72 61 77  |%)...$. a%,"Draw|
00002670  20 66 69 6c 65 20 72 65  6e 64 65 72 69 6e 67 20  | file rendering |
00002680  65 72 72 6f 72 22 0d 0f  8c 05 e1 0d 0f 96 04 0d  |error"..........|
00002690  0f a0 12 dd 20 a4 73 74  72 69 6e 67 30 28 73 25  |.... .string0(s%|
000026a0  29 0d 0f aa 0b ea 20 49  25 2c 6e 24 0d 0f b4 1b  |)..... I%,n$....|
000026b0  49 25 3d 30 3a 6e 24 3d  c4 32 30 30 2c 22 20 22  |I%=0:n$=.200," "|
000026c0  29 3a 6e 24 3d 22 22 0d  0f be 18 c8 95 20 73 25  |):n$=""...... s%|
000026d0  3f 49 25 3e 33 31 20 80  20 49 25 3c 32 35 34 0d  |?I%>31 . I%<254.|
000026e0  0f c8 12 20 20 6e 24 2b  3d bd 28 73 25 3f 49 25  |...  n$+=.(s%?I%|
000026f0  29 0d 0f d2 0b 20 20 49  25 2b 3d 31 0d 0f dc 05  |)....  I%+=1....|
00002700  ce 0d 0f e6 07 3d 6e 24  0d 0f f0 04 0d 0f fa 29  |.....=n$.......)|
00002710  f4 20 47 65 74 20 68 6f  6c 64 20 6f 66 20 74 68  |. Get hold of th|
00002720  65 20 70 61 6c 65 74 74  65 20 6f 66 20 61 20 73  |e palette of a s|
00002730  70 72 69 74 65 0d 10 04  27 f4 20 61 6e 64 20 72  |prite...'. and r|
00002740  65 74 75 72 6e 20 54 52  55 45 2f 46 41 4c 53 45  |eturn TRUE/FALSE|
00002750  20 74 6f 20 69 6e 64 69  63 61 74 65 0d 10 0e 19  | to indicate....|
00002760  f4 20 69 74 73 20 70 72  65 73 65 6e 63 65 20 6f  |. its presence o|
00002770  72 20 6e 6f 74 0d 10 18  04 0d 10 22 32 dd 20 a4  |r not......"2. .|
00002780  72 65 61 64 5f 73 70 72  69 74 65 5f 70 61 6c 65  |read_sprite_pale|
00002790  74 74 65 41 28 61 64 64  72 25 2c 70 61 6c 65 74  |tteA(addr%,palet|
000027a0  74 65 25 2c 6c 32 62 70  70 25 29 0d 10 2c 28 ea  |te%,l2bpp%)..,(.|
000027b0  20 49 25 2c 70 61 6c 25  2c 65 6e 74 72 79 25 2c  | I%,pal%,entry%,|
000027c0  65 6e 74 72 69 65 73 25  2c 72 65 73 25 2c 6d 61  |entries%,res%,ma|
000027d0  73 6b 25 0d 10 36 0a 72  65 73 25 3d a3 0d 10 40  |sk%..6.res%=...@|
000027e0  11 e7 20 61 64 64 72 25  3c 3e 2d 31 20 8c 0d 10  |.. addr%<>-1 ...|
000027f0  4a 11 20 20 c8 8e 20 6c  32 62 70 70 25 20 ca 0d  |J.  .. l2bpp% ..|
00002800  10 54 0d 20 20 c9 20 30  2c 31 2c 32 0d 10 5e 1f  |.T.  . 0,1,2..^.|
00002810  20 20 20 20 65 6e 74 72  69 65 73 25 3d 31 3c 3c  |    entries%=1<<|
00002820  28 31 3c 3c 6c 32 62 70  70 25 29 0d 10 68 10 20  |(1<<l2bpp%)..h. |
00002830  20 20 20 6d 61 73 6b 25  3d 2d 31 0d 10 72 09 20  |   mask%=-1..r. |
00002840  20 c9 20 33 0d 10 7c 13  20 20 20 20 65 6e 74 72  | . 3..|.    entr|
00002850  69 65 73 25 3d 31 36 0d  10 86 17 20 20 20 20 6d  |ies%=16....    m|
00002860  61 73 6b 25 3d 26 37 30  33 30 37 30 30 30 0d 10  |ask%=&70307000..|
00002870  90 07 20 20 cb 0d 10 9a  19 20 20 70 61 6c 25 3d  |..  .....  pal%=|
00002880  61 64 64 72 25 2b 34 2a  28 31 32 2d 31 29 0d 10  |addr%+4*(12-1)..|
00002890  a4 23 20 20 e7 20 61 64  64 72 25 21 28 34 2a 28  |.#  . addr%!(4*(|
000028a0  39 2d 31 29 29 3c 3e 34  2a 28 31 32 2d 31 29 20  |9-1))<>4*(12-1) |
000028b0  8c 0d 10 ae 21 20 20 20  20 e3 49 25 3d 30 20 b8  |....!    .I%=0 .|
000028c0  20 28 65 6e 74 72 69 65  73 25 2d 31 29 2a 34 20  | (entries%-1)*4 |
000028d0  88 34 0d 10 b8 26 20 20  20 20 20 20 65 6e 74 72  |.4...&      entr|
000028e0  79 25 3d 28 70 61 6c 25  21 28 49 25 2a 32 29 29  |y%=(pal%!(I%*2))|
000028f0  20 80 20 6d 61 73 6b 25  0d 10 c2 1d 20 20 20 20  | . mask%....    |
00002900  20 20 70 61 6c 65 74 74  65 25 21 49 25 3d 20 65  |  palette%!I%= e|
00002910  6e 74 72 79 25 0d 10 cc  09 20 20 20 20 ed 0d 10  |ntry%....    ...|
00002920  d6 0e 20 20 20 20 72 65  73 25 3d b9 0d 10 e0 07  |..    res%=.....|
00002930  20 20 cd 0d 10 ea 05 cd  0d 10 f4 09 3d 72 65 73  |  ..........=res|
00002940  25 0d ff                                          |%..|
00002943