Home » Archimedes archive » Archimedes World » AW-1994-06-Disc2.adf » Disk2Jun94 » !AWJune94/Goodies/Zap/!Zap/Docs/Redraw

!AWJune94/Goodies/Zap/!Zap/Docs/Redraw

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-1994-06-Disc2.adf » Disk2Jun94
Filename: !AWJune94/Goodies/Zap/!Zap/Docs/Redraw
Read OK:
File size: 9414 bytes
Load address: 0000
Exec address: 0000
File contents
*************************************************************************
* >Redraw - Documentation for the ZapRedraw module v0.20		*
*************************************************************************

Summary:
--------

The module ZapRedraw provides the "ZapRedraw_" SWI's which are capable of
drawing a rectangle of text characters on screen. It offers the following
features:

* Redraw may be by direct screen access (henceforth DSA) where the
  data is poked into the screen memory or by the standard VDU redraw.
  
* Full colour provided (with your own definable palette). Supports up to 32
  bits per pixel in DSA mode and 24 bit colour in VDU mode.

* DSA redraw can handle any size of bitmap characters. Special optimised
  code is provided by 8*8 pixel characters in 2,4,16 and 256 colour modes.
  Also up to 65536 characters can be defined.
  
* VDU redraw mode can handle any font and font size.

* Support is provided for cursors.

* Many extra SWIs perform all the work of creating cached bitmaps, updating
  them on a mode change etc. Swi's are also provided for creating palettes
  and other functions related to the redraw.

* An example program is provided which can be used as a template.
  
Limitations:

* All characters are equally spaced. Proportional spacing is not supported.

Copyright:
----------

The ZapRedraw module is copyright Dominic Symes 1994. Please contact me if
you wish to use it in a program other than Zap. See the Zap Copyright file
for my address.

Definitions required for the SWI's
==================================

ZapRedraw chunk prefix: ZapRedraw
ZapRedraw chunk number: &48480

All SWI numbers below are given as offsets from the chunk number.

'DSA' means direct screen access mode (characters poked into the screen).
'VDU' means VDU mode (operating system called to draw characters).

Pixel co-ordinates are used wherever possible to prevent rounding errors when
OS co-ordinates are not pixel aligned (these errors DO mess things up!).
Pixel co-ordinates are from the top left of the screen with the y axis
descending. By a 'pixel' I mean a hardware pixel (this differs from an OS
pixel in double-pixel emulation modes - this only crops up in the RISC OS 2
MODE 2 wimp!).

Zap redraw block:
-----------------

For several SWI's, R1 points to a redraw block of the type described below.
The SWI documentation will mention which data in the block is actually used
by that SWI (so should be filled in). Each offset in the block is named with
a name beginning 'r_'. The Basic program E-Library contains a procedure to
set these variables up should you be using the Basic assembler. The contents
of some offsets depends on which redraw mode is being used (VDU or DSA), this
is indicated by 'VDU:' and 'DSA:'.

Offset	Name		Function

&00	r_flags		Flags word determining the type of redraw:
			b0 Clear for DSA mode. Set for VDU redraw mode.
			b1 Set for 'double height mode'. Only valid in DSA
			   mode. Draws each raster twice so actual character
			   height is 2*r_charh and spacing 2*r_linesp.
			b2 Extension routine provided.
			   Only valid in DSA mode. See ZapRedraw_RedrawArea.
			b3-31 Reserved - set to zero.
&04	r_minx		Min x of redraw (pixels from lhs - inclusive)
&08	r_miny		Min y of redraw (pixels from top - inclusive)
&0C	r_maxx		Max x of redraw (pixels form lhs - exclusive)
&10	r_maxy		Max y of redraw (pixels from top - exclusive)
&14	r_screen	DSA: Address of screen to write to or 0 to read the
			     current screen address.
			VDU: ignored
&18	r_bpl		DSA: Bytes per raster line of the screen
			VDU: ignored
&1C	r_bpp		Log base 2 of number of bits per pixel
			(ie 0=2 cols 1=4 cols 2=16 cols 3=256 cols
			4=65536 cols 5=2^32 cols).
&20	r_charw		Width of a character in pixels
&24	r_charh		Height of a character in pixels
&28	r_caddr		DSA: Address of character cache (format below)
			VDU: Pointer to font name or 0 for system font
&2C	r_cbpl		DSA: Number of bytes per cached character line.
			VDU: x os offset of where to print the font char
			     in the character 'box'. (eg 0 for system font)
&30	r_cbpc		DSA: Number of bytes per cached character.
			VDU: y os offset of where to print the font char
			     in the character 'box'. (eg char height-1 for
			     system font as VDU5 plots char downwards).
&34	r_linesp	Line spacing in pixels.
&38	r_data		Address of data (rectangle of characters) to print
			on the screen (format below).
&3C	r_scrollx	Horizontal scroll offset in rectangle of characters
			given in r_data of top left of redraw rectangle.
			This is in pixels from the lhs of the characters.
			Thus it equals n*r_charw+m where n is the number of
			characters in and m is the number of pixels into
			the n'th character.
&40	r_scrolly	Vertical scroll offset in rectangle of characters
			given in r_data of top left of redraw rectangle.
			This is in pixels from the top of the characters.
			Note that in single height mode each line is
			r_charh+r_linesp pixels high and in double height
			mode each line is 2*(r_charh+r_linesp) pixels high.
&44	r_palette	Address of palette to be used for colour translation.
			(see below).
&48	r_for		Foreground colour to use at the start of a line as an
			offset in the palette table.
&4C	r_bac		Background colour to use at the start of a line as
			an offset in the palette table.
&50	r_workarea	Pointer to an area of workspace for the SWI to use.
			The size of this workspace depends on the SWI.
			(It must be word aligned).
&54	r_magx		Log base 2 of number of x os co-ords per pixel.
&58	r_magy  	Log base 2 of number of y os co-ords per pixel.
&5C	r_xsize		Width of screen in pixels.
&60	r_ysize		Height of screen in pixels.
&64	r_mode		Current screen mode.

Character cache format (r_caddr):
---------------------------------

When using VDU redraw, this should point to the name of the font to use, or
be zero for the system font.

When using direct screen access, the module will expect this block to contain
the bitmaps for all the characters it is asked to print. Each character has
size r_cbpc so it will expect to find the bitmap for ascii character 'n' at
address char_start=(!r_caddr)+n*r_cbpc. The character definition then
consists of r_charh rows of r_cbpl each so r_cbpc=r_charh*r_cbpl. NB r_cbpl
need not be a multiple of 4 so this address need not be word aligned.

The format of a row is the same of that for a sprite file except there is
never any lhs wastage. Ie, the first pixel is aligned to the start of the
first word. Each character is r_charw pixels wide and thus requires
N=r_charw<<r_bpp bits of storage. There are special cases when N is small:

 If 0<N=<8  then r_cbpl=1 and the top 8-N bits of each byte are wasted.
 If 8<N=<16 then r_cbpl=2 and the top 16-N bits of each byte are wasted.
 If N>16    then r_cbpl is aligned to the next multiple of 4 bytes greater
  or equal to N. (eg 16<N=<32 => r_cbpl=4, 32<N=<64 => r_cbpl=8 etc).
  
The SWI ZapRedraw_CachedCharSize will calculate the values of r_cbpl and
r_cbpc for you from a given size of character.

Only TWO colours can be used in the defn of the character. Set all foreground
pixels to 1's and background pixels to 0's. Eg, in a 16 colour mode pixels
will be either 1111 or 0000. Unused bits at the end of the words (or bytes)
are ignored and so can contain rubbish. The real foreground and background
colours are masked in at run time.

 Examples:

 For 8*8 characters at 1 bit per pixel we have 1 byte per row. Eg "E" may be
 cached as:
  				b0 .. b7
  	row0	&7E		01111110
	row1	&06		01100000
  	row2	&06		01100000
  	row3	&7E		01111110
  	row4	&06		01100000
  	row5	&06		01100000
  	row6	&7E		01111110
  	row7	&00		00000000
 
 If it was in a 16 colour mode then there would be one word per row and the
 first rows would be:
 				b0 ......................... b31
 	row0	&01111110	00001111111111111111111111110000
 	row1	&00000110	00001111111100000000000000000000
 	...
  	
 In general you have:
 
 	Word 0					Word (N/4)-1
 	b0 .... b31    ...................      b0 ..... b31
 	pix0 pix1 ......................pix(r_charw-1) 00000
 	
In practice you first cache the font at one bit per pixel (eg use
ZapRedraw_ReadSystemChars) and then convert it to 'n' bits per pixel (for the
current mode) by use of ZapRedraw_ConvertBitmap.

Although I have said that the foreground colour must be all 1's and the
background all 0's this is not strictly true. The data poked into the screen
memory is (foreground mask AND bitmap) OR (background mask BIC bitmap). Thus
if you have a foreground mask of &FFFFFFFF and a background mask of 0 then
the bitmap will be poked directly into the screen so can have any format you
like (though character merging and several other features may not work
properly). This idea can be used in conjunction with ZapRedraw_CacheFontChars
to create a fast redraw mode for anti aliased fonts (as used in Zap).

Format of text to display (r_data):
-----------------------------------

This block contains the text to be printed on the screen. There should be
sufficient text here to redraw the specified area of the screen (given its
size, the scroll offset, character sizes etc). Terminating each line with
the bytes 0,2 will ensure the redraw doesn't run out of text horizontally and
terminating the line list with a zero will ensure the same vertically. The
value in r_data points to a list of words. The n'th word in the list is the
offset (from the block data start) of the n'th line of text to be printed in
the window. This list can be terminated by a 0 offset in which case all
further lines will be cleared to background colour (r_bac).

The data for each line consists of a string of bytes giving the characters to
print. By character number 'n' will I mean the n'th (n starting from 0)
bitmap in your character cache in DSA mode or the character with ASCII code
'n' in VDU redraw mode. The Redraw module does not limit n to the range 0-255
but also allows higher values. Currently you can access 0-65535. Of course,
ASCII characters for the codes 0-31 and 256-65535 are not defined. Zap treats
these specially - see below.

The byte 0 in the data for a line introduces a control code. Bytes 1-255 just
print characters n=1-255 as normal so you will need to use control codes to
access characters > 256. The currently defined control sequences are:

 0,0		Prints character n=0.
 0,1,f,b	Switch colour to foreground f and background b. (f/b are
		palette offsets - see r_for/r_bac).
 0,2		End of line - the rest of the line is cleared to the current
 		background colour.
 0,3,l,h	Print character n=l+h*256.
 0,4,f,b,x,y	Merges the characters x,y. If a pixel is clear in the bitmap
		for y then the pixel is drawn according to the bitmap for x
		and the current for/background colours. If the pixel is
		set for y then the colours f/b are used instead for the x
		pixel. Useful for laying a cursor on top of the character.
		This effect is simulated in VDU mode by using sprites and
		masks. This leaves the current foreground and background
		colours unaltered. NB x and y may contain control codes as
		well. Eg you could have x=0,0 and y=0,3,0,1. If you nest,
		0,4 codes (ie either x or y contain 0,4) then only the most
		deeply nested one will have effect.
 0,5		For internal use only. Restores the stacked values after a
 		0,4 call. Putting this in your input string will probably
 		cause a crash.
 0,6,f		Change foreground colour to f.
 0,7,b		Change background colour to b.
 0,8,f,b,x,y	Cursor merge of characters x,y. This is similar to 0,4 but
 		only works for characters &7F,&100-&105. For &7F, it masks
 		in the block simply by changing the for/bac cols of the
 		current character being printed. For &100+, the square or
 		line is plotted over the top of the character in the
 		background colour b.

Note that sequences with codes 0,3,4 evaluate to one 'screen printable
character', code 1 to none, and code 2 to as many as is required. Thus it is
not a simple matter to calculate the start of the n'th actual printable
character given a string containing control codes as above. The SWI
ZapRedraw_FindCharacter does this for you.

In DSA mode character 'n' just looks up the cached character at address
r_caddr+n*r_cbpc. Usually the bitmaps will correspond to the VDU list
below so that character &20 will be the bitmap for a space etc.
 
In VDU mode character 'n' is interpreted as below:

  &00		Prints a '0' (ASCII &30)
  &01-&1A	These print the letters A-Z (ie &40 is added)
  &1B-&1F	Prints "[ \ ] ^ _" respectively (ie &40 is added)
  &20-&7E	Usual Ascii characters printed.
  &7F		This draws a filled in block (useful for a cursor)
  &80-&FF	Usual Ascii characters printed.
  &100		This draws the top,bottom,left edges ie '['.
  &101		This draws the top,bottom edges.
  &102		This draws the top,bottom,right edges ie ']'.
  &103		This draws an empty square (useful for a cursor)
  &104		This draws the baseline ie '_' (useful for a cursor)
  &105		This draws the left edge giving a vertical bar.
  &106+		Undefined action (prints an @ for debugging purposes)
  		(More codes may be added in future).
  
The characters are drawn using OS_WriteN/OS_WriteC/OS_Plot (or Font_Paint if
not using the system font).

Use ZapRedraw_FindCharacter to jump over the control codes. Use
ZapRedraw_PrepareDataLine to automatically generate the r_data lines from
normal text with foreground and background colour masks. Use
ZapRedraw_AddVduBitmaps to create the bitmaps for character codes 0-&1F,&7F
and >=&100.

Format of palette data (r_palette):
-----------------------------------

All colours are specified as offsets in the palette table. Thus if you set
r_for to 1 then the module will look up the word at offset 4*1 in the palette
table when it comes to printing a character.

DSA MODE: The palette consists of a list of words giving the colour 'mask' to
use for this colour. The mask is duplicated to fill the word out. For
example, in a 16 colour mode, the mask &AAAAAAAA would stand for actual
screen colour 10. The table:

		&33333333
		&66666666
		&AAAAAAAA
		&00000000
		
would cause 3 to be poked into the screen when in zap colour 0, 6 when in
zap colour 1 etc. The masks will usually correspond to the wimp colours. The
SWI ZapRedraw_CreatePalette is provided to set them up.

The actual value poked into the screen is: (Foreground mask AND bitmap) OR
(Background mask BIC bitmap) where the bitmap is as specified in r_caddr.

VDU MODE: The palette consists of a list of words giving the 24 bit colour
required. The word is in the form of a standard palette entry. Ie, &BBGGRRxx
where &BB is the amount of blue etc. These will usually be set up by reading
the wimp palette. The SWI ZapRedraw_CreatePalette will do this for you.
ColourTrans calls will be used during the redraw to find the closest
available GCOL colour.

*****************************************************************
* SWI Definitions						*
*****************************************************************

None of the SWI's are re-entrant unless explicitly mentioned. All the SWI's
corrupt R0 and flags and can produce errors.

ZapRedraw_RedrawArea (+&00)
---------------------------

This redraws a rectangle of characters on the screen.

Entry:	R1=redraw block (as described above).
	All defined offsets in the redraw block are used.
	
	In VDU mode r_workarea must be at least 64 bytes+the amount needed
	 for a sprite of one character - see ZapRedraw_SpriteSize.
	 If using fonts then the first word of the workarea should contain
	 the fontsize in points.
	
	In DSA mode r_workarea must be at least 64+r_cbpl bytes (and a
	 whole number of words long).
	 If b2 of the r_flags word is set then you provide an extension
	 routine and:
	  R2=address of the routine
	  R3=private word value to pass to the routine.

Exit:	R0 and flags corrupted.

The extension routine is provided so you can trap unknown control codes and
add extra functionality to the ones that exist. For example, you may wish to
change font on a colour change. Zaps fast font redraw mode does this. If you
provide an extension routine then on entry to it R0=reason code R12=your
private word and:

 R0=0 => Starting a raster line:
 	 R1=redraw block
 	 R3=address of first character
 	 R4=r_caddr+r_cbpl*row where row (0 ... r_charh-1) is the current
 	    character row being drawn. Or, R4=0 if in line spacing.
 	 R5=screen address of current word being written
 	 R6=bit offset in current word being written
 	 R7=current word being writen (bits >= R6 are clear)
 	 R10=start foreground mask (eg &77777777)
 	 R11=start background mask (eg &00000000)
 	 
 R0=1 => Foreground and background colours changing (control code 0,1)
 	 Registers as above with R3=next character after the control
 	 code and R10,R11 new foreground/background masks etc.
 
 R0=4 => About to merge characters (control code 0,4)
 	 R1=redraw block
 	 R2=character defn table to use for the mask character
 	 R3=next character after the merge
 	 R4=character defn table for the base character (as for R0=1)
 	 R6=base char
 	 R7=mask char (or these are -1 if invalid).
 	 R8/R9=for/bac masks where mask character bits set.
 	 R10/R11=current for/bac masks.
 	 NB Any changes you make to these registers will be effective for
 	 this one character only the normal values being stacked.
 
 R0=6 => Foreground colour changing (control code 0,6)
 	 Registers as for R0=1.
 
 R0=7 => Background colour changing (control code 0,7)
 	 Registers as for R0=1.
 	 
 R0=8 => About to cursor merge characters (control code 0,8)
 	 Registers as for R0=4
 	 If R7<&100 then R10/R11 will be set to R9/R8 and next char drawn
 	 If R7>=&100 then the characters will be merged with R9
 	 copied into R8.

 R0=2,3,5,>8	 Reserved - ignore.
 
 Exit:  You may corrupt R0 and R12 and alter the registers mentioned
  	(except R1!) to new (sensible) values.
  	All registers are reset at the start of a new raster line.
  	You must not alter the redraw block itself.
	You CANNOT return errors from an extension call.

ZapRedraw_GetPaletteEntry (+&01)
--------------------------------

This SWI takes a colour bitmap and duplicates it to fill a word, creating
a mask as needed for r_palette in DSA mode. Eg if R0=7 and R1=2 on entry then
R0=&77777777 on exit.

Entry:	R0=The colour number to be poked into the screen. (0->num_of_cols-1)
	R1=r_bpp (0-5)

Exit:	R0=Mask to put in palette table (with colour duplicated to fill the
	word).

ZapRedraw_RedrawRaster (+&02)
-----------------------------

Redraws a single raster line. Only applies to non-vdu redraw. This is a low
level call used by ZapRedraw_RedrawArea and not of much use otherwise.

Entry:	R1=redraw block
           Offsets used are: r_flags,r_minx,r_maxx,r_bpp,r_charw,r_charh
            r_cbpl,r_cbpc,r_palette,r_workarea.
	R3=address of text to use for this line starting at the first
	   visible character.
	R4=address of character defn table with row offset added so redraw
	   uses first 'row' of each bitmap, or set to 0 if you want the
	   line to be cleared to the background colour (eg interline gap).
	R5=screen address of the start of the raster line.
	R6=b0-b15	= start foreground colour to use (eg r_for value)
	   b16-b31	= start background colour to use (eg r_bac value)
	The initial words of r_workarea are set up as follows:
	#0 Pixel scroll offset within the first visible char (0->charw-1)
	#4 Number of pixels to do from the first character   (0->charw-1)
	#8 Number of whole characters to do after the first char
	#12 Number of pixels to do in the last visible char  (0->charw-1)
	#16 -
	#20 Address of extension sub if redraw flags bit 2 set
	#24 Extension sub private word pointer redraw flags bit 2 set
			
Exit:	R0 and flags corrupted.

ZapRedraw_ConvertBitmap (+&03)
------------------------------

This SWI takes a character bitmap of the form of 1 bit per pixel, (the bit
set for foreground/clear for background) and converts it into a bitmap for
use by the RedrawArea SWI, by changing each '1' to n '1's and each '0' to
n '0's where 'n' is the number of bits per pixel given. It uses the SWI
ZapRedraw_ConvBitmapChar to do this.

Entry:	R1=redraw block, offsets looked at are:
	r_bpp		To find the number of bits per pixel.
	r_charw		Width of char in pixels
	r_charh		Height of char in pixels
	r_caddr		Address to write the bitmap. Memory at offsets
			R2*r_cbpc to (R3+1)*r_bpc must be preserved
	r_cbpl		Cache line width in bytes (as defined under
			r_caddr help text)
	r_cbpc		Number of bytes per cached character (as defined
			under r_caddr help text)
	R2=First character to be converted (eg 0)
	R3=Last character to be converted (inclusive) (eg 255)
	R4=Address of source bitmap of the format described under r_caddr
	   but with 1 bit per pixel (ie 2 colour mode format)

Exit:	r_caddr block written to.
	R0 and flags corrupted.

ZapRedraw_PrepareDataLine (+&04)
--------------------------------

This SWI is to help prepare the 'r_data' field of the redraw block. It takes
as input the pointer to a line of text character (0-255) to be treated as
ordinary characters (0 is not a control code). It also takes as input a
pointer to a background mask and a foreground mask list, giving the
background and foreground colours of each character separately. The output is
a line of the format required by 'r_data' with control codes changing the
colours and specifying the line end. Control codes in the input string can
have their colour set automatically by setting R0 to the colour.

Eg: Input:

	Text input (characters): "HELLO WORLD         "
	Foreground (bytes list):  11111122222222222222
	Background (bytes list):  00000000000000000000
	Start background 0
	Start foreground 1
	Input length 20
        
    Output: "HELLO ",0,1,2,0,"WORLD",0,2 (highest letter used = "W").
    
Entry:	R0=foreground colour to use for control characters (0-&1F) or
	   set to -1 if you do not wish ctrl chars to be specially treated.
	R1=redraw block giving start foreground background colours in
	   r_for,r_bac - nothing else used.
	R2=pointer to text input string (length in R5)
	R3=pointer to foreground mask (length in R5)
	R4=pointer to background mask (length in R5)
	R5=length of inputs in bytes
	R6=destination buffer (length must be at least 6*R5+16 to ensure
	   it is big enough - colour change + 0 -> 0,0 + terminator).
	   
Exit:	R0=highest used character code used (ie &20-&FF). You may not
	want to cache all font characters as usually those >= 128 are not
	needed. This tells you the range you MUST cache.
	R5=length of output string (including 0,2 terminator)
	Only the codes 0,0 (for byte 0) 0,1 (for change colour) 0,2 (line
	end) are used.

ZapRedraw_AddCursor (+&05)
--------------------------

This SWI takes a line of the same format used in 'r_data', eg the output from
the above SWI, and adds in the codes to place 'cursors' over some of the text
by using the code 0,4 (merge characters) or the code 0,8 (merge cursors).
Here, a cursor means a string of characters to be overlayed.

 Entry:	R0=destination string
 	R1=redraw block giving initial r_for and r_bac.
 	R2=offset in source string of first character to be in the cursor
	R3=cursor length (length in characters of string pointed to by R4)
	R4=pointer to string of cursor characters (usually &7Fs)
	R5=source string (0,2 terminated)
	R6=swap colour/-1 if none. If the character having the cursor placed
	   over it has this foreground colour then the cursor bac/foreground
	   cols are swapped over (eg in a selected region).
	R7=b0-b7   high byte to use for cursor characters in R4 string
	   b8-b15  control code to use when merging ie 4 or 8.
	   b16-b23 foreground colour of the cursor
	   b24-b31 background colour of the cursor
	Room should be reserved for the string to grow by 8*R3
	characters. (eg 0,4,f,b,old,0,3,l,h) If the indicated offset (R2)
	is off the end of the string then it will be lengthened with spaces
	(&20) so you should ensure R2+9*R3 characters extra are reserved.
	
 Exit:	R0=end of new destination string (after 0,2 terminator)
 
ZapRedraw_FindCharacter (+&06)
------------------------------

This SWI takes as input a line of the format required by 'r_data' (ie
containing ctrl sequences starting with 0) and a number 'n' and returns the
start of the (n+1)'th printable character within this line (ie it skips over
n printable characters), ignoring colour change control codes etc. Thus on
exit it points to a byte 1-255 or one of the control sequences 0,0 or 0,2 or
0,3,l,h or 0,4,f,b,c1,c2 each of which define one printable character. If the
offset n is off the end of the line then it will point to the 0,2 terminator.
It also keeps track of the colour changes that take place. NB If n=0 then it
may still be useful - as it will jump over any colour changes before the
first character. If R0>R1 on exit then the character was found, otherwise
there were R1-R0 characters left to skip.

Eg: Input:	"hello ",0,1,2,3,"goodbye",0,2
    Output:	If n=0 then it will point to the 'h'
    		If n=6 then it will point to the 'g'
    		If n=100 then it will point to the 0 of 0,2.
 
 Entry:		R0=n (number of characters to skip)
 		     (or -1 to move to the end of the string - find its len)
		R1=pointer to the input string (terminated by 0,2)
 		R2=current foreground colour
 		R3=current background colour
 		
 Exit:		R0=If the n'th character is in the string then this points
 		    to the end of the n'th character (start in R1)
 		   If the n'th 'character' is the terminator (0,2) then this
 		    equals R1 (start of the terminator)
 		   If it reached the string terminator before the n'th
 		    character then this is R1-number of chars not skipped
 		R1=start of the next printable character after skipping n.
 		   (or string terminator if reached that first).
 		R2-R3 updated by any colour change control codes.
 		Flags corrupted.
 		   
ZapRedraw_MoveBytes (+&07)
--------------------------

This is a fast byte shifting SWI. Highly optimised and bytes are shifted
starting at the top or bottom depending on whether the destination address is
higher or lower than the start (respectively). Thus the data is always
preserved.

 Entry:		R1=source address (need not be word aligned)
 		R2=destination address (need not be word aligned)
 		R3=number of bytes to move (>=0)
 
 Exit:		R0-R3 and flags corrupted.

ZapRedraw_CachedCharSize (+&08)
-------------------------------

This SWI works out the values of r_cbpl,r_cbpc from r_charw,r_charh,r_bpp in
the manor defined under the help text on r_caddr. Ie, r_cbpl is either 1,2,
or a multiple of 4 and r_cbpc=r_charh*r_cbpl.

 Entry:		R0=r_bpp value
 		R2=r_charw value
 		R3=r_charh value
 		
 Exit:		R2=number of bytes per cache line (r_cbpl)
 		R3=number of bytes per cached character (r_cbpc)

ZapRedraw_ConvBitmapChar (+&09)
-------------------------------

This SWI is for the use of the ConvertBitmap SWI and performs the bitmap
conversion for one character. It takes a bit map of the one bit per pixel
format and expands it to have n=2^R7 bits per pixel by replacing each '0'
with n '0's and each '1' with the mask in R6 (usually n '1's). Thus for
standard conversion you should set R6 to be 2^n-1 (=2^(2^R7)-1). (NB if R7
(=r_bpp) is zero then all you have to do is copy the bitmap. R7=0 is not
supported by this call.

 Entry:		R1=redraw block (only r_charh is used to find the height of
 		   the character in pixels).
 		R2=bytes per cache line for the source character (1,2,*4)
 		R3=bytes per cache line for the dest character (1,2,*4)
 		R4=pointer to source character bitmap
 		R5=address to place destination character bitmap
 		R6=bit mask to insert in place of 1's (only bottom 2^R7 bits)
 		R7=Log_2 of number of bits per pixel (1-5)
 
 Exit:		R4 and R5 updated to the start of the 'next' characters.
 		R0 and flags corrupted.

ZapRedraw_CreatePalette (+&0A)
------------------------------

This SWI is used to create the r_palette data block. If R0=1 on entry then it
takes a palette consisting of a list of wimp colour numbers (one per word)
and converts it to entries of the form &BBGGRRxx, a 24 bit palette entry by
using the call Wimp_ReadPalette and duplicating the nibbles. If R0=2 on entry
then it takes a list of entries of the form &BBGGRRxx and converts them to
colour masks required for DSA redraw (see r_palette) using ColourTrans calls
and ZapRedraw_GetPaletteEntry. If R0=3 on entry then it does both, converting
wimp colour numbers to DSA redraw masks.

 Entry:		R0=reason code:
		     b0 Set to convert wimp cols to &BBGGRRxx
		     b1 Set to convert &bbggrrxx to DSA colour masks
		     b2+ reserved - set to 0
 		R1=redraw block. The following are used:
 		   r_bpp      = log_2 of bits per pixel
 		   r_workarea = pointer to 128 byte work area to load wimp
 		   		palette into.
		R2=address of source palette
		R3=address for dest palette (needs 4*R4 bytes preserved)
		   (source may equal destination)
		R4=number of palette entries (eg 16)

 Exit:		R0 and flags corrupted.

ZapRedraw_InsertChar (+&0B)
---------------------------

This inserts a single character into a string of r_data format. If R0=0 then
it inserts 0,0 and if R0>=&100 then it inserts 0,3,x,y where R0=&yyxx.
Otherwise it just inserts the byte as normal.

 Entry:		R0=character
 		R1=string address
 		
 Exit:		R1 updated 'till after the character
 		R0 and flags corrupted.

ZapRedraw_ReadSystemChars (+&0C)
--------------------------------

This reads the standard system characters bitmaps via OS_Word calls. It reads
them in 1 bit per pixel (8 bytes per character) form suitable for
ZapRedraw_ConvertBitmap to convert it to a form usable for
ZapRedraw_RedrawArea. To do this, it just bit-reverses the information read
by OS_Word,10. It only reads characters &20-&FF, leaving 0-&1F untouched. The
bit reversing is done efficiently so this call is fairly fast.

 Entry:		R0=buffer for bitmap (size 8*256=&800=2k)
 		R1=redraw block. r_workarea must be a 16 byte work area.
 		
 Exit:		R0 and flags corrupted.

ZapRedraw_ReverseBitmaps (+&0D)
-------------------------------

This SWI takes a list of bytes and reverses the bits of each byte. This is
useful for reversing the bitmaps (flipping about the y axis) of 8*8 pixel
characters at one bit per pixel (ie r_cbpl=1 r_cbpc=8).

 Entry:		R1=source buffer
 		R2=destination buffer (can equal source)
 		R3=number of bytes (must be a multiple of 4)
 
 Exit:		R0 and flags corrupted.

ZapRedraw_ReadVduVars (+&0E)
----------------------------

This SWI is used to set up the Zap redraw block initially. It puts the value
0 in r_screen so the actual screen address is used when ZapRedraw_RedrawArea
is called (this can change quite often) and fills in r_bpl, r_bpp, r_magx,
r_magy, r_xsize, r_ysize by using the call OS_ReadVduVariables. It also fills
in r_mode by using OS_Byte 135. This call should be made after any mode
change. Compensation is made for double pixel modes by decreasing r_magx. A
pixel in Zap means a hardware pixel rather than an emulated double pixel.

 Entry:		R1=redraw block to update
 		   r_workarea should point to a 64 byte scratch area.
 
 Exit:		R0 and flags corrupted.

ZapRedraw_GetRectangle (+&0F)
-----------------------------

This SWI should be used after calls to Wimp_GetRectangle. It takes the redraw
rectangle block as returned by Wimp_RedrawWindow or Wimp_GetRectangle and
uses it to fill in the ZapRedraw block. The scroll offsets of the update
rectangle are in pixels. The y scroll offset is the amount 'down' from the
work area origin (inclusive), so negating will get the 'upward' scroll
offset in pixels (exclusive), and the shifting by r_magy will give the
normal OS work area scroll offset (which is exclusive).

 Entry:		R0=block as returned by Wimp_RedrawWindow/Wimp_GetRectangle
 		   ie: window handle,minx,miny,maxx,maxy,scrollx,scrolly etc
 		R1=Zap redraw block with r_magx,r_magy,r_xsize,r_ysize
 		   filled in.
 
 Exit:		r_minx,r_miny,r_maxx,r_maxy,r_scrollx,r_scrolly have been
 		filled in in the redraw block pointed to by R1.
 		R0 and flags corrupted.

ZapRedraw_AddVduBitmaps (+&10)
------------------------------

If you look at the VDU codes, you will see that characters 0-&1F,&7F,&100+
are treated specially during a VDU redraw, drawing blocks and squares. The
purpose of this SWI is to create bitmaps for these extra characters from a
standard bitmap of the normal characters, so you can also use these in a DSA
redraw. You specify an interval of characters, and in that interval, it
creates bitmaps for the following:

	&00	Creates bitmap for '0' by copying bitmap &30
	&01-&1F Creates bitmap for 'AB...' by copying bitmaps &41-&5F
	&7F	Creates a filled in square.
	&100	Top bottom and left edge filled [
	&101	Top and bottom edges
	&102	Top bottom and right edge filled ]
	&103	Empty square
	&104	Underscore _
	&105	Left edge (giving a bar)
	&106+	Undefined (currently copies the @ character).
	
This means that the bitmaps will then be consistent with the VDU characters
of these numbers. These bitmaps are also useful as cursors.

 Entry: R1=redraw block (uses r_charw and r_charh to find the char size)
 	   r_workarea must have 64 bytes + room for a character sprite
 	   (see ZapRedraw_SpriteSize) reserved.
        R2=first extra bitmap to create (eg 0)
        R3=last extra bitmap to create (inclusive eg &104)
        R4=address of bitmaps in 1 bit per pixel form.
           (space must be reserved for the characters to be created).

 Exit:	R0 and flags corrupted.

ZapRedraw_CacheFontChars (+&11)
-------------------------------

This SWI takes an anti-aliased font and caches a range of characters as
bitmaps (see r_caddr). The cacheing can be done in any colours or screen
resolution. Of course only those with foreground colour all bits set and
background colour all bits clear can be used directly by
ZapRedraw_RedrawArea. However, by giving a foreground colour mask of -1 and a
background mask of 0 any bitmap can be drawn (see r_caddr etc). An hourglass
is given with the % as the current character/256 if it takes a long time.

 Entry:	R0=reason code and other registers as below.
 	      
  R0=1 => Cache font in current wimp mode (ie wimp palette used).
  	  R1=redraw block with the following set up:
		r_bpp = number of bits per pixel to cache at
		r_caddr = address of cache with space reserved for the chars
		r_cbpl/cbpc/r_charw/r_charh setup
		r_for/r_bac = offset in r_palette of for and bac cols
		r_palette = palette of colours as for VDU redraw mode
			    (ie each entry of form &BBGGRRxx)
		r_workarea = room for 64 bytes + single sprite
			     (use ZapRedraw_SpriteSize).
		r_mode = mode to cache font in (ie mode sprite defined in).
	  R2=pointer to font name
	  R3=font size to plot at (points)
	  R4=x os offset (from bottom left) to plot character in the box
	  R5=y os offset (from bottom left) to plot character in the box
	  R6=first character to cache (0 caches as &30 and 1-&1F have &40
	     added &7F is ignored).
	  R7=last character to cache (inclusive)

  R0=2 => Cache font in mode 0 with background 0 and foreground 1.
	  R1=redraw block with the following set up:
	  	r_caddr = address of cache with space reserved for the chars
	  	r_cbpl/cbpc/r_charw/r_charh setup
	  	r_workarea = as for R0=1
	  	r_magx,r_magy for mode used with reason code R0=1
	  R2-R7 as for reason code R0=1.
	  Font size is scaled up by 2^(1-r_magx) horizontally and
	  2^(2-r_magy) vertically so the characters are the same pixel
	  size as those cached with R0=1.
	  
 Exit: R0 and flags corrupted.

ZapRedraw_SpriteSize (+&12)
---------------------------

Several SWI's (eg ZapRedraw_RedrawArea - VDU mode, ZapRedraw_CacheFontChars)
need to create a sprite area the size of a single character. This call
returns the size required for this sprite (+palette+mask+save area etc), and
thus the amount of workarea that should be reserved. The sprite needs a save
area as it appears that Font_Paint redirects output to a sprite and thus
corrupts the graphics colours. This means that it takes two passes to read
the size required for the sprite - the first to read the size for the sprite
and the second to create the sprite (space now reserved for it) and calculate
the save area required via OS_SpriteOp,62.

 Example: SYS "ZapRedraw_SpriteSize",&01,redraw_block TO size%
 	  PROCensure_workarea(size%)
 	  SYS "ZapRedraw_SpriteSize",&81,redraw_block TO size%
 	  PROCensure_workarea(size%)
 (NB In practice the SWI usually requires 64+size% bytes of workspace)

 Entry:	R0=reason code
 	   b0-b6 1=return sprite size for sprite in current mode and r_bpp
 	         2=return sprite size for a mode 0 sprite (ie assume r_bpp=0)
 	   b7    Clear for first pass, set for second pass.
 	R1=redraw block with r_bpp,r_charw,r_charh setup.
 	   On the second pass r_workarea must be at least the size returned
 	   by the first pass.
 	
 Exit:  On first pass : R0=size required for sprite area (no save area).
 	On second pass: R0=total size required for sprite + save area.

ZapRedraw_RedrawWindow (+&13)
-----------------------------

This SWI performs the calls to Wimp_RedrawWindow, Wimp_GetRectangle,
Zap_GetRectangle, and Zap_RedrawArea for you. It assumes that the redraw
block is already setup. This call is equivalent to the basic code:
	SYS "Wimp_RedrawWindow",,data% TO flag%
        WHILE flag%
         SYS "ZapRedraw_GetRectangle",data%,redraw%
         SYS "ZapRedraw_RedrawArea",,redraw%
         SYS "Wimp_GetRectangle",,data% TO flag%
        ENDWHILE
where redraw% is the address of the redraw block and data% the data block
returned by Wimp_Poll for event 1 (redraw window request).

 Entry:	R0=Redraw block as returned by Wimp for Wimp_Poll 1 (data%)
 	R1=Zap redraw block with r_data containing the text to redraw. All
 	   of the block should be setup apart from rectangle to draw
 	   and the scroll offsets which are filled in for you.
 	   
 Exit:	R0 and flags corrupted.
00000000  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000040  2a 2a 2a 2a 2a 2a 2a 2a  2a 0a 2a 20 3e 52 65 64  |*********.* >Red|
00000050  72 61 77 20 2d 20 44 6f  63 75 6d 65 6e 74 61 74  |raw - Documentat|
00000060  69 6f 6e 20 66 6f 72 20  74 68 65 20 5a 61 70 52  |ion for the ZapR|
00000070  65 64 72 61 77 20 6d 6f  64 75 6c 65 20 76 30 2e  |edraw module v0.|
00000080  32 30 09 09 2a 0a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |20..*.**********|
00000090  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000000c0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 0a  |***************.|
000000d0  0a 53 75 6d 6d 61 72 79  3a 0a 2d 2d 2d 2d 2d 2d  |.Summary:.------|
000000e0  2d 2d 0a 0a 54 68 65 20  6d 6f 64 75 6c 65 20 5a  |--..The module Z|
000000f0  61 70 52 65 64 72 61 77  20 70 72 6f 76 69 64 65  |apRedraw provide|
00000100  73 20 74 68 65 20 22 5a  61 70 52 65 64 72 61 77  |s the "ZapRedraw|
00000110  5f 22 20 53 57 49 27 73  20 77 68 69 63 68 20 61  |_" SWI's which a|
00000120  72 65 20 63 61 70 61 62  6c 65 20 6f 66 0a 64 72  |re capable of.dr|
00000130  61 77 69 6e 67 20 61 20  72 65 63 74 61 6e 67 6c  |awing a rectangl|
00000140  65 20 6f 66 20 74 65 78  74 20 63 68 61 72 61 63  |e of text charac|
00000150  74 65 72 73 20 6f 6e 20  73 63 72 65 65 6e 2e 20  |ters on screen. |
00000160  49 74 20 6f 66 66 65 72  73 20 74 68 65 20 66 6f  |It offers the fo|
00000170  6c 6c 6f 77 69 6e 67 0a  66 65 61 74 75 72 65 73  |llowing.features|
00000180  3a 0a 0a 2a 20 52 65 64  72 61 77 20 6d 61 79 20  |:..* Redraw may |
00000190  62 65 20 62 79 20 64 69  72 65 63 74 20 73 63 72  |be by direct scr|
000001a0  65 65 6e 20 61 63 63 65  73 73 20 28 68 65 6e 63  |een access (henc|
000001b0  65 66 6f 72 74 68 20 44  53 41 29 20 77 68 65 72  |eforth DSA) wher|
000001c0  65 20 74 68 65 0a 20 20  64 61 74 61 20 69 73 20  |e the.  data is |
000001d0  70 6f 6b 65 64 20 69 6e  74 6f 20 74 68 65 20 73  |poked into the s|
000001e0  63 72 65 65 6e 20 6d 65  6d 6f 72 79 20 6f 72 20  |creen memory or |
000001f0  62 79 20 74 68 65 20 73  74 61 6e 64 61 72 64 20  |by the standard |
00000200  56 44 55 20 72 65 64 72  61 77 2e 0a 20 20 0a 2a  |VDU redraw..  .*|
00000210  20 46 75 6c 6c 20 63 6f  6c 6f 75 72 20 70 72 6f  | Full colour pro|
00000220  76 69 64 65 64 20 28 77  69 74 68 20 79 6f 75 72  |vided (with your|
00000230  20 6f 77 6e 20 64 65 66  69 6e 61 62 6c 65 20 70  | own definable p|
00000240  61 6c 65 74 74 65 29 2e  20 53 75 70 70 6f 72 74  |alette). Support|
00000250  73 20 75 70 20 74 6f 20  33 32 0a 20 20 62 69 74  |s up to 32.  bit|
00000260  73 20 70 65 72 20 70 69  78 65 6c 20 69 6e 20 44  |s per pixel in D|
00000270  53 41 20 6d 6f 64 65 20  61 6e 64 20 32 34 20 62  |SA mode and 24 b|
00000280  69 74 20 63 6f 6c 6f 75  72 20 69 6e 20 56 44 55  |it colour in VDU|
00000290  20 6d 6f 64 65 2e 0a 0a  2a 20 44 53 41 20 72 65  | mode...* DSA re|
000002a0  64 72 61 77 20 63 61 6e  20 68 61 6e 64 6c 65 20  |draw can handle |
000002b0  61 6e 79 20 73 69 7a 65  20 6f 66 20 62 69 74 6d  |any size of bitm|
000002c0  61 70 20 63 68 61 72 61  63 74 65 72 73 2e 20 53  |ap characters. S|
000002d0  70 65 63 69 61 6c 20 6f  70 74 69 6d 69 73 65 64  |pecial optimised|
000002e0  0a 20 20 63 6f 64 65 20  69 73 20 70 72 6f 76 69  |.  code is provi|
000002f0  64 65 64 20 62 79 20 38  2a 38 20 70 69 78 65 6c  |ded by 8*8 pixel|
00000300  20 63 68 61 72 61 63 74  65 72 73 20 69 6e 20 32  | characters in 2|
00000310  2c 34 2c 31 36 20 61 6e  64 20 32 35 36 20 63 6f  |,4,16 and 256 co|
00000320  6c 6f 75 72 20 6d 6f 64  65 73 2e 0a 20 20 41 6c  |lour modes..  Al|
00000330  73 6f 20 75 70 20 74 6f  20 36 35 35 33 36 20 63  |so up to 65536 c|
00000340  68 61 72 61 63 74 65 72  73 20 63 61 6e 20 62 65  |haracters can be|
00000350  20 64 65 66 69 6e 65 64  2e 0a 20 20 0a 2a 20 56  | defined..  .* V|
00000360  44 55 20 72 65 64 72 61  77 20 6d 6f 64 65 20 63  |DU redraw mode c|
00000370  61 6e 20 68 61 6e 64 6c  65 20 61 6e 79 20 66 6f  |an handle any fo|
00000380  6e 74 20 61 6e 64 20 66  6f 6e 74 20 73 69 7a 65  |nt and font size|
00000390  2e 0a 0a 2a 20 53 75 70  70 6f 72 74 20 69 73 20  |...* Support is |
000003a0  70 72 6f 76 69 64 65 64  20 66 6f 72 20 63 75 72  |provided for cur|
000003b0  73 6f 72 73 2e 0a 0a 2a  20 4d 61 6e 79 20 65 78  |sors...* Many ex|
000003c0  74 72 61 20 53 57 49 73  20 70 65 72 66 6f 72 6d  |tra SWIs perform|
000003d0  20 61 6c 6c 20 74 68 65  20 77 6f 72 6b 20 6f 66  | all the work of|
000003e0  20 63 72 65 61 74 69 6e  67 20 63 61 63 68 65 64  | creating cached|
000003f0  20 62 69 74 6d 61 70 73  2c 20 75 70 64 61 74 69  | bitmaps, updati|
00000400  6e 67 0a 20 20 74 68 65  6d 20 6f 6e 20 61 20 6d  |ng.  them on a m|
00000410  6f 64 65 20 63 68 61 6e  67 65 20 65 74 63 2e 20  |ode change etc. |
00000420  53 77 69 27 73 20 61 72  65 20 61 6c 73 6f 20 70  |Swi's are also p|
00000430  72 6f 76 69 64 65 64 20  66 6f 72 20 63 72 65 61  |rovided for crea|
00000440  74 69 6e 67 20 70 61 6c  65 74 74 65 73 0a 20 20  |ting palettes.  |
00000450  61 6e 64 20 6f 74 68 65  72 20 66 75 6e 63 74 69  |and other functi|
00000460  6f 6e 73 20 72 65 6c 61  74 65 64 20 74 6f 20 74  |ons related to t|
00000470  68 65 20 72 65 64 72 61  77 2e 0a 0a 2a 20 41 6e  |he redraw...* An|
00000480  20 65 78 61 6d 70 6c 65  20 70 72 6f 67 72 61 6d  | example program|
00000490  20 69 73 20 70 72 6f 76  69 64 65 64 20 77 68 69  | is provided whi|
000004a0  63 68 20 63 61 6e 20 62  65 20 75 73 65 64 20 61  |ch can be used a|
000004b0  73 20 61 20 74 65 6d 70  6c 61 74 65 2e 0a 20 20  |s a template..  |
000004c0  0a 4c 69 6d 69 74 61 74  69 6f 6e 73 3a 0a 0a 2a  |.Limitations:..*|
000004d0  20 41 6c 6c 20 63 68 61  72 61 63 74 65 72 73 20  | All characters |
000004e0  61 72 65 20 65 71 75 61  6c 6c 79 20 73 70 61 63  |are equally spac|
000004f0  65 64 2e 20 50 72 6f 70  6f 72 74 69 6f 6e 61 6c  |ed. Proportional|
00000500  20 73 70 61 63 69 6e 67  20 69 73 20 6e 6f 74 20  | spacing is not |
00000510  73 75 70 70 6f 72 74 65  64 2e 0a 0a 43 6f 70 79  |supported...Copy|
00000520  72 69 67 68 74 3a 0a 2d  2d 2d 2d 2d 2d 2d 2d 2d  |right:.---------|
00000530  2d 0a 0a 54 68 65 20 5a  61 70 52 65 64 72 61 77  |-..The ZapRedraw|
00000540  20 6d 6f 64 75 6c 65 20  69 73 20 63 6f 70 79 72  | module is copyr|
00000550  69 67 68 74 20 44 6f 6d  69 6e 69 63 20 53 79 6d  |ight Dominic Sym|
00000560  65 73 20 31 39 39 34 2e  20 50 6c 65 61 73 65 20  |es 1994. Please |
00000570  63 6f 6e 74 61 63 74 20  6d 65 20 69 66 0a 79 6f  |contact me if.yo|
00000580  75 20 77 69 73 68 20 74  6f 20 75 73 65 20 69 74  |u wish to use it|
00000590  20 69 6e 20 61 20 70 72  6f 67 72 61 6d 20 6f 74  | in a program ot|
000005a0  68 65 72 20 74 68 61 6e  20 5a 61 70 2e 20 53 65  |her than Zap. Se|
000005b0  65 20 74 68 65 20 5a 61  70 20 43 6f 70 79 72 69  |e the Zap Copyri|
000005c0  67 68 74 20 66 69 6c 65  0a 66 6f 72 20 6d 79 20  |ght file.for my |
000005d0  61 64 64 72 65 73 73 2e  0a 0a 44 65 66 69 6e 69  |address...Defini|
000005e0  74 69 6f 6e 73 20 72 65  71 75 69 72 65 64 20 66  |tions required f|
000005f0  6f 72 20 74 68 65 20 53  57 49 27 73 0a 3d 3d 3d  |or the SWI's.===|
00000600  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00000610  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 0a  |===============.|
00000620  0a 5a 61 70 52 65 64 72  61 77 20 63 68 75 6e 6b  |.ZapRedraw chunk|
00000630  20 70 72 65 66 69 78 3a  20 5a 61 70 52 65 64 72  | prefix: ZapRedr|
00000640  61 77 0a 5a 61 70 52 65  64 72 61 77 20 63 68 75  |aw.ZapRedraw chu|
00000650  6e 6b 20 6e 75 6d 62 65  72 3a 20 26 34 38 34 38  |nk number: &4848|
00000660  30 0a 0a 41 6c 6c 20 53  57 49 20 6e 75 6d 62 65  |0..All SWI numbe|
00000670  72 73 20 62 65 6c 6f 77  20 61 72 65 20 67 69 76  |rs below are giv|
00000680  65 6e 20 61 73 20 6f 66  66 73 65 74 73 20 66 72  |en as offsets fr|
00000690  6f 6d 20 74 68 65 20 63  68 75 6e 6b 20 6e 75 6d  |om the chunk num|
000006a0  62 65 72 2e 0a 0a 27 44  53 41 27 20 6d 65 61 6e  |ber...'DSA' mean|
000006b0  73 20 64 69 72 65 63 74  20 73 63 72 65 65 6e 20  |s direct screen |
000006c0  61 63 63 65 73 73 20 6d  6f 64 65 20 28 63 68 61  |access mode (cha|
000006d0  72 61 63 74 65 72 73 20  70 6f 6b 65 64 20 69 6e  |racters poked in|
000006e0  74 6f 20 74 68 65 20 73  63 72 65 65 6e 29 2e 0a  |to the screen)..|
000006f0  27 56 44 55 27 20 6d 65  61 6e 73 20 56 44 55 20  |'VDU' means VDU |
00000700  6d 6f 64 65 20 28 6f 70  65 72 61 74 69 6e 67 20  |mode (operating |
00000710  73 79 73 74 65 6d 20 63  61 6c 6c 65 64 20 74 6f  |system called to|
00000720  20 64 72 61 77 20 63 68  61 72 61 63 74 65 72 73  | draw characters|
00000730  29 2e 0a 0a 50 69 78 65  6c 20 63 6f 2d 6f 72 64  |)...Pixel co-ord|
00000740  69 6e 61 74 65 73 20 61  72 65 20 75 73 65 64 20  |inates are used |
00000750  77 68 65 72 65 76 65 72  20 70 6f 73 73 69 62 6c  |wherever possibl|
00000760  65 20 74 6f 20 70 72 65  76 65 6e 74 20 72 6f 75  |e to prevent rou|
00000770  6e 64 69 6e 67 20 65 72  72 6f 72 73 20 77 68 65  |nding errors whe|
00000780  6e 0a 4f 53 20 63 6f 2d  6f 72 64 69 6e 61 74 65  |n.OS co-ordinate|
00000790  73 20 61 72 65 20 6e 6f  74 20 70 69 78 65 6c 20  |s are not pixel |
000007a0  61 6c 69 67 6e 65 64 20  28 74 68 65 73 65 20 65  |aligned (these e|
000007b0  72 72 6f 72 73 20 44 4f  20 6d 65 73 73 20 74 68  |rrors DO mess th|
000007c0  69 6e 67 73 20 75 70 21  29 2e 0a 50 69 78 65 6c  |ings up!)..Pixel|
000007d0  20 63 6f 2d 6f 72 64 69  6e 61 74 65 73 20 61 72  | co-ordinates ar|
000007e0  65 20 66 72 6f 6d 20 74  68 65 20 74 6f 70 20 6c  |e from the top l|
000007f0  65 66 74 20 6f 66 20 74  68 65 20 73 63 72 65 65  |eft of the scree|
00000800  6e 20 77 69 74 68 20 74  68 65 20 79 20 61 78 69  |n with the y axi|
00000810  73 0a 64 65 73 63 65 6e  64 69 6e 67 2e 20 42 79  |s.descending. By|
00000820  20 61 20 27 70 69 78 65  6c 27 20 49 20 6d 65 61  | a 'pixel' I mea|
00000830  6e 20 61 20 68 61 72 64  77 61 72 65 20 70 69 78  |n a hardware pix|
00000840  65 6c 20 28 74 68 69 73  20 64 69 66 66 65 72 73  |el (this differs|
00000850  20 66 72 6f 6d 20 61 6e  20 4f 53 0a 70 69 78 65  | from an OS.pixe|
00000860  6c 20 69 6e 20 64 6f 75  62 6c 65 2d 70 69 78 65  |l in double-pixe|
00000870  6c 20 65 6d 75 6c 61 74  69 6f 6e 20 6d 6f 64 65  |l emulation mode|
00000880  73 20 2d 20 74 68 69 73  20 6f 6e 6c 79 20 63 72  |s - this only cr|
00000890  6f 70 73 20 75 70 20 69  6e 20 74 68 65 20 52 49  |ops up in the RI|
000008a0  53 43 20 4f 53 20 32 0a  4d 4f 44 45 20 32 20 77  |SC OS 2.MODE 2 w|
000008b0  69 6d 70 21 29 2e 0a 0a  5a 61 70 20 72 65 64 72  |imp!)...Zap redr|
000008c0  61 77 20 62 6c 6f 63 6b  3a 0a 2d 2d 2d 2d 2d 2d  |aw block:.------|
000008d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 46 6f 72  |-----------..For|
000008e0  20 73 65 76 65 72 61 6c  20 53 57 49 27 73 2c 20  | several SWI's, |
000008f0  52 31 20 70 6f 69 6e 74  73 20 74 6f 20 61 20 72  |R1 points to a r|
00000900  65 64 72 61 77 20 62 6c  6f 63 6b 20 6f 66 20 74  |edraw block of t|
00000910  68 65 20 74 79 70 65 20  64 65 73 63 72 69 62 65  |he type describe|
00000920  64 20 62 65 6c 6f 77 2e  0a 54 68 65 20 53 57 49  |d below..The SWI|
00000930  20 64 6f 63 75 6d 65 6e  74 61 74 69 6f 6e 20 77  | documentation w|
00000940  69 6c 6c 20 6d 65 6e 74  69 6f 6e 20 77 68 69 63  |ill mention whic|
00000950  68 20 64 61 74 61 20 69  6e 20 74 68 65 20 62 6c  |h data in the bl|
00000960  6f 63 6b 20 69 73 20 61  63 74 75 61 6c 6c 79 20  |ock is actually |
00000970  75 73 65 64 0a 62 79 20  74 68 61 74 20 53 57 49  |used.by that SWI|
00000980  20 28 73 6f 20 73 68 6f  75 6c 64 20 62 65 20 66  | (so should be f|
00000990  69 6c 6c 65 64 20 69 6e  29 2e 20 45 61 63 68 20  |illed in). Each |
000009a0  6f 66 66 73 65 74 20 69  6e 20 74 68 65 20 62 6c  |offset in the bl|
000009b0  6f 63 6b 20 69 73 20 6e  61 6d 65 64 20 77 69 74  |ock is named wit|
000009c0  68 0a 61 20 6e 61 6d 65  20 62 65 67 69 6e 6e 69  |h.a name beginni|
000009d0  6e 67 20 27 72 5f 27 2e  20 54 68 65 20 42 61 73  |ng 'r_'. The Bas|
000009e0  69 63 20 70 72 6f 67 72  61 6d 20 45 2d 4c 69 62  |ic program E-Lib|
000009f0  72 61 72 79 20 63 6f 6e  74 61 69 6e 73 20 61 20  |rary contains a |
00000a00  70 72 6f 63 65 64 75 72  65 20 74 6f 0a 73 65 74  |procedure to.set|
00000a10  20 74 68 65 73 65 20 76  61 72 69 61 62 6c 65 73  | these variables|
00000a20  20 75 70 20 73 68 6f 75  6c 64 20 79 6f 75 20 62  | up should you b|
00000a30  65 20 75 73 69 6e 67 20  74 68 65 20 42 61 73 69  |e using the Basi|
00000a40  63 20 61 73 73 65 6d 62  6c 65 72 2e 20 54 68 65  |c assembler. The|
00000a50  20 63 6f 6e 74 65 6e 74  73 0a 6f 66 20 73 6f 6d  | contents.of som|
00000a60  65 20 6f 66 66 73 65 74  73 20 64 65 70 65 6e 64  |e offsets depend|
00000a70  73 20 6f 6e 20 77 68 69  63 68 20 72 65 64 72 61  |s on which redra|
00000a80  77 20 6d 6f 64 65 20 69  73 20 62 65 69 6e 67 20  |w mode is being |
00000a90  75 73 65 64 20 28 56 44  55 20 6f 72 20 44 53 41  |used (VDU or DSA|
00000aa0  29 2c 20 74 68 69 73 0a  69 73 20 69 6e 64 69 63  |), this.is indic|
00000ab0  61 74 65 64 20 62 79 20  27 56 44 55 3a 27 20 61  |ated by 'VDU:' a|
00000ac0  6e 64 20 27 44 53 41 3a  27 2e 0a 0a 4f 66 66 73  |nd 'DSA:'...Offs|
00000ad0  65 74 09 4e 61 6d 65 09  09 46 75 6e 63 74 69 6f  |et.Name..Functio|
00000ae0  6e 0a 0a 26 30 30 09 72  5f 66 6c 61 67 73 09 09  |n..&00.r_flags..|
00000af0  46 6c 61 67 73 20 77 6f  72 64 20 64 65 74 65 72  |Flags word deter|
00000b00  6d 69 6e 69 6e 67 20 74  68 65 20 74 79 70 65 20  |mining the type |
00000b10  6f 66 20 72 65 64 72 61  77 3a 0a 09 09 09 62 30  |of redraw:....b0|
00000b20  20 43 6c 65 61 72 20 66  6f 72 20 44 53 41 20 6d  | Clear for DSA m|
00000b30  6f 64 65 2e 20 53 65 74  20 66 6f 72 20 56 44 55  |ode. Set for VDU|
00000b40  20 72 65 64 72 61 77 20  6d 6f 64 65 2e 0a 09 09  | redraw mode....|
00000b50  09 62 31 20 53 65 74 20  66 6f 72 20 27 64 6f 75  |.b1 Set for 'dou|
00000b60  62 6c 65 20 68 65 69 67  68 74 20 6d 6f 64 65 27  |ble height mode'|
00000b70  2e 20 4f 6e 6c 79 20 76  61 6c 69 64 20 69 6e 20  |. Only valid in |
00000b80  44 53 41 0a 09 09 09 20  20 20 6d 6f 64 65 2e 20  |DSA....   mode. |
00000b90  44 72 61 77 73 20 65 61  63 68 20 72 61 73 74 65  |Draws each raste|
00000ba0  72 20 74 77 69 63 65 20  73 6f 20 61 63 74 75 61  |r twice so actua|
00000bb0  6c 20 63 68 61 72 61 63  74 65 72 0a 09 09 09 20  |l character.... |
00000bc0  20 20 68 65 69 67 68 74  20 69 73 20 32 2a 72 5f  |  height is 2*r_|
00000bd0  63 68 61 72 68 20 61 6e  64 20 73 70 61 63 69 6e  |charh and spacin|
00000be0  67 20 32 2a 72 5f 6c 69  6e 65 73 70 2e 0a 09 09  |g 2*r_linesp....|
00000bf0  09 62 32 20 45 78 74 65  6e 73 69 6f 6e 20 72 6f  |.b2 Extension ro|
00000c00  75 74 69 6e 65 20 70 72  6f 76 69 64 65 64 2e 0a  |utine provided..|
00000c10  09 09 09 20 20 20 4f 6e  6c 79 20 76 61 6c 69 64  |...   Only valid|
00000c20  20 69 6e 20 44 53 41 20  6d 6f 64 65 2e 20 53 65  | in DSA mode. Se|
00000c30  65 20 5a 61 70 52 65 64  72 61 77 5f 52 65 64 72  |e ZapRedraw_Redr|
00000c40  61 77 41 72 65 61 2e 0a  09 09 09 62 33 2d 33 31  |awArea.....b3-31|
00000c50  20 52 65 73 65 72 76 65  64 20 2d 20 73 65 74 20  | Reserved - set |
00000c60  74 6f 20 7a 65 72 6f 2e  0a 26 30 34 09 72 5f 6d  |to zero..&04.r_m|
00000c70  69 6e 78 09 09 4d 69 6e  20 78 20 6f 66 20 72 65  |inx..Min x of re|
00000c80  64 72 61 77 20 28 70 69  78 65 6c 73 20 66 72 6f  |draw (pixels fro|
00000c90  6d 20 6c 68 73 20 2d 20  69 6e 63 6c 75 73 69 76  |m lhs - inclusiv|
00000ca0  65 29 0a 26 30 38 09 72  5f 6d 69 6e 79 09 09 4d  |e).&08.r_miny..M|
00000cb0  69 6e 20 79 20 6f 66 20  72 65 64 72 61 77 20 28  |in y of redraw (|
00000cc0  70 69 78 65 6c 73 20 66  72 6f 6d 20 74 6f 70 20  |pixels from top |
00000cd0  2d 20 69 6e 63 6c 75 73  69 76 65 29 0a 26 30 43  |- inclusive).&0C|
00000ce0  09 72 5f 6d 61 78 78 09  09 4d 61 78 20 78 20 6f  |.r_maxx..Max x o|
00000cf0  66 20 72 65 64 72 61 77  20 28 70 69 78 65 6c 73  |f redraw (pixels|
00000d00  20 66 6f 72 6d 20 6c 68  73 20 2d 20 65 78 63 6c  | form lhs - excl|
00000d10  75 73 69 76 65 29 0a 26  31 30 09 72 5f 6d 61 78  |usive).&10.r_max|
00000d20  79 09 09 4d 61 78 20 79  20 6f 66 20 72 65 64 72  |y..Max y of redr|
00000d30  61 77 20 28 70 69 78 65  6c 73 20 66 72 6f 6d 20  |aw (pixels from |
00000d40  74 6f 70 20 2d 20 65 78  63 6c 75 73 69 76 65 29  |top - exclusive)|
00000d50  0a 26 31 34 09 72 5f 73  63 72 65 65 6e 09 44 53  |.&14.r_screen.DS|
00000d60  41 3a 20 41 64 64 72 65  73 73 20 6f 66 20 73 63  |A: Address of sc|
00000d70  72 65 65 6e 20 74 6f 20  77 72 69 74 65 20 74 6f  |reen to write to|
00000d80  20 6f 72 20 30 20 74 6f  20 72 65 61 64 20 74 68  | or 0 to read th|
00000d90  65 0a 09 09 09 20 20 20  20 20 63 75 72 72 65 6e  |e....     curren|
00000da0  74 20 73 63 72 65 65 6e  20 61 64 64 72 65 73 73  |t screen address|
00000db0  2e 0a 09 09 09 56 44 55  3a 20 69 67 6e 6f 72 65  |.....VDU: ignore|
00000dc0  64 0a 26 31 38 09 72 5f  62 70 6c 09 09 44 53 41  |d.&18.r_bpl..DSA|
00000dd0  3a 20 42 79 74 65 73 20  70 65 72 20 72 61 73 74  |: Bytes per rast|
00000de0  65 72 20 6c 69 6e 65 20  6f 66 20 74 68 65 20 73  |er line of the s|
00000df0  63 72 65 65 6e 0a 09 09  09 56 44 55 3a 20 69 67  |creen....VDU: ig|
00000e00  6e 6f 72 65 64 0a 26 31  43 09 72 5f 62 70 70 09  |nored.&1C.r_bpp.|
00000e10  09 4c 6f 67 20 62 61 73  65 20 32 20 6f 66 20 6e  |.Log base 2 of n|
00000e20  75 6d 62 65 72 20 6f 66  20 62 69 74 73 20 70 65  |umber of bits pe|
00000e30  72 20 70 69 78 65 6c 0a  09 09 09 28 69 65 20 30  |r pixel....(ie 0|
00000e40  3d 32 20 63 6f 6c 73 20  31 3d 34 20 63 6f 6c 73  |=2 cols 1=4 cols|
00000e50  20 32 3d 31 36 20 63 6f  6c 73 20 33 3d 32 35 36  | 2=16 cols 3=256|
00000e60  20 63 6f 6c 73 0a 09 09  09 34 3d 36 35 35 33 36  | cols....4=65536|
00000e70  20 63 6f 6c 73 20 35 3d  32 5e 33 32 20 63 6f 6c  | cols 5=2^32 col|
00000e80  73 29 2e 0a 26 32 30 09  72 5f 63 68 61 72 77 09  |s)..&20.r_charw.|
00000e90  09 57 69 64 74 68 20 6f  66 20 61 20 63 68 61 72  |.Width of a char|
00000ea0  61 63 74 65 72 20 69 6e  20 70 69 78 65 6c 73 0a  |acter in pixels.|
00000eb0  26 32 34 09 72 5f 63 68  61 72 68 09 09 48 65 69  |&24.r_charh..Hei|
00000ec0  67 68 74 20 6f 66 20 61  20 63 68 61 72 61 63 74  |ght of a charact|
00000ed0  65 72 20 69 6e 20 70 69  78 65 6c 73 0a 26 32 38  |er in pixels.&28|
00000ee0  09 72 5f 63 61 64 64 72  09 09 44 53 41 3a 20 41  |.r_caddr..DSA: A|
00000ef0  64 64 72 65 73 73 20 6f  66 20 63 68 61 72 61 63  |ddress of charac|
00000f00  74 65 72 20 63 61 63 68  65 20 28 66 6f 72 6d 61  |ter cache (forma|
00000f10  74 20 62 65 6c 6f 77 29  0a 09 09 09 56 44 55 3a  |t below)....VDU:|
00000f20  20 50 6f 69 6e 74 65 72  20 74 6f 20 66 6f 6e 74  | Pointer to font|
00000f30  20 6e 61 6d 65 20 6f 72  20 30 20 66 6f 72 20 73  | name or 0 for s|
00000f40  79 73 74 65 6d 20 66 6f  6e 74 0a 26 32 43 09 72  |ystem font.&2C.r|
00000f50  5f 63 62 70 6c 09 09 44  53 41 3a 20 4e 75 6d 62  |_cbpl..DSA: Numb|
00000f60  65 72 20 6f 66 20 62 79  74 65 73 20 70 65 72 20  |er of bytes per |
00000f70  63 61 63 68 65 64 20 63  68 61 72 61 63 74 65 72  |cached character|
00000f80  20 6c 69 6e 65 2e 0a 09  09 09 56 44 55 3a 20 78  | line.....VDU: x|
00000f90  20 6f 73 20 6f 66 66 73  65 74 20 6f 66 20 77 68  | os offset of wh|
00000fa0  65 72 65 20 74 6f 20 70  72 69 6e 74 20 74 68 65  |ere to print the|
00000fb0  20 66 6f 6e 74 20 63 68  61 72 0a 09 09 09 20 20  | font char....  |
00000fc0  20 20 20 69 6e 20 74 68  65 20 63 68 61 72 61 63  |   in the charac|
00000fd0  74 65 72 20 27 62 6f 78  27 2e 20 28 65 67 20 30  |ter 'box'. (eg 0|
00000fe0  20 66 6f 72 20 73 79 73  74 65 6d 20 66 6f 6e 74  | for system font|
00000ff0  29 0a 26 33 30 09 72 5f  63 62 70 63 09 09 44 53  |).&30.r_cbpc..DS|
00001000  41 3a 20 4e 75 6d 62 65  72 20 6f 66 20 62 79 74  |A: Number of byt|
00001010  65 73 20 70 65 72 20 63  61 63 68 65 64 20 63 68  |es per cached ch|
00001020  61 72 61 63 74 65 72 2e  0a 09 09 09 56 44 55 3a  |aracter.....VDU:|
00001030  20 79 20 6f 73 20 6f 66  66 73 65 74 20 6f 66 20  | y os offset of |
00001040  77 68 65 72 65 20 74 6f  20 70 72 69 6e 74 20 74  |where to print t|
00001050  68 65 20 66 6f 6e 74 20  63 68 61 72 0a 09 09 09  |he font char....|
00001060  20 20 20 20 20 69 6e 20  74 68 65 20 63 68 61 72  |     in the char|
00001070  61 63 74 65 72 20 27 62  6f 78 27 2e 20 28 65 67  |acter 'box'. (eg|
00001080  20 63 68 61 72 20 68 65  69 67 68 74 2d 31 20 66  | char height-1 f|
00001090  6f 72 0a 09 09 09 20 20  20 20 20 73 79 73 74 65  |or....     syste|
000010a0  6d 20 66 6f 6e 74 20 61  73 20 56 44 55 35 20 70  |m font as VDU5 p|
000010b0  6c 6f 74 73 20 63 68 61  72 20 64 6f 77 6e 77 61  |lots char downwa|
000010c0  72 64 73 29 2e 0a 26 33  34 09 72 5f 6c 69 6e 65  |rds)..&34.r_line|
000010d0  73 70 09 4c 69 6e 65 20  73 70 61 63 69 6e 67 20  |sp.Line spacing |
000010e0  69 6e 20 70 69 78 65 6c  73 2e 0a 26 33 38 09 72  |in pixels..&38.r|
000010f0  5f 64 61 74 61 09 09 41  64 64 72 65 73 73 20 6f  |_data..Address o|
00001100  66 20 64 61 74 61 20 28  72 65 63 74 61 6e 67 6c  |f data (rectangl|
00001110  65 20 6f 66 20 63 68 61  72 61 63 74 65 72 73 29  |e of characters)|
00001120  20 74 6f 20 70 72 69 6e  74 0a 09 09 09 6f 6e 20  | to print....on |
00001130  74 68 65 20 73 63 72 65  65 6e 20 28 66 6f 72 6d  |the screen (form|
00001140  61 74 20 62 65 6c 6f 77  29 2e 0a 26 33 43 09 72  |at below)..&3C.r|
00001150  5f 73 63 72 6f 6c 6c 78  09 48 6f 72 69 7a 6f 6e  |_scrollx.Horizon|
00001160  74 61 6c 20 73 63 72 6f  6c 6c 20 6f 66 66 73 65  |tal scroll offse|
00001170  74 20 69 6e 20 72 65 63  74 61 6e 67 6c 65 20 6f  |t in rectangle o|
00001180  66 20 63 68 61 72 61 63  74 65 72 73 0a 09 09 09  |f characters....|
00001190  67 69 76 65 6e 20 69 6e  20 72 5f 64 61 74 61 20  |given in r_data |
000011a0  6f 66 20 74 6f 70 20 6c  65 66 74 20 6f 66 20 72  |of top left of r|
000011b0  65 64 72 61 77 20 72 65  63 74 61 6e 67 6c 65 2e  |edraw rectangle.|
000011c0  0a 09 09 09 54 68 69 73  20 69 73 20 69 6e 20 70  |....This is in p|
000011d0  69 78 65 6c 73 20 66 72  6f 6d 20 74 68 65 20 6c  |ixels from the l|
000011e0  68 73 20 6f 66 20 74 68  65 20 63 68 61 72 61 63  |hs of the charac|
000011f0  74 65 72 73 2e 0a 09 09  09 54 68 75 73 20 69 74  |ters.....Thus it|
00001200  20 65 71 75 61 6c 73 20  6e 2a 72 5f 63 68 61 72  | equals n*r_char|
00001210  77 2b 6d 20 77 68 65 72  65 20 6e 20 69 73 20 74  |w+m where n is t|
00001220  68 65 20 6e 75 6d 62 65  72 20 6f 66 0a 09 09 09  |he number of....|
00001230  63 68 61 72 61 63 74 65  72 73 20 69 6e 20 61 6e  |characters in an|
00001240  64 20 6d 20 69 73 20 74  68 65 20 6e 75 6d 62 65  |d m is the numbe|
00001250  72 20 6f 66 20 70 69 78  65 6c 73 20 69 6e 74 6f  |r of pixels into|
00001260  0a 09 09 09 74 68 65 20  6e 27 74 68 20 63 68 61  |....the n'th cha|
00001270  72 61 63 74 65 72 2e 0a  26 34 30 09 72 5f 73 63  |racter..&40.r_sc|
00001280  72 6f 6c 6c 79 09 56 65  72 74 69 63 61 6c 20 73  |rolly.Vertical s|
00001290  63 72 6f 6c 6c 20 6f 66  66 73 65 74 20 69 6e 20  |croll offset in |
000012a0  72 65 63 74 61 6e 67 6c  65 20 6f 66 20 63 68 61  |rectangle of cha|
000012b0  72 61 63 74 65 72 73 0a  09 09 09 67 69 76 65 6e  |racters....given|
000012c0  20 69 6e 20 72 5f 64 61  74 61 20 6f 66 20 74 6f  | in r_data of to|
000012d0  70 20 6c 65 66 74 20 6f  66 20 72 65 64 72 61 77  |p left of redraw|
000012e0  20 72 65 63 74 61 6e 67  6c 65 2e 0a 09 09 09 54  | rectangle.....T|
000012f0  68 69 73 20 69 73 20 69  6e 20 70 69 78 65 6c 73  |his is in pixels|
00001300  20 66 72 6f 6d 20 74 68  65 20 74 6f 70 20 6f 66  | from the top of|
00001310  20 74 68 65 20 63 68 61  72 61 63 74 65 72 73 2e  | the characters.|
00001320  0a 09 09 09 4e 6f 74 65  20 74 68 61 74 20 69 6e  |....Note that in|
00001330  20 73 69 6e 67 6c 65 20  68 65 69 67 68 74 20 6d  | single height m|
00001340  6f 64 65 20 65 61 63 68  20 6c 69 6e 65 20 69 73  |ode each line is|
00001350  0a 09 09 09 72 5f 63 68  61 72 68 2b 72 5f 6c 69  |....r_charh+r_li|
00001360  6e 65 73 70 20 70 69 78  65 6c 73 20 68 69 67 68  |nesp pixels high|
00001370  20 61 6e 64 20 69 6e 20  64 6f 75 62 6c 65 20 68  | and in double h|
00001380  65 69 67 68 74 0a 09 09  09 6d 6f 64 65 20 65 61  |eight....mode ea|
00001390  63 68 20 6c 69 6e 65 20  69 73 20 32 2a 28 72 5f  |ch line is 2*(r_|
000013a0  63 68 61 72 68 2b 72 5f  6c 69 6e 65 73 70 29 20  |charh+r_linesp) |
000013b0  70 69 78 65 6c 73 20 68  69 67 68 2e 0a 26 34 34  |pixels high..&44|
000013c0  09 72 5f 70 61 6c 65 74  74 65 09 41 64 64 72 65  |.r_palette.Addre|
000013d0  73 73 20 6f 66 20 70 61  6c 65 74 74 65 20 74 6f  |ss of palette to|
000013e0  20 62 65 20 75 73 65 64  20 66 6f 72 20 63 6f 6c  | be used for col|
000013f0  6f 75 72 20 74 72 61 6e  73 6c 61 74 69 6f 6e 2e  |our translation.|
00001400  0a 09 09 09 28 73 65 65  20 62 65 6c 6f 77 29 2e  |....(see below).|
00001410  0a 26 34 38 09 72 5f 66  6f 72 09 09 46 6f 72 65  |.&48.r_for..Fore|
00001420  67 72 6f 75 6e 64 20 63  6f 6c 6f 75 72 20 74 6f  |ground colour to|
00001430  20 75 73 65 20 61 74 20  74 68 65 20 73 74 61 72  | use at the star|
00001440  74 20 6f 66 20 61 20 6c  69 6e 65 20 61 73 20 61  |t of a line as a|
00001450  6e 0a 09 09 09 6f 66 66  73 65 74 20 69 6e 20 74  |n....offset in t|
00001460  68 65 20 70 61 6c 65 74  74 65 20 74 61 62 6c 65  |he palette table|
00001470  2e 0a 26 34 43 09 72 5f  62 61 63 09 09 42 61 63  |..&4C.r_bac..Bac|
00001480  6b 67 72 6f 75 6e 64 20  63 6f 6c 6f 75 72 20 74  |kground colour t|
00001490  6f 20 75 73 65 20 61 74  20 74 68 65 20 73 74 61  |o use at the sta|
000014a0  72 74 20 6f 66 20 61 20  6c 69 6e 65 20 61 73 0a  |rt of a line as.|
000014b0  09 09 09 61 6e 20 6f 66  66 73 65 74 20 69 6e 20  |...an offset in |
000014c0  74 68 65 20 70 61 6c 65  74 74 65 20 74 61 62 6c  |the palette tabl|
000014d0  65 2e 0a 26 35 30 09 72  5f 77 6f 72 6b 61 72 65  |e..&50.r_workare|
000014e0  61 09 50 6f 69 6e 74 65  72 20 74 6f 20 61 6e 20  |a.Pointer to an |
000014f0  61 72 65 61 20 6f 66 20  77 6f 72 6b 73 70 61 63  |area of workspac|
00001500  65 20 66 6f 72 20 74 68  65 20 53 57 49 20 74 6f  |e for the SWI to|
00001510  20 75 73 65 2e 0a 09 09  09 54 68 65 20 73 69 7a  | use.....The siz|
00001520  65 20 6f 66 20 74 68 69  73 20 77 6f 72 6b 73 70  |e of this worksp|
00001530  61 63 65 20 64 65 70 65  6e 64 73 20 6f 6e 20 74  |ace depends on t|
00001540  68 65 20 53 57 49 2e 0a  09 09 09 28 49 74 20 6d  |he SWI.....(It m|
00001550  75 73 74 20 62 65 20 77  6f 72 64 20 61 6c 69 67  |ust be word alig|
00001560  6e 65 64 29 2e 0a 26 35  34 09 72 5f 6d 61 67 78  |ned)..&54.r_magx|
00001570  09 09 4c 6f 67 20 62 61  73 65 20 32 20 6f 66 20  |..Log base 2 of |
00001580  6e 75 6d 62 65 72 20 6f  66 20 78 20 6f 73 20 63  |number of x os c|
00001590  6f 2d 6f 72 64 73 20 70  65 72 20 70 69 78 65 6c  |o-ords per pixel|
000015a0  2e 0a 26 35 38 09 72 5f  6d 61 67 79 20 20 09 4c  |..&58.r_magy  .L|
000015b0  6f 67 20 62 61 73 65 20  32 20 6f 66 20 6e 75 6d  |og base 2 of num|
000015c0  62 65 72 20 6f 66 20 79  20 6f 73 20 63 6f 2d 6f  |ber of y os co-o|
000015d0  72 64 73 20 70 65 72 20  70 69 78 65 6c 2e 0a 26  |rds per pixel..&|
000015e0  35 43 09 72 5f 78 73 69  7a 65 09 09 57 69 64 74  |5C.r_xsize..Widt|
000015f0  68 20 6f 66 20 73 63 72  65 65 6e 20 69 6e 20 70  |h of screen in p|
00001600  69 78 65 6c 73 2e 0a 26  36 30 09 72 5f 79 73 69  |ixels..&60.r_ysi|
00001610  7a 65 09 09 48 65 69 67  68 74 20 6f 66 20 73 63  |ze..Height of sc|
00001620  72 65 65 6e 20 69 6e 20  70 69 78 65 6c 73 2e 0a  |reen in pixels..|
00001630  26 36 34 09 72 5f 6d 6f  64 65 09 09 43 75 72 72  |&64.r_mode..Curr|
00001640  65 6e 74 20 73 63 72 65  65 6e 20 6d 6f 64 65 2e  |ent screen mode.|
00001650  0a 0a 43 68 61 72 61 63  74 65 72 20 63 61 63 68  |..Character cach|
00001660  65 20 66 6f 72 6d 61 74  20 28 72 5f 63 61 64 64  |e format (r_cadd|
00001670  72 29 3a 0a 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |r):.------------|
00001680  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001690  2d 2d 2d 2d 2d 0a 0a 57  68 65 6e 20 75 73 69 6e  |-----..When usin|
000016a0  67 20 56 44 55 20 72 65  64 72 61 77 2c 20 74 68  |g VDU redraw, th|
000016b0  69 73 20 73 68 6f 75 6c  64 20 70 6f 69 6e 74 20  |is should point |
000016c0  74 6f 20 74 68 65 20 6e  61 6d 65 20 6f 66 20 74  |to the name of t|
000016d0  68 65 20 66 6f 6e 74 20  74 6f 20 75 73 65 2c 20  |he font to use, |
000016e0  6f 72 0a 62 65 20 7a 65  72 6f 20 66 6f 72 20 74  |or.be zero for t|
000016f0  68 65 20 73 79 73 74 65  6d 20 66 6f 6e 74 2e 0a  |he system font..|
00001700  0a 57 68 65 6e 20 75 73  69 6e 67 20 64 69 72 65  |.When using dire|
00001710  63 74 20 73 63 72 65 65  6e 20 61 63 63 65 73 73  |ct screen access|
00001720  2c 20 74 68 65 20 6d 6f  64 75 6c 65 20 77 69 6c  |, the module wil|
00001730  6c 20 65 78 70 65 63 74  20 74 68 69 73 20 62 6c  |l expect this bl|
00001740  6f 63 6b 20 74 6f 20 63  6f 6e 74 61 69 6e 0a 74  |ock to contain.t|
00001750  68 65 20 62 69 74 6d 61  70 73 20 66 6f 72 20 61  |he bitmaps for a|
00001760  6c 6c 20 74 68 65 20 63  68 61 72 61 63 74 65 72  |ll the character|
00001770  73 20 69 74 20 69 73 20  61 73 6b 65 64 20 74 6f  |s it is asked to|
00001780  20 70 72 69 6e 74 2e 20  45 61 63 68 20 63 68 61  | print. Each cha|
00001790  72 61 63 74 65 72 20 68  61 73 0a 73 69 7a 65 20  |racter has.size |
000017a0  72 5f 63 62 70 63 20 73  6f 20 69 74 20 77 69 6c  |r_cbpc so it wil|
000017b0  6c 20 65 78 70 65 63 74  20 74 6f 20 66 69 6e 64  |l expect to find|
000017c0  20 74 68 65 20 62 69 74  6d 61 70 20 66 6f 72 20  | the bitmap for |
000017d0  61 73 63 69 69 20 63 68  61 72 61 63 74 65 72 20  |ascii character |
000017e0  27 6e 27 20 61 74 0a 61  64 64 72 65 73 73 20 63  |'n' at.address c|
000017f0  68 61 72 5f 73 74 61 72  74 3d 28 21 72 5f 63 61  |har_start=(!r_ca|
00001800  64 64 72 29 2b 6e 2a 72  5f 63 62 70 63 2e 20 54  |ddr)+n*r_cbpc. T|
00001810  68 65 20 63 68 61 72 61  63 74 65 72 20 64 65 66  |he character def|
00001820  69 6e 69 74 69 6f 6e 20  74 68 65 6e 0a 63 6f 6e  |inition then.con|
00001830  73 69 73 74 73 20 6f 66  20 72 5f 63 68 61 72 68  |sists of r_charh|
00001840  20 72 6f 77 73 20 6f 66  20 72 5f 63 62 70 6c 20  | rows of r_cbpl |
00001850  65 61 63 68 20 73 6f 20  72 5f 63 62 70 63 3d 72  |each so r_cbpc=r|
00001860  5f 63 68 61 72 68 2a 72  5f 63 62 70 6c 2e 20 4e  |_charh*r_cbpl. N|
00001870  42 20 72 5f 63 62 70 6c  0a 6e 65 65 64 20 6e 6f  |B r_cbpl.need no|
00001880  74 20 62 65 20 61 20 6d  75 6c 74 69 70 6c 65 20  |t be a multiple |
00001890  6f 66 20 34 20 73 6f 20  74 68 69 73 20 61 64 64  |of 4 so this add|
000018a0  72 65 73 73 20 6e 65 65  64 20 6e 6f 74 20 62 65  |ress need not be|
000018b0  20 77 6f 72 64 20 61 6c  69 67 6e 65 64 2e 0a 0a  | word aligned...|
000018c0  54 68 65 20 66 6f 72 6d  61 74 20 6f 66 20 61 20  |The format of a |
000018d0  72 6f 77 20 69 73 20 74  68 65 20 73 61 6d 65 20  |row is the same |
000018e0  6f 66 20 74 68 61 74 20  66 6f 72 20 61 20 73 70  |of that for a sp|
000018f0  72 69 74 65 20 66 69 6c  65 20 65 78 63 65 70 74  |rite file except|
00001900  20 74 68 65 72 65 20 69  73 0a 6e 65 76 65 72 20  | there is.never |
00001910  61 6e 79 20 6c 68 73 20  77 61 73 74 61 67 65 2e  |any lhs wastage.|
00001920  20 49 65 2c 20 74 68 65  20 66 69 72 73 74 20 70  | Ie, the first p|
00001930  69 78 65 6c 20 69 73 20  61 6c 69 67 6e 65 64 20  |ixel is aligned |
00001940  74 6f 20 74 68 65 20 73  74 61 72 74 20 6f 66 20  |to the start of |
00001950  74 68 65 0a 66 69 72 73  74 20 77 6f 72 64 2e 20  |the.first word. |
00001960  45 61 63 68 20 63 68 61  72 61 63 74 65 72 20 69  |Each character i|
00001970  73 20 72 5f 63 68 61 72  77 20 70 69 78 65 6c 73  |s r_charw pixels|
00001980  20 77 69 64 65 20 61 6e  64 20 74 68 75 73 20 72  | wide and thus r|
00001990  65 71 75 69 72 65 73 0a  4e 3d 72 5f 63 68 61 72  |equires.N=r_char|
000019a0  77 3c 3c 72 5f 62 70 70  20 62 69 74 73 20 6f 66  |w<<r_bpp bits of|
000019b0  20 73 74 6f 72 61 67 65  2e 20 54 68 65 72 65 20  | storage. There |
000019c0  61 72 65 20 73 70 65 63  69 61 6c 20 63 61 73 65  |are special case|
000019d0  73 20 77 68 65 6e 20 4e  20 69 73 20 73 6d 61 6c  |s when N is smal|
000019e0  6c 3a 0a 0a 20 49 66 20  30 3c 4e 3d 3c 38 20 20  |l:.. If 0<N=<8  |
000019f0  74 68 65 6e 20 72 5f 63  62 70 6c 3d 31 20 61 6e  |then r_cbpl=1 an|
00001a00  64 20 74 68 65 20 74 6f  70 20 38 2d 4e 20 62 69  |d the top 8-N bi|
00001a10  74 73 20 6f 66 20 65 61  63 68 20 62 79 74 65 20  |ts of each byte |
00001a20  61 72 65 20 77 61 73 74  65 64 2e 0a 20 49 66 20  |are wasted.. If |
00001a30  38 3c 4e 3d 3c 31 36 20  74 68 65 6e 20 72 5f 63  |8<N=<16 then r_c|
00001a40  62 70 6c 3d 32 20 61 6e  64 20 74 68 65 20 74 6f  |bpl=2 and the to|
00001a50  70 20 31 36 2d 4e 20 62  69 74 73 20 6f 66 20 65  |p 16-N bits of e|
00001a60  61 63 68 20 62 79 74 65  20 61 72 65 20 77 61 73  |ach byte are was|
00001a70  74 65 64 2e 0a 20 49 66  20 4e 3e 31 36 20 20 20  |ted.. If N>16   |
00001a80  20 74 68 65 6e 20 72 5f  63 62 70 6c 20 69 73 20  | then r_cbpl is |
00001a90  61 6c 69 67 6e 65 64 20  74 6f 20 74 68 65 20 6e  |aligned to the n|
00001aa0  65 78 74 20 6d 75 6c 74  69 70 6c 65 20 6f 66 20  |ext multiple of |
00001ab0  34 20 62 79 74 65 73 20  67 72 65 61 74 65 72 0a  |4 bytes greater.|
00001ac0  20 20 6f 72 20 65 71 75  61 6c 20 74 6f 20 4e 2e  |  or equal to N.|
00001ad0  20 28 65 67 20 31 36 3c  4e 3d 3c 33 32 20 3d 3e  | (eg 16<N=<32 =>|
00001ae0  20 72 5f 63 62 70 6c 3d  34 2c 20 33 32 3c 4e 3d  | r_cbpl=4, 32<N=|
00001af0  3c 36 34 20 3d 3e 20 72  5f 63 62 70 6c 3d 38 20  |<64 => r_cbpl=8 |
00001b00  65 74 63 29 2e 0a 20 20  0a 54 68 65 20 53 57 49  |etc)..  .The SWI|
00001b10  20 5a 61 70 52 65 64 72  61 77 5f 43 61 63 68 65  | ZapRedraw_Cache|
00001b20  64 43 68 61 72 53 69 7a  65 20 77 69 6c 6c 20 63  |dCharSize will c|
00001b30  61 6c 63 75 6c 61 74 65  20 74 68 65 20 76 61 6c  |alculate the val|
00001b40  75 65 73 20 6f 66 20 72  5f 63 62 70 6c 20 61 6e  |ues of r_cbpl an|
00001b50  64 0a 72 5f 63 62 70 63  20 66 6f 72 20 79 6f 75  |d.r_cbpc for you|
00001b60  20 66 72 6f 6d 20 61 20  67 69 76 65 6e 20 73 69  | from a given si|
00001b70  7a 65 20 6f 66 20 63 68  61 72 61 63 74 65 72 2e  |ze of character.|
00001b80  0a 0a 4f 6e 6c 79 20 54  57 4f 20 63 6f 6c 6f 75  |..Only TWO colou|
00001b90  72 73 20 63 61 6e 20 62  65 20 75 73 65 64 20 69  |rs can be used i|
00001ba0  6e 20 74 68 65 20 64 65  66 6e 20 6f 66 20 74 68  |n the defn of th|
00001bb0  65 20 63 68 61 72 61 63  74 65 72 2e 20 53 65 74  |e character. Set|
00001bc0  20 61 6c 6c 20 66 6f 72  65 67 72 6f 75 6e 64 0a  | all foreground.|
00001bd0  70 69 78 65 6c 73 20 74  6f 20 31 27 73 20 61 6e  |pixels to 1's an|
00001be0  64 20 62 61 63 6b 67 72  6f 75 6e 64 20 70 69 78  |d background pix|
00001bf0  65 6c 73 20 74 6f 20 30  27 73 2e 20 45 67 2c 20  |els to 0's. Eg, |
00001c00  69 6e 20 61 20 31 36 20  63 6f 6c 6f 75 72 20 6d  |in a 16 colour m|
00001c10  6f 64 65 20 70 69 78 65  6c 73 0a 77 69 6c 6c 20  |ode pixels.will |
00001c20  62 65 20 65 69 74 68 65  72 20 31 31 31 31 20 6f  |be either 1111 o|
00001c30  72 20 30 30 30 30 2e 20  55 6e 75 73 65 64 20 62  |r 0000. Unused b|
00001c40  69 74 73 20 61 74 20 74  68 65 20 65 6e 64 20 6f  |its at the end o|
00001c50  66 20 74 68 65 20 77 6f  72 64 73 20 28 6f 72 20  |f the words (or |
00001c60  62 79 74 65 73 29 0a 61  72 65 20 69 67 6e 6f 72  |bytes).are ignor|
00001c70  65 64 20 61 6e 64 20 73  6f 20 63 61 6e 20 63 6f  |ed and so can co|
00001c80  6e 74 61 69 6e 20 72 75  62 62 69 73 68 2e 20 54  |ntain rubbish. T|
00001c90  68 65 20 72 65 61 6c 20  66 6f 72 65 67 72 6f 75  |he real foregrou|
00001ca0  6e 64 20 61 6e 64 20 62  61 63 6b 67 72 6f 75 6e  |nd and backgroun|
00001cb0  64 0a 63 6f 6c 6f 75 72  73 20 61 72 65 20 6d 61  |d.colours are ma|
00001cc0  73 6b 65 64 20 69 6e 20  61 74 20 72 75 6e 20 74  |sked in at run t|
00001cd0  69 6d 65 2e 0a 0a 20 45  78 61 6d 70 6c 65 73 3a  |ime... Examples:|
00001ce0  0a 0a 20 46 6f 72 20 38  2a 38 20 63 68 61 72 61  |.. For 8*8 chara|
00001cf0  63 74 65 72 73 20 61 74  20 31 20 62 69 74 20 70  |cters at 1 bit p|
00001d00  65 72 20 70 69 78 65 6c  20 77 65 20 68 61 76 65  |er pixel we have|
00001d10  20 31 20 62 79 74 65 20  70 65 72 20 72 6f 77 2e  | 1 byte per row.|
00001d20  20 45 67 20 22 45 22 20  6d 61 79 20 62 65 0a 20  | Eg "E" may be. |
00001d30  63 61 63 68 65 64 20 61  73 3a 0a 20 20 09 09 09  |cached as:.  ...|
00001d40  09 62 30 20 2e 2e 20 62  37 0a 20 20 09 72 6f 77  |.b0 .. b7.  .row|
00001d50  30 09 26 37 45 09 09 30  31 31 31 31 31 31 30 0a  |0.&7E..01111110.|
00001d60  09 72 6f 77 31 09 26 30  36 09 09 30 31 31 30 30  |.row1.&06..01100|
00001d70  30 30 30 0a 20 20 09 72  6f 77 32 09 26 30 36 09  |000.  .row2.&06.|
00001d80  09 30 31 31 30 30 30 30  30 0a 20 20 09 72 6f 77  |.01100000.  .row|
00001d90  33 09 26 37 45 09 09 30  31 31 31 31 31 31 30 0a  |3.&7E..01111110.|
00001da0  20 20 09 72 6f 77 34 09  26 30 36 09 09 30 31 31  |  .row4.&06..011|
00001db0  30 30 30 30 30 0a 20 20  09 72 6f 77 35 09 26 30  |00000.  .row5.&0|
00001dc0  36 09 09 30 31 31 30 30  30 30 30 0a 20 20 09 72  |6..01100000.  .r|
00001dd0  6f 77 36 09 26 37 45 09  09 30 31 31 31 31 31 31  |ow6.&7E..0111111|
00001de0  30 0a 20 20 09 72 6f 77  37 09 26 30 30 09 09 30  |0.  .row7.&00..0|
00001df0  30 30 30 30 30 30 30 0a  20 0a 20 49 66 20 69 74  |0000000. . If it|
00001e00  20 77 61 73 20 69 6e 20  61 20 31 36 20 63 6f 6c  | was in a 16 col|
00001e10  6f 75 72 20 6d 6f 64 65  20 74 68 65 6e 20 74 68  |our mode then th|
00001e20  65 72 65 20 77 6f 75 6c  64 20 62 65 20 6f 6e 65  |ere would be one|
00001e30  20 77 6f 72 64 20 70 65  72 20 72 6f 77 20 61 6e  | word per row an|
00001e40  64 20 74 68 65 0a 20 66  69 72 73 74 20 72 6f 77  |d the. first row|
00001e50  73 20 77 6f 75 6c 64 20  62 65 3a 0a 20 09 09 09  |s would be:. ...|
00001e60  09 62 30 20 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |.b0 ............|
00001e70  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 20 62 33  |............. b3|
00001e80  31 0a 20 09 72 6f 77 30  09 26 30 31 31 31 31 31  |1. .row0.&011111|
00001e90  31 30 09 30 30 30 30 31  31 31 31 31 31 31 31 31  |10.0000111111111|
00001ea0  31 31 31 31 31 31 31 31  31 31 31 31 31 31 31 30  |1111111111111110|
00001eb0  30 30 30 0a 20 09 72 6f  77 31 09 26 30 30 30 30  |000. .row1.&0000|
00001ec0  30 31 31 30 09 30 30 30  30 31 31 31 31 31 31 31  |0110.00001111111|
00001ed0  31 30 30 30 30 30 30 30  30 30 30 30 30 30 30 30  |1000000000000000|
00001ee0  30 30 30 30 30 0a 20 09  2e 2e 2e 0a 20 20 09 0a  |00000. .....  ..|
00001ef0  20 49 6e 20 67 65 6e 65  72 61 6c 20 79 6f 75 20  | In general you |
00001f00  68 61 76 65 3a 0a 20 0a  20 09 57 6f 72 64 20 30  |have:. . .Word 0|
00001f10  09 09 09 09 09 57 6f 72  64 20 28 4e 2f 34 29 2d  |.....Word (N/4)-|
00001f20  31 0a 20 09 62 30 20 2e  2e 2e 2e 20 62 33 31 20  |1. .b0 .... b31 |
00001f30  20 20 20 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |   .............|
00001f40  2e 2e 2e 2e 2e 2e 20 20  20 20 20 20 62 30 20 2e  |......      b0 .|
00001f50  2e 2e 2e 2e 20 62 33 31  0a 20 09 70 69 78 30 20  |.... b31. .pix0 |
00001f60  70 69 78 31 20 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |pix1 ...........|
00001f70  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 70 69 78 28 72  |...........pix(r|
00001f80  5f 63 68 61 72 77 2d 31  29 20 30 30 30 30 30 0a  |_charw-1) 00000.|
00001f90  20 09 0a 49 6e 20 70 72  61 63 74 69 63 65 20 79  | ..In practice y|
00001fa0  6f 75 20 66 69 72 73 74  20 63 61 63 68 65 20 74  |ou first cache t|
00001fb0  68 65 20 66 6f 6e 74 20  61 74 20 6f 6e 65 20 62  |he font at one b|
00001fc0  69 74 20 70 65 72 20 70  69 78 65 6c 20 28 65 67  |it per pixel (eg|
00001fd0  20 75 73 65 0a 5a 61 70  52 65 64 72 61 77 5f 52  | use.ZapRedraw_R|
00001fe0  65 61 64 53 79 73 74 65  6d 43 68 61 72 73 29 20  |eadSystemChars) |
00001ff0  61 6e 64 20 74 68 65 6e  20 63 6f 6e 76 65 72 74  |and then convert|
00002000  20 69 74 20 74 6f 20 27  6e 27 20 62 69 74 73 20  | it to 'n' bits |
00002010  70 65 72 20 70 69 78 65  6c 20 28 66 6f 72 20 74  |per pixel (for t|
00002020  68 65 0a 63 75 72 72 65  6e 74 20 6d 6f 64 65 29  |he.current mode)|
00002030  20 62 79 20 75 73 65 20  6f 66 20 5a 61 70 52 65  | by use of ZapRe|
00002040  64 72 61 77 5f 43 6f 6e  76 65 72 74 42 69 74 6d  |draw_ConvertBitm|
00002050  61 70 2e 0a 0a 41 6c 74  68 6f 75 67 68 20 49 20  |ap...Although I |
00002060  68 61 76 65 20 73 61 69  64 20 74 68 61 74 20 74  |have said that t|
00002070  68 65 20 66 6f 72 65 67  72 6f 75 6e 64 20 63 6f  |he foreground co|
00002080  6c 6f 75 72 20 6d 75 73  74 20 62 65 20 61 6c 6c  |lour must be all|
00002090  20 31 27 73 20 61 6e 64  20 74 68 65 0a 62 61 63  | 1's and the.bac|
000020a0  6b 67 72 6f 75 6e 64 20  61 6c 6c 20 30 27 73 20  |kground all 0's |
000020b0  74 68 69 73 20 69 73 20  6e 6f 74 20 73 74 72 69  |this is not stri|
000020c0  63 74 6c 79 20 74 72 75  65 2e 20 54 68 65 20 64  |ctly true. The d|
000020d0  61 74 61 20 70 6f 6b 65  64 20 69 6e 74 6f 20 74  |ata poked into t|
000020e0  68 65 20 73 63 72 65 65  6e 0a 6d 65 6d 6f 72 79  |he screen.memory|
000020f0  20 69 73 20 28 66 6f 72  65 67 72 6f 75 6e 64 20  | is (foreground |
00002100  6d 61 73 6b 20 41 4e 44  20 62 69 74 6d 61 70 29  |mask AND bitmap)|
00002110  20 4f 52 20 28 62 61 63  6b 67 72 6f 75 6e 64 20  | OR (background |
00002120  6d 61 73 6b 20 42 49 43  20 62 69 74 6d 61 70 29  |mask BIC bitmap)|
00002130  2e 20 54 68 75 73 0a 69  66 20 79 6f 75 20 68 61  |. Thus.if you ha|
00002140  76 65 20 61 20 66 6f 72  65 67 72 6f 75 6e 64 20  |ve a foreground |
00002150  6d 61 73 6b 20 6f 66 20  26 46 46 46 46 46 46 46  |mask of &FFFFFFF|
00002160  46 20 61 6e 64 20 61 20  62 61 63 6b 67 72 6f 75  |F and a backgrou|
00002170  6e 64 20 6d 61 73 6b 20  6f 66 20 30 20 74 68 65  |nd mask of 0 the|
00002180  6e 0a 74 68 65 20 62 69  74 6d 61 70 20 77 69 6c  |n.the bitmap wil|
00002190  6c 20 62 65 20 70 6f 6b  65 64 20 64 69 72 65 63  |l be poked direc|
000021a0  74 6c 79 20 69 6e 74 6f  20 74 68 65 20 73 63 72  |tly into the scr|
000021b0  65 65 6e 20 73 6f 20 63  61 6e 20 68 61 76 65 20  |een so can have |
000021c0  61 6e 79 20 66 6f 72 6d  61 74 20 79 6f 75 0a 6c  |any format you.l|
000021d0  69 6b 65 20 28 74 68 6f  75 67 68 20 63 68 61 72  |ike (though char|
000021e0  61 63 74 65 72 20 6d 65  72 67 69 6e 67 20 61 6e  |acter merging an|
000021f0  64 20 73 65 76 65 72 61  6c 20 6f 74 68 65 72 20  |d several other |
00002200  66 65 61 74 75 72 65 73  20 6d 61 79 20 6e 6f 74  |features may not|
00002210  20 77 6f 72 6b 0a 70 72  6f 70 65 72 6c 79 29 2e  | work.properly).|
00002220  20 54 68 69 73 20 69 64  65 61 20 63 61 6e 20 62  | This idea can b|
00002230  65 20 75 73 65 64 20 69  6e 20 63 6f 6e 6a 75 6e  |e used in conjun|
00002240  63 74 69 6f 6e 20 77 69  74 68 20 5a 61 70 52 65  |ction with ZapRe|
00002250  64 72 61 77 5f 43 61 63  68 65 46 6f 6e 74 43 68  |draw_CacheFontCh|
00002260  61 72 73 0a 74 6f 20 63  72 65 61 74 65 20 61 20  |ars.to create a |
00002270  66 61 73 74 20 72 65 64  72 61 77 20 6d 6f 64 65  |fast redraw mode|
00002280  20 66 6f 72 20 61 6e 74  69 20 61 6c 69 61 73 65  | for anti aliase|
00002290  64 20 66 6f 6e 74 73 20  28 61 73 20 75 73 65 64  |d fonts (as used|
000022a0  20 69 6e 20 5a 61 70 29  2e 0a 0a 46 6f 72 6d 61  | in Zap)...Forma|
000022b0  74 20 6f 66 20 74 65 78  74 20 74 6f 20 64 69 73  |t of text to dis|
000022c0  70 6c 61 79 20 28 72 5f  64 61 74 61 29 3a 0a 2d  |play (r_data):.-|
000022d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000022f0  2d 2d 0a 0a 54 68 69 73  20 62 6c 6f 63 6b 20 63  |--..This block c|
00002300  6f 6e 74 61 69 6e 73 20  74 68 65 20 74 65 78 74  |ontains the text|
00002310  20 74 6f 20 62 65 20 70  72 69 6e 74 65 64 20 6f  | to be printed o|
00002320  6e 20 74 68 65 20 73 63  72 65 65 6e 2e 20 54 68  |n the screen. Th|
00002330  65 72 65 20 73 68 6f 75  6c 64 20 62 65 0a 73 75  |ere should be.su|
00002340  66 66 69 63 69 65 6e 74  20 74 65 78 74 20 68 65  |fficient text he|
00002350  72 65 20 74 6f 20 72 65  64 72 61 77 20 74 68 65  |re to redraw the|
00002360  20 73 70 65 63 69 66 69  65 64 20 61 72 65 61 20  | specified area |
00002370  6f 66 20 74 68 65 20 73  63 72 65 65 6e 20 28 67  |of the screen (g|
00002380  69 76 65 6e 20 69 74 73  0a 73 69 7a 65 2c 20 74  |iven its.size, t|
00002390  68 65 20 73 63 72 6f 6c  6c 20 6f 66 66 73 65 74  |he scroll offset|
000023a0  2c 20 63 68 61 72 61 63  74 65 72 20 73 69 7a 65  |, character size|
000023b0  73 20 65 74 63 29 2e 20  54 65 72 6d 69 6e 61 74  |s etc). Terminat|
000023c0  69 6e 67 20 65 61 63 68  20 6c 69 6e 65 20 77 69  |ing each line wi|
000023d0  74 68 0a 74 68 65 20 62  79 74 65 73 20 30 2c 32  |th.the bytes 0,2|
000023e0  20 77 69 6c 6c 20 65 6e  73 75 72 65 20 74 68 65  | will ensure the|
000023f0  20 72 65 64 72 61 77 20  64 6f 65 73 6e 27 74 20  | redraw doesn't |
00002400  72 75 6e 20 6f 75 74 20  6f 66 20 74 65 78 74 20  |run out of text |
00002410  68 6f 72 69 7a 6f 6e 74  61 6c 6c 79 20 61 6e 64  |horizontally and|
00002420  0a 74 65 72 6d 69 6e 61  74 69 6e 67 20 74 68 65  |.terminating the|
00002430  20 6c 69 6e 65 20 6c 69  73 74 20 77 69 74 68 20  | line list with |
00002440  61 20 7a 65 72 6f 20 77  69 6c 6c 20 65 6e 73 75  |a zero will ensu|
00002450  72 65 20 74 68 65 20 73  61 6d 65 20 76 65 72 74  |re the same vert|
00002460  69 63 61 6c 6c 79 2e 20  54 68 65 0a 76 61 6c 75  |ically. The.valu|
00002470  65 20 69 6e 20 72 5f 64  61 74 61 20 70 6f 69 6e  |e in r_data poin|
00002480  74 73 20 74 6f 20 61 20  6c 69 73 74 20 6f 66 20  |ts to a list of |
00002490  77 6f 72 64 73 2e 20 54  68 65 20 6e 27 74 68 20  |words. The n'th |
000024a0  77 6f 72 64 20 69 6e 20  74 68 65 20 6c 69 73 74  |word in the list|
000024b0  20 69 73 20 74 68 65 0a  6f 66 66 73 65 74 20 28  | is the.offset (|
000024c0  66 72 6f 6d 20 74 68 65  20 62 6c 6f 63 6b 20 64  |from the block d|
000024d0  61 74 61 20 73 74 61 72  74 29 20 6f 66 20 74 68  |ata start) of th|
000024e0  65 20 6e 27 74 68 20 6c  69 6e 65 20 6f 66 20 74  |e n'th line of t|
000024f0  65 78 74 20 74 6f 20 62  65 20 70 72 69 6e 74 65  |ext to be printe|
00002500  64 20 69 6e 0a 74 68 65  20 77 69 6e 64 6f 77 2e  |d in.the window.|
00002510  20 54 68 69 73 20 6c 69  73 74 20 63 61 6e 20 62  | This list can b|
00002520  65 20 74 65 72 6d 69 6e  61 74 65 64 20 62 79 20  |e terminated by |
00002530  61 20 30 20 6f 66 66 73  65 74 20 69 6e 20 77 68  |a 0 offset in wh|
00002540  69 63 68 20 63 61 73 65  20 61 6c 6c 0a 66 75 72  |ich case all.fur|
00002550  74 68 65 72 20 6c 69 6e  65 73 20 77 69 6c 6c 20  |ther lines will |
00002560  62 65 20 63 6c 65 61 72  65 64 20 74 6f 20 62 61  |be cleared to ba|
00002570  63 6b 67 72 6f 75 6e 64  20 63 6f 6c 6f 75 72 20  |ckground colour |
00002580  28 72 5f 62 61 63 29 2e  0a 0a 54 68 65 20 64 61  |(r_bac)...The da|
00002590  74 61 20 66 6f 72 20 65  61 63 68 20 6c 69 6e 65  |ta for each line|
000025a0  20 63 6f 6e 73 69 73 74  73 20 6f 66 20 61 20 73  | consists of a s|
000025b0  74 72 69 6e 67 20 6f 66  20 62 79 74 65 73 20 67  |tring of bytes g|
000025c0  69 76 69 6e 67 20 74 68  65 20 63 68 61 72 61 63  |iving the charac|
000025d0  74 65 72 73 20 74 6f 0a  70 72 69 6e 74 2e 20 42  |ters to.print. B|
000025e0  79 20 63 68 61 72 61 63  74 65 72 20 6e 75 6d 62  |y character numb|
000025f0  65 72 20 27 6e 27 20 77  69 6c 6c 20 49 20 6d 65  |er 'n' will I me|
00002600  61 6e 20 74 68 65 20 6e  27 74 68 20 28 6e 20 73  |an the n'th (n s|
00002610  74 61 72 74 69 6e 67 20  66 72 6f 6d 20 30 29 0a  |tarting from 0).|
00002620  62 69 74 6d 61 70 20 69  6e 20 79 6f 75 72 20 63  |bitmap in your c|
00002630  68 61 72 61 63 74 65 72  20 63 61 63 68 65 20 69  |haracter cache i|
00002640  6e 20 44 53 41 20 6d 6f  64 65 20 6f 72 20 74 68  |n DSA mode or th|
00002650  65 20 63 68 61 72 61 63  74 65 72 20 77 69 74 68  |e character with|
00002660  20 41 53 43 49 49 20 63  6f 64 65 0a 27 6e 27 20  | ASCII code.'n' |
00002670  69 6e 20 56 44 55 20 72  65 64 72 61 77 20 6d 6f  |in VDU redraw mo|
00002680  64 65 2e 20 54 68 65 20  52 65 64 72 61 77 20 6d  |de. The Redraw m|
00002690  6f 64 75 6c 65 20 64 6f  65 73 20 6e 6f 74 20 6c  |odule does not l|
000026a0  69 6d 69 74 20 6e 20 74  6f 20 74 68 65 20 72 61  |imit n to the ra|
000026b0  6e 67 65 20 30 2d 32 35  35 0a 62 75 74 20 61 6c  |nge 0-255.but al|
000026c0  73 6f 20 61 6c 6c 6f 77  73 20 68 69 67 68 65 72  |so allows higher|
000026d0  20 76 61 6c 75 65 73 2e  20 43 75 72 72 65 6e 74  | values. Current|
000026e0  6c 79 20 79 6f 75 20 63  61 6e 20 61 63 63 65 73  |ly you can acces|
000026f0  73 20 30 2d 36 35 35 33  35 2e 20 4f 66 20 63 6f  |s 0-65535. Of co|
00002700  75 72 73 65 2c 0a 41 53  43 49 49 20 63 68 61 72  |urse,.ASCII char|
00002710  61 63 74 65 72 73 20 66  6f 72 20 74 68 65 20 63  |acters for the c|
00002720  6f 64 65 73 20 30 2d 33  31 20 61 6e 64 20 32 35  |odes 0-31 and 25|
00002730  36 2d 36 35 35 33 35 20  61 72 65 20 6e 6f 74 20  |6-65535 are not |
00002740  64 65 66 69 6e 65 64 2e  20 5a 61 70 20 74 72 65  |defined. Zap tre|
00002750  61 74 73 0a 74 68 65 73  65 20 73 70 65 63 69 61  |ats.these specia|
00002760  6c 6c 79 20 2d 20 73 65  65 20 62 65 6c 6f 77 2e  |lly - see below.|
00002770  0a 0a 54 68 65 20 62 79  74 65 20 30 20 69 6e 20  |..The byte 0 in |
00002780  74 68 65 20 64 61 74 61  20 66 6f 72 20 61 20 6c  |the data for a l|
00002790  69 6e 65 20 69 6e 74 72  6f 64 75 63 65 73 20 61  |ine introduces a|
000027a0  20 63 6f 6e 74 72 6f 6c  20 63 6f 64 65 2e 20 42  | control code. B|
000027b0  79 74 65 73 20 31 2d 32  35 35 20 6a 75 73 74 0a  |ytes 1-255 just.|
000027c0  70 72 69 6e 74 20 63 68  61 72 61 63 74 65 72 73  |print characters|
000027d0  20 6e 3d 31 2d 32 35 35  20 61 73 20 6e 6f 72 6d  | n=1-255 as norm|
000027e0  61 6c 20 73 6f 20 79 6f  75 20 77 69 6c 6c 20 6e  |al so you will n|
000027f0  65 65 64 20 74 6f 20 75  73 65 20 63 6f 6e 74 72  |eed to use contr|
00002800  6f 6c 20 63 6f 64 65 73  20 74 6f 0a 61 63 63 65  |ol codes to.acce|
00002810  73 73 20 63 68 61 72 61  63 74 65 72 73 20 3e 20  |ss characters > |
00002820  32 35 36 2e 20 54 68 65  20 63 75 72 72 65 6e 74  |256. The current|
00002830  6c 79 20 64 65 66 69 6e  65 64 20 63 6f 6e 74 72  |ly defined contr|
00002840  6f 6c 20 73 65 71 75 65  6e 63 65 73 20 61 72 65  |ol sequences are|
00002850  3a 0a 0a 20 30 2c 30 09  09 50 72 69 6e 74 73 20  |:.. 0,0..Prints |
00002860  63 68 61 72 61 63 74 65  72 20 6e 3d 30 2e 0a 20  |character n=0.. |
00002870  30 2c 31 2c 66 2c 62 09  53 77 69 74 63 68 20 63  |0,1,f,b.Switch c|
00002880  6f 6c 6f 75 72 20 74 6f  20 66 6f 72 65 67 72 6f  |olour to foregro|
00002890  75 6e 64 20 66 20 61 6e  64 20 62 61 63 6b 67 72  |und f and backgr|
000028a0  6f 75 6e 64 20 62 2e 20  28 66 2f 62 20 61 72 65  |ound b. (f/b are|
000028b0  0a 09 09 70 61 6c 65 74  74 65 20 6f 66 66 73 65  |...palette offse|
000028c0  74 73 20 2d 20 73 65 65  20 72 5f 66 6f 72 2f 72  |ts - see r_for/r|
000028d0  5f 62 61 63 29 2e 0a 20  30 2c 32 09 09 45 6e 64  |_bac).. 0,2..End|
000028e0  20 6f 66 20 6c 69 6e 65  20 2d 20 74 68 65 20 72  | of line - the r|
000028f0  65 73 74 20 6f 66 20 74  68 65 20 6c 69 6e 65 20  |est of the line |
00002900  69 73 20 63 6c 65 61 72  65 64 20 74 6f 20 74 68  |is cleared to th|
00002910  65 20 63 75 72 72 65 6e  74 0a 20 09 09 62 61 63  |e current. ..bac|
00002920  6b 67 72 6f 75 6e 64 20  63 6f 6c 6f 75 72 2e 0a  |kground colour..|
00002930  20 30 2c 33 2c 6c 2c 68  09 50 72 69 6e 74 20 63  | 0,3,l,h.Print c|
00002940  68 61 72 61 63 74 65 72  20 6e 3d 6c 2b 68 2a 32  |haracter n=l+h*2|
00002950  35 36 2e 0a 20 30 2c 34  2c 66 2c 62 2c 78 2c 79  |56.. 0,4,f,b,x,y|
00002960  09 4d 65 72 67 65 73 20  74 68 65 20 63 68 61 72  |.Merges the char|
00002970  61 63 74 65 72 73 20 78  2c 79 2e 20 49 66 20 61  |acters x,y. If a|
00002980  20 70 69 78 65 6c 20 69  73 20 63 6c 65 61 72 20  | pixel is clear |
00002990  69 6e 20 74 68 65 20 62  69 74 6d 61 70 0a 09 09  |in the bitmap...|
000029a0  66 6f 72 20 79 20 74 68  65 6e 20 74 68 65 20 70  |for y then the p|
000029b0  69 78 65 6c 20 69 73 20  64 72 61 77 6e 20 61 63  |ixel is drawn ac|
000029c0  63 6f 72 64 69 6e 67 20  74 6f 20 74 68 65 20 62  |cording to the b|
000029d0  69 74 6d 61 70 20 66 6f  72 20 78 0a 09 09 61 6e  |itmap for x...an|
000029e0  64 20 74 68 65 20 63 75  72 72 65 6e 74 20 66 6f  |d the current fo|
000029f0  72 2f 62 61 63 6b 67 72  6f 75 6e 64 20 63 6f 6c  |r/background col|
00002a00  6f 75 72 73 2e 20 49 66  20 74 68 65 20 70 69 78  |ours. If the pix|
00002a10  65 6c 20 69 73 0a 09 09  73 65 74 20 66 6f 72 20  |el is...set for |
00002a20  79 20 74 68 65 6e 20 74  68 65 20 63 6f 6c 6f 75  |y then the colou|
00002a30  72 73 20 66 2f 62 20 61  72 65 20 75 73 65 64 20  |rs f/b are used |
00002a40  69 6e 73 74 65 61 64 20  66 6f 72 20 74 68 65 20  |instead for the |
00002a50  78 0a 09 09 70 69 78 65  6c 2e 20 55 73 65 66 75  |x...pixel. Usefu|
00002a60  6c 20 66 6f 72 20 6c 61  79 69 6e 67 20 61 20 63  |l for laying a c|
00002a70  75 72 73 6f 72 20 6f 6e  20 74 6f 70 20 6f 66 20  |ursor on top of |
00002a80  74 68 65 20 63 68 61 72  61 63 74 65 72 2e 0a 09  |the character...|
00002a90  09 54 68 69 73 20 65 66  66 65 63 74 20 69 73 20  |.This effect is |
00002aa0  73 69 6d 75 6c 61 74 65  64 20 69 6e 20 56 44 55  |simulated in VDU|
00002ab0  20 6d 6f 64 65 20 62 79  20 75 73 69 6e 67 20 73  | mode by using s|
00002ac0  70 72 69 74 65 73 20 61  6e 64 0a 09 09 6d 61 73  |prites and...mas|
00002ad0  6b 73 2e 20 54 68 69 73  20 6c 65 61 76 65 73 20  |ks. This leaves |
00002ae0  74 68 65 20 63 75 72 72  65 6e 74 20 66 6f 72 65  |the current fore|
00002af0  67 72 6f 75 6e 64 20 61  6e 64 20 62 61 63 6b 67  |ground and backg|
00002b00  72 6f 75 6e 64 0a 09 09  63 6f 6c 6f 75 72 73 20  |round...colours |
00002b10  75 6e 61 6c 74 65 72 65  64 2e 20 4e 42 20 78 20  |unaltered. NB x |
00002b20  61 6e 64 20 79 20 6d 61  79 20 63 6f 6e 74 61 69  |and y may contai|
00002b30  6e 20 63 6f 6e 74 72 6f  6c 20 63 6f 64 65 73 20  |n control codes |
00002b40  61 73 0a 09 09 77 65 6c  6c 2e 20 45 67 20 79 6f  |as...well. Eg yo|
00002b50  75 20 63 6f 75 6c 64 20  68 61 76 65 20 78 3d 30  |u could have x=0|
00002b60  2c 30 20 61 6e 64 20 79  3d 30 2c 33 2c 30 2c 31  |,0 and y=0,3,0,1|
00002b70  2e 20 49 66 20 79 6f 75  20 6e 65 73 74 2c 0a 09  |. If you nest,..|
00002b80  09 30 2c 34 20 63 6f 64  65 73 20 28 69 65 20 65  |.0,4 codes (ie e|
00002b90  69 74 68 65 72 20 78 20  6f 72 20 79 20 63 6f 6e  |ither x or y con|
00002ba0  74 61 69 6e 20 30 2c 34  29 20 74 68 65 6e 20 6f  |tain 0,4) then o|
00002bb0  6e 6c 79 20 74 68 65 20  6d 6f 73 74 0a 09 09 64  |nly the most...d|
00002bc0  65 65 70 6c 79 20 6e 65  73 74 65 64 20 6f 6e 65  |eeply nested one|
00002bd0  20 77 69 6c 6c 20 68 61  76 65 20 65 66 66 65 63  | will have effec|
00002be0  74 2e 0a 20 30 2c 35 09  09 46 6f 72 20 69 6e 74  |t.. 0,5..For int|
00002bf0  65 72 6e 61 6c 20 75 73  65 20 6f 6e 6c 79 2e 20  |ernal use only. |
00002c00  52 65 73 74 6f 72 65 73  20 74 68 65 20 73 74 61  |Restores the sta|
00002c10  63 6b 65 64 20 76 61 6c  75 65 73 20 61 66 74 65  |cked values afte|
00002c20  72 20 61 0a 20 09 09 30  2c 34 20 63 61 6c 6c 2e  |r a. ..0,4 call.|
00002c30  20 50 75 74 74 69 6e 67  20 74 68 69 73 20 69 6e  | Putting this in|
00002c40  20 79 6f 75 72 20 69 6e  70 75 74 20 73 74 72 69  | your input stri|
00002c50  6e 67 20 77 69 6c 6c 20  70 72 6f 62 61 62 6c 79  |ng will probably|
00002c60  0a 20 09 09 63 61 75 73  65 20 61 20 63 72 61 73  |. ..cause a cras|
00002c70  68 2e 0a 20 30 2c 36 2c  66 09 09 43 68 61 6e 67  |h.. 0,6,f..Chang|
00002c80  65 20 66 6f 72 65 67 72  6f 75 6e 64 20 63 6f 6c  |e foreground col|
00002c90  6f 75 72 20 74 6f 20 66  2e 0a 20 30 2c 37 2c 62  |our to f.. 0,7,b|
00002ca0  09 09 43 68 61 6e 67 65  20 62 61 63 6b 67 72 6f  |..Change backgro|
00002cb0  75 6e 64 20 63 6f 6c 6f  75 72 20 74 6f 20 62 2e  |und colour to b.|
00002cc0  0a 20 30 2c 38 2c 66 2c  62 2c 78 2c 79 09 43 75  |. 0,8,f,b,x,y.Cu|
00002cd0  72 73 6f 72 20 6d 65 72  67 65 20 6f 66 20 63 68  |rsor merge of ch|
00002ce0  61 72 61 63 74 65 72 73  20 78 2c 79 2e 20 54 68  |aracters x,y. Th|
00002cf0  69 73 20 69 73 20 73 69  6d 69 6c 61 72 20 74 6f  |is is similar to|
00002d00  20 30 2c 34 20 62 75 74  0a 20 09 09 6f 6e 6c 79  | 0,4 but. ..only|
00002d10  20 77 6f 72 6b 73 20 66  6f 72 20 63 68 61 72 61  | works for chara|
00002d20  63 74 65 72 73 20 26 37  46 2c 26 31 30 30 2d 26  |cters &7F,&100-&|
00002d30  31 30 35 2e 20 46 6f 72  20 26 37 46 2c 20 69 74  |105. For &7F, it|
00002d40  20 6d 61 73 6b 73 0a 20  09 09 69 6e 20 74 68 65  | masks. ..in the|
00002d50  20 62 6c 6f 63 6b 20 73  69 6d 70 6c 79 20 62 79  | block simply by|
00002d60  20 63 68 61 6e 67 69 6e  67 20 74 68 65 20 66 6f  | changing the fo|
00002d70  72 2f 62 61 63 20 63 6f  6c 73 20 6f 66 20 74 68  |r/bac cols of th|
00002d80  65 0a 20 09 09 63 75 72  72 65 6e 74 20 63 68 61  |e. ..current cha|
00002d90  72 61 63 74 65 72 20 62  65 69 6e 67 20 70 72 69  |racter being pri|
00002da0  6e 74 65 64 2e 20 46 6f  72 20 26 31 30 30 2b 2c  |nted. For &100+,|
00002db0  20 74 68 65 20 73 71 75  61 72 65 20 6f 72 0a 20  | the square or. |
00002dc0  09 09 6c 69 6e 65 20 69  73 20 70 6c 6f 74 74 65  |..line is plotte|
00002dd0  64 20 6f 76 65 72 20 74  68 65 20 74 6f 70 20 6f  |d over the top o|
00002de0  66 20 74 68 65 20 63 68  61 72 61 63 74 65 72 20  |f the character |
00002df0  69 6e 20 74 68 65 0a 20  09 09 62 61 63 6b 67 72  |in the. ..backgr|
00002e00  6f 75 6e 64 20 63 6f 6c  6f 75 72 20 62 2e 0a 0a  |ound colour b...|
00002e10  4e 6f 74 65 20 74 68 61  74 20 73 65 71 75 65 6e  |Note that sequen|
00002e20  63 65 73 20 77 69 74 68  20 63 6f 64 65 73 20 30  |ces with codes 0|
00002e30  2c 33 2c 34 20 65 76 61  6c 75 61 74 65 20 74 6f  |,3,4 evaluate to|
00002e40  20 6f 6e 65 20 27 73 63  72 65 65 6e 20 70 72 69  | one 'screen pri|
00002e50  6e 74 61 62 6c 65 0a 63  68 61 72 61 63 74 65 72  |ntable.character|
00002e60  27 2c 20 63 6f 64 65 20  31 20 74 6f 20 6e 6f 6e  |', code 1 to non|
00002e70  65 2c 20 61 6e 64 20 63  6f 64 65 20 32 20 74 6f  |e, and code 2 to|
00002e80  20 61 73 20 6d 61 6e 79  20 61 73 20 69 73 20 72  | as many as is r|
00002e90  65 71 75 69 72 65 64 2e  20 54 68 75 73 20 69 74  |equired. Thus it|
00002ea0  20 69 73 0a 6e 6f 74 20  61 20 73 69 6d 70 6c 65  | is.not a simple|
00002eb0  20 6d 61 74 74 65 72 20  74 6f 20 63 61 6c 63 75  | matter to calcu|
00002ec0  6c 61 74 65 20 74 68 65  20 73 74 61 72 74 20 6f  |late the start o|
00002ed0  66 20 74 68 65 20 6e 27  74 68 20 61 63 74 75 61  |f the n'th actua|
00002ee0  6c 20 70 72 69 6e 74 61  62 6c 65 0a 63 68 61 72  |l printable.char|
00002ef0  61 63 74 65 72 20 67 69  76 65 6e 20 61 20 73 74  |acter given a st|
00002f00  72 69 6e 67 20 63 6f 6e  74 61 69 6e 69 6e 67 20  |ring containing |
00002f10  63 6f 6e 74 72 6f 6c 20  63 6f 64 65 73 20 61 73  |control codes as|
00002f20  20 61 62 6f 76 65 2e 20  54 68 65 20 53 57 49 0a  | above. The SWI.|
00002f30  5a 61 70 52 65 64 72 61  77 5f 46 69 6e 64 43 68  |ZapRedraw_FindCh|
00002f40  61 72 61 63 74 65 72 20  64 6f 65 73 20 74 68 69  |aracter does thi|
00002f50  73 20 66 6f 72 20 79 6f  75 2e 0a 0a 49 6e 20 44  |s for you...In D|
00002f60  53 41 20 6d 6f 64 65 20  63 68 61 72 61 63 74 65  |SA mode characte|
00002f70  72 20 27 6e 27 20 6a 75  73 74 20 6c 6f 6f 6b 73  |r 'n' just looks|
00002f80  20 75 70 20 74 68 65 20  63 61 63 68 65 64 20 63  | up the cached c|
00002f90  68 61 72 61 63 74 65 72  20 61 74 20 61 64 64 72  |haracter at addr|
00002fa0  65 73 73 0a 72 5f 63 61  64 64 72 2b 6e 2a 72 5f  |ess.r_caddr+n*r_|
00002fb0  63 62 70 63 2e 20 55 73  75 61 6c 6c 79 20 74 68  |cbpc. Usually th|
00002fc0  65 20 62 69 74 6d 61 70  73 20 77 69 6c 6c 20 63  |e bitmaps will c|
00002fd0  6f 72 72 65 73 70 6f 6e  64 20 74 6f 20 74 68 65  |orrespond to the|
00002fe0  20 56 44 55 20 6c 69 73  74 0a 62 65 6c 6f 77 20  | VDU list.below |
00002ff0  73 6f 20 74 68 61 74 20  63 68 61 72 61 63 74 65  |so that characte|
00003000  72 20 26 32 30 20 77 69  6c 6c 20 62 65 20 74 68  |r &20 will be th|
00003010  65 20 62 69 74 6d 61 70  20 66 6f 72 20 61 20 73  |e bitmap for a s|
00003020  70 61 63 65 20 65 74 63  2e 0a 20 0a 49 6e 20 56  |pace etc.. .In V|
00003030  44 55 20 6d 6f 64 65 20  63 68 61 72 61 63 74 65  |DU mode characte|
00003040  72 20 27 6e 27 20 69 73  20 69 6e 74 65 72 70 72  |r 'n' is interpr|
00003050  65 74 65 64 20 61 73 20  62 65 6c 6f 77 3a 0a 0a  |eted as below:..|
00003060  20 20 26 30 30 09 09 50  72 69 6e 74 73 20 61 20  |  &00..Prints a |
00003070  27 30 27 20 28 41 53 43  49 49 20 26 33 30 29 0a  |'0' (ASCII &30).|
00003080  20 20 26 30 31 2d 26 31  41 09 54 68 65 73 65 20  |  &01-&1A.These |
00003090  70 72 69 6e 74 20 74 68  65 20 6c 65 74 74 65 72  |print the letter|
000030a0  73 20 41 2d 5a 20 28 69  65 20 26 34 30 20 69 73  |s A-Z (ie &40 is|
000030b0  20 61 64 64 65 64 29 0a  20 20 26 31 42 2d 26 31  | added).  &1B-&1|
000030c0  46 09 50 72 69 6e 74 73  20 22 5b 20 5c 20 5d 20  |F.Prints "[ \ ] |
000030d0  5e 20 5f 22 20 72 65 73  70 65 63 74 69 76 65 6c  |^ _" respectivel|
000030e0  79 20 28 69 65 20 26 34  30 20 69 73 20 61 64 64  |y (ie &40 is add|
000030f0  65 64 29 0a 20 20 26 32  30 2d 26 37 45 09 55 73  |ed).  &20-&7E.Us|
00003100  75 61 6c 20 41 73 63 69  69 20 63 68 61 72 61 63  |ual Ascii charac|
00003110  74 65 72 73 20 70 72 69  6e 74 65 64 2e 0a 20 20  |ters printed..  |
00003120  26 37 46 09 09 54 68 69  73 20 64 72 61 77 73 20  |&7F..This draws |
00003130  61 20 66 69 6c 6c 65 64  20 69 6e 20 62 6c 6f 63  |a filled in bloc|
00003140  6b 20 28 75 73 65 66 75  6c 20 66 6f 72 20 61 20  |k (useful for a |
00003150  63 75 72 73 6f 72 29 0a  20 20 26 38 30 2d 26 46  |cursor).  &80-&F|
00003160  46 09 55 73 75 61 6c 20  41 73 63 69 69 20 63 68  |F.Usual Ascii ch|
00003170  61 72 61 63 74 65 72 73  20 70 72 69 6e 74 65 64  |aracters printed|
00003180  2e 0a 20 20 26 31 30 30  09 09 54 68 69 73 20 64  |..  &100..This d|
00003190  72 61 77 73 20 74 68 65  20 74 6f 70 2c 62 6f 74  |raws the top,bot|
000031a0  74 6f 6d 2c 6c 65 66 74  20 65 64 67 65 73 20 69  |tom,left edges i|
000031b0  65 20 27 5b 27 2e 0a 20  20 26 31 30 31 09 09 54  |e '['..  &101..T|
000031c0  68 69 73 20 64 72 61 77  73 20 74 68 65 20 74 6f  |his draws the to|
000031d0  70 2c 62 6f 74 74 6f 6d  20 65 64 67 65 73 2e 0a  |p,bottom edges..|
000031e0  20 20 26 31 30 32 09 09  54 68 69 73 20 64 72 61  |  &102..This dra|
000031f0  77 73 20 74 68 65 20 74  6f 70 2c 62 6f 74 74 6f  |ws the top,botto|
00003200  6d 2c 72 69 67 68 74 20  65 64 67 65 73 20 69 65  |m,right edges ie|
00003210  20 27 5d 27 2e 0a 20 20  26 31 30 33 09 09 54 68  | ']'..  &103..Th|
00003220  69 73 20 64 72 61 77 73  20 61 6e 20 65 6d 70 74  |is draws an empt|
00003230  79 20 73 71 75 61 72 65  20 28 75 73 65 66 75 6c  |y square (useful|
00003240  20 66 6f 72 20 61 20 63  75 72 73 6f 72 29 0a 20  | for a cursor). |
00003250  20 26 31 30 34 09 09 54  68 69 73 20 64 72 61 77  | &104..This draw|
00003260  73 20 74 68 65 20 62 61  73 65 6c 69 6e 65 20 69  |s the baseline i|
00003270  65 20 27 5f 27 20 28 75  73 65 66 75 6c 20 66 6f  |e '_' (useful fo|
00003280  72 20 61 20 63 75 72 73  6f 72 29 0a 20 20 26 31  |r a cursor).  &1|
00003290  30 35 09 09 54 68 69 73  20 64 72 61 77 73 20 74  |05..This draws t|
000032a0  68 65 20 6c 65 66 74 20  65 64 67 65 20 67 69 76  |he left edge giv|
000032b0  69 6e 67 20 61 20 76 65  72 74 69 63 61 6c 20 62  |ing a vertical b|
000032c0  61 72 2e 0a 20 20 26 31  30 36 2b 09 09 55 6e 64  |ar..  &106+..Und|
000032d0  65 66 69 6e 65 64 20 61  63 74 69 6f 6e 20 28 70  |efined action (p|
000032e0  72 69 6e 74 73 20 61 6e  20 40 20 66 6f 72 20 64  |rints an @ for d|
000032f0  65 62 75 67 67 69 6e 67  20 70 75 72 70 6f 73 65  |ebugging purpose|
00003300  73 29 0a 20 20 09 09 28  4d 6f 72 65 20 63 6f 64  |s).  ..(More cod|
00003310  65 73 20 6d 61 79 20 62  65 20 61 64 64 65 64 20  |es may be added |
00003320  69 6e 20 66 75 74 75 72  65 29 2e 0a 20 20 0a 54  |in future)..  .T|
00003330  68 65 20 63 68 61 72 61  63 74 65 72 73 20 61 72  |he characters ar|
00003340  65 20 64 72 61 77 6e 20  75 73 69 6e 67 20 4f 53  |e drawn using OS|
00003350  5f 57 72 69 74 65 4e 2f  4f 53 5f 57 72 69 74 65  |_WriteN/OS_Write|
00003360  43 2f 4f 53 5f 50 6c 6f  74 20 28 6f 72 20 46 6f  |C/OS_Plot (or Fo|
00003370  6e 74 5f 50 61 69 6e 74  20 69 66 0a 6e 6f 74 20  |nt_Paint if.not |
00003380  75 73 69 6e 67 20 74 68  65 20 73 79 73 74 65 6d  |using the system|
00003390  20 66 6f 6e 74 29 2e 0a  0a 55 73 65 20 5a 61 70  | font)...Use Zap|
000033a0  52 65 64 72 61 77 5f 46  69 6e 64 43 68 61 72 61  |Redraw_FindChara|
000033b0  63 74 65 72 20 74 6f 20  6a 75 6d 70 20 6f 76 65  |cter to jump ove|
000033c0  72 20 74 68 65 20 63 6f  6e 74 72 6f 6c 20 63 6f  |r the control co|
000033d0  64 65 73 2e 20 55 73 65  0a 5a 61 70 52 65 64 72  |des. Use.ZapRedr|
000033e0  61 77 5f 50 72 65 70 61  72 65 44 61 74 61 4c 69  |aw_PrepareDataLi|
000033f0  6e 65 20 74 6f 20 61 75  74 6f 6d 61 74 69 63 61  |ne to automatica|
00003400  6c 6c 79 20 67 65 6e 65  72 61 74 65 20 74 68 65  |lly generate the|
00003410  20 72 5f 64 61 74 61 20  6c 69 6e 65 73 20 66 72  | r_data lines fr|
00003420  6f 6d 0a 6e 6f 72 6d 61  6c 20 74 65 78 74 20 77  |om.normal text w|
00003430  69 74 68 20 66 6f 72 65  67 72 6f 75 6e 64 20 61  |ith foreground a|
00003440  6e 64 20 62 61 63 6b 67  72 6f 75 6e 64 20 63 6f  |nd background co|
00003450  6c 6f 75 72 20 6d 61 73  6b 73 2e 20 55 73 65 0a  |lour masks. Use.|
00003460  5a 61 70 52 65 64 72 61  77 5f 41 64 64 56 64 75  |ZapRedraw_AddVdu|
00003470  42 69 74 6d 61 70 73 20  74 6f 20 63 72 65 61 74  |Bitmaps to creat|
00003480  65 20 74 68 65 20 62 69  74 6d 61 70 73 20 66 6f  |e the bitmaps fo|
00003490  72 20 63 68 61 72 61 63  74 65 72 20 63 6f 64 65  |r character code|
000034a0  73 20 30 2d 26 31 46 2c  26 37 46 0a 61 6e 64 20  |s 0-&1F,&7F.and |
000034b0  3e 3d 26 31 30 30 2e 0a  0a 46 6f 72 6d 61 74 20  |>=&100...Format |
000034c0  6f 66 20 70 61 6c 65 74  74 65 20 64 61 74 61 20  |of palette data |
000034d0  28 72 5f 70 61 6c 65 74  74 65 29 3a 0a 2d 2d 2d  |(r_palette):.---|
000034e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00003500  0a 0a 41 6c 6c 20 63 6f  6c 6f 75 72 73 20 61 72  |..All colours ar|
00003510  65 20 73 70 65 63 69 66  69 65 64 20 61 73 20 6f  |e specified as o|
00003520  66 66 73 65 74 73 20 69  6e 20 74 68 65 20 70 61  |ffsets in the pa|
00003530  6c 65 74 74 65 20 74 61  62 6c 65 2e 20 54 68 75  |lette table. Thu|
00003540  73 20 69 66 20 79 6f 75  20 73 65 74 0a 72 5f 66  |s if you set.r_f|
00003550  6f 72 20 74 6f 20 31 20  74 68 65 6e 20 74 68 65  |or to 1 then the|
00003560  20 6d 6f 64 75 6c 65 20  77 69 6c 6c 20 6c 6f 6f  | module will loo|
00003570  6b 20 75 70 20 74 68 65  20 77 6f 72 64 20 61 74  |k up the word at|
00003580  20 6f 66 66 73 65 74 20  34 2a 31 20 69 6e 20 74  | offset 4*1 in t|
00003590  68 65 20 70 61 6c 65 74  74 65 0a 74 61 62 6c 65  |he palette.table|
000035a0  20 77 68 65 6e 20 69 74  20 63 6f 6d 65 73 20 74  | when it comes t|
000035b0  6f 20 70 72 69 6e 74 69  6e 67 20 61 20 63 68 61  |o printing a cha|
000035c0  72 61 63 74 65 72 2e 0a  0a 44 53 41 20 4d 4f 44  |racter...DSA MOD|
000035d0  45 3a 20 54 68 65 20 70  61 6c 65 74 74 65 20 63  |E: The palette c|
000035e0  6f 6e 73 69 73 74 73 20  6f 66 20 61 20 6c 69 73  |onsists of a lis|
000035f0  74 20 6f 66 20 77 6f 72  64 73 20 67 69 76 69 6e  |t of words givin|
00003600  67 20 74 68 65 20 63 6f  6c 6f 75 72 20 27 6d 61  |g the colour 'ma|
00003610  73 6b 27 20 74 6f 0a 75  73 65 20 66 6f 72 20 74  |sk' to.use for t|
00003620  68 69 73 20 63 6f 6c 6f  75 72 2e 20 54 68 65 20  |his colour. The |
00003630  6d 61 73 6b 20 69 73 20  64 75 70 6c 69 63 61 74  |mask is duplicat|
00003640  65 64 20 74 6f 20 66 69  6c 6c 20 74 68 65 20 77  |ed to fill the w|
00003650  6f 72 64 20 6f 75 74 2e  20 46 6f 72 0a 65 78 61  |ord out. For.exa|
00003660  6d 70 6c 65 2c 20 69 6e  20 61 20 31 36 20 63 6f  |mple, in a 16 co|
00003670  6c 6f 75 72 20 6d 6f 64  65 2c 20 74 68 65 20 6d  |lour mode, the m|
00003680  61 73 6b 20 26 41 41 41  41 41 41 41 41 20 77 6f  |ask &AAAAAAAA wo|
00003690  75 6c 64 20 73 74 61 6e  64 20 66 6f 72 20 61 63  |uld stand for ac|
000036a0  74 75 61 6c 0a 73 63 72  65 65 6e 20 63 6f 6c 6f  |tual.screen colo|
000036b0  75 72 20 31 30 2e 20 54  68 65 20 74 61 62 6c 65  |ur 10. The table|
000036c0  3a 0a 0a 09 09 26 33 33  33 33 33 33 33 33 0a 09  |:....&33333333..|
000036d0  09 26 36 36 36 36 36 36  36 36 0a 09 09 26 41 41  |.&66666666...&AA|
000036e0  41 41 41 41 41 41 0a 09  09 26 30 30 30 30 30 30  |AAAAAA...&000000|
000036f0  30 30 0a 09 09 0a 77 6f  75 6c 64 20 63 61 75 73  |00....would caus|
00003700  65 20 33 20 74 6f 20 62  65 20 70 6f 6b 65 64 20  |e 3 to be poked |
00003710  69 6e 74 6f 20 74 68 65  20 73 63 72 65 65 6e 20  |into the screen |
00003720  77 68 65 6e 20 69 6e 20  7a 61 70 20 63 6f 6c 6f  |when in zap colo|
00003730  75 72 20 30 2c 20 36 20  77 68 65 6e 20 69 6e 0a  |ur 0, 6 when in.|
00003740  7a 61 70 20 63 6f 6c 6f  75 72 20 31 20 65 74 63  |zap colour 1 etc|
00003750  2e 20 54 68 65 20 6d 61  73 6b 73 20 77 69 6c 6c  |. The masks will|
00003760  20 75 73 75 61 6c 6c 79  20 63 6f 72 72 65 73 70  | usually corresp|
00003770  6f 6e 64 20 74 6f 20 74  68 65 20 77 69 6d 70 20  |ond to the wimp |
00003780  63 6f 6c 6f 75 72 73 2e  20 54 68 65 0a 53 57 49  |colours. The.SWI|
00003790  20 5a 61 70 52 65 64 72  61 77 5f 43 72 65 61 74  | ZapRedraw_Creat|
000037a0  65 50 61 6c 65 74 74 65  20 69 73 20 70 72 6f 76  |ePalette is prov|
000037b0  69 64 65 64 20 74 6f 20  73 65 74 20 74 68 65 6d  |ided to set them|
000037c0  20 75 70 2e 0a 0a 54 68  65 20 61 63 74 75 61 6c  | up...The actual|
000037d0  20 76 61 6c 75 65 20 70  6f 6b 65 64 20 69 6e 74  | value poked int|
000037e0  6f 20 74 68 65 20 73 63  72 65 65 6e 20 69 73 3a  |o the screen is:|
000037f0  20 28 46 6f 72 65 67 72  6f 75 6e 64 20 6d 61 73  | (Foreground mas|
00003800  6b 20 41 4e 44 20 62 69  74 6d 61 70 29 20 4f 52  |k AND bitmap) OR|
00003810  0a 28 42 61 63 6b 67 72  6f 75 6e 64 20 6d 61 73  |.(Background mas|
00003820  6b 20 42 49 43 20 62 69  74 6d 61 70 29 20 77 68  |k BIC bitmap) wh|
00003830  65 72 65 20 74 68 65 20  62 69 74 6d 61 70 20 69  |ere the bitmap i|
00003840  73 20 61 73 20 73 70 65  63 69 66 69 65 64 20 69  |s as specified i|
00003850  6e 20 72 5f 63 61 64 64  72 2e 0a 0a 56 44 55 20  |n r_caddr...VDU |
00003860  4d 4f 44 45 3a 20 54 68  65 20 70 61 6c 65 74 74  |MODE: The palett|
00003870  65 20 63 6f 6e 73 69 73  74 73 20 6f 66 20 61 20  |e consists of a |
00003880  6c 69 73 74 20 6f 66 20  77 6f 72 64 73 20 67 69  |list of words gi|
00003890  76 69 6e 67 20 74 68 65  20 32 34 20 62 69 74 20  |ving the 24 bit |
000038a0  63 6f 6c 6f 75 72 0a 72  65 71 75 69 72 65 64 2e  |colour.required.|
000038b0  20 54 68 65 20 77 6f 72  64 20 69 73 20 69 6e 20  | The word is in |
000038c0  74 68 65 20 66 6f 72 6d  20 6f 66 20 61 20 73 74  |the form of a st|
000038d0  61 6e 64 61 72 64 20 70  61 6c 65 74 74 65 20 65  |andard palette e|
000038e0  6e 74 72 79 2e 20 49 65  2c 20 26 42 42 47 47 52  |ntry. Ie, &BBGGR|
000038f0  52 78 78 0a 77 68 65 72  65 20 26 42 42 20 69 73  |Rxx.where &BB is|
00003900  20 74 68 65 20 61 6d 6f  75 6e 74 20 6f 66 20 62  | the amount of b|
00003910  6c 75 65 20 65 74 63 2e  20 54 68 65 73 65 20 77  |lue etc. These w|
00003920  69 6c 6c 20 75 73 75 61  6c 6c 79 20 62 65 20 73  |ill usually be s|
00003930  65 74 20 75 70 20 62 79  20 72 65 61 64 69 6e 67  |et up by reading|
00003940  0a 74 68 65 20 77 69 6d  70 20 70 61 6c 65 74 74  |.the wimp palett|
00003950  65 2e 20 54 68 65 20 53  57 49 20 5a 61 70 52 65  |e. The SWI ZapRe|
00003960  64 72 61 77 5f 43 72 65  61 74 65 50 61 6c 65 74  |draw_CreatePalet|
00003970  74 65 20 77 69 6c 6c 20  64 6f 20 74 68 69 73 20  |te will do this |
00003980  66 6f 72 20 79 6f 75 2e  0a 43 6f 6c 6f 75 72 54  |for you..ColourT|
00003990  72 61 6e 73 20 63 61 6c  6c 73 20 77 69 6c 6c 20  |rans calls will |
000039a0  62 65 20 75 73 65 64 20  64 75 72 69 6e 67 20 74  |be used during t|
000039b0  68 65 20 72 65 64 72 61  77 20 74 6f 20 66 69 6e  |he redraw to fin|
000039c0  64 20 74 68 65 20 63 6c  6f 73 65 73 74 0a 61 76  |d the closest.av|
000039d0  61 69 6c 61 62 6c 65 20  47 43 4f 4c 20 63 6f 6c  |ailable GCOL col|
000039e0  6f 75 72 2e 0a 0a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |our...**********|
000039f0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00003a20  2a 2a 2a 2a 2a 2a 2a 0a  2a 20 53 57 49 20 44 65  |*******.* SWI De|
00003a30  66 69 6e 69 74 69 6f 6e  73 09 09 09 09 09 09 2a  |finitions......*|
00003a40  0a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |.***************|
00003a50  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00003a80  2a 2a 0a 0a 4e 6f 6e 65  20 6f 66 20 74 68 65 20  |**..None of the |
00003a90  53 57 49 27 73 20 61 72  65 20 72 65 2d 65 6e 74  |SWI's are re-ent|
00003aa0  72 61 6e 74 20 75 6e 6c  65 73 73 20 65 78 70 6c  |rant unless expl|
00003ab0  69 63 69 74 6c 79 20 6d  65 6e 74 69 6f 6e 65 64  |icitly mentioned|
00003ac0  2e 20 41 6c 6c 20 74 68  65 20 53 57 49 27 73 0a  |. All the SWI's.|
00003ad0  63 6f 72 72 75 70 74 20  52 30 20 61 6e 64 20 66  |corrupt R0 and f|
00003ae0  6c 61 67 73 20 61 6e 64  20 63 61 6e 20 70 72 6f  |lags and can pro|
00003af0  64 75 63 65 20 65 72 72  6f 72 73 2e 0a 0a 5a 61  |duce errors...Za|
00003b00  70 52 65 64 72 61 77 5f  52 65 64 72 61 77 41 72  |pRedraw_RedrawAr|
00003b10  65 61 20 28 2b 26 30 30  29 0a 2d 2d 2d 2d 2d 2d  |ea (+&00).------|
00003b20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00003b30  2d 2d 2d 2d 2d 0a 0a 54  68 69 73 20 72 65 64 72  |-----..This redr|
00003b40  61 77 73 20 61 20 72 65  63 74 61 6e 67 6c 65 20  |aws a rectangle |
00003b50  6f 66 20 63 68 61 72 61  63 74 65 72 73 20 6f 6e  |of characters on|
00003b60  20 74 68 65 20 73 63 72  65 65 6e 2e 0a 0a 45 6e  | the screen...En|
00003b70  74 72 79 3a 09 52 31 3d  72 65 64 72 61 77 20 62  |try:.R1=redraw b|
00003b80  6c 6f 63 6b 20 28 61 73  20 64 65 73 63 72 69 62  |lock (as describ|
00003b90  65 64 20 61 62 6f 76 65  29 2e 0a 09 41 6c 6c 20  |ed above)...All |
00003ba0  64 65 66 69 6e 65 64 20  6f 66 66 73 65 74 73 20  |defined offsets |
00003bb0  69 6e 20 74 68 65 20 72  65 64 72 61 77 20 62 6c  |in the redraw bl|
00003bc0  6f 63 6b 20 61 72 65 20  75 73 65 64 2e 0a 09 0a  |ock are used....|
00003bd0  09 49 6e 20 56 44 55 20  6d 6f 64 65 20 72 5f 77  |.In VDU mode r_w|
00003be0  6f 72 6b 61 72 65 61 20  6d 75 73 74 20 62 65 20  |orkarea must be |
00003bf0  61 74 20 6c 65 61 73 74  20 36 34 20 62 79 74 65  |at least 64 byte|
00003c00  73 2b 74 68 65 20 61 6d  6f 75 6e 74 20 6e 65 65  |s+the amount nee|
00003c10  64 65 64 0a 09 20 66 6f  72 20 61 20 73 70 72 69  |ded.. for a spri|
00003c20  74 65 20 6f 66 20 6f 6e  65 20 63 68 61 72 61 63  |te of one charac|
00003c30  74 65 72 20 2d 20 73 65  65 20 5a 61 70 52 65 64  |ter - see ZapRed|
00003c40  72 61 77 5f 53 70 72 69  74 65 53 69 7a 65 2e 0a  |raw_SpriteSize..|
00003c50  09 20 49 66 20 75 73 69  6e 67 20 66 6f 6e 74 73  |. If using fonts|
00003c60  20 74 68 65 6e 20 74 68  65 20 66 69 72 73 74 20  | then the first |
00003c70  77 6f 72 64 20 6f 66 20  74 68 65 20 77 6f 72 6b  |word of the work|
00003c80  61 72 65 61 20 73 68 6f  75 6c 64 20 63 6f 6e 74  |area should cont|
00003c90  61 69 6e 0a 09 20 74 68  65 20 66 6f 6e 74 73 69  |ain.. the fontsi|
00003ca0  7a 65 20 69 6e 20 70 6f  69 6e 74 73 2e 0a 09 0a  |ze in points....|
00003cb0  09 49 6e 20 44 53 41 20  6d 6f 64 65 20 72 5f 77  |.In DSA mode r_w|
00003cc0  6f 72 6b 61 72 65 61 20  6d 75 73 74 20 62 65 20  |orkarea must be |
00003cd0  61 74 20 6c 65 61 73 74  20 36 34 2b 72 5f 63 62  |at least 64+r_cb|
00003ce0  70 6c 20 62 79 74 65 73  20 28 61 6e 64 20 61 0a  |pl bytes (and a.|
00003cf0  09 20 77 68 6f 6c 65 20  6e 75 6d 62 65 72 20 6f  |. whole number o|
00003d00  66 20 77 6f 72 64 73 20  6c 6f 6e 67 29 2e 0a 09  |f words long)...|
00003d10  20 49 66 20 62 32 20 6f  66 20 74 68 65 20 72 5f  | If b2 of the r_|
00003d20  66 6c 61 67 73 20 77 6f  72 64 20 69 73 20 73 65  |flags word is se|
00003d30  74 20 74 68 65 6e 20 79  6f 75 20 70 72 6f 76 69  |t then you provi|
00003d40  64 65 20 61 6e 20 65 78  74 65 6e 73 69 6f 6e 0a  |de an extension.|
00003d50  09 20 72 6f 75 74 69 6e  65 20 61 6e 64 3a 0a 09  |. routine and:..|
00003d60  20 20 52 32 3d 61 64 64  72 65 73 73 20 6f 66 20  |  R2=address of |
00003d70  74 68 65 20 72 6f 75 74  69 6e 65 0a 09 20 20 52  |the routine..  R|
00003d80  33 3d 70 72 69 76 61 74  65 20 77 6f 72 64 20 76  |3=private word v|
00003d90  61 6c 75 65 20 74 6f 20  70 61 73 73 20 74 6f 20  |alue to pass to |
00003da0  74 68 65 20 72 6f 75 74  69 6e 65 2e 0a 0a 45 78  |the routine...Ex|
00003db0  69 74 3a 09 52 30 20 61  6e 64 20 66 6c 61 67 73  |it:.R0 and flags|
00003dc0  20 63 6f 72 72 75 70 74  65 64 2e 0a 0a 54 68 65  | corrupted...The|
00003dd0  20 65 78 74 65 6e 73 69  6f 6e 20 72 6f 75 74 69  | extension routi|
00003de0  6e 65 20 69 73 20 70 72  6f 76 69 64 65 64 20 73  |ne is provided s|
00003df0  6f 20 79 6f 75 20 63 61  6e 20 74 72 61 70 20 75  |o you can trap u|
00003e00  6e 6b 6e 6f 77 6e 20 63  6f 6e 74 72 6f 6c 20 63  |nknown control c|
00003e10  6f 64 65 73 20 61 6e 64  0a 61 64 64 20 65 78 74  |odes and.add ext|
00003e20  72 61 20 66 75 6e 63 74  69 6f 6e 61 6c 69 74 79  |ra functionality|
00003e30  20 74 6f 20 74 68 65 20  6f 6e 65 73 20 74 68 61  | to the ones tha|
00003e40  74 20 65 78 69 73 74 2e  20 46 6f 72 20 65 78 61  |t exist. For exa|
00003e50  6d 70 6c 65 2c 20 79 6f  75 20 6d 61 79 20 77 69  |mple, you may wi|
00003e60  73 68 20 74 6f 0a 63 68  61 6e 67 65 20 66 6f 6e  |sh to.change fon|
00003e70  74 20 6f 6e 20 61 20 63  6f 6c 6f 75 72 20 63 68  |t on a colour ch|
00003e80  61 6e 67 65 2e 20 5a 61  70 73 20 66 61 73 74 20  |ange. Zaps fast |
00003e90  66 6f 6e 74 20 72 65 64  72 61 77 20 6d 6f 64 65  |font redraw mode|
00003ea0  20 64 6f 65 73 20 74 68  69 73 2e 20 49 66 20 79  | does this. If y|
00003eb0  6f 75 0a 70 72 6f 76 69  64 65 20 61 6e 20 65 78  |ou.provide an ex|
00003ec0  74 65 6e 73 69 6f 6e 20  72 6f 75 74 69 6e 65 20  |tension routine |
00003ed0  74 68 65 6e 20 6f 6e 20  65 6e 74 72 79 20 74 6f  |then on entry to|
00003ee0  20 69 74 20 52 30 3d 72  65 61 73 6f 6e 20 63 6f  | it R0=reason co|
00003ef0  64 65 20 52 31 32 3d 79  6f 75 72 0a 70 72 69 76  |de R12=your.priv|
00003f00  61 74 65 20 77 6f 72 64  20 61 6e 64 3a 0a 0a 20  |ate word and:.. |
00003f10  52 30 3d 30 20 3d 3e 20  53 74 61 72 74 69 6e 67  |R0=0 => Starting|
00003f20  20 61 20 72 61 73 74 65  72 20 6c 69 6e 65 3a 0a  | a raster line:.|
00003f30  20 09 20 52 31 3d 72 65  64 72 61 77 20 62 6c 6f  | . R1=redraw blo|
00003f40  63 6b 0a 20 09 20 52 33  3d 61 64 64 72 65 73 73  |ck. . R3=address|
00003f50  20 6f 66 20 66 69 72 73  74 20 63 68 61 72 61 63  | of first charac|
00003f60  74 65 72 0a 20 09 20 52  34 3d 72 5f 63 61 64 64  |ter. . R4=r_cadd|
00003f70  72 2b 72 5f 63 62 70 6c  2a 72 6f 77 20 77 68 65  |r+r_cbpl*row whe|
00003f80  72 65 20 72 6f 77 20 28  30 20 2e 2e 2e 20 72 5f  |re row (0 ... r_|
00003f90  63 68 61 72 68 2d 31 29  20 69 73 20 74 68 65 20  |charh-1) is the |
00003fa0  63 75 72 72 65 6e 74 0a  20 09 20 20 20 20 63 68  |current. .    ch|
00003fb0  61 72 61 63 74 65 72 20  72 6f 77 20 62 65 69 6e  |aracter row bein|
00003fc0  67 20 64 72 61 77 6e 2e  20 4f 72 2c 20 52 34 3d  |g drawn. Or, R4=|
00003fd0  30 20 69 66 20 69 6e 20  6c 69 6e 65 20 73 70 61  |0 if in line spa|
00003fe0  63 69 6e 67 2e 0a 20 09  20 52 35 3d 73 63 72 65  |cing.. . R5=scre|
00003ff0  65 6e 20 61 64 64 72 65  73 73 20 6f 66 20 63 75  |en address of cu|
00004000  72 72 65 6e 74 20 77 6f  72 64 20 62 65 69 6e 67  |rrent word being|
00004010  20 77 72 69 74 74 65 6e  0a 20 09 20 52 36 3d 62  | written. . R6=b|
00004020  69 74 20 6f 66 66 73 65  74 20 69 6e 20 63 75 72  |it offset in cur|
00004030  72 65 6e 74 20 77 6f 72  64 20 62 65 69 6e 67 20  |rent word being |
00004040  77 72 69 74 74 65 6e 0a  20 09 20 52 37 3d 63 75  |written. . R7=cu|
00004050  72 72 65 6e 74 20 77 6f  72 64 20 62 65 69 6e 67  |rrent word being|
00004060  20 77 72 69 74 65 6e 20  28 62 69 74 73 20 3e 3d  | writen (bits >=|
00004070  20 52 36 20 61 72 65 20  63 6c 65 61 72 29 0a 20  | R6 are clear). |
00004080  09 20 52 31 30 3d 73 74  61 72 74 20 66 6f 72 65  |. R10=start fore|
00004090  67 72 6f 75 6e 64 20 6d  61 73 6b 20 28 65 67 20  |ground mask (eg |
000040a0  26 37 37 37 37 37 37 37  37 29 0a 20 09 20 52 31  |&77777777). . R1|
000040b0  31 3d 73 74 61 72 74 20  62 61 63 6b 67 72 6f 75  |1=start backgrou|
000040c0  6e 64 20 6d 61 73 6b 20  28 65 67 20 26 30 30 30  |nd mask (eg &000|
000040d0  30 30 30 30 30 29 0a 20  09 20 0a 20 52 30 3d 31  |00000). . . R0=1|
000040e0  20 3d 3e 20 46 6f 72 65  67 72 6f 75 6e 64 20 61  | => Foreground a|
000040f0  6e 64 20 62 61 63 6b 67  72 6f 75 6e 64 20 63 6f  |nd background co|
00004100  6c 6f 75 72 73 20 63 68  61 6e 67 69 6e 67 20 28  |lours changing (|
00004110  63 6f 6e 74 72 6f 6c 20  63 6f 64 65 20 30 2c 31  |control code 0,1|
00004120  29 0a 20 09 20 52 65 67  69 73 74 65 72 73 20 61  |). . Registers a|
00004130  73 20 61 62 6f 76 65 20  77 69 74 68 20 52 33 3d  |s above with R3=|
00004140  6e 65 78 74 20 63 68 61  72 61 63 74 65 72 20 61  |next character a|
00004150  66 74 65 72 20 74 68 65  20 63 6f 6e 74 72 6f 6c  |fter the control|
00004160  0a 20 09 20 63 6f 64 65  20 61 6e 64 20 52 31 30  |. . code and R10|
00004170  2c 52 31 31 20 6e 65 77  20 66 6f 72 65 67 72 6f  |,R11 new foregro|
00004180  75 6e 64 2f 62 61 63 6b  67 72 6f 75 6e 64 20 6d  |und/background m|
00004190  61 73 6b 73 20 65 74 63  2e 0a 20 0a 20 52 30 3d  |asks etc.. . R0=|
000041a0  34 20 3d 3e 20 41 62 6f  75 74 20 74 6f 20 6d 65  |4 => About to me|
000041b0  72 67 65 20 63 68 61 72  61 63 74 65 72 73 20 28  |rge characters (|
000041c0  63 6f 6e 74 72 6f 6c 20  63 6f 64 65 20 30 2c 34  |control code 0,4|
000041d0  29 0a 20 09 20 52 31 3d  72 65 64 72 61 77 20 62  |). . R1=redraw b|
000041e0  6c 6f 63 6b 0a 20 09 20  52 32 3d 63 68 61 72 61  |lock. . R2=chara|
000041f0  63 74 65 72 20 64 65 66  6e 20 74 61 62 6c 65 20  |cter defn table |
00004200  74 6f 20 75 73 65 20 66  6f 72 20 74 68 65 20 6d  |to use for the m|
00004210  61 73 6b 20 63 68 61 72  61 63 74 65 72 0a 20 09  |ask character. .|
00004220  20 52 33 3d 6e 65 78 74  20 63 68 61 72 61 63 74  | R3=next charact|
00004230  65 72 20 61 66 74 65 72  20 74 68 65 20 6d 65 72  |er after the mer|
00004240  67 65 0a 20 09 20 52 34  3d 63 68 61 72 61 63 74  |ge. . R4=charact|
00004250  65 72 20 64 65 66 6e 20  74 61 62 6c 65 20 66 6f  |er defn table fo|
00004260  72 20 74 68 65 20 62 61  73 65 20 63 68 61 72 61  |r the base chara|
00004270  63 74 65 72 20 28 61 73  20 66 6f 72 20 52 30 3d  |cter (as for R0=|
00004280  31 29 0a 20 09 20 52 36  3d 62 61 73 65 20 63 68  |1). . R6=base ch|
00004290  61 72 0a 20 09 20 52 37  3d 6d 61 73 6b 20 63 68  |ar. . R7=mask ch|
000042a0  61 72 20 28 6f 72 20 74  68 65 73 65 20 61 72 65  |ar (or these are|
000042b0  20 2d 31 20 69 66 20 69  6e 76 61 6c 69 64 29 2e  | -1 if invalid).|
000042c0  0a 20 09 20 52 38 2f 52  39 3d 66 6f 72 2f 62 61  |. . R8/R9=for/ba|
000042d0  63 20 6d 61 73 6b 73 20  77 68 65 72 65 20 6d 61  |c masks where ma|
000042e0  73 6b 20 63 68 61 72 61  63 74 65 72 20 62 69 74  |sk character bit|
000042f0  73 20 73 65 74 2e 0a 20  09 20 52 31 30 2f 52 31  |s set.. . R10/R1|
00004300  31 3d 63 75 72 72 65 6e  74 20 66 6f 72 2f 62 61  |1=current for/ba|
00004310  63 20 6d 61 73 6b 73 2e  0a 20 09 20 4e 42 20 41  |c masks.. . NB A|
00004320  6e 79 20 63 68 61 6e 67  65 73 20 79 6f 75 20 6d  |ny changes you m|
00004330  61 6b 65 20 74 6f 20 74  68 65 73 65 20 72 65 67  |ake to these reg|
00004340  69 73 74 65 72 73 20 77  69 6c 6c 20 62 65 20 65  |isters will be e|
00004350  66 66 65 63 74 69 76 65  20 66 6f 72 0a 20 09 20  |ffective for. . |
00004360  74 68 69 73 20 6f 6e 65  20 63 68 61 72 61 63 74  |this one charact|
00004370  65 72 20 6f 6e 6c 79 20  74 68 65 20 6e 6f 72 6d  |er only the norm|
00004380  61 6c 20 76 61 6c 75 65  73 20 62 65 69 6e 67 20  |al values being |
00004390  73 74 61 63 6b 65 64 2e  0a 20 0a 20 52 30 3d 36  |stacked.. . R0=6|
000043a0  20 3d 3e 20 46 6f 72 65  67 72 6f 75 6e 64 20 63  | => Foreground c|
000043b0  6f 6c 6f 75 72 20 63 68  61 6e 67 69 6e 67 20 28  |olour changing (|
000043c0  63 6f 6e 74 72 6f 6c 20  63 6f 64 65 20 30 2c 36  |control code 0,6|
000043d0  29 0a 20 09 20 52 65 67  69 73 74 65 72 73 20 61  |). . Registers a|
000043e0  73 20 66 6f 72 20 52 30  3d 31 2e 0a 20 0a 20 52  |s for R0=1.. . R|
000043f0  30 3d 37 20 3d 3e 20 42  61 63 6b 67 72 6f 75 6e  |0=7 => Backgroun|
00004400  64 20 63 6f 6c 6f 75 72  20 63 68 61 6e 67 69 6e  |d colour changin|
00004410  67 20 28 63 6f 6e 74 72  6f 6c 20 63 6f 64 65 20  |g (control code |
00004420  30 2c 37 29 0a 20 09 20  52 65 67 69 73 74 65 72  |0,7). . Register|
00004430  73 20 61 73 20 66 6f 72  20 52 30 3d 31 2e 0a 20  |s as for R0=1.. |
00004440  09 20 0a 20 52 30 3d 38  20 3d 3e 20 41 62 6f 75  |. . R0=8 => Abou|
00004450  74 20 74 6f 20 63 75 72  73 6f 72 20 6d 65 72 67  |t to cursor merg|
00004460  65 20 63 68 61 72 61 63  74 65 72 73 20 28 63 6f  |e characters (co|
00004470  6e 74 72 6f 6c 20 63 6f  64 65 20 30 2c 38 29 0a  |ntrol code 0,8).|
00004480  20 09 20 52 65 67 69 73  74 65 72 73 20 61 73 20  | . Registers as |
00004490  66 6f 72 20 52 30 3d 34  0a 20 09 20 49 66 20 52  |for R0=4. . If R|
000044a0  37 3c 26 31 30 30 20 74  68 65 6e 20 52 31 30 2f  |7<&100 then R10/|
000044b0  52 31 31 20 77 69 6c 6c  20 62 65 20 73 65 74 20  |R11 will be set |
000044c0  74 6f 20 52 39 2f 52 38  20 61 6e 64 20 6e 65 78  |to R9/R8 and nex|
000044d0  74 20 63 68 61 72 20 64  72 61 77 6e 0a 20 09 20  |t char drawn. . |
000044e0  49 66 20 52 37 3e 3d 26  31 30 30 20 74 68 65 6e  |If R7>=&100 then|
000044f0  20 74 68 65 20 63 68 61  72 61 63 74 65 72 73 20  | the characters |
00004500  77 69 6c 6c 20 62 65 20  6d 65 72 67 65 64 20 77  |will be merged w|
00004510  69 74 68 20 52 39 0a 20  09 20 63 6f 70 69 65 64  |ith R9. . copied|
00004520  20 69 6e 74 6f 20 52 38  2e 0a 0a 20 52 30 3d 32  | into R8... R0=2|
00004530  2c 33 2c 35 2c 3e 38 09  20 52 65 73 65 72 76 65  |,3,5,>8. Reserve|
00004540  64 20 2d 20 69 67 6e 6f  72 65 2e 0a 20 0a 20 45  |d - ignore.. . E|
00004550  78 69 74 3a 20 20 59 6f  75 20 6d 61 79 20 63 6f  |xit:  You may co|
00004560  72 72 75 70 74 20 52 30  20 61 6e 64 20 52 31 32  |rrupt R0 and R12|
00004570  20 61 6e 64 20 61 6c 74  65 72 20 74 68 65 20 72  | and alter the r|
00004580  65 67 69 73 74 65 72 73  20 6d 65 6e 74 69 6f 6e  |egisters mention|
00004590  65 64 0a 20 20 09 28 65  78 63 65 70 74 20 52 31  |ed.  .(except R1|
000045a0  21 29 20 74 6f 20 6e 65  77 20 28 73 65 6e 73 69  |!) to new (sensi|
000045b0  62 6c 65 29 20 76 61 6c  75 65 73 2e 0a 20 20 09  |ble) values..  .|
000045c0  41 6c 6c 20 72 65 67 69  73 74 65 72 73 20 61 72  |All registers ar|
000045d0  65 20 72 65 73 65 74 20  61 74 20 74 68 65 20 73  |e reset at the s|
000045e0  74 61 72 74 20 6f 66 20  61 20 6e 65 77 20 72 61  |tart of a new ra|
000045f0  73 74 65 72 20 6c 69 6e  65 2e 0a 20 20 09 59 6f  |ster line..  .Yo|
00004600  75 20 6d 75 73 74 20 6e  6f 74 20 61 6c 74 65 72  |u must not alter|
00004610  20 74 68 65 20 72 65 64  72 61 77 20 62 6c 6f 63  | the redraw bloc|
00004620  6b 20 69 74 73 65 6c 66  2e 0a 09 59 6f 75 20 43  |k itself...You C|
00004630  41 4e 4e 4f 54 20 72 65  74 75 72 6e 20 65 72 72  |ANNOT return err|
00004640  6f 72 73 20 66 72 6f 6d  20 61 6e 20 65 78 74 65  |ors from an exte|
00004650  6e 73 69 6f 6e 20 63 61  6c 6c 2e 0a 0a 5a 61 70  |nsion call...Zap|
00004660  52 65 64 72 61 77 5f 47  65 74 50 61 6c 65 74 74  |Redraw_GetPalett|
00004670  65 45 6e 74 72 79 20 28  2b 26 30 31 29 0a 2d 2d  |eEntry (+&01).--|
00004680  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00004690  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 0a  |--------------..|
000046a0  54 68 69 73 20 53 57 49  20 74 61 6b 65 73 20 61  |This SWI takes a|
000046b0  20 63 6f 6c 6f 75 72 20  62 69 74 6d 61 70 20 61  | colour bitmap a|
000046c0  6e 64 20 64 75 70 6c 69  63 61 74 65 73 20 69 74  |nd duplicates it|
000046d0  20 74 6f 20 66 69 6c 6c  20 61 20 77 6f 72 64 2c  | to fill a word,|
000046e0  20 63 72 65 61 74 69 6e  67 0a 61 20 6d 61 73 6b  | creating.a mask|
000046f0  20 61 73 20 6e 65 65 64  65 64 20 66 6f 72 20 72  | as needed for r|
00004700  5f 70 61 6c 65 74 74 65  20 69 6e 20 44 53 41 20  |_palette in DSA |
00004710  6d 6f 64 65 2e 20 45 67  20 69 66 20 52 30 3d 37  |mode. Eg if R0=7|
00004720  20 61 6e 64 20 52 31 3d  32 20 6f 6e 20 65 6e 74  | and R1=2 on ent|
00004730  72 79 20 74 68 65 6e 0a  52 30 3d 26 37 37 37 37  |ry then.R0=&7777|
00004740  37 37 37 37 20 6f 6e 20  65 78 69 74 2e 0a 0a 45  |7777 on exit...E|
00004750  6e 74 72 79 3a 09 52 30  3d 54 68 65 20 63 6f 6c  |ntry:.R0=The col|
00004760  6f 75 72 20 6e 75 6d 62  65 72 20 74 6f 20 62 65  |our number to be|
00004770  20 70 6f 6b 65 64 20 69  6e 74 6f 20 74 68 65 20  | poked into the |
00004780  73 63 72 65 65 6e 2e 20  28 30 2d 3e 6e 75 6d 5f  |screen. (0->num_|
00004790  6f 66 5f 63 6f 6c 73 2d  31 29 0a 09 52 31 3d 72  |of_cols-1)..R1=r|
000047a0  5f 62 70 70 20 28 30 2d  35 29 0a 0a 45 78 69 74  |_bpp (0-5)..Exit|
000047b0  3a 09 52 30 3d 4d 61 73  6b 20 74 6f 20 70 75 74  |:.R0=Mask to put|
000047c0  20 69 6e 20 70 61 6c 65  74 74 65 20 74 61 62 6c  | in palette tabl|
000047d0  65 20 28 77 69 74 68 20  63 6f 6c 6f 75 72 20 64  |e (with colour d|
000047e0  75 70 6c 69 63 61 74 65  64 20 74 6f 20 66 69 6c  |uplicated to fil|
000047f0  6c 20 74 68 65 0a 09 77  6f 72 64 29 2e 0a 0a 5a  |l the..word)...Z|
00004800  61 70 52 65 64 72 61 77  5f 52 65 64 72 61 77 52  |apRedraw_RedrawR|
00004810  61 73 74 65 72 20 28 2b  26 30 32 29 0a 2d 2d 2d  |aster (+&02).---|
00004820  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00004830  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 0a 52 65 64 72  |----------..Redr|
00004840  61 77 73 20 61 20 73 69  6e 67 6c 65 20 72 61 73  |aws a single ras|
00004850  74 65 72 20 6c 69 6e 65  2e 20 4f 6e 6c 79 20 61  |ter line. Only a|
00004860  70 70 6c 69 65 73 20 74  6f 20 6e 6f 6e 2d 76 64  |pplies to non-vd|
00004870  75 20 72 65 64 72 61 77  2e 20 54 68 69 73 20 69  |u redraw. This i|
00004880  73 20 61 20 6c 6f 77 0a  6c 65 76 65 6c 20 63 61  |s a low.level ca|
00004890  6c 6c 20 75 73 65 64 20  62 79 20 5a 61 70 52 65  |ll used by ZapRe|
000048a0  64 72 61 77 5f 52 65 64  72 61 77 41 72 65 61 20  |draw_RedrawArea |
000048b0  61 6e 64 20 6e 6f 74 20  6f 66 20 6d 75 63 68 20  |and not of much |
000048c0  75 73 65 20 6f 74 68 65  72 77 69 73 65 2e 0a 0a  |use otherwise...|
000048d0  45 6e 74 72 79 3a 09 52  31 3d 72 65 64 72 61 77  |Entry:.R1=redraw|
000048e0  20 62 6c 6f 63 6b 0a 20  20 20 20 20 20 20 20 20  | block.         |
000048f0  20 20 4f 66 66 73 65 74  73 20 75 73 65 64 20 61  |  Offsets used a|
00004900  72 65 3a 20 72 5f 66 6c  61 67 73 2c 72 5f 6d 69  |re: r_flags,r_mi|
00004910  6e 78 2c 72 5f 6d 61 78  78 2c 72 5f 62 70 70 2c  |nx,r_maxx,r_bpp,|
00004920  72 5f 63 68 61 72 77 2c  72 5f 63 68 61 72 68 0a  |r_charw,r_charh.|
00004930  20 20 20 20 20 20 20 20  20 20 20 20 72 5f 63 62  |            r_cb|
00004940  70 6c 2c 72 5f 63 62 70  63 2c 72 5f 70 61 6c 65  |pl,r_cbpc,r_pale|
00004950  74 74 65 2c 72 5f 77 6f  72 6b 61 72 65 61 2e 0a  |tte,r_workarea..|
00004960  09 52 33 3d 61 64 64 72  65 73 73 20 6f 66 20 74  |.R3=address of t|
00004970  65 78 74 20 74 6f 20 75  73 65 20 66 6f 72 20 74  |ext to use for t|
00004980  68 69 73 20 6c 69 6e 65  20 73 74 61 72 74 69 6e  |his line startin|
00004990  67 20 61 74 20 74 68 65  20 66 69 72 73 74 0a 09  |g at the first..|
000049a0  20 20 20 76 69 73 69 62  6c 65 20 63 68 61 72 61  |   visible chara|
000049b0  63 74 65 72 2e 0a 09 52  34 3d 61 64 64 72 65 73  |cter...R4=addres|
000049c0  73 20 6f 66 20 63 68 61  72 61 63 74 65 72 20 64  |s of character d|
000049d0  65 66 6e 20 74 61 62 6c  65 20 77 69 74 68 20 72  |efn table with r|
000049e0  6f 77 20 6f 66 66 73 65  74 20 61 64 64 65 64 20  |ow offset added |
000049f0  73 6f 20 72 65 64 72 61  77 0a 09 20 20 20 75 73  |so redraw..   us|
00004a00  65 73 20 66 69 72 73 74  20 27 72 6f 77 27 20 6f  |es first 'row' o|
00004a10  66 20 65 61 63 68 20 62  69 74 6d 61 70 2c 20 6f  |f each bitmap, o|
00004a20  72 20 73 65 74 20 74 6f  20 30 20 69 66 20 79 6f  |r set to 0 if yo|
00004a30  75 20 77 61 6e 74 20 74  68 65 0a 09 20 20 20 6c  |u want the..   l|
00004a40  69 6e 65 20 74 6f 20 62  65 20 63 6c 65 61 72 65  |ine to be cleare|
00004a50  64 20 74 6f 20 74 68 65  20 62 61 63 6b 67 72 6f  |d to the backgro|
00004a60  75 6e 64 20 63 6f 6c 6f  75 72 20 28 65 67 20 69  |und colour (eg i|
00004a70  6e 74 65 72 6c 69 6e 65  20 67 61 70 29 2e 0a 09  |nterline gap)...|
00004a80  52 35 3d 73 63 72 65 65  6e 20 61 64 64 72 65 73  |R5=screen addres|
00004a90  73 20 6f 66 20 74 68 65  20 73 74 61 72 74 20 6f  |s of the start o|
00004aa0  66 20 74 68 65 20 72 61  73 74 65 72 20 6c 69 6e  |f the raster lin|
00004ab0  65 2e 0a 09 52 36 3d 62  30 2d 62 31 35 09 3d 20  |e...R6=b0-b15.= |
00004ac0  73 74 61 72 74 20 66 6f  72 65 67 72 6f 75 6e 64  |start foreground|
00004ad0  20 63 6f 6c 6f 75 72 20  74 6f 20 75 73 65 20 28  | colour to use (|
00004ae0  65 67 20 72 5f 66 6f 72  20 76 61 6c 75 65 29 0a  |eg r_for value).|
00004af0  09 20 20 20 62 31 36 2d  62 33 31 09 3d 20 73 74  |.   b16-b31.= st|
00004b00  61 72 74 20 62 61 63 6b  67 72 6f 75 6e 64 20 63  |art background c|
00004b10  6f 6c 6f 75 72 20 74 6f  20 75 73 65 20 28 65 67  |olour to use (eg|
00004b20  20 72 5f 62 61 63 20 76  61 6c 75 65 29 0a 09 54  | r_bac value)..T|
00004b30  68 65 20 69 6e 69 74 69  61 6c 20 77 6f 72 64 73  |he initial words|
00004b40  20 6f 66 20 72 5f 77 6f  72 6b 61 72 65 61 20 61  | of r_workarea a|
00004b50  72 65 20 73 65 74 20 75  70 20 61 73 20 66 6f 6c  |re set up as fol|
00004b60  6c 6f 77 73 3a 0a 09 23  30 20 50 69 78 65 6c 20  |lows:..#0 Pixel |
00004b70  73 63 72 6f 6c 6c 20 6f  66 66 73 65 74 20 77 69  |scroll offset wi|
00004b80  74 68 69 6e 20 74 68 65  20 66 69 72 73 74 20 76  |thin the first v|
00004b90  69 73 69 62 6c 65 20 63  68 61 72 20 28 30 2d 3e  |isible char (0->|
00004ba0  63 68 61 72 77 2d 31 29  0a 09 23 34 20 4e 75 6d  |charw-1)..#4 Num|
00004bb0  62 65 72 20 6f 66 20 70  69 78 65 6c 73 20 74 6f  |ber of pixels to|
00004bc0  20 64 6f 20 66 72 6f 6d  20 74 68 65 20 66 69 72  | do from the fir|
00004bd0  73 74 20 63 68 61 72 61  63 74 65 72 20 20 20 28  |st character   (|
00004be0  30 2d 3e 63 68 61 72 77  2d 31 29 0a 09 23 38 20  |0->charw-1)..#8 |
00004bf0  4e 75 6d 62 65 72 20 6f  66 20 77 68 6f 6c 65 20  |Number of whole |
00004c00  63 68 61 72 61 63 74 65  72 73 20 74 6f 20 64 6f  |characters to do|
00004c10  20 61 66 74 65 72 20 74  68 65 20 66 69 72 73 74  | after the first|
00004c20  20 63 68 61 72 0a 09 23  31 32 20 4e 75 6d 62 65  | char..#12 Numbe|
00004c30  72 20 6f 66 20 70 69 78  65 6c 73 20 74 6f 20 64  |r of pixels to d|
00004c40  6f 20 69 6e 20 74 68 65  20 6c 61 73 74 20 76 69  |o in the last vi|
00004c50  73 69 62 6c 65 20 63 68  61 72 20 20 28 30 2d 3e  |sible char  (0->|
00004c60  63 68 61 72 77 2d 31 29  0a 09 23 31 36 20 2d 0a  |charw-1)..#16 -.|
00004c70  09 23 32 30 20 41 64 64  72 65 73 73 20 6f 66 20  |.#20 Address of |
00004c80  65 78 74 65 6e 73 69 6f  6e 20 73 75 62 20 69 66  |extension sub if|
00004c90  20 72 65 64 72 61 77 20  66 6c 61 67 73 20 62 69  | redraw flags bi|
00004ca0  74 20 32 20 73 65 74 0a  09 23 32 34 20 45 78 74  |t 2 set..#24 Ext|
00004cb0  65 6e 73 69 6f 6e 20 73  75 62 20 70 72 69 76 61  |ension sub priva|
00004cc0  74 65 20 77 6f 72 64 20  70 6f 69 6e 74 65 72 20  |te word pointer |
00004cd0  72 65 64 72 61 77 20 66  6c 61 67 73 20 62 69 74  |redraw flags bit|
00004ce0  20 32 20 73 65 74 0a 09  09 09 0a 45 78 69 74 3a  | 2 set.....Exit:|
00004cf0  09 52 30 20 61 6e 64 20  66 6c 61 67 73 20 63 6f  |.R0 and flags co|
00004d00  72 72 75 70 74 65 64 2e  0a 0a 5a 61 70 52 65 64  |rrupted...ZapRed|
00004d10  72 61 77 5f 43 6f 6e 76  65 72 74 42 69 74 6d 61  |raw_ConvertBitma|
00004d20  70 20 28 2b 26 30 33 29  0a 2d 2d 2d 2d 2d 2d 2d  |p (+&03).-------|
00004d30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00004d40  2d 2d 2d 2d 2d 2d 2d 0a  0a 54 68 69 73 20 53 57  |-------..This SW|
00004d50  49 20 74 61 6b 65 73 20  61 20 63 68 61 72 61 63  |I takes a charac|
00004d60  74 65 72 20 62 69 74 6d  61 70 20 6f 66 20 74 68  |ter bitmap of th|
00004d70  65 20 66 6f 72 6d 20 6f  66 20 31 20 62 69 74 20  |e form of 1 bit |
00004d80  70 65 72 20 70 69 78 65  6c 2c 20 28 74 68 65 20  |per pixel, (the |
00004d90  62 69 74 0a 73 65 74 20  66 6f 72 20 66 6f 72 65  |bit.set for fore|
00004da0  67 72 6f 75 6e 64 2f 63  6c 65 61 72 20 66 6f 72  |ground/clear for|
00004db0  20 62 61 63 6b 67 72 6f  75 6e 64 29 20 61 6e 64  | background) and|
00004dc0  20 63 6f 6e 76 65 72 74  73 20 69 74 20 69 6e 74  | converts it int|
00004dd0  6f 20 61 20 62 69 74 6d  61 70 20 66 6f 72 0a 75  |o a bitmap for.u|
00004de0  73 65 20 62 79 20 74 68  65 20 52 65 64 72 61 77  |se by the Redraw|
00004df0  41 72 65 61 20 53 57 49  2c 20 62 79 20 63 68 61  |Area SWI, by cha|
00004e00  6e 67 69 6e 67 20 65 61  63 68 20 27 31 27 20 74  |nging each '1' t|
00004e10  6f 20 6e 20 27 31 27 73  20 61 6e 64 20 65 61 63  |o n '1's and eac|
00004e20  68 20 27 30 27 20 74 6f  0a 6e 20 27 30 27 73 20  |h '0' to.n '0's |
00004e30  77 68 65 72 65 20 27 6e  27 20 69 73 20 74 68 65  |where 'n' is the|
00004e40  20 6e 75 6d 62 65 72 20  6f 66 20 62 69 74 73 20  | number of bits |
00004e50  70 65 72 20 70 69 78 65  6c 20 67 69 76 65 6e 2e  |per pixel given.|
00004e60  20 49 74 20 75 73 65 73  20 74 68 65 20 53 57 49  | It uses the SWI|
00004e70  0a 5a 61 70 52 65 64 72  61 77 5f 43 6f 6e 76 42  |.ZapRedraw_ConvB|
00004e80  69 74 6d 61 70 43 68 61  72 20 74 6f 20 64 6f 20  |itmapChar to do |
00004e90  74 68 69 73 2e 0a 0a 45  6e 74 72 79 3a 09 52 31  |this...Entry:.R1|
00004ea0  3d 72 65 64 72 61 77 20  62 6c 6f 63 6b 2c 20 6f  |=redraw block, o|
00004eb0  66 66 73 65 74 73 20 6c  6f 6f 6b 65 64 20 61 74  |ffsets looked at|
00004ec0  20 61 72 65 3a 0a 09 72  5f 62 70 70 09 09 54 6f  | are:..r_bpp..To|
00004ed0  20 66 69 6e 64 20 74 68  65 20 6e 75 6d 62 65 72  | find the number|
00004ee0  20 6f 66 20 62 69 74 73  20 70 65 72 20 70 69 78  | of bits per pix|
00004ef0  65 6c 2e 0a 09 72 5f 63  68 61 72 77 09 09 57 69  |el...r_charw..Wi|
00004f00  64 74 68 20 6f 66 20 63  68 61 72 20 69 6e 20 70  |dth of char in p|
00004f10  69 78 65 6c 73 0a 09 72  5f 63 68 61 72 68 09 09  |ixels..r_charh..|
00004f20  48 65 69 67 68 74 20 6f  66 20 63 68 61 72 20 69  |Height of char i|
00004f30  6e 20 70 69 78 65 6c 73  0a 09 72 5f 63 61 64 64  |n pixels..r_cadd|
00004f40  72 09 09 41 64 64 72 65  73 73 20 74 6f 20 77 72  |r..Address to wr|
00004f50  69 74 65 20 74 68 65 20  62 69 74 6d 61 70 2e 20  |ite the bitmap. |
00004f60  4d 65 6d 6f 72 79 20 61  74 20 6f 66 66 73 65 74  |Memory at offset|
00004f70  73 0a 09 09 09 52 32 2a  72 5f 63 62 70 63 20 74  |s....R2*r_cbpc t|
00004f80  6f 20 28 52 33 2b 31 29  2a 72 5f 62 70 63 20 6d  |o (R3+1)*r_bpc m|
00004f90  75 73 74 20 62 65 20 70  72 65 73 65 72 76 65 64  |ust be preserved|
00004fa0  0a 09 72 5f 63 62 70 6c  09 09 43 61 63 68 65 20  |..r_cbpl..Cache |
00004fb0  6c 69 6e 65 20 77 69 64  74 68 20 69 6e 20 62 79  |line width in by|
00004fc0  74 65 73 20 28 61 73 20  64 65 66 69 6e 65 64 20  |tes (as defined |
00004fd0  75 6e 64 65 72 0a 09 09  09 72 5f 63 61 64 64 72  |under....r_caddr|
00004fe0  20 68 65 6c 70 20 74 65  78 74 29 0a 09 72 5f 63  | help text)..r_c|
00004ff0  62 70 63 09 09 4e 75 6d  62 65 72 20 6f 66 20 62  |bpc..Number of b|
00005000  79 74 65 73 20 70 65 72  20 63 61 63 68 65 64 20  |ytes per cached |
00005010  63 68 61 72 61 63 74 65  72 20 28 61 73 20 64 65  |character (as de|
00005020  66 69 6e 65 64 0a 09 09  09 75 6e 64 65 72 20 72  |fined....under r|
00005030  5f 63 61 64 64 72 20 68  65 6c 70 20 74 65 78 74  |_caddr help text|
00005040  29 0a 09 52 32 3d 46 69  72 73 74 20 63 68 61 72  |)..R2=First char|
00005050  61 63 74 65 72 20 74 6f  20 62 65 20 63 6f 6e 76  |acter to be conv|
00005060  65 72 74 65 64 20 28 65  67 20 30 29 0a 09 52 33  |erted (eg 0)..R3|
00005070  3d 4c 61 73 74 20 63 68  61 72 61 63 74 65 72 20  |=Last character |
00005080  74 6f 20 62 65 20 63 6f  6e 76 65 72 74 65 64 20  |to be converted |
00005090  28 69 6e 63 6c 75 73 69  76 65 29 20 28 65 67 20  |(inclusive) (eg |
000050a0  32 35 35 29 0a 09 52 34  3d 41 64 64 72 65 73 73  |255)..R4=Address|
000050b0  20 6f 66 20 73 6f 75 72  63 65 20 62 69 74 6d 61  | of source bitma|
000050c0  70 20 6f 66 20 74 68 65  20 66 6f 72 6d 61 74 20  |p of the format |
000050d0  64 65 73 63 72 69 62 65  64 20 75 6e 64 65 72 20  |described under |
000050e0  72 5f 63 61 64 64 72 0a  09 20 20 20 62 75 74 20  |r_caddr..   but |
000050f0  77 69 74 68 20 31 20 62  69 74 20 70 65 72 20 70  |with 1 bit per p|
00005100  69 78 65 6c 20 28 69 65  20 32 20 63 6f 6c 6f 75  |ixel (ie 2 colou|
00005110  72 20 6d 6f 64 65 20 66  6f 72 6d 61 74 29 0a 0a  |r mode format)..|
00005120  45 78 69 74 3a 09 72 5f  63 61 64 64 72 20 62 6c  |Exit:.r_caddr bl|
00005130  6f 63 6b 20 77 72 69 74  74 65 6e 20 74 6f 2e 0a  |ock written to..|
00005140  09 52 30 20 61 6e 64 20  66 6c 61 67 73 20 63 6f  |.R0 and flags co|
00005150  72 72 75 70 74 65 64 2e  0a 0a 5a 61 70 52 65 64  |rrupted...ZapRed|
00005160  72 61 77 5f 50 72 65 70  61 72 65 44 61 74 61 4c  |raw_PrepareDataL|
00005170  69 6e 65 20 28 2b 26 30  34 29 0a 2d 2d 2d 2d 2d  |ine (+&04).-----|
00005180  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00005190  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 54 68 69  |-----------..Thi|
000051a0  73 20 53 57 49 20 69 73  20 74 6f 20 68 65 6c 70  |s SWI is to help|
000051b0  20 70 72 65 70 61 72 65  20 74 68 65 20 27 72 5f  | prepare the 'r_|
000051c0  64 61 74 61 27 20 66 69  65 6c 64 20 6f 66 20 74  |data' field of t|
000051d0  68 65 20 72 65 64 72 61  77 20 62 6c 6f 63 6b 2e  |he redraw block.|
000051e0  20 49 74 20 74 61 6b 65  73 0a 61 73 20 69 6e 70  | It takes.as inp|
000051f0  75 74 20 74 68 65 20 70  6f 69 6e 74 65 72 20 74  |ut the pointer t|
00005200  6f 20 61 20 6c 69 6e 65  20 6f 66 20 74 65 78 74  |o a line of text|
00005210  20 63 68 61 72 61 63 74  65 72 20 28 30 2d 32 35  | character (0-25|
00005220  35 29 20 74 6f 20 62 65  20 74 72 65 61 74 65 64  |5) to be treated|
00005230  20 61 73 0a 6f 72 64 69  6e 61 72 79 20 63 68 61  | as.ordinary cha|
00005240  72 61 63 74 65 72 73 20  28 30 20 69 73 20 6e 6f  |racters (0 is no|
00005250  74 20 61 20 63 6f 6e 74  72 6f 6c 20 63 6f 64 65  |t a control code|
00005260  29 2e 20 49 74 20 61 6c  73 6f 20 74 61 6b 65 73  |). It also takes|
00005270  20 61 73 20 69 6e 70 75  74 20 61 0a 70 6f 69 6e  | as input a.poin|
00005280  74 65 72 20 74 6f 20 61  20 62 61 63 6b 67 72 6f  |ter to a backgro|
00005290  75 6e 64 20 6d 61 73 6b  20 61 6e 64 20 61 20 66  |und mask and a f|
000052a0  6f 72 65 67 72 6f 75 6e  64 20 6d 61 73 6b 20 6c  |oreground mask l|
000052b0  69 73 74 2c 20 67 69 76  69 6e 67 20 74 68 65 0a  |ist, giving the.|
000052c0  62 61 63 6b 67 72 6f 75  6e 64 20 61 6e 64 20 66  |background and f|
000052d0  6f 72 65 67 72 6f 75 6e  64 20 63 6f 6c 6f 75 72  |oreground colour|
000052e0  73 20 6f 66 20 65 61 63  68 20 63 68 61 72 61 63  |s of each charac|
000052f0  74 65 72 20 73 65 70 61  72 61 74 65 6c 79 2e 20  |ter separately. |
00005300  54 68 65 20 6f 75 74 70  75 74 20 69 73 0a 61 20  |The output is.a |
00005310  6c 69 6e 65 20 6f 66 20  74 68 65 20 66 6f 72 6d  |line of the form|
00005320  61 74 20 72 65 71 75 69  72 65 64 20 62 79 20 27  |at required by '|
00005330  72 5f 64 61 74 61 27 20  77 69 74 68 20 63 6f 6e  |r_data' with con|
00005340  74 72 6f 6c 20 63 6f 64  65 73 20 63 68 61 6e 67  |trol codes chang|
00005350  69 6e 67 20 74 68 65 0a  63 6f 6c 6f 75 72 73 20  |ing the.colours |
00005360  61 6e 64 20 73 70 65 63  69 66 79 69 6e 67 20 74  |and specifying t|
00005370  68 65 20 6c 69 6e 65 20  65 6e 64 2e 20 43 6f 6e  |he line end. Con|
00005380  74 72 6f 6c 20 63 6f 64  65 73 20 69 6e 20 74 68  |trol codes in th|
00005390  65 20 69 6e 70 75 74 20  73 74 72 69 6e 67 20 63  |e input string c|
000053a0  61 6e 0a 68 61 76 65 20  74 68 65 69 72 20 63 6f  |an.have their co|
000053b0  6c 6f 75 72 20 73 65 74  20 61 75 74 6f 6d 61 74  |lour set automat|
000053c0  69 63 61 6c 6c 79 20 62  79 20 73 65 74 74 69 6e  |ically by settin|
000053d0  67 20 52 30 20 74 6f 20  74 68 65 20 63 6f 6c 6f  |g R0 to the colo|
000053e0  75 72 2e 0a 0a 45 67 3a  20 49 6e 70 75 74 3a 0a  |ur...Eg: Input:.|
000053f0  0a 09 54 65 78 74 20 69  6e 70 75 74 20 28 63 68  |..Text input (ch|
00005400  61 72 61 63 74 65 72 73  29 3a 20 22 48 45 4c 4c  |aracters): "HELL|
00005410  4f 20 57 4f 52 4c 44 20  20 20 20 20 20 20 20 20  |O WORLD         |
00005420  22 0a 09 46 6f 72 65 67  72 6f 75 6e 64 20 28 62  |"..Foreground (b|
00005430  79 74 65 73 20 6c 69 73  74 29 3a 20 20 31 31 31  |ytes list):  111|
00005440  31 31 31 32 32 32 32 32  32 32 32 32 32 32 32 32  |1112222222222222|
00005450  32 0a 09 42 61 63 6b 67  72 6f 75 6e 64 20 28 62  |2..Background (b|
00005460  79 74 65 73 20 6c 69 73  74 29 3a 20 20 30 30 30  |ytes list):  000|
00005470  30 30 30 30 30 30 30 30  30 30 30 30 30 30 30 30  |0000000000000000|
00005480  30 0a 09 53 74 61 72 74  20 62 61 63 6b 67 72 6f  |0..Start backgro|
00005490  75 6e 64 20 30 0a 09 53  74 61 72 74 20 66 6f 72  |und 0..Start for|
000054a0  65 67 72 6f 75 6e 64 20  31 0a 09 49 6e 70 75 74  |eground 1..Input|
000054b0  20 6c 65 6e 67 74 68 20  32 30 0a 20 20 20 20 20  | length 20.     |
000054c0  20 20 20 0a 20 20 20 20  4f 75 74 70 75 74 3a 20  |   .    Output: |
000054d0  22 48 45 4c 4c 4f 20 22  2c 30 2c 31 2c 32 2c 30  |"HELLO ",0,1,2,0|
000054e0  2c 22 57 4f 52 4c 44 22  2c 30 2c 32 20 28 68 69  |,"WORLD",0,2 (hi|
000054f0  67 68 65 73 74 20 6c 65  74 74 65 72 20 75 73 65  |ghest letter use|
00005500  64 20 3d 20 22 57 22 29  2e 0a 20 20 20 20 0a 45  |d = "W")..    .E|
00005510  6e 74 72 79 3a 09 52 30  3d 66 6f 72 65 67 72 6f  |ntry:.R0=foregro|
00005520  75 6e 64 20 63 6f 6c 6f  75 72 20 74 6f 20 75 73  |und colour to us|
00005530  65 20 66 6f 72 20 63 6f  6e 74 72 6f 6c 20 63 68  |e for control ch|
00005540  61 72 61 63 74 65 72 73  20 28 30 2d 26 31 46 29  |aracters (0-&1F)|
00005550  20 6f 72 0a 09 20 20 20  73 65 74 20 74 6f 20 2d  | or..   set to -|
00005560  31 20 69 66 20 79 6f 75  20 64 6f 20 6e 6f 74 20  |1 if you do not |
00005570  77 69 73 68 20 63 74 72  6c 20 63 68 61 72 73 20  |wish ctrl chars |
00005580  74 6f 20 62 65 20 73 70  65 63 69 61 6c 6c 79 20  |to be specially |
00005590  74 72 65 61 74 65 64 2e  0a 09 52 31 3d 72 65 64  |treated...R1=red|
000055a0  72 61 77 20 62 6c 6f 63  6b 20 67 69 76 69 6e 67  |raw block giving|
000055b0  20 73 74 61 72 74 20 66  6f 72 65 67 72 6f 75 6e  | start foregroun|
000055c0  64 20 62 61 63 6b 67 72  6f 75 6e 64 20 63 6f 6c  |d background col|
000055d0  6f 75 72 73 20 69 6e 0a  09 20 20 20 72 5f 66 6f  |ours in..   r_fo|
000055e0  72 2c 72 5f 62 61 63 20  2d 20 6e 6f 74 68 69 6e  |r,r_bac - nothin|
000055f0  67 20 65 6c 73 65 20 75  73 65 64 2e 0a 09 52 32  |g else used...R2|
00005600  3d 70 6f 69 6e 74 65 72  20 74 6f 20 74 65 78 74  |=pointer to text|
00005610  20 69 6e 70 75 74 20 73  74 72 69 6e 67 20 28 6c  | input string (l|
00005620  65 6e 67 74 68 20 69 6e  20 52 35 29 0a 09 52 33  |ength in R5)..R3|
00005630  3d 70 6f 69 6e 74 65 72  20 74 6f 20 66 6f 72 65  |=pointer to fore|
00005640  67 72 6f 75 6e 64 20 6d  61 73 6b 20 28 6c 65 6e  |ground mask (len|
00005650  67 74 68 20 69 6e 20 52  35 29 0a 09 52 34 3d 70  |gth in R5)..R4=p|
00005660  6f 69 6e 74 65 72 20 74  6f 20 62 61 63 6b 67 72  |ointer to backgr|
00005670  6f 75 6e 64 20 6d 61 73  6b 20 28 6c 65 6e 67 74  |ound mask (lengt|
00005680  68 20 69 6e 20 52 35 29  0a 09 52 35 3d 6c 65 6e  |h in R5)..R5=len|
00005690  67 74 68 20 6f 66 20 69  6e 70 75 74 73 20 69 6e  |gth of inputs in|
000056a0  20 62 79 74 65 73 0a 09  52 36 3d 64 65 73 74 69  | bytes..R6=desti|
000056b0  6e 61 74 69 6f 6e 20 62  75 66 66 65 72 20 28 6c  |nation buffer (l|
000056c0  65 6e 67 74 68 20 6d 75  73 74 20 62 65 20 61 74  |ength must be at|
000056d0  20 6c 65 61 73 74 20 36  2a 52 35 2b 31 36 20 74  | least 6*R5+16 t|
000056e0  6f 20 65 6e 73 75 72 65  0a 09 20 20 20 69 74 20  |o ensure..   it |
000056f0  69 73 20 62 69 67 20 65  6e 6f 75 67 68 20 2d 20  |is big enough - |
00005700  63 6f 6c 6f 75 72 20 63  68 61 6e 67 65 20 2b 20  |colour change + |
00005710  30 20 2d 3e 20 30 2c 30  20 2b 20 74 65 72 6d 69  |0 -> 0,0 + termi|
00005720  6e 61 74 6f 72 29 2e 0a  09 20 20 20 0a 45 78 69  |nator)...   .Exi|
00005730  74 3a 09 52 30 3d 68 69  67 68 65 73 74 20 75 73  |t:.R0=highest us|
00005740  65 64 20 63 68 61 72 61  63 74 65 72 20 63 6f 64  |ed character cod|
00005750  65 20 75 73 65 64 20 28  69 65 20 26 32 30 2d 26  |e used (ie &20-&|
00005760  46 46 29 2e 20 59 6f 75  20 6d 61 79 20 6e 6f 74  |FF). You may not|
00005770  0a 09 77 61 6e 74 20 74  6f 20 63 61 63 68 65 20  |..want to cache |
00005780  61 6c 6c 20 66 6f 6e 74  20 63 68 61 72 61 63 74  |all font charact|
00005790  65 72 73 20 61 73 20 75  73 75 61 6c 6c 79 20 74  |ers as usually t|
000057a0  68 6f 73 65 20 3e 3d 20  31 32 38 20 61 72 65 20  |hose >= 128 are |
000057b0  6e 6f 74 0a 09 6e 65 65  64 65 64 2e 20 54 68 69  |not..needed. Thi|
000057c0  73 20 74 65 6c 6c 73 20  79 6f 75 20 74 68 65 20  |s tells you the |
000057d0  72 61 6e 67 65 20 79 6f  75 20 4d 55 53 54 20 63  |range you MUST c|
000057e0  61 63 68 65 2e 0a 09 52  35 3d 6c 65 6e 67 74 68  |ache...R5=length|
000057f0  20 6f 66 20 6f 75 74 70  75 74 20 73 74 72 69 6e  | of output strin|
00005800  67 20 28 69 6e 63 6c 75  64 69 6e 67 20 30 2c 32  |g (including 0,2|
00005810  20 74 65 72 6d 69 6e 61  74 6f 72 29 0a 09 4f 6e  | terminator)..On|
00005820  6c 79 20 74 68 65 20 63  6f 64 65 73 20 30 2c 30  |ly the codes 0,0|
00005830  20 28 66 6f 72 20 62 79  74 65 20 30 29 20 30 2c  | (for byte 0) 0,|
00005840  31 20 28 66 6f 72 20 63  68 61 6e 67 65 20 63 6f  |1 (for change co|
00005850  6c 6f 75 72 29 20 30 2c  32 20 28 6c 69 6e 65 0a  |lour) 0,2 (line.|
00005860  09 65 6e 64 29 20 61 72  65 20 75 73 65 64 2e 0a  |.end) are used..|
00005870  0a 5a 61 70 52 65 64 72  61 77 5f 41 64 64 43 75  |.ZapRedraw_AddCu|
00005880  72 73 6f 72 20 28 2b 26  30 35 29 0a 2d 2d 2d 2d  |rsor (+&05).----|
00005890  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000058a0  2d 2d 2d 2d 2d 2d 0a 0a  54 68 69 73 20 53 57 49  |------..This SWI|
000058b0  20 74 61 6b 65 73 20 61  20 6c 69 6e 65 20 6f 66  | takes a line of|
000058c0  20 74 68 65 20 73 61 6d  65 20 66 6f 72 6d 61 74  | the same format|
000058d0  20 75 73 65 64 20 69 6e  20 27 72 5f 64 61 74 61  | used in 'r_data|
000058e0  27 2c 20 65 67 20 74 68  65 20 6f 75 74 70 75 74  |', eg the output|
000058f0  20 66 72 6f 6d 0a 74 68  65 20 61 62 6f 76 65 20  | from.the above |
00005900  53 57 49 2c 20 61 6e 64  20 61 64 64 73 20 69 6e  |SWI, and adds in|
00005910  20 74 68 65 20 63 6f 64  65 73 20 74 6f 20 70 6c  | the codes to pl|
00005920  61 63 65 20 27 63 75 72  73 6f 72 73 27 20 6f 76  |ace 'cursors' ov|
00005930  65 72 20 73 6f 6d 65 20  6f 66 20 74 68 65 20 74  |er some of the t|
00005940  65 78 74 0a 62 79 20 75  73 69 6e 67 20 74 68 65  |ext.by using the|
00005950  20 63 6f 64 65 20 30 2c  34 20 28 6d 65 72 67 65  | code 0,4 (merge|
00005960  20 63 68 61 72 61 63 74  65 72 73 29 20 6f 72 20  | characters) or |
00005970  74 68 65 20 63 6f 64 65  20 30 2c 38 20 28 6d 65  |the code 0,8 (me|
00005980  72 67 65 20 63 75 72 73  6f 72 73 29 2e 0a 48 65  |rge cursors)..He|
00005990  72 65 2c 20 61 20 63 75  72 73 6f 72 20 6d 65 61  |re, a cursor mea|
000059a0  6e 73 20 61 20 73 74 72  69 6e 67 20 6f 66 20 63  |ns a string of c|
000059b0  68 61 72 61 63 74 65 72  73 20 74 6f 20 62 65 20  |haracters to be |
000059c0  6f 76 65 72 6c 61 79 65  64 2e 0a 0a 20 45 6e 74  |overlayed... Ent|
000059d0  72 79 3a 09 52 30 3d 64  65 73 74 69 6e 61 74 69  |ry:.R0=destinati|
000059e0  6f 6e 20 73 74 72 69 6e  67 0a 20 09 52 31 3d 72  |on string. .R1=r|
000059f0  65 64 72 61 77 20 62 6c  6f 63 6b 20 67 69 76 69  |edraw block givi|
00005a00  6e 67 20 69 6e 69 74 69  61 6c 20 72 5f 66 6f 72  |ng initial r_for|
00005a10  20 61 6e 64 20 72 5f 62  61 63 2e 0a 20 09 52 32  | and r_bac.. .R2|
00005a20  3d 6f 66 66 73 65 74 20  69 6e 20 73 6f 75 72 63  |=offset in sourc|
00005a30  65 20 73 74 72 69 6e 67  20 6f 66 20 66 69 72 73  |e string of firs|
00005a40  74 20 63 68 61 72 61 63  74 65 72 20 74 6f 20 62  |t character to b|
00005a50  65 20 69 6e 20 74 68 65  20 63 75 72 73 6f 72 0a  |e in the cursor.|
00005a60  09 52 33 3d 63 75 72 73  6f 72 20 6c 65 6e 67 74  |.R3=cursor lengt|
00005a70  68 20 28 6c 65 6e 67 74  68 20 69 6e 20 63 68 61  |h (length in cha|
00005a80  72 61 63 74 65 72 73 20  6f 66 20 73 74 72 69 6e  |racters of strin|
00005a90  67 20 70 6f 69 6e 74 65  64 20 74 6f 20 62 79 20  |g pointed to by |
00005aa0  52 34 29 0a 09 52 34 3d  70 6f 69 6e 74 65 72 20  |R4)..R4=pointer |
00005ab0  74 6f 20 73 74 72 69 6e  67 20 6f 66 20 63 75 72  |to string of cur|
00005ac0  73 6f 72 20 63 68 61 72  61 63 74 65 72 73 20 28  |sor characters (|
00005ad0  75 73 75 61 6c 6c 79 20  26 37 46 73 29 0a 09 52  |usually &7Fs)..R|
00005ae0  35 3d 73 6f 75 72 63 65  20 73 74 72 69 6e 67 20  |5=source string |
00005af0  28 30 2c 32 20 74 65 72  6d 69 6e 61 74 65 64 29  |(0,2 terminated)|
00005b00  0a 09 52 36 3d 73 77 61  70 20 63 6f 6c 6f 75 72  |..R6=swap colour|
00005b10  2f 2d 31 20 69 66 20 6e  6f 6e 65 2e 20 49 66 20  |/-1 if none. If |
00005b20  74 68 65 20 63 68 61 72  61 63 74 65 72 20 68 61  |the character ha|
00005b30  76 69 6e 67 20 74 68 65  20 63 75 72 73 6f 72 20  |ving the cursor |
00005b40  70 6c 61 63 65 64 0a 09  20 20 20 6f 76 65 72 20  |placed..   over |
00005b50  69 74 20 68 61 73 20 74  68 69 73 20 66 6f 72 65  |it has this fore|
00005b60  67 72 6f 75 6e 64 20 63  6f 6c 6f 75 72 20 74 68  |ground colour th|
00005b70  65 6e 20 74 68 65 20 63  75 72 73 6f 72 20 62 61  |en the cursor ba|
00005b80  63 2f 66 6f 72 65 67 72  6f 75 6e 64 0a 09 20 20  |c/foreground..  |
00005b90  20 63 6f 6c 73 20 61 72  65 20 73 77 61 70 70 65  | cols are swappe|
00005ba0  64 20 6f 76 65 72 20 28  65 67 20 69 6e 20 61 20  |d over (eg in a |
00005bb0  73 65 6c 65 63 74 65 64  20 72 65 67 69 6f 6e 29  |selected region)|
00005bc0  2e 0a 09 52 37 3d 62 30  2d 62 37 20 20 20 68 69  |...R7=b0-b7   hi|
00005bd0  67 68 20 62 79 74 65 20  74 6f 20 75 73 65 20 66  |gh byte to use f|
00005be0  6f 72 20 63 75 72 73 6f  72 20 63 68 61 72 61 63  |or cursor charac|
00005bf0  74 65 72 73 20 69 6e 20  52 34 20 73 74 72 69 6e  |ters in R4 strin|
00005c00  67 0a 09 20 20 20 62 38  2d 62 31 35 20 20 63 6f  |g..   b8-b15  co|
00005c10  6e 74 72 6f 6c 20 63 6f  64 65 20 74 6f 20 75 73  |ntrol code to us|
00005c20  65 20 77 68 65 6e 20 6d  65 72 67 69 6e 67 20 69  |e when merging i|
00005c30  65 20 34 20 6f 72 20 38  2e 0a 09 20 20 20 62 31  |e 4 or 8...   b1|
00005c40  36 2d 62 32 33 20 66 6f  72 65 67 72 6f 75 6e 64  |6-b23 foreground|
00005c50  20 63 6f 6c 6f 75 72 20  6f 66 20 74 68 65 20 63  | colour of the c|
00005c60  75 72 73 6f 72 0a 09 20  20 20 62 32 34 2d 62 33  |ursor..   b24-b3|
00005c70  31 20 62 61 63 6b 67 72  6f 75 6e 64 20 63 6f 6c  |1 background col|
00005c80  6f 75 72 20 6f 66 20 74  68 65 20 63 75 72 73 6f  |our of the curso|
00005c90  72 0a 09 52 6f 6f 6d 20  73 68 6f 75 6c 64 20 62  |r..Room should b|
00005ca0  65 20 72 65 73 65 72 76  65 64 20 66 6f 72 20 74  |e reserved for t|
00005cb0  68 65 20 73 74 72 69 6e  67 20 74 6f 20 67 72 6f  |he string to gro|
00005cc0  77 20 62 79 20 38 2a 52  33 0a 09 63 68 61 72 61  |w by 8*R3..chara|
00005cd0  63 74 65 72 73 2e 20 28  65 67 20 30 2c 34 2c 66  |cters. (eg 0,4,f|
00005ce0  2c 62 2c 6f 6c 64 2c 30  2c 33 2c 6c 2c 68 29 20  |,b,old,0,3,l,h) |
00005cf0  49 66 20 74 68 65 20 69  6e 64 69 63 61 74 65 64  |If the indicated|
00005d00  20 6f 66 66 73 65 74 20  28 52 32 29 0a 09 69 73  | offset (R2)..is|
00005d10  20 6f 66 66 20 74 68 65  20 65 6e 64 20 6f 66 20  | off the end of |
00005d20  74 68 65 20 73 74 72 69  6e 67 20 74 68 65 6e 20  |the string then |
00005d30  69 74 20 77 69 6c 6c 20  62 65 20 6c 65 6e 67 74  |it will be lengt|
00005d40  68 65 6e 65 64 20 77 69  74 68 20 73 70 61 63 65  |hened with space|
00005d50  73 0a 09 28 26 32 30 29  20 73 6f 20 79 6f 75 20  |s..(&20) so you |
00005d60  73 68 6f 75 6c 64 20 65  6e 73 75 72 65 20 52 32  |should ensure R2|
00005d70  2b 39 2a 52 33 20 63 68  61 72 61 63 74 65 72 73  |+9*R3 characters|
00005d80  20 65 78 74 72 61 20 61  72 65 20 72 65 73 65 72  | extra are reser|
00005d90  76 65 64 2e 0a 09 0a 20  45 78 69 74 3a 09 52 30  |ved.... Exit:.R0|
00005da0  3d 65 6e 64 20 6f 66 20  6e 65 77 20 64 65 73 74  |=end of new dest|
00005db0  69 6e 61 74 69 6f 6e 20  73 74 72 69 6e 67 20 28  |ination string (|
00005dc0  61 66 74 65 72 20 30 2c  32 20 74 65 72 6d 69 6e  |after 0,2 termin|
00005dd0  61 74 6f 72 29 0a 20 0a  5a 61 70 52 65 64 72 61  |ator). .ZapRedra|
00005de0  77 5f 46 69 6e 64 43 68  61 72 61 63 74 65 72 20  |w_FindCharacter |
00005df0  28 2b 26 30 36 29 0a 2d  2d 2d 2d 2d 2d 2d 2d 2d  |(+&06).---------|
00005e00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00005e10  2d 2d 2d 2d 2d 0a 0a 54  68 69 73 20 53 57 49 20  |-----..This SWI |
00005e20  74 61 6b 65 73 20 61 73  20 69 6e 70 75 74 20 61  |takes as input a|
00005e30  20 6c 69 6e 65 20 6f 66  20 74 68 65 20 66 6f 72  | line of the for|
00005e40  6d 61 74 20 72 65 71 75  69 72 65 64 20 62 79 20  |mat required by |
00005e50  27 72 5f 64 61 74 61 27  20 28 69 65 0a 63 6f 6e  |'r_data' (ie.con|
00005e60  74 61 69 6e 69 6e 67 20  63 74 72 6c 20 73 65 71  |taining ctrl seq|
00005e70  75 65 6e 63 65 73 20 73  74 61 72 74 69 6e 67 20  |uences starting |
00005e80  77 69 74 68 20 30 29 20  61 6e 64 20 61 20 6e 75  |with 0) and a nu|
00005e90  6d 62 65 72 20 27 6e 27  20 61 6e 64 20 72 65 74  |mber 'n' and ret|
00005ea0  75 72 6e 73 20 74 68 65  0a 73 74 61 72 74 20 6f  |urns the.start o|
00005eb0  66 20 74 68 65 20 28 6e  2b 31 29 27 74 68 20 70  |f the (n+1)'th p|
00005ec0  72 69 6e 74 61 62 6c 65  20 63 68 61 72 61 63 74  |rintable charact|
00005ed0  65 72 20 77 69 74 68 69  6e 20 74 68 69 73 20 6c  |er within this l|
00005ee0  69 6e 65 20 28 69 65 20  69 74 20 73 6b 69 70 73  |ine (ie it skips|
00005ef0  20 6f 76 65 72 0a 6e 20  70 72 69 6e 74 61 62 6c  | over.n printabl|
00005f00  65 20 63 68 61 72 61 63  74 65 72 73 29 2c 20 69  |e characters), i|
00005f10  67 6e 6f 72 69 6e 67 20  63 6f 6c 6f 75 72 20 63  |gnoring colour c|
00005f20  68 61 6e 67 65 20 63 6f  6e 74 72 6f 6c 20 63 6f  |hange control co|
00005f30  64 65 73 20 65 74 63 2e  20 54 68 75 73 20 6f 6e  |des etc. Thus on|
00005f40  0a 65 78 69 74 20 69 74  20 70 6f 69 6e 74 73 20  |.exit it points |
00005f50  74 6f 20 61 20 62 79 74  65 20 31 2d 32 35 35 20  |to a byte 1-255 |
00005f60  6f 72 20 6f 6e 65 20 6f  66 20 74 68 65 20 63 6f  |or one of the co|
00005f70  6e 74 72 6f 6c 20 73 65  71 75 65 6e 63 65 73 20  |ntrol sequences |
00005f80  30 2c 30 20 6f 72 20 30  2c 32 20 6f 72 0a 30 2c  |0,0 or 0,2 or.0,|
00005f90  33 2c 6c 2c 68 20 6f 72  20 30 2c 34 2c 66 2c 62  |3,l,h or 0,4,f,b|
00005fa0  2c 63 31 2c 63 32 20 65  61 63 68 20 6f 66 20 77  |,c1,c2 each of w|
00005fb0  68 69 63 68 20 64 65 66  69 6e 65 20 6f 6e 65 20  |hich define one |
00005fc0  70 72 69 6e 74 61 62 6c  65 20 63 68 61 72 61 63  |printable charac|
00005fd0  74 65 72 2e 20 49 66 20  74 68 65 0a 6f 66 66 73  |ter. If the.offs|
00005fe0  65 74 20 6e 20 69 73 20  6f 66 66 20 74 68 65 20  |et n is off the |
00005ff0  65 6e 64 20 6f 66 20 74  68 65 20 6c 69 6e 65 20  |end of the line |
00006000  74 68 65 6e 20 69 74 20  77 69 6c 6c 20 70 6f 69  |then it will poi|
00006010  6e 74 20 74 6f 20 74 68  65 20 30 2c 32 20 74 65  |nt to the 0,2 te|
00006020  72 6d 69 6e 61 74 6f 72  2e 0a 49 74 20 61 6c 73  |rminator..It als|
00006030  6f 20 6b 65 65 70 73 20  74 72 61 63 6b 20 6f 66  |o keeps track of|
00006040  20 74 68 65 20 63 6f 6c  6f 75 72 20 63 68 61 6e  | the colour chan|
00006050  67 65 73 20 74 68 61 74  20 74 61 6b 65 20 70 6c  |ges that take pl|
00006060  61 63 65 2e 20 4e 42 20  49 66 20 6e 3d 30 20 74  |ace. NB If n=0 t|
00006070  68 65 6e 20 69 74 0a 6d  61 79 20 73 74 69 6c 6c  |hen it.may still|
00006080  20 62 65 20 75 73 65 66  75 6c 20 2d 20 61 73 20  | be useful - as |
00006090  69 74 20 77 69 6c 6c 20  6a 75 6d 70 20 6f 76 65  |it will jump ove|
000060a0  72 20 61 6e 79 20 63 6f  6c 6f 75 72 20 63 68 61  |r any colour cha|
000060b0  6e 67 65 73 20 62 65 66  6f 72 65 20 74 68 65 0a  |nges before the.|
000060c0  66 69 72 73 74 20 63 68  61 72 61 63 74 65 72 2e  |first character.|
000060d0  20 49 66 20 52 30 3e 52  31 20 6f 6e 20 65 78 69  | If R0>R1 on exi|
000060e0  74 20 74 68 65 6e 20 74  68 65 20 63 68 61 72 61  |t then the chara|
000060f0  63 74 65 72 20 77 61 73  20 66 6f 75 6e 64 2c 20  |cter was found, |
00006100  6f 74 68 65 72 77 69 73  65 0a 74 68 65 72 65 20  |otherwise.there |
00006110  77 65 72 65 20 52 31 2d  52 30 20 63 68 61 72 61  |were R1-R0 chara|
00006120  63 74 65 72 73 20 6c 65  66 74 20 74 6f 20 73 6b  |cters left to sk|
00006130  69 70 2e 0a 0a 45 67 3a  20 49 6e 70 75 74 3a 09  |ip...Eg: Input:.|
00006140  22 68 65 6c 6c 6f 20 22  2c 30 2c 31 2c 32 2c 33  |"hello ",0,1,2,3|
00006150  2c 22 67 6f 6f 64 62 79  65 22 2c 30 2c 32 0a 20  |,"goodbye",0,2. |
00006160  20 20 20 4f 75 74 70 75  74 3a 09 49 66 20 6e 3d  |   Output:.If n=|
00006170  30 20 74 68 65 6e 20 69  74 20 77 69 6c 6c 20 70  |0 then it will p|
00006180  6f 69 6e 74 20 74 6f 20  74 68 65 20 27 68 27 0a  |oint to the 'h'.|
00006190  20 20 20 20 09 09 49 66  20 6e 3d 36 20 74 68 65  |    ..If n=6 the|
000061a0  6e 20 69 74 20 77 69 6c  6c 20 70 6f 69 6e 74 20  |n it will point |
000061b0  74 6f 20 74 68 65 20 27  67 27 0a 20 20 20 20 09  |to the 'g'.    .|
000061c0  09 49 66 20 6e 3d 31 30  30 20 74 68 65 6e 20 69  |.If n=100 then i|
000061d0  74 20 77 69 6c 6c 20 70  6f 69 6e 74 20 74 6f 20  |t will point to |
000061e0  74 68 65 20 30 20 6f 66  20 30 2c 32 2e 0a 20 0a  |the 0 of 0,2.. .|
000061f0  20 45 6e 74 72 79 3a 09  09 52 30 3d 6e 20 28 6e  | Entry:..R0=n (n|
00006200  75 6d 62 65 72 20 6f 66  20 63 68 61 72 61 63 74  |umber of charact|
00006210  65 72 73 20 74 6f 20 73  6b 69 70 29 0a 20 09 09  |ers to skip). ..|
00006220  20 20 20 20 20 28 6f 72  20 2d 31 20 74 6f 20 6d  |     (or -1 to m|
00006230  6f 76 65 20 74 6f 20 74  68 65 20 65 6e 64 20 6f  |ove to the end o|
00006240  66 20 74 68 65 20 73 74  72 69 6e 67 20 2d 20 66  |f the string - f|
00006250  69 6e 64 20 69 74 73 20  6c 65 6e 29 0a 09 09 52  |ind its len)...R|
00006260  31 3d 70 6f 69 6e 74 65  72 20 74 6f 20 74 68 65  |1=pointer to the|
00006270  20 69 6e 70 75 74 20 73  74 72 69 6e 67 20 28 74  | input string (t|
00006280  65 72 6d 69 6e 61 74 65  64 20 62 79 20 30 2c 32  |erminated by 0,2|
00006290  29 0a 20 09 09 52 32 3d  63 75 72 72 65 6e 74 20  |). ..R2=current |
000062a0  66 6f 72 65 67 72 6f 75  6e 64 20 63 6f 6c 6f 75  |foreground colou|
000062b0  72 0a 20 09 09 52 33 3d  63 75 72 72 65 6e 74 20  |r. ..R3=current |
000062c0  62 61 63 6b 67 72 6f 75  6e 64 20 63 6f 6c 6f 75  |background colou|
000062d0  72 0a 20 09 09 0a 20 45  78 69 74 3a 09 09 52 30  |r. ... Exit:..R0|
000062e0  3d 49 66 20 74 68 65 20  6e 27 74 68 20 63 68 61  |=If the n'th cha|
000062f0  72 61 63 74 65 72 20 69  73 20 69 6e 20 74 68 65  |racter is in the|
00006300  20 73 74 72 69 6e 67 20  74 68 65 6e 20 74 68 69  | string then thi|
00006310  73 20 70 6f 69 6e 74 73  0a 20 09 09 20 20 20 20  |s points. ..    |
00006320  74 6f 20 74 68 65 20 65  6e 64 20 6f 66 20 74 68  |to the end of th|
00006330  65 20 6e 27 74 68 20 63  68 61 72 61 63 74 65 72  |e n'th character|
00006340  20 28 73 74 61 72 74 20  69 6e 20 52 31 29 0a 20  | (start in R1). |
00006350  09 09 20 20 20 49 66 20  74 68 65 20 6e 27 74 68  |..   If the n'th|
00006360  20 27 63 68 61 72 61 63  74 65 72 27 20 69 73 20  | 'character' is |
00006370  74 68 65 20 74 65 72 6d  69 6e 61 74 6f 72 20 28  |the terminator (|
00006380  30 2c 32 29 20 74 68 65  6e 20 74 68 69 73 0a 20  |0,2) then this. |
00006390  09 09 20 20 20 20 65 71  75 61 6c 73 20 52 31 20  |..    equals R1 |
000063a0  28 73 74 61 72 74 20 6f  66 20 74 68 65 20 74 65  |(start of the te|
000063b0  72 6d 69 6e 61 74 6f 72  29 0a 20 09 09 20 20 20  |rminator). ..   |
000063c0  49 66 20 69 74 20 72 65  61 63 68 65 64 20 74 68  |If it reached th|
000063d0  65 20 73 74 72 69 6e 67  20 74 65 72 6d 69 6e 61  |e string termina|
000063e0  74 6f 72 20 62 65 66 6f  72 65 20 74 68 65 20 6e  |tor before the n|
000063f0  27 74 68 0a 20 09 09 20  20 20 20 63 68 61 72 61  |'th. ..    chara|
00006400  63 74 65 72 20 74 68 65  6e 20 74 68 69 73 20 69  |cter then this i|
00006410  73 20 52 31 2d 6e 75 6d  62 65 72 20 6f 66 20 63  |s R1-number of c|
00006420  68 61 72 73 20 6e 6f 74  20 73 6b 69 70 70 65 64  |hars not skipped|
00006430  0a 20 09 09 52 31 3d 73  74 61 72 74 20 6f 66 20  |. ..R1=start of |
00006440  74 68 65 20 6e 65 78 74  20 70 72 69 6e 74 61 62  |the next printab|
00006450  6c 65 20 63 68 61 72 61  63 74 65 72 20 61 66 74  |le character aft|
00006460  65 72 20 73 6b 69 70 70  69 6e 67 20 6e 2e 0a 20  |er skipping n.. |
00006470  09 09 20 20 20 28 6f 72  20 73 74 72 69 6e 67 20  |..   (or string |
00006480  74 65 72 6d 69 6e 61 74  6f 72 20 69 66 20 72 65  |terminator if re|
00006490  61 63 68 65 64 20 74 68  61 74 20 66 69 72 73 74  |ached that first|
000064a0  29 2e 0a 20 09 09 52 32  2d 52 33 20 75 70 64 61  |).. ..R2-R3 upda|
000064b0  74 65 64 20 62 79 20 61  6e 79 20 63 6f 6c 6f 75  |ted by any colou|
000064c0  72 20 63 68 61 6e 67 65  20 63 6f 6e 74 72 6f 6c  |r change control|
000064d0  20 63 6f 64 65 73 2e 0a  20 09 09 46 6c 61 67 73  | codes.. ..Flags|
000064e0  20 63 6f 72 72 75 70 74  65 64 2e 0a 20 09 09 20  | corrupted.. .. |
000064f0  20 20 0a 5a 61 70 52 65  64 72 61 77 5f 4d 6f 76  |  .ZapRedraw_Mov|
00006500  65 42 79 74 65 73 20 28  2b 26 30 37 29 0a 2d 2d  |eBytes (+&07).--|
00006510  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00006520  2d 2d 2d 2d 2d 2d 2d 2d  0a 0a 54 68 69 73 20 69  |--------..This i|
00006530  73 20 61 20 66 61 73 74  20 62 79 74 65 20 73 68  |s a fast byte sh|
00006540  69 66 74 69 6e 67 20 53  57 49 2e 20 48 69 67 68  |ifting SWI. High|
00006550  6c 79 20 6f 70 74 69 6d  69 73 65 64 20 61 6e 64  |ly optimised and|
00006560  20 62 79 74 65 73 20 61  72 65 20 73 68 69 66 74  | bytes are shift|
00006570  65 64 0a 73 74 61 72 74  69 6e 67 20 61 74 20 74  |ed.starting at t|
00006580  68 65 20 74 6f 70 20 6f  72 20 62 6f 74 74 6f 6d  |he top or bottom|
00006590  20 64 65 70 65 6e 64 69  6e 67 20 6f 6e 20 77 68  | depending on wh|
000065a0  65 74 68 65 72 20 74 68  65 20 64 65 73 74 69 6e  |ether the destin|
000065b0  61 74 69 6f 6e 20 61 64  64 72 65 73 73 20 69 73  |ation address is|
000065c0  0a 68 69 67 68 65 72 20  6f 72 20 6c 6f 77 65 72  |.higher or lower|
000065d0  20 74 68 61 6e 20 74 68  65 20 73 74 61 72 74 20  | than the start |
000065e0  28 72 65 73 70 65 63 74  69 76 65 6c 79 29 2e 20  |(respectively). |
000065f0  54 68 75 73 20 74 68 65  20 64 61 74 61 20 69 73  |Thus the data is|
00006600  20 61 6c 77 61 79 73 0a  70 72 65 73 65 72 76 65  | always.preserve|
00006610  64 2e 0a 0a 20 45 6e 74  72 79 3a 09 09 52 31 3d  |d... Entry:..R1=|
00006620  73 6f 75 72 63 65 20 61  64 64 72 65 73 73 20 28  |source address (|
00006630  6e 65 65 64 20 6e 6f 74  20 62 65 20 77 6f 72 64  |need not be word|
00006640  20 61 6c 69 67 6e 65 64  29 0a 20 09 09 52 32 3d  | aligned). ..R2=|
00006650  64 65 73 74 69 6e 61 74  69 6f 6e 20 61 64 64 72  |destination addr|
00006660  65 73 73 20 28 6e 65 65  64 20 6e 6f 74 20 62 65  |ess (need not be|
00006670  20 77 6f 72 64 20 61 6c  69 67 6e 65 64 29 0a 20  | word aligned). |
00006680  09 09 52 33 3d 6e 75 6d  62 65 72 20 6f 66 20 62  |..R3=number of b|
00006690  79 74 65 73 20 74 6f 20  6d 6f 76 65 20 28 3e 3d  |ytes to move (>=|
000066a0  30 29 0a 20 0a 20 45 78  69 74 3a 09 09 52 30 2d  |0). . Exit:..R0-|
000066b0  52 33 20 61 6e 64 20 66  6c 61 67 73 20 63 6f 72  |R3 and flags cor|
000066c0  72 75 70 74 65 64 2e 0a  0a 5a 61 70 52 65 64 72  |rupted...ZapRedr|
000066d0  61 77 5f 43 61 63 68 65  64 43 68 61 72 53 69 7a  |aw_CachedCharSiz|
000066e0  65 20 28 2b 26 30 38 29  0a 2d 2d 2d 2d 2d 2d 2d  |e (+&08).-------|
000066f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00006700  2d 2d 2d 2d 2d 2d 2d 2d  0a 0a 54 68 69 73 20 53  |--------..This S|
00006710  57 49 20 77 6f 72 6b 73  20 6f 75 74 20 74 68 65  |WI works out the|
00006720  20 76 61 6c 75 65 73 20  6f 66 20 72 5f 63 62 70  | values of r_cbp|
00006730  6c 2c 72 5f 63 62 70 63  20 66 72 6f 6d 20 72 5f  |l,r_cbpc from r_|
00006740  63 68 61 72 77 2c 72 5f  63 68 61 72 68 2c 72 5f  |charw,r_charh,r_|
00006750  62 70 70 20 69 6e 0a 74  68 65 20 6d 61 6e 6f 72  |bpp in.the manor|
00006760  20 64 65 66 69 6e 65 64  20 75 6e 64 65 72 20 74  | defined under t|
00006770  68 65 20 68 65 6c 70 20  74 65 78 74 20 6f 6e 20  |he help text on |
00006780  72 5f 63 61 64 64 72 2e  20 49 65 2c 20 72 5f 63  |r_caddr. Ie, r_c|
00006790  62 70 6c 20 69 73 20 65  69 74 68 65 72 20 31 2c  |bpl is either 1,|
000067a0  32 2c 0a 6f 72 20 61 20  6d 75 6c 74 69 70 6c 65  |2,.or a multiple|
000067b0  20 6f 66 20 34 20 61 6e  64 20 72 5f 63 62 70 63  | of 4 and r_cbpc|
000067c0  3d 72 5f 63 68 61 72 68  2a 72 5f 63 62 70 6c 2e  |=r_charh*r_cbpl.|
000067d0  0a 0a 20 45 6e 74 72 79  3a 09 09 52 30 3d 72 5f  |.. Entry:..R0=r_|
000067e0  62 70 70 20 76 61 6c 75  65 0a 20 09 09 52 32 3d  |bpp value. ..R2=|
000067f0  72 5f 63 68 61 72 77 20  76 61 6c 75 65 0a 20 09  |r_charw value. .|
00006800  09 52 33 3d 72 5f 63 68  61 72 68 20 76 61 6c 75  |.R3=r_charh valu|
00006810  65 0a 20 09 09 0a 20 45  78 69 74 3a 09 09 52 32  |e. ... Exit:..R2|
00006820  3d 6e 75 6d 62 65 72 20  6f 66 20 62 79 74 65 73  |=number of bytes|
00006830  20 70 65 72 20 63 61 63  68 65 20 6c 69 6e 65 20  | per cache line |
00006840  28 72 5f 63 62 70 6c 29  0a 20 09 09 52 33 3d 6e  |(r_cbpl). ..R3=n|
00006850  75 6d 62 65 72 20 6f 66  20 62 79 74 65 73 20 70  |umber of bytes p|
00006860  65 72 20 63 61 63 68 65  64 20 63 68 61 72 61 63  |er cached charac|
00006870  74 65 72 20 28 72 5f 63  62 70 63 29 0a 0a 5a 61  |ter (r_cbpc)..Za|
00006880  70 52 65 64 72 61 77 5f  43 6f 6e 76 42 69 74 6d  |pRedraw_ConvBitm|
00006890  61 70 43 68 61 72 20 28  2b 26 30 39 29 0a 2d 2d  |apChar (+&09).--|
000068a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000068b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 0a 54  |-------------..T|
000068c0  68 69 73 20 53 57 49 20  69 73 20 66 6f 72 20 74  |his SWI is for t|
000068d0  68 65 20 75 73 65 20 6f  66 20 74 68 65 20 43 6f  |he use of the Co|
000068e0  6e 76 65 72 74 42 69 74  6d 61 70 20 53 57 49 20  |nvertBitmap SWI |
000068f0  61 6e 64 20 70 65 72 66  6f 72 6d 73 20 74 68 65  |and performs the|
00006900  20 62 69 74 6d 61 70 0a  63 6f 6e 76 65 72 73 69  | bitmap.conversi|
00006910  6f 6e 20 66 6f 72 20 6f  6e 65 20 63 68 61 72 61  |on for one chara|
00006920  63 74 65 72 2e 20 49 74  20 74 61 6b 65 73 20 61  |cter. It takes a|
00006930  20 62 69 74 20 6d 61 70  20 6f 66 20 74 68 65 20  | bit map of the |
00006940  6f 6e 65 20 62 69 74 20  70 65 72 20 70 69 78 65  |one bit per pixe|
00006950  6c 0a 66 6f 72 6d 61 74  20 61 6e 64 20 65 78 70  |l.format and exp|
00006960  61 6e 64 73 20 69 74 20  74 6f 20 68 61 76 65 20  |ands it to have |
00006970  6e 3d 32 5e 52 37 20 62  69 74 73 20 70 65 72 20  |n=2^R7 bits per |
00006980  70 69 78 65 6c 20 62 79  20 72 65 70 6c 61 63 69  |pixel by replaci|
00006990  6e 67 20 65 61 63 68 20  27 30 27 0a 77 69 74 68  |ng each '0'.with|
000069a0  20 6e 20 27 30 27 73 20  61 6e 64 20 65 61 63 68  | n '0's and each|
000069b0  20 27 31 27 20 77 69 74  68 20 74 68 65 20 6d 61  | '1' with the ma|
000069c0  73 6b 20 69 6e 20 52 36  20 28 75 73 75 61 6c 6c  |sk in R6 (usuall|
000069d0  79 20 6e 20 27 31 27 73  29 2e 20 54 68 75 73 20  |y n '1's). Thus |
000069e0  66 6f 72 0a 73 74 61 6e  64 61 72 64 20 63 6f 6e  |for.standard con|
000069f0  76 65 72 73 69 6f 6e 20  79 6f 75 20 73 68 6f 75  |version you shou|
00006a00  6c 64 20 73 65 74 20 52  36 20 74 6f 20 62 65 20  |ld set R6 to be |
00006a10  32 5e 6e 2d 31 20 28 3d  32 5e 28 32 5e 52 37 29  |2^n-1 (=2^(2^R7)|
00006a20  2d 31 29 2e 20 28 4e 42  20 69 66 20 52 37 0a 28  |-1). (NB if R7.(|
00006a30  3d 72 5f 62 70 70 29 20  69 73 20 7a 65 72 6f 20  |=r_bpp) is zero |
00006a40  74 68 65 6e 20 61 6c 6c  20 79 6f 75 20 68 61 76  |then all you hav|
00006a50  65 20 74 6f 20 64 6f 20  69 73 20 63 6f 70 79 20  |e to do is copy |
00006a60  74 68 65 20 62 69 74 6d  61 70 2e 20 52 37 3d 30  |the bitmap. R7=0|
00006a70  20 69 73 20 6e 6f 74 0a  73 75 70 70 6f 72 74 65  | is not.supporte|
00006a80  64 20 62 79 20 74 68 69  73 20 63 61 6c 6c 2e 0a  |d by this call..|
00006a90  0a 20 45 6e 74 72 79 3a  09 09 52 31 3d 72 65 64  |. Entry:..R1=red|
00006aa0  72 61 77 20 62 6c 6f 63  6b 20 28 6f 6e 6c 79 20  |raw block (only |
00006ab0  72 5f 63 68 61 72 68 20  69 73 20 75 73 65 64 20  |r_charh is used |
00006ac0  74 6f 20 66 69 6e 64 20  74 68 65 20 68 65 69 67  |to find the heig|
00006ad0  68 74 20 6f 66 0a 20 09  09 20 20 20 74 68 65 20  |ht of. ..   the |
00006ae0  63 68 61 72 61 63 74 65  72 20 69 6e 20 70 69 78  |character in pix|
00006af0  65 6c 73 29 2e 0a 20 09  09 52 32 3d 62 79 74 65  |els).. ..R2=byte|
00006b00  73 20 70 65 72 20 63 61  63 68 65 20 6c 69 6e 65  |s per cache line|
00006b10  20 66 6f 72 20 74 68 65  20 73 6f 75 72 63 65 20  | for the source |
00006b20  63 68 61 72 61 63 74 65  72 20 28 31 2c 32 2c 2a  |character (1,2,*|
00006b30  34 29 0a 20 09 09 52 33  3d 62 79 74 65 73 20 70  |4). ..R3=bytes p|
00006b40  65 72 20 63 61 63 68 65  20 6c 69 6e 65 20 66 6f  |er cache line fo|
00006b50  72 20 74 68 65 20 64 65  73 74 20 63 68 61 72 61  |r the dest chara|
00006b60  63 74 65 72 20 28 31 2c  32 2c 2a 34 29 0a 20 09  |cter (1,2,*4). .|
00006b70  09 52 34 3d 70 6f 69 6e  74 65 72 20 74 6f 20 73  |.R4=pointer to s|
00006b80  6f 75 72 63 65 20 63 68  61 72 61 63 74 65 72 20  |ource character |
00006b90  62 69 74 6d 61 70 0a 20  09 09 52 35 3d 61 64 64  |bitmap. ..R5=add|
00006ba0  72 65 73 73 20 74 6f 20  70 6c 61 63 65 20 64 65  |ress to place de|
00006bb0  73 74 69 6e 61 74 69 6f  6e 20 63 68 61 72 61 63  |stination charac|
00006bc0  74 65 72 20 62 69 74 6d  61 70 0a 20 09 09 52 36  |ter bitmap. ..R6|
00006bd0  3d 62 69 74 20 6d 61 73  6b 20 74 6f 20 69 6e 73  |=bit mask to ins|
00006be0  65 72 74 20 69 6e 20 70  6c 61 63 65 20 6f 66 20  |ert in place of |
00006bf0  31 27 73 20 28 6f 6e 6c  79 20 62 6f 74 74 6f 6d  |1's (only bottom|
00006c00  20 32 5e 52 37 20 62 69  74 73 29 0a 20 09 09 52  | 2^R7 bits). ..R|
00006c10  37 3d 4c 6f 67 5f 32 20  6f 66 20 6e 75 6d 62 65  |7=Log_2 of numbe|
00006c20  72 20 6f 66 20 62 69 74  73 20 70 65 72 20 70 69  |r of bits per pi|
00006c30  78 65 6c 20 28 31 2d 35  29 0a 20 0a 20 45 78 69  |xel (1-5). . Exi|
00006c40  74 3a 09 09 52 34 20 61  6e 64 20 52 35 20 75 70  |t:..R4 and R5 up|
00006c50  64 61 74 65 64 20 74 6f  20 74 68 65 20 73 74 61  |dated to the sta|
00006c60  72 74 20 6f 66 20 74 68  65 20 27 6e 65 78 74 27  |rt of the 'next'|
00006c70  20 63 68 61 72 61 63 74  65 72 73 2e 0a 20 09 09  | characters.. ..|
00006c80  52 30 20 61 6e 64 20 66  6c 61 67 73 20 63 6f 72  |R0 and flags cor|
00006c90  72 75 70 74 65 64 2e 0a  0a 5a 61 70 52 65 64 72  |rupted...ZapRedr|
00006ca0  61 77 5f 43 72 65 61 74  65 50 61 6c 65 74 74 65  |aw_CreatePalette|
00006cb0  20 28 2b 26 30 41 29 0a  2d 2d 2d 2d 2d 2d 2d 2d  | (+&0A).--------|
00006cc0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00006cd0  2d 2d 2d 2d 2d 2d 0a 0a  54 68 69 73 20 53 57 49  |------..This SWI|
00006ce0  20 69 73 20 75 73 65 64  20 74 6f 20 63 72 65 61  | is used to crea|
00006cf0  74 65 20 74 68 65 20 72  5f 70 61 6c 65 74 74 65  |te the r_palette|
00006d00  20 64 61 74 61 20 62 6c  6f 63 6b 2e 20 49 66 20  | data block. If |
00006d10  52 30 3d 31 20 6f 6e 20  65 6e 74 72 79 20 74 68  |R0=1 on entry th|
00006d20  65 6e 20 69 74 0a 74 61  6b 65 73 20 61 20 70 61  |en it.takes a pa|
00006d30  6c 65 74 74 65 20 63 6f  6e 73 69 73 74 69 6e 67  |lette consisting|
00006d40  20 6f 66 20 61 20 6c 69  73 74 20 6f 66 20 77 69  | of a list of wi|
00006d50  6d 70 20 63 6f 6c 6f 75  72 20 6e 75 6d 62 65 72  |mp colour number|
00006d60  73 20 28 6f 6e 65 20 70  65 72 20 77 6f 72 64 29  |s (one per word)|
00006d70  0a 61 6e 64 20 63 6f 6e  76 65 72 74 73 20 69 74  |.and converts it|
00006d80  20 74 6f 20 65 6e 74 72  69 65 73 20 6f 66 20 74  | to entries of t|
00006d90  68 65 20 66 6f 72 6d 20  26 42 42 47 47 52 52 78  |he form &BBGGRRx|
00006da0  78 2c 20 61 20 32 34 20  62 69 74 20 70 61 6c 65  |x, a 24 bit pale|
00006db0  74 74 65 20 65 6e 74 72  79 20 62 79 0a 75 73 69  |tte entry by.usi|
00006dc0  6e 67 20 74 68 65 20 63  61 6c 6c 20 57 69 6d 70  |ng the call Wimp|
00006dd0  5f 52 65 61 64 50 61 6c  65 74 74 65 20 61 6e 64  |_ReadPalette and|
00006de0  20 64 75 70 6c 69 63 61  74 69 6e 67 20 74 68 65  | duplicating the|
00006df0  20 6e 69 62 62 6c 65 73  2e 20 49 66 20 52 30 3d  | nibbles. If R0=|
00006e00  32 20 6f 6e 20 65 6e 74  72 79 0a 74 68 65 6e 20  |2 on entry.then |
00006e10  69 74 20 74 61 6b 65 73  20 61 20 6c 69 73 74 20  |it takes a list |
00006e20  6f 66 20 65 6e 74 72 69  65 73 20 6f 66 20 74 68  |of entries of th|
00006e30  65 20 66 6f 72 6d 20 26  42 42 47 47 52 52 78 78  |e form &BBGGRRxx|
00006e40  20 61 6e 64 20 63 6f 6e  76 65 72 74 73 20 74 68  | and converts th|
00006e50  65 6d 20 74 6f 0a 63 6f  6c 6f 75 72 20 6d 61 73  |em to.colour mas|
00006e60  6b 73 20 72 65 71 75 69  72 65 64 20 66 6f 72 20  |ks required for |
00006e70  44 53 41 20 72 65 64 72  61 77 20 28 73 65 65 20  |DSA redraw (see |
00006e80  72 5f 70 61 6c 65 74 74  65 29 20 75 73 69 6e 67  |r_palette) using|
00006e90  20 43 6f 6c 6f 75 72 54  72 61 6e 73 20 63 61 6c  | ColourTrans cal|
00006ea0  6c 73 0a 61 6e 64 20 5a  61 70 52 65 64 72 61 77  |ls.and ZapRedraw|
00006eb0  5f 47 65 74 50 61 6c 65  74 74 65 45 6e 74 72 79  |_GetPaletteEntry|
00006ec0  2e 20 49 66 20 52 30 3d  33 20 6f 6e 20 65 6e 74  |. If R0=3 on ent|
00006ed0  72 79 20 74 68 65 6e 20  69 74 20 64 6f 65 73 20  |ry then it does |
00006ee0  62 6f 74 68 2c 20 63 6f  6e 76 65 72 74 69 6e 67  |both, converting|
00006ef0  0a 77 69 6d 70 20 63 6f  6c 6f 75 72 20 6e 75 6d  |.wimp colour num|
00006f00  62 65 72 73 20 74 6f 20  44 53 41 20 72 65 64 72  |bers to DSA redr|
00006f10  61 77 20 6d 61 73 6b 73  2e 0a 0a 20 45 6e 74 72  |aw masks... Entr|
00006f20  79 3a 09 09 52 30 3d 72  65 61 73 6f 6e 20 63 6f  |y:..R0=reason co|
00006f30  64 65 3a 0a 09 09 20 20  20 20 20 62 30 20 53 65  |de:...     b0 Se|
00006f40  74 20 74 6f 20 63 6f 6e  76 65 72 74 20 77 69 6d  |t to convert wim|
00006f50  70 20 63 6f 6c 73 20 74  6f 20 26 42 42 47 47 52  |p cols to &BBGGR|
00006f60  52 78 78 0a 09 09 20 20  20 20 20 62 31 20 53 65  |Rxx...     b1 Se|
00006f70  74 20 74 6f 20 63 6f 6e  76 65 72 74 20 26 62 62  |t to convert &bb|
00006f80  67 67 72 72 78 78 20 74  6f 20 44 53 41 20 63 6f  |ggrrxx to DSA co|
00006f90  6c 6f 75 72 20 6d 61 73  6b 73 0a 09 09 20 20 20  |lour masks...   |
00006fa0  20 20 62 32 2b 20 72 65  73 65 72 76 65 64 20 2d  |  b2+ reserved -|
00006fb0  20 73 65 74 20 74 6f 20  30 0a 20 09 09 52 31 3d  | set to 0. ..R1=|
00006fc0  72 65 64 72 61 77 20 62  6c 6f 63 6b 2e 20 54 68  |redraw block. Th|
00006fd0  65 20 66 6f 6c 6c 6f 77  69 6e 67 20 61 72 65 20  |e following are |
00006fe0  75 73 65 64 3a 0a 20 09  09 20 20 20 72 5f 62 70  |used:. ..   r_bp|
00006ff0  70 20 20 20 20 20 20 3d  20 6c 6f 67 5f 32 20 6f  |p      = log_2 o|
00007000  66 20 62 69 74 73 20 70  65 72 20 70 69 78 65 6c  |f bits per pixel|
00007010  0a 20 09 09 20 20 20 72  5f 77 6f 72 6b 61 72 65  |. ..   r_workare|
00007020  61 20 3d 20 70 6f 69 6e  74 65 72 20 74 6f 20 31  |a = pointer to 1|
00007030  32 38 20 62 79 74 65 20  77 6f 72 6b 20 61 72 65  |28 byte work are|
00007040  61 20 74 6f 20 6c 6f 61  64 20 77 69 6d 70 0a 20  |a to load wimp. |
00007050  09 09 20 20 20 09 09 70  61 6c 65 74 74 65 20 69  |..   ..palette i|
00007060  6e 74 6f 2e 0a 09 09 52  32 3d 61 64 64 72 65 73  |nto....R2=addres|
00007070  73 20 6f 66 20 73 6f 75  72 63 65 20 70 61 6c 65  |s of source pale|
00007080  74 74 65 0a 09 09 52 33  3d 61 64 64 72 65 73 73  |tte...R3=address|
00007090  20 66 6f 72 20 64 65 73  74 20 70 61 6c 65 74 74  | for dest palett|
000070a0  65 20 28 6e 65 65 64 73  20 34 2a 52 34 20 62 79  |e (needs 4*R4 by|
000070b0  74 65 73 20 70 72 65 73  65 72 76 65 64 29 0a 09  |tes preserved)..|
000070c0  09 20 20 20 28 73 6f 75  72 63 65 20 6d 61 79 20  |.   (source may |
000070d0  65 71 75 61 6c 20 64 65  73 74 69 6e 61 74 69 6f  |equal destinatio|
000070e0  6e 29 0a 09 09 52 34 3d  6e 75 6d 62 65 72 20 6f  |n)...R4=number o|
000070f0  66 20 70 61 6c 65 74 74  65 20 65 6e 74 72 69 65  |f palette entrie|
00007100  73 20 28 65 67 20 31 36  29 0a 0a 20 45 78 69 74  |s (eg 16).. Exit|
00007110  3a 09 09 52 30 20 61 6e  64 20 66 6c 61 67 73 20  |:..R0 and flags |
00007120  63 6f 72 72 75 70 74 65  64 2e 0a 0a 5a 61 70 52  |corrupted...ZapR|
00007130  65 64 72 61 77 5f 49 6e  73 65 72 74 43 68 61 72  |edraw_InsertChar|
00007140  20 28 2b 26 30 42 29 0a  2d 2d 2d 2d 2d 2d 2d 2d  | (+&0B).--------|
00007150  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00007160  2d 2d 2d 0a 0a 54 68 69  73 20 69 6e 73 65 72 74  |---..This insert|
00007170  73 20 61 20 73 69 6e 67  6c 65 20 63 68 61 72 61  |s a single chara|
00007180  63 74 65 72 20 69 6e 74  6f 20 61 20 73 74 72 69  |cter into a stri|
00007190  6e 67 20 6f 66 20 72 5f  64 61 74 61 20 66 6f 72  |ng of r_data for|
000071a0  6d 61 74 2e 20 49 66 20  52 30 3d 30 20 74 68 65  |mat. If R0=0 the|
000071b0  6e 0a 69 74 20 69 6e 73  65 72 74 73 20 30 2c 30  |n.it inserts 0,0|
000071c0  20 61 6e 64 20 69 66 20  52 30 3e 3d 26 31 30 30  | and if R0>=&100|
000071d0  20 74 68 65 6e 20 69 74  20 69 6e 73 65 72 74 73  | then it inserts|
000071e0  20 30 2c 33 2c 78 2c 79  20 77 68 65 72 65 20 52  | 0,3,x,y where R|
000071f0  30 3d 26 79 79 78 78 2e  0a 4f 74 68 65 72 77 69  |0=&yyxx..Otherwi|
00007200  73 65 20 69 74 20 6a 75  73 74 20 69 6e 73 65 72  |se it just inser|
00007210  74 73 20 74 68 65 20 62  79 74 65 20 61 73 20 6e  |ts the byte as n|
00007220  6f 72 6d 61 6c 2e 0a 0a  20 45 6e 74 72 79 3a 09  |ormal... Entry:.|
00007230  09 52 30 3d 63 68 61 72  61 63 74 65 72 0a 20 09  |.R0=character. .|
00007240  09 52 31 3d 73 74 72 69  6e 67 20 61 64 64 72 65  |.R1=string addre|
00007250  73 73 0a 20 09 09 0a 20  45 78 69 74 3a 09 09 52  |ss. ... Exit:..R|
00007260  31 20 75 70 64 61 74 65  64 20 27 74 69 6c 6c 20  |1 updated 'till |
00007270  61 66 74 65 72 20 74 68  65 20 63 68 61 72 61 63  |after the charac|
00007280  74 65 72 0a 20 09 09 52  30 20 61 6e 64 20 66 6c  |ter. ..R0 and fl|
00007290  61 67 73 20 63 6f 72 72  75 70 74 65 64 2e 0a 0a  |ags corrupted...|
000072a0  5a 61 70 52 65 64 72 61  77 5f 52 65 61 64 53 79  |ZapRedraw_ReadSy|
000072b0  73 74 65 6d 43 68 61 72  73 20 28 2b 26 30 43 29  |stemChars (+&0C)|
000072c0  0a 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.---------------|
000072d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000072e0  2d 0a 0a 54 68 69 73 20  72 65 61 64 73 20 74 68  |-..This reads th|
000072f0  65 20 73 74 61 6e 64 61  72 64 20 73 79 73 74 65  |e standard syste|
00007300  6d 20 63 68 61 72 61 63  74 65 72 73 20 62 69 74  |m characters bit|
00007310  6d 61 70 73 20 76 69 61  20 4f 53 5f 57 6f 72 64  |maps via OS_Word|
00007320  20 63 61 6c 6c 73 2e 20  49 74 20 72 65 61 64 73  | calls. It reads|
00007330  0a 74 68 65 6d 20 69 6e  20 31 20 62 69 74 20 70  |.them in 1 bit p|
00007340  65 72 20 70 69 78 65 6c  20 28 38 20 62 79 74 65  |er pixel (8 byte|
00007350  73 20 70 65 72 20 63 68  61 72 61 63 74 65 72 29  |s per character)|
00007360  20 66 6f 72 6d 20 73 75  69 74 61 62 6c 65 20 66  | form suitable f|
00007370  6f 72 0a 5a 61 70 52 65  64 72 61 77 5f 43 6f 6e  |or.ZapRedraw_Con|
00007380  76 65 72 74 42 69 74 6d  61 70 20 74 6f 20 63 6f  |vertBitmap to co|
00007390  6e 76 65 72 74 20 69 74  20 74 6f 20 61 20 66 6f  |nvert it to a fo|
000073a0  72 6d 20 75 73 61 62 6c  65 20 66 6f 72 0a 5a 61  |rm usable for.Za|
000073b0  70 52 65 64 72 61 77 5f  52 65 64 72 61 77 41 72  |pRedraw_RedrawAr|
000073c0  65 61 2e 20 54 6f 20 64  6f 20 74 68 69 73 2c 20  |ea. To do this, |
000073d0  69 74 20 6a 75 73 74 20  62 69 74 2d 72 65 76 65  |it just bit-reve|
000073e0  72 73 65 73 20 74 68 65  20 69 6e 66 6f 72 6d 61  |rses the informa|
000073f0  74 69 6f 6e 20 72 65 61  64 0a 62 79 20 4f 53 5f  |tion read.by OS_|
00007400  57 6f 72 64 2c 31 30 2e  20 49 74 20 6f 6e 6c 79  |Word,10. It only|
00007410  20 72 65 61 64 73 20 63  68 61 72 61 63 74 65 72  | reads character|
00007420  73 20 26 32 30 2d 26 46  46 2c 20 6c 65 61 76 69  |s &20-&FF, leavi|
00007430  6e 67 20 30 2d 26 31 46  20 75 6e 74 6f 75 63 68  |ng 0-&1F untouch|
00007440  65 64 2e 20 54 68 65 0a  62 69 74 20 72 65 76 65  |ed. The.bit reve|
00007450  72 73 69 6e 67 20 69 73  20 64 6f 6e 65 20 65 66  |rsing is done ef|
00007460  66 69 63 69 65 6e 74 6c  79 20 73 6f 20 74 68 69  |ficiently so thi|
00007470  73 20 63 61 6c 6c 20 69  73 20 66 61 69 72 6c 79  |s call is fairly|
00007480  20 66 61 73 74 2e 0a 0a  20 45 6e 74 72 79 3a 09  | fast... Entry:.|
00007490  09 52 30 3d 62 75 66 66  65 72 20 66 6f 72 20 62  |.R0=buffer for b|
000074a0  69 74 6d 61 70 20 28 73  69 7a 65 20 38 2a 32 35  |itmap (size 8*25|
000074b0  36 3d 26 38 30 30 3d 32  6b 29 0a 20 09 09 52 31  |6=&800=2k). ..R1|
000074c0  3d 72 65 64 72 61 77 20  62 6c 6f 63 6b 2e 20 72  |=redraw block. r|
000074d0  5f 77 6f 72 6b 61 72 65  61 20 6d 75 73 74 20 62  |_workarea must b|
000074e0  65 20 61 20 31 36 20 62  79 74 65 20 77 6f 72 6b  |e a 16 byte work|
000074f0  20 61 72 65 61 2e 0a 20  09 09 0a 20 45 78 69 74  | area.. ... Exit|
00007500  3a 09 09 52 30 20 61 6e  64 20 66 6c 61 67 73 20  |:..R0 and flags |
00007510  63 6f 72 72 75 70 74 65  64 2e 0a 0a 5a 61 70 52  |corrupted...ZapR|
00007520  65 64 72 61 77 5f 52 65  76 65 72 73 65 42 69 74  |edraw_ReverseBit|
00007530  6d 61 70 73 20 28 2b 26  30 44 29 0a 2d 2d 2d 2d  |maps (+&0D).----|
00007540  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00007550  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 54 68 69  |-----------..Thi|
00007560  73 20 53 57 49 20 74 61  6b 65 73 20 61 20 6c 69  |s SWI takes a li|
00007570  73 74 20 6f 66 20 62 79  74 65 73 20 61 6e 64 20  |st of bytes and |
00007580  72 65 76 65 72 73 65 73  20 74 68 65 20 62 69 74  |reverses the bit|
00007590  73 20 6f 66 20 65 61 63  68 20 62 79 74 65 2e 20  |s of each byte. |
000075a0  54 68 69 73 20 69 73 0a  75 73 65 66 75 6c 20 66  |This is.useful f|
000075b0  6f 72 20 72 65 76 65 72  73 69 6e 67 20 74 68 65  |or reversing the|
000075c0  20 62 69 74 6d 61 70 73  20 28 66 6c 69 70 70 69  | bitmaps (flippi|
000075d0  6e 67 20 61 62 6f 75 74  20 74 68 65 20 79 20 61  |ng about the y a|
000075e0  78 69 73 29 20 6f 66 20  38 2a 38 20 70 69 78 65  |xis) of 8*8 pixe|
000075f0  6c 0a 63 68 61 72 61 63  74 65 72 73 20 61 74 20  |l.characters at |
00007600  6f 6e 65 20 62 69 74 20  70 65 72 20 70 69 78 65  |one bit per pixe|
00007610  6c 20 28 69 65 20 72 5f  63 62 70 6c 3d 31 20 72  |l (ie r_cbpl=1 r|
00007620  5f 63 62 70 63 3d 38 29  2e 0a 0a 20 45 6e 74 72  |_cbpc=8)... Entr|
00007630  79 3a 09 09 52 31 3d 73  6f 75 72 63 65 20 62 75  |y:..R1=source bu|
00007640  66 66 65 72 0a 20 09 09  52 32 3d 64 65 73 74 69  |ffer. ..R2=desti|
00007650  6e 61 74 69 6f 6e 20 62  75 66 66 65 72 20 28 63  |nation buffer (c|
00007660  61 6e 20 65 71 75 61 6c  20 73 6f 75 72 63 65 29  |an equal source)|
00007670  0a 20 09 09 52 33 3d 6e  75 6d 62 65 72 20 6f 66  |. ..R3=number of|
00007680  20 62 79 74 65 73 20 28  6d 75 73 74 20 62 65 20  | bytes (must be |
00007690  61 20 6d 75 6c 74 69 70  6c 65 20 6f 66 20 34 29  |a multiple of 4)|
000076a0  0a 20 0a 20 45 78 69 74  3a 09 09 52 30 20 61 6e  |. . Exit:..R0 an|
000076b0  64 20 66 6c 61 67 73 20  63 6f 72 72 75 70 74 65  |d flags corrupte|
000076c0  64 2e 0a 0a 5a 61 70 52  65 64 72 61 77 5f 52 65  |d...ZapRedraw_Re|
000076d0  61 64 56 64 75 56 61 72  73 20 28 2b 26 30 45 29  |adVduVars (+&0E)|
000076e0  0a 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.---------------|
000076f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 0a 54  |-------------..T|
00007700  68 69 73 20 53 57 49 20  69 73 20 75 73 65 64 20  |his SWI is used |
00007710  74 6f 20 73 65 74 20 75  70 20 74 68 65 20 5a 61  |to set up the Za|
00007720  70 20 72 65 64 72 61 77  20 62 6c 6f 63 6b 20 69  |p redraw block i|
00007730  6e 69 74 69 61 6c 6c 79  2e 20 49 74 20 70 75 74  |nitially. It put|
00007740  73 20 74 68 65 20 76 61  6c 75 65 0a 30 20 69 6e  |s the value.0 in|
00007750  20 72 5f 73 63 72 65 65  6e 20 73 6f 20 74 68 65  | r_screen so the|
00007760  20 61 63 74 75 61 6c 20  73 63 72 65 65 6e 20 61  | actual screen a|
00007770  64 64 72 65 73 73 20 69  73 20 75 73 65 64 20 77  |ddress is used w|
00007780  68 65 6e 20 5a 61 70 52  65 64 72 61 77 5f 52 65  |hen ZapRedraw_Re|
00007790  64 72 61 77 41 72 65 61  0a 69 73 20 63 61 6c 6c  |drawArea.is call|
000077a0  65 64 20 28 74 68 69 73  20 63 61 6e 20 63 68 61  |ed (this can cha|
000077b0  6e 67 65 20 71 75 69 74  65 20 6f 66 74 65 6e 29  |nge quite often)|
000077c0  20 61 6e 64 20 66 69 6c  6c 73 20 69 6e 20 72 5f  | and fills in r_|
000077d0  62 70 6c 2c 20 72 5f 62  70 70 2c 20 72 5f 6d 61  |bpl, r_bpp, r_ma|
000077e0  67 78 2c 0a 72 5f 6d 61  67 79 2c 20 72 5f 78 73  |gx,.r_magy, r_xs|
000077f0  69 7a 65 2c 20 72 5f 79  73 69 7a 65 20 62 79 20  |ize, r_ysize by |
00007800  75 73 69 6e 67 20 74 68  65 20 63 61 6c 6c 20 4f  |using the call O|
00007810  53 5f 52 65 61 64 56 64  75 56 61 72 69 61 62 6c  |S_ReadVduVariabl|
00007820  65 73 2e 20 49 74 20 61  6c 73 6f 20 66 69 6c 6c  |es. It also fill|
00007830  73 0a 69 6e 20 72 5f 6d  6f 64 65 20 62 79 20 75  |s.in r_mode by u|
00007840  73 69 6e 67 20 4f 53 5f  42 79 74 65 20 31 33 35  |sing OS_Byte 135|
00007850  2e 20 54 68 69 73 20 63  61 6c 6c 20 73 68 6f 75  |. This call shou|
00007860  6c 64 20 62 65 20 6d 61  64 65 20 61 66 74 65 72  |ld be made after|
00007870  20 61 6e 79 20 6d 6f 64  65 0a 63 68 61 6e 67 65  | any mode.change|
00007880  2e 20 43 6f 6d 70 65 6e  73 61 74 69 6f 6e 20 69  |. Compensation i|
00007890  73 20 6d 61 64 65 20 66  6f 72 20 64 6f 75 62 6c  |s made for doubl|
000078a0  65 20 70 69 78 65 6c 20  6d 6f 64 65 73 20 62 79  |e pixel modes by|
000078b0  20 64 65 63 72 65 61 73  69 6e 67 20 72 5f 6d 61  | decreasing r_ma|
000078c0  67 78 2e 20 41 0a 70 69  78 65 6c 20 69 6e 20 5a  |gx. A.pixel in Z|
000078d0  61 70 20 6d 65 61 6e 73  20 61 20 68 61 72 64 77  |ap means a hardw|
000078e0  61 72 65 20 70 69 78 65  6c 20 72 61 74 68 65 72  |are pixel rather|
000078f0  20 74 68 61 6e 20 61 6e  20 65 6d 75 6c 61 74 65  | than an emulate|
00007900  64 20 64 6f 75 62 6c 65  20 70 69 78 65 6c 2e 0a  |d double pixel..|
00007910  0a 20 45 6e 74 72 79 3a  09 09 52 31 3d 72 65 64  |. Entry:..R1=red|
00007920  72 61 77 20 62 6c 6f 63  6b 20 74 6f 20 75 70 64  |raw block to upd|
00007930  61 74 65 0a 20 09 09 20  20 20 72 5f 77 6f 72 6b  |ate. ..   r_work|
00007940  61 72 65 61 20 73 68 6f  75 6c 64 20 70 6f 69 6e  |area should poin|
00007950  74 20 74 6f 20 61 20 36  34 20 62 79 74 65 20 73  |t to a 64 byte s|
00007960  63 72 61 74 63 68 20 61  72 65 61 2e 0a 20 0a 20  |cratch area.. . |
00007970  45 78 69 74 3a 09 09 52  30 20 61 6e 64 20 66 6c  |Exit:..R0 and fl|
00007980  61 67 73 20 63 6f 72 72  75 70 74 65 64 2e 0a 0a  |ags corrupted...|
00007990  5a 61 70 52 65 64 72 61  77 5f 47 65 74 52 65 63  |ZapRedraw_GetRec|
000079a0  74 61 6e 67 6c 65 20 28  2b 26 30 46 29 0a 2d 2d  |tangle (+&0F).--|
000079b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000079c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 54 68 69  |-----------..Thi|
000079d0  73 20 53 57 49 20 73 68  6f 75 6c 64 20 62 65 20  |s SWI should be |
000079e0  75 73 65 64 20 61 66 74  65 72 20 63 61 6c 6c 73  |used after calls|
000079f0  20 74 6f 20 57 69 6d 70  5f 47 65 74 52 65 63 74  | to Wimp_GetRect|
00007a00  61 6e 67 6c 65 2e 20 49  74 20 74 61 6b 65 73 20  |angle. It takes |
00007a10  74 68 65 20 72 65 64 72  61 77 0a 72 65 63 74 61  |the redraw.recta|
00007a20  6e 67 6c 65 20 62 6c 6f  63 6b 20 61 73 20 72 65  |ngle block as re|
00007a30  74 75 72 6e 65 64 20 62  79 20 57 69 6d 70 5f 52  |turned by Wimp_R|
00007a40  65 64 72 61 77 57 69 6e  64 6f 77 20 6f 72 20 57  |edrawWindow or W|
00007a50  69 6d 70 5f 47 65 74 52  65 63 74 61 6e 67 6c 65  |imp_GetRectangle|
00007a60  20 61 6e 64 0a 75 73 65  73 20 69 74 20 74 6f 20  | and.uses it to |
00007a70  66 69 6c 6c 20 69 6e 20  74 68 65 20 5a 61 70 52  |fill in the ZapR|
00007a80  65 64 72 61 77 20 62 6c  6f 63 6b 2e 20 54 68 65  |edraw block. The|
00007a90  20 73 63 72 6f 6c 6c 20  6f 66 66 73 65 74 73 20  | scroll offsets |
00007aa0  6f 66 20 74 68 65 20 75  70 64 61 74 65 0a 72 65  |of the update.re|
00007ab0  63 74 61 6e 67 6c 65 20  61 72 65 20 69 6e 20 70  |ctangle are in p|
00007ac0  69 78 65 6c 73 2e 20 54  68 65 20 79 20 73 63 72  |ixels. The y scr|
00007ad0  6f 6c 6c 20 6f 66 66 73  65 74 20 69 73 20 74 68  |oll offset is th|
00007ae0  65 20 61 6d 6f 75 6e 74  20 27 64 6f 77 6e 27 20  |e amount 'down' |
00007af0  66 72 6f 6d 20 74 68 65  0a 77 6f 72 6b 20 61 72  |from the.work ar|
00007b00  65 61 20 6f 72 69 67 69  6e 20 28 69 6e 63 6c 75  |ea origin (inclu|
00007b10  73 69 76 65 29 2c 20 73  6f 20 6e 65 67 61 74 69  |sive), so negati|
00007b20  6e 67 20 77 69 6c 6c 20  67 65 74 20 74 68 65 20  |ng will get the |
00007b30  27 75 70 77 61 72 64 27  20 73 63 72 6f 6c 6c 0a  |'upward' scroll.|
00007b40  6f 66 66 73 65 74 20 69  6e 20 70 69 78 65 6c 73  |offset in pixels|
00007b50  20 28 65 78 63 6c 75 73  69 76 65 29 2c 20 61 6e  | (exclusive), an|
00007b60  64 20 74 68 65 20 73 68  69 66 74 69 6e 67 20 62  |d the shifting b|
00007b70  79 20 72 5f 6d 61 67 79  20 77 69 6c 6c 20 67 69  |y r_magy will gi|
00007b80  76 65 20 74 68 65 0a 6e  6f 72 6d 61 6c 20 4f 53  |ve the.normal OS|
00007b90  20 77 6f 72 6b 20 61 72  65 61 20 73 63 72 6f 6c  | work area scrol|
00007ba0  6c 20 6f 66 66 73 65 74  20 28 77 68 69 63 68 20  |l offset (which |
00007bb0  69 73 20 65 78 63 6c 75  73 69 76 65 29 2e 0a 0a  |is exclusive)...|
00007bc0  20 45 6e 74 72 79 3a 09  09 52 30 3d 62 6c 6f 63  | Entry:..R0=bloc|
00007bd0  6b 20 61 73 20 72 65 74  75 72 6e 65 64 20 62 79  |k as returned by|
00007be0  20 57 69 6d 70 5f 52 65  64 72 61 77 57 69 6e 64  | Wimp_RedrawWind|
00007bf0  6f 77 2f 57 69 6d 70 5f  47 65 74 52 65 63 74 61  |ow/Wimp_GetRecta|
00007c00  6e 67 6c 65 0a 20 09 09  20 20 20 69 65 3a 20 77  |ngle. ..   ie: w|
00007c10  69 6e 64 6f 77 20 68 61  6e 64 6c 65 2c 6d 69 6e  |indow handle,min|
00007c20  78 2c 6d 69 6e 79 2c 6d  61 78 78 2c 6d 61 78 79  |x,miny,maxx,maxy|
00007c30  2c 73 63 72 6f 6c 6c 78  2c 73 63 72 6f 6c 6c 79  |,scrollx,scrolly|
00007c40  20 65 74 63 0a 20 09 09  52 31 3d 5a 61 70 20 72  | etc. ..R1=Zap r|
00007c50  65 64 72 61 77 20 62 6c  6f 63 6b 20 77 69 74 68  |edraw block with|
00007c60  20 72 5f 6d 61 67 78 2c  72 5f 6d 61 67 79 2c 72  | r_magx,r_magy,r|
00007c70  5f 78 73 69 7a 65 2c 72  5f 79 73 69 7a 65 0a 20  |_xsize,r_ysize. |
00007c80  09 09 20 20 20 66 69 6c  6c 65 64 20 69 6e 2e 0a  |..   filled in..|
00007c90  20 0a 20 45 78 69 74 3a  09 09 72 5f 6d 69 6e 78  | . Exit:..r_minx|
00007ca0  2c 72 5f 6d 69 6e 79 2c  72 5f 6d 61 78 78 2c 72  |,r_miny,r_maxx,r|
00007cb0  5f 6d 61 78 79 2c 72 5f  73 63 72 6f 6c 6c 78 2c  |_maxy,r_scrollx,|
00007cc0  72 5f 73 63 72 6f 6c 6c  79 20 68 61 76 65 20 62  |r_scrolly have b|
00007cd0  65 65 6e 0a 20 09 09 66  69 6c 6c 65 64 20 69 6e  |een. ..filled in|
00007ce0  20 69 6e 20 74 68 65 20  72 65 64 72 61 77 20 62  | in the redraw b|
00007cf0  6c 6f 63 6b 20 70 6f 69  6e 74 65 64 20 74 6f 20  |lock pointed to |
00007d00  62 79 20 52 31 2e 0a 20  09 09 52 30 20 61 6e 64  |by R1.. ..R0 and|
00007d10  20 66 6c 61 67 73 20 63  6f 72 72 75 70 74 65 64  | flags corrupted|
00007d20  2e 0a 0a 5a 61 70 52 65  64 72 61 77 5f 41 64 64  |...ZapRedraw_Add|
00007d30  56 64 75 42 69 74 6d 61  70 73 20 28 2b 26 31 30  |VduBitmaps (+&10|
00007d40  29 0a 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |).--------------|
00007d50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00007d60  0a 0a 49 66 20 79 6f 75  20 6c 6f 6f 6b 20 61 74  |..If you look at|
00007d70  20 74 68 65 20 56 44 55  20 63 6f 64 65 73 2c 20  | the VDU codes, |
00007d80  79 6f 75 20 77 69 6c 6c  20 73 65 65 20 74 68 61  |you will see tha|
00007d90  74 20 63 68 61 72 61 63  74 65 72 73 20 30 2d 26  |t characters 0-&|
00007da0  31 46 2c 26 37 46 2c 26  31 30 30 2b 0a 61 72 65  |1F,&7F,&100+.are|
00007db0  20 74 72 65 61 74 65 64  20 73 70 65 63 69 61 6c  | treated special|
00007dc0  6c 79 20 64 75 72 69 6e  67 20 61 20 56 44 55 20  |ly during a VDU |
00007dd0  72 65 64 72 61 77 2c 20  64 72 61 77 69 6e 67 20  |redraw, drawing |
00007de0  62 6c 6f 63 6b 73 20 61  6e 64 20 73 71 75 61 72  |blocks and squar|
00007df0  65 73 2e 20 54 68 65 0a  70 75 72 70 6f 73 65 20  |es. The.purpose |
00007e00  6f 66 20 74 68 69 73 20  53 57 49 20 69 73 20 74  |of this SWI is t|
00007e10  6f 20 63 72 65 61 74 65  20 62 69 74 6d 61 70 73  |o create bitmaps|
00007e20  20 66 6f 72 20 74 68 65  73 65 20 65 78 74 72 61  | for these extra|
00007e30  20 63 68 61 72 61 63 74  65 72 73 20 66 72 6f 6d  | characters from|
00007e40  20 61 0a 73 74 61 6e 64  61 72 64 20 62 69 74 6d  | a.standard bitm|
00007e50  61 70 20 6f 66 20 74 68  65 20 6e 6f 72 6d 61 6c  |ap of the normal|
00007e60  20 63 68 61 72 61 63 74  65 72 73 2c 20 73 6f 20  | characters, so |
00007e70  79 6f 75 20 63 61 6e 20  61 6c 73 6f 20 75 73 65  |you can also use|
00007e80  20 74 68 65 73 65 20 69  6e 20 61 20 44 53 41 0a  | these in a DSA.|
00007e90  72 65 64 72 61 77 2e 20  59 6f 75 20 73 70 65 63  |redraw. You spec|
00007ea0  69 66 79 20 61 6e 20 69  6e 74 65 72 76 61 6c 20  |ify an interval |
00007eb0  6f 66 20 63 68 61 72 61  63 74 65 72 73 2c 20 61  |of characters, a|
00007ec0  6e 64 20 69 6e 20 74 68  61 74 20 69 6e 74 65 72  |nd in that inter|
00007ed0  76 61 6c 2c 20 69 74 0a  63 72 65 61 74 65 73 20  |val, it.creates |
00007ee0  62 69 74 6d 61 70 73 20  66 6f 72 20 74 68 65 20  |bitmaps for the |
00007ef0  66 6f 6c 6c 6f 77 69 6e  67 3a 0a 0a 09 26 30 30  |following:...&00|
00007f00  09 43 72 65 61 74 65 73  20 62 69 74 6d 61 70 20  |.Creates bitmap |
00007f10  66 6f 72 20 27 30 27 20  62 79 20 63 6f 70 79 69  |for '0' by copyi|
00007f20  6e 67 20 62 69 74 6d 61  70 20 26 33 30 0a 09 26  |ng bitmap &30..&|
00007f30  30 31 2d 26 31 46 20 43  72 65 61 74 65 73 20 62  |01-&1F Creates b|
00007f40  69 74 6d 61 70 20 66 6f  72 20 27 41 42 2e 2e 2e  |itmap for 'AB...|
00007f50  27 20 62 79 20 63 6f 70  79 69 6e 67 20 62 69 74  |' by copying bit|
00007f60  6d 61 70 73 20 26 34 31  2d 26 35 46 0a 09 26 37  |maps &41-&5F..&7|
00007f70  46 09 43 72 65 61 74 65  73 20 61 20 66 69 6c 6c  |F.Creates a fill|
00007f80  65 64 20 69 6e 20 73 71  75 61 72 65 2e 0a 09 26  |ed in square...&|
00007f90  31 30 30 09 54 6f 70 20  62 6f 74 74 6f 6d 20 61  |100.Top bottom a|
00007fa0  6e 64 20 6c 65 66 74 20  65 64 67 65 20 66 69 6c  |nd left edge fil|
00007fb0  6c 65 64 20 5b 0a 09 26  31 30 31 09 54 6f 70 20  |led [..&101.Top |
00007fc0  61 6e 64 20 62 6f 74 74  6f 6d 20 65 64 67 65 73  |and bottom edges|
00007fd0  0a 09 26 31 30 32 09 54  6f 70 20 62 6f 74 74 6f  |..&102.Top botto|
00007fe0  6d 20 61 6e 64 20 72 69  67 68 74 20 65 64 67 65  |m and right edge|
00007ff0  20 66 69 6c 6c 65 64 20  5d 0a 09 26 31 30 33 09  | filled ]..&103.|
00008000  45 6d 70 74 79 20 73 71  75 61 72 65 0a 09 26 31  |Empty square..&1|
00008010  30 34 09 55 6e 64 65 72  73 63 6f 72 65 20 5f 0a  |04.Underscore _.|
00008020  09 26 31 30 35 09 4c 65  66 74 20 65 64 67 65 20  |.&105.Left edge |
00008030  28 67 69 76 69 6e 67 20  61 20 62 61 72 29 0a 09  |(giving a bar)..|
00008040  26 31 30 36 2b 09 55 6e  64 65 66 69 6e 65 64 20  |&106+.Undefined |
00008050  28 63 75 72 72 65 6e 74  6c 79 20 63 6f 70 69 65  |(currently copie|
00008060  73 20 74 68 65 20 40 20  63 68 61 72 61 63 74 65  |s the @ characte|
00008070  72 29 2e 0a 09 0a 54 68  69 73 20 6d 65 61 6e 73  |r)....This means|
00008080  20 74 68 61 74 20 74 68  65 20 62 69 74 6d 61 70  | that the bitmap|
00008090  73 20 77 69 6c 6c 20 74  68 65 6e 20 62 65 20 63  |s will then be c|
000080a0  6f 6e 73 69 73 74 65 6e  74 20 77 69 74 68 20 74  |onsistent with t|
000080b0  68 65 20 56 44 55 20 63  68 61 72 61 63 74 65 72  |he VDU character|
000080c0  73 0a 6f 66 20 74 68 65  73 65 20 6e 75 6d 62 65  |s.of these numbe|
000080d0  72 73 2e 20 54 68 65 73  65 20 62 69 74 6d 61 70  |rs. These bitmap|
000080e0  73 20 61 72 65 20 61 6c  73 6f 20 75 73 65 66 75  |s are also usefu|
000080f0  6c 20 61 73 20 63 75 72  73 6f 72 73 2e 0a 0a 20  |l as cursors... |
00008100  45 6e 74 72 79 3a 20 52  31 3d 72 65 64 72 61 77  |Entry: R1=redraw|
00008110  20 62 6c 6f 63 6b 20 28  75 73 65 73 20 72 5f 63  | block (uses r_c|
00008120  68 61 72 77 20 61 6e 64  20 72 5f 63 68 61 72 68  |harw and r_charh|
00008130  20 74 6f 20 66 69 6e 64  20 74 68 65 20 63 68 61  | to find the cha|
00008140  72 20 73 69 7a 65 29 0a  20 09 20 20 20 72 5f 77  |r size). .   r_w|
00008150  6f 72 6b 61 72 65 61 20  6d 75 73 74 20 68 61 76  |orkarea must hav|
00008160  65 20 36 34 20 62 79 74  65 73 20 2b 20 72 6f 6f  |e 64 bytes + roo|
00008170  6d 20 66 6f 72 20 61 20  63 68 61 72 61 63 74 65  |m for a characte|
00008180  72 20 73 70 72 69 74 65  0a 20 09 20 20 20 28 73  |r sprite. .   (s|
00008190  65 65 20 5a 61 70 52 65  64 72 61 77 5f 53 70 72  |ee ZapRedraw_Spr|
000081a0  69 74 65 53 69 7a 65 29  20 72 65 73 65 72 76 65  |iteSize) reserve|
000081b0  64 2e 0a 20 20 20 20 20  20 20 20 52 32 3d 66 69  |d..        R2=fi|
000081c0  72 73 74 20 65 78 74 72  61 20 62 69 74 6d 61 70  |rst extra bitmap|
000081d0  20 74 6f 20 63 72 65 61  74 65 20 28 65 67 20 30  | to create (eg 0|
000081e0  29 0a 20 20 20 20 20 20  20 20 52 33 3d 6c 61 73  |).        R3=las|
000081f0  74 20 65 78 74 72 61 20  62 69 74 6d 61 70 20 74  |t extra bitmap t|
00008200  6f 20 63 72 65 61 74 65  20 28 69 6e 63 6c 75 73  |o create (inclus|
00008210  69 76 65 20 65 67 20 26  31 30 34 29 0a 20 20 20  |ive eg &104).   |
00008220  20 20 20 20 20 52 34 3d  61 64 64 72 65 73 73 20  |     R4=address |
00008230  6f 66 20 62 69 74 6d 61  70 73 20 69 6e 20 31 20  |of bitmaps in 1 |
00008240  62 69 74 20 70 65 72 20  70 69 78 65 6c 20 66 6f  |bit per pixel fo|
00008250  72 6d 2e 0a 20 20 20 20  20 20 20 20 20 20 20 28  |rm..           (|
00008260  73 70 61 63 65 20 6d 75  73 74 20 62 65 20 72 65  |space must be re|
00008270  73 65 72 76 65 64 20 66  6f 72 20 74 68 65 20 63  |served for the c|
00008280  68 61 72 61 63 74 65 72  73 20 74 6f 20 62 65 20  |haracters to be |
00008290  63 72 65 61 74 65 64 29  2e 0a 0a 20 45 78 69 74  |created)... Exit|
000082a0  3a 09 52 30 20 61 6e 64  20 66 6c 61 67 73 20 63  |:.R0 and flags c|
000082b0  6f 72 72 75 70 74 65 64  2e 0a 0a 5a 61 70 52 65  |orrupted...ZapRe|
000082c0  64 72 61 77 5f 43 61 63  68 65 46 6f 6e 74 43 68  |draw_CacheFontCh|
000082d0  61 72 73 20 28 2b 26 31  31 29 0a 2d 2d 2d 2d 2d  |ars (+&11).-----|
000082e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000082f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 0a 54 68 69 73  |----------..This|
00008300  20 53 57 49 20 74 61 6b  65 73 20 61 6e 20 61 6e  | SWI takes an an|
00008310  74 69 2d 61 6c 69 61 73  65 64 20 66 6f 6e 74 20  |ti-aliased font |
00008320  61 6e 64 20 63 61 63 68  65 73 20 61 20 72 61 6e  |and caches a ran|
00008330  67 65 20 6f 66 20 63 68  61 72 61 63 74 65 72 73  |ge of characters|
00008340  20 61 73 0a 62 69 74 6d  61 70 73 20 28 73 65 65  | as.bitmaps (see|
00008350  20 72 5f 63 61 64 64 72  29 2e 20 54 68 65 20 63  | r_caddr). The c|
00008360  61 63 68 65 69 6e 67 20  63 61 6e 20 62 65 20 64  |acheing can be d|
00008370  6f 6e 65 20 69 6e 20 61  6e 79 20 63 6f 6c 6f 75  |one in any colou|
00008380  72 73 20 6f 72 20 73 63  72 65 65 6e 0a 72 65 73  |rs or screen.res|
00008390  6f 6c 75 74 69 6f 6e 2e  20 4f 66 20 63 6f 75 72  |olution. Of cour|
000083a0  73 65 20 6f 6e 6c 79 20  74 68 6f 73 65 20 77 69  |se only those wi|
000083b0  74 68 20 66 6f 72 65 67  72 6f 75 6e 64 20 63 6f  |th foreground co|
000083c0  6c 6f 75 72 20 61 6c 6c  20 62 69 74 73 20 73 65  |lour all bits se|
000083d0  74 20 61 6e 64 0a 62 61  63 6b 67 72 6f 75 6e 64  |t and.background|
000083e0  20 63 6f 6c 6f 75 72 20  61 6c 6c 20 62 69 74 73  | colour all bits|
000083f0  20 63 6c 65 61 72 20 63  61 6e 20 62 65 20 75 73  | clear can be us|
00008400  65 64 20 64 69 72 65 63  74 6c 79 20 62 79 0a 5a  |ed directly by.Z|
00008410  61 70 52 65 64 72 61 77  5f 52 65 64 72 61 77 41  |apRedraw_RedrawA|
00008420  72 65 61 2e 20 48 6f 77  65 76 65 72 2c 20 62 79  |rea. However, by|
00008430  20 67 69 76 69 6e 67 20  61 20 66 6f 72 65 67 72  | giving a foregr|
00008440  6f 75 6e 64 20 63 6f 6c  6f 75 72 20 6d 61 73 6b  |ound colour mask|
00008450  20 6f 66 20 2d 31 20 61  6e 64 20 61 0a 62 61 63  | of -1 and a.bac|
00008460  6b 67 72 6f 75 6e 64 20  6d 61 73 6b 20 6f 66 20  |kground mask of |
00008470  30 20 61 6e 79 20 62 69  74 6d 61 70 20 63 61 6e  |0 any bitmap can|
00008480  20 62 65 20 64 72 61 77  6e 20 28 73 65 65 20 72  | be drawn (see r|
00008490  5f 63 61 64 64 72 20 65  74 63 29 2e 20 41 6e 20  |_caddr etc). An |
000084a0  68 6f 75 72 67 6c 61 73  73 0a 69 73 20 67 69 76  |hourglass.is giv|
000084b0  65 6e 20 77 69 74 68 20  74 68 65 20 25 20 61 73  |en with the % as|
000084c0  20 74 68 65 20 63 75 72  72 65 6e 74 20 63 68 61  | the current cha|
000084d0  72 61 63 74 65 72 2f 32  35 36 20 69 66 20 69 74  |racter/256 if it|
000084e0  20 74 61 6b 65 73 20 61  20 6c 6f 6e 67 20 74 69  | takes a long ti|
000084f0  6d 65 2e 0a 0a 20 45 6e  74 72 79 3a 09 52 30 3d  |me... Entry:.R0=|
00008500  72 65 61 73 6f 6e 20 63  6f 64 65 20 61 6e 64 20  |reason code and |
00008510  6f 74 68 65 72 20 72 65  67 69 73 74 65 72 73 20  |other registers |
00008520  61 73 20 62 65 6c 6f 77  2e 0a 20 09 20 20 20 20  |as below.. .    |
00008530  20 20 0a 20 20 52 30 3d  31 20 3d 3e 20 43 61 63  |  .  R0=1 => Cac|
00008540  68 65 20 66 6f 6e 74 20  69 6e 20 63 75 72 72 65  |he font in curre|
00008550  6e 74 20 77 69 6d 70 20  6d 6f 64 65 20 28 69 65  |nt wimp mode (ie|
00008560  20 77 69 6d 70 20 70 61  6c 65 74 74 65 20 75 73  | wimp palette us|
00008570  65 64 29 2e 0a 20 20 09  20 20 52 31 3d 72 65 64  |ed)..  .  R1=red|
00008580  72 61 77 20 62 6c 6f 63  6b 20 77 69 74 68 20 74  |raw block with t|
00008590  68 65 20 66 6f 6c 6c 6f  77 69 6e 67 20 73 65 74  |he following set|
000085a0  20 75 70 3a 0a 09 09 72  5f 62 70 70 20 3d 20 6e  | up:...r_bpp = n|
000085b0  75 6d 62 65 72 20 6f 66  20 62 69 74 73 20 70 65  |umber of bits pe|
000085c0  72 20 70 69 78 65 6c 20  74 6f 20 63 61 63 68 65  |r pixel to cache|
000085d0  20 61 74 0a 09 09 72 5f  63 61 64 64 72 20 3d 20  | at...r_caddr = |
000085e0  61 64 64 72 65 73 73 20  6f 66 20 63 61 63 68 65  |address of cache|
000085f0  20 77 69 74 68 20 73 70  61 63 65 20 72 65 73 65  | with space rese|
00008600  72 76 65 64 20 66 6f 72  20 74 68 65 20 63 68 61  |rved for the cha|
00008610  72 73 0a 09 09 72 5f 63  62 70 6c 2f 63 62 70 63  |rs...r_cbpl/cbpc|
00008620  2f 72 5f 63 68 61 72 77  2f 72 5f 63 68 61 72 68  |/r_charw/r_charh|
00008630  20 73 65 74 75 70 0a 09  09 72 5f 66 6f 72 2f 72  | setup...r_for/r|
00008640  5f 62 61 63 20 3d 20 6f  66 66 73 65 74 20 69 6e  |_bac = offset in|
00008650  20 72 5f 70 61 6c 65 74  74 65 20 6f 66 20 66 6f  | r_palette of fo|
00008660  72 20 61 6e 64 20 62 61  63 20 63 6f 6c 73 0a 09  |r and bac cols..|
00008670  09 72 5f 70 61 6c 65 74  74 65 20 3d 20 70 61 6c  |.r_palette = pal|
00008680  65 74 74 65 20 6f 66 20  63 6f 6c 6f 75 72 73 20  |ette of colours |
00008690  61 73 20 66 6f 72 20 56  44 55 20 72 65 64 72 61  |as for VDU redra|
000086a0  77 20 6d 6f 64 65 0a 09  09 09 20 20 20 20 28 69  |w mode....    (i|
000086b0  65 20 65 61 63 68 20 65  6e 74 72 79 20 6f 66 20  |e each entry of |
000086c0  66 6f 72 6d 20 26 42 42  47 47 52 52 78 78 29 0a  |form &BBGGRRxx).|
000086d0  09 09 72 5f 77 6f 72 6b  61 72 65 61 20 3d 20 72  |..r_workarea = r|
000086e0  6f 6f 6d 20 66 6f 72 20  36 34 20 62 79 74 65 73  |oom for 64 bytes|
000086f0  20 2b 20 73 69 6e 67 6c  65 20 73 70 72 69 74 65  | + single sprite|
00008700  0a 09 09 09 20 20 20 20  20 28 75 73 65 20 5a 61  |....     (use Za|
00008710  70 52 65 64 72 61 77 5f  53 70 72 69 74 65 53 69  |pRedraw_SpriteSi|
00008720  7a 65 29 2e 0a 09 09 72  5f 6d 6f 64 65 20 3d 20  |ze)....r_mode = |
00008730  6d 6f 64 65 20 74 6f 20  63 61 63 68 65 20 66 6f  |mode to cache fo|
00008740  6e 74 20 69 6e 20 28 69  65 20 6d 6f 64 65 20 73  |nt in (ie mode s|
00008750  70 72 69 74 65 20 64 65  66 69 6e 65 64 20 69 6e  |prite defined in|
00008760  29 2e 0a 09 20 20 52 32  3d 70 6f 69 6e 74 65 72  |)...  R2=pointer|
00008770  20 74 6f 20 66 6f 6e 74  20 6e 61 6d 65 0a 09 20  | to font name.. |
00008780  20 52 33 3d 66 6f 6e 74  20 73 69 7a 65 20 74 6f  | R3=font size to|
00008790  20 70 6c 6f 74 20 61 74  20 28 70 6f 69 6e 74 73  | plot at (points|
000087a0  29 0a 09 20 20 52 34 3d  78 20 6f 73 20 6f 66 66  |)..  R4=x os off|
000087b0  73 65 74 20 28 66 72 6f  6d 20 62 6f 74 74 6f 6d  |set (from bottom|
000087c0  20 6c 65 66 74 29 20 74  6f 20 70 6c 6f 74 20 63  | left) to plot c|
000087d0  68 61 72 61 63 74 65 72  20 69 6e 20 74 68 65 20  |haracter in the |
000087e0  62 6f 78 0a 09 20 20 52  35 3d 79 20 6f 73 20 6f  |box..  R5=y os o|
000087f0  66 66 73 65 74 20 28 66  72 6f 6d 20 62 6f 74 74  |ffset (from bott|
00008800  6f 6d 20 6c 65 66 74 29  20 74 6f 20 70 6c 6f 74  |om left) to plot|
00008810  20 63 68 61 72 61 63 74  65 72 20 69 6e 20 74 68  | character in th|
00008820  65 20 62 6f 78 0a 09 20  20 52 36 3d 66 69 72 73  |e box..  R6=firs|
00008830  74 20 63 68 61 72 61 63  74 65 72 20 74 6f 20 63  |t character to c|
00008840  61 63 68 65 20 28 30 20  63 61 63 68 65 73 20 61  |ache (0 caches a|
00008850  73 20 26 33 30 20 61 6e  64 20 31 2d 26 31 46 20  |s &30 and 1-&1F |
00008860  68 61 76 65 20 26 34 30  0a 09 20 20 20 20 20 61  |have &40..     a|
00008870  64 64 65 64 20 26 37 46  20 69 73 20 69 67 6e 6f  |dded &7F is igno|
00008880  72 65 64 29 2e 0a 09 20  20 52 37 3d 6c 61 73 74  |red)...  R7=last|
00008890  20 63 68 61 72 61 63 74  65 72 20 74 6f 20 63 61  | character to ca|
000088a0  63 68 65 20 28 69 6e 63  6c 75 73 69 76 65 29 0a  |che (inclusive).|
000088b0  0a 20 20 52 30 3d 32 20  3d 3e 20 43 61 63 68 65  |.  R0=2 => Cache|
000088c0  20 66 6f 6e 74 20 69 6e  20 6d 6f 64 65 20 30 20  | font in mode 0 |
000088d0  77 69 74 68 20 62 61 63  6b 67 72 6f 75 6e 64 20  |with background |
000088e0  30 20 61 6e 64 20 66 6f  72 65 67 72 6f 75 6e 64  |0 and foreground|
000088f0  20 31 2e 0a 09 20 20 52  31 3d 72 65 64 72 61 77  | 1...  R1=redraw|
00008900  20 62 6c 6f 63 6b 20 77  69 74 68 20 74 68 65 20  | block with the |
00008910  66 6f 6c 6c 6f 77 69 6e  67 20 73 65 74 20 75 70  |following set up|
00008920  3a 0a 09 20 20 09 72 5f  63 61 64 64 72 20 3d 20  |:..  .r_caddr = |
00008930  61 64 64 72 65 73 73 20  6f 66 20 63 61 63 68 65  |address of cache|
00008940  20 77 69 74 68 20 73 70  61 63 65 20 72 65 73 65  | with space rese|
00008950  72 76 65 64 20 66 6f 72  20 74 68 65 20 63 68 61  |rved for the cha|
00008960  72 73 0a 09 20 20 09 72  5f 63 62 70 6c 2f 63 62  |rs..  .r_cbpl/cb|
00008970  70 63 2f 72 5f 63 68 61  72 77 2f 72 5f 63 68 61  |pc/r_charw/r_cha|
00008980  72 68 20 73 65 74 75 70  0a 09 20 20 09 72 5f 77  |rh setup..  .r_w|
00008990  6f 72 6b 61 72 65 61 20  3d 20 61 73 20 66 6f 72  |orkarea = as for|
000089a0  20 52 30 3d 31 0a 09 20  20 09 72 5f 6d 61 67 78  | R0=1..  .r_magx|
000089b0  2c 72 5f 6d 61 67 79 20  66 6f 72 20 6d 6f 64 65  |,r_magy for mode|
000089c0  20 75 73 65 64 20 77 69  74 68 20 72 65 61 73 6f  | used with reaso|
000089d0  6e 20 63 6f 64 65 20 52  30 3d 31 0a 09 20 20 52  |n code R0=1..  R|
000089e0  32 2d 52 37 20 61 73 20  66 6f 72 20 72 65 61 73  |2-R7 as for reas|
000089f0  6f 6e 20 63 6f 64 65 20  52 30 3d 31 2e 0a 09 20  |on code R0=1... |
00008a00  20 46 6f 6e 74 20 73 69  7a 65 20 69 73 20 73 63  | Font size is sc|
00008a10  61 6c 65 64 20 75 70 20  62 79 20 32 5e 28 31 2d  |aled up by 2^(1-|
00008a20  72 5f 6d 61 67 78 29 20  68 6f 72 69 7a 6f 6e 74  |r_magx) horizont|
00008a30  61 6c 6c 79 20 61 6e 64  0a 09 20 20 32 5e 28 32  |ally and..  2^(2|
00008a40  2d 72 5f 6d 61 67 79 29  20 76 65 72 74 69 63 61  |-r_magy) vertica|
00008a50  6c 6c 79 20 73 6f 20 74  68 65 20 63 68 61 72 61  |lly so the chara|
00008a60  63 74 65 72 73 20 61 72  65 20 74 68 65 20 73 61  |cters are the sa|
00008a70  6d 65 20 70 69 78 65 6c  0a 09 20 20 73 69 7a 65  |me pixel..  size|
00008a80  20 61 73 20 74 68 6f 73  65 20 63 61 63 68 65 64  | as those cached|
00008a90  20 77 69 74 68 20 52 30  3d 31 2e 0a 09 20 20 0a  | with R0=1...  .|
00008aa0  20 45 78 69 74 3a 20 52  30 20 61 6e 64 20 66 6c  | Exit: R0 and fl|
00008ab0  61 67 73 20 63 6f 72 72  75 70 74 65 64 2e 0a 0a  |ags corrupted...|
00008ac0  5a 61 70 52 65 64 72 61  77 5f 53 70 72 69 74 65  |ZapRedraw_Sprite|
00008ad0  53 69 7a 65 20 28 2b 26  31 32 29 0a 2d 2d 2d 2d  |Size (+&12).----|
00008ae0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00008af0  2d 2d 2d 2d 2d 2d 2d 0a  0a 53 65 76 65 72 61 6c  |-------..Several|
00008b00  20 53 57 49 27 73 20 28  65 67 20 5a 61 70 52 65  | SWI's (eg ZapRe|
00008b10  64 72 61 77 5f 52 65 64  72 61 77 41 72 65 61 20  |draw_RedrawArea |
00008b20  2d 20 56 44 55 20 6d 6f  64 65 2c 20 5a 61 70 52  |- VDU mode, ZapR|
00008b30  65 64 72 61 77 5f 43 61  63 68 65 46 6f 6e 74 43  |edraw_CacheFontC|
00008b40  68 61 72 73 29 0a 6e 65  65 64 20 74 6f 20 63 72  |hars).need to cr|
00008b50  65 61 74 65 20 61 20 73  70 72 69 74 65 20 61 72  |eate a sprite ar|
00008b60  65 61 20 74 68 65 20 73  69 7a 65 20 6f 66 20 61  |ea the size of a|
00008b70  20 73 69 6e 67 6c 65 20  63 68 61 72 61 63 74 65  | single characte|
00008b80  72 2e 20 54 68 69 73 20  63 61 6c 6c 0a 72 65 74  |r. This call.ret|
00008b90  75 72 6e 73 20 74 68 65  20 73 69 7a 65 20 72 65  |urns the size re|
00008ba0  71 75 69 72 65 64 20 66  6f 72 20 74 68 69 73 20  |quired for this |
00008bb0  73 70 72 69 74 65 20 28  2b 70 61 6c 65 74 74 65  |sprite (+palette|
00008bc0  2b 6d 61 73 6b 2b 73 61  76 65 20 61 72 65 61 20  |+mask+save area |
00008bd0  65 74 63 29 2c 20 61 6e  64 0a 74 68 75 73 20 74  |etc), and.thus t|
00008be0  68 65 20 61 6d 6f 75 6e  74 20 6f 66 20 77 6f 72  |he amount of wor|
00008bf0  6b 61 72 65 61 20 74 68  61 74 20 73 68 6f 75 6c  |karea that shoul|
00008c00  64 20 62 65 20 72 65 73  65 72 76 65 64 2e 20 54  |d be reserved. T|
00008c10  68 65 20 73 70 72 69 74  65 20 6e 65 65 64 73 20  |he sprite needs |
00008c20  61 20 73 61 76 65 0a 61  72 65 61 20 61 73 20 69  |a save.area as i|
00008c30  74 20 61 70 70 65 61 72  73 20 74 68 61 74 20 46  |t appears that F|
00008c40  6f 6e 74 5f 50 61 69 6e  74 20 72 65 64 69 72 65  |ont_Paint redire|
00008c50  63 74 73 20 6f 75 74 70  75 74 20 74 6f 20 61 20  |cts output to a |
00008c60  73 70 72 69 74 65 20 61  6e 64 20 74 68 75 73 0a  |sprite and thus.|
00008c70  63 6f 72 72 75 70 74 73  20 74 68 65 20 67 72 61  |corrupts the gra|
00008c80  70 68 69 63 73 20 63 6f  6c 6f 75 72 73 2e 20 54  |phics colours. T|
00008c90  68 69 73 20 6d 65 61 6e  73 20 74 68 61 74 20 69  |his means that i|
00008ca0  74 20 74 61 6b 65 73 20  74 77 6f 20 70 61 73 73  |t takes two pass|
00008cb0  65 73 20 74 6f 20 72 65  61 64 0a 74 68 65 20 73  |es to read.the s|
00008cc0  69 7a 65 20 72 65 71 75  69 72 65 64 20 66 6f 72  |ize required for|
00008cd0  20 74 68 65 20 73 70 72  69 74 65 20 2d 20 74 68  | the sprite - th|
00008ce0  65 20 66 69 72 73 74 20  74 6f 20 72 65 61 64 20  |e first to read |
00008cf0  74 68 65 20 73 69 7a 65  20 66 6f 72 20 74 68 65  |the size for the|
00008d00  20 73 70 72 69 74 65 0a  61 6e 64 20 74 68 65 20  | sprite.and the |
00008d10  73 65 63 6f 6e 64 20 74  6f 20 63 72 65 61 74 65  |second to create|
00008d20  20 74 68 65 20 73 70 72  69 74 65 20 28 73 70 61  | the sprite (spa|
00008d30  63 65 20 6e 6f 77 20 72  65 73 65 72 76 65 64 20  |ce now reserved |
00008d40  66 6f 72 20 69 74 29 20  61 6e 64 20 63 61 6c 63  |for it) and calc|
00008d50  75 6c 61 74 65 0a 74 68  65 20 73 61 76 65 20 61  |ulate.the save a|
00008d60  72 65 61 20 72 65 71 75  69 72 65 64 20 76 69 61  |rea required via|
00008d70  20 4f 53 5f 53 70 72 69  74 65 4f 70 2c 36 32 2e  | OS_SpriteOp,62.|
00008d80  0a 0a 20 45 78 61 6d 70  6c 65 3a 20 53 59 53 20  |.. Example: SYS |
00008d90  22 5a 61 70 52 65 64 72  61 77 5f 53 70 72 69 74  |"ZapRedraw_Sprit|
00008da0  65 53 69 7a 65 22 2c 26  30 31 2c 72 65 64 72 61  |eSize",&01,redra|
00008db0  77 5f 62 6c 6f 63 6b 20  54 4f 20 73 69 7a 65 25  |w_block TO size%|
00008dc0  0a 20 09 20 20 50 52 4f  43 65 6e 73 75 72 65 5f  |. .  PROCensure_|
00008dd0  77 6f 72 6b 61 72 65 61  28 73 69 7a 65 25 29 0a  |workarea(size%).|
00008de0  20 09 20 20 53 59 53 20  22 5a 61 70 52 65 64 72  | .  SYS "ZapRedr|
00008df0  61 77 5f 53 70 72 69 74  65 53 69 7a 65 22 2c 26  |aw_SpriteSize",&|
00008e00  38 31 2c 72 65 64 72 61  77 5f 62 6c 6f 63 6b 20  |81,redraw_block |
00008e10  54 4f 20 73 69 7a 65 25  0a 20 09 20 20 50 52 4f  |TO size%. .  PRO|
00008e20  43 65 6e 73 75 72 65 5f  77 6f 72 6b 61 72 65 61  |Censure_workarea|
00008e30  28 73 69 7a 65 25 29 0a  20 28 4e 42 20 49 6e 20  |(size%). (NB In |
00008e40  70 72 61 63 74 69 63 65  20 74 68 65 20 53 57 49  |practice the SWI|
00008e50  20 75 73 75 61 6c 6c 79  20 72 65 71 75 69 72 65  | usually require|
00008e60  73 20 36 34 2b 73 69 7a  65 25 20 62 79 74 65 73  |s 64+size% bytes|
00008e70  20 6f 66 20 77 6f 72 6b  73 70 61 63 65 29 0a 0a  | of workspace)..|
00008e80  20 45 6e 74 72 79 3a 09  52 30 3d 72 65 61 73 6f  | Entry:.R0=reaso|
00008e90  6e 20 63 6f 64 65 0a 20  09 20 20 20 62 30 2d 62  |n code. .   b0-b|
00008ea0  36 20 31 3d 72 65 74 75  72 6e 20 73 70 72 69 74  |6 1=return sprit|
00008eb0  65 20 73 69 7a 65 20 66  6f 72 20 73 70 72 69 74  |e size for sprit|
00008ec0  65 20 69 6e 20 63 75 72  72 65 6e 74 20 6d 6f 64  |e in current mod|
00008ed0  65 20 61 6e 64 20 72 5f  62 70 70 0a 20 09 20 20  |e and r_bpp. .  |
00008ee0  20 20 20 20 20 20 20 32  3d 72 65 74 75 72 6e 20  |       2=return |
00008ef0  73 70 72 69 74 65 20 73  69 7a 65 20 66 6f 72 20  |sprite size for |
00008f00  61 20 6d 6f 64 65 20 30  20 73 70 72 69 74 65 20  |a mode 0 sprite |
00008f10  28 69 65 20 61 73 73 75  6d 65 20 72 5f 62 70 70  |(ie assume r_bpp|
00008f20  3d 30 29 0a 20 09 20 20  20 62 37 20 20 20 20 43  |=0). .   b7    C|
00008f30  6c 65 61 72 20 66 6f 72  20 66 69 72 73 74 20 70  |lear for first p|
00008f40  61 73 73 2c 20 73 65 74  20 66 6f 72 20 73 65 63  |ass, set for sec|
00008f50  6f 6e 64 20 70 61 73 73  2e 0a 20 09 52 31 3d 72  |ond pass.. .R1=r|
00008f60  65 64 72 61 77 20 62 6c  6f 63 6b 20 77 69 74 68  |edraw block with|
00008f70  20 72 5f 62 70 70 2c 72  5f 63 68 61 72 77 2c 72  | r_bpp,r_charw,r|
00008f80  5f 63 68 61 72 68 20 73  65 74 75 70 2e 0a 20 09  |_charh setup.. .|
00008f90  20 20 20 4f 6e 20 74 68  65 20 73 65 63 6f 6e 64  |   On the second|
00008fa0  20 70 61 73 73 20 72 5f  77 6f 72 6b 61 72 65 61  | pass r_workarea|
00008fb0  20 6d 75 73 74 20 62 65  20 61 74 20 6c 65 61 73  | must be at leas|
00008fc0  74 20 74 68 65 20 73 69  7a 65 20 72 65 74 75 72  |t the size retur|
00008fd0  6e 65 64 0a 20 09 20 20  20 62 79 20 74 68 65 20  |ned. .   by the |
00008fe0  66 69 72 73 74 20 70 61  73 73 2e 0a 20 09 0a 20  |first pass.. .. |
00008ff0  45 78 69 74 3a 20 20 4f  6e 20 66 69 72 73 74 20  |Exit:  On first |
00009000  70 61 73 73 20 3a 20 52  30 3d 73 69 7a 65 20 72  |pass : R0=size r|
00009010  65 71 75 69 72 65 64 20  66 6f 72 20 73 70 72 69  |equired for spri|
00009020  74 65 20 61 72 65 61 20  28 6e 6f 20 73 61 76 65  |te area (no save|
00009030  20 61 72 65 61 29 2e 0a  20 09 4f 6e 20 73 65 63  | area).. .On sec|
00009040  6f 6e 64 20 70 61 73 73  3a 20 52 30 3d 74 6f 74  |ond pass: R0=tot|
00009050  61 6c 20 73 69 7a 65 20  72 65 71 75 69 72 65 64  |al size required|
00009060  20 66 6f 72 20 73 70 72  69 74 65 20 2b 20 73 61  | for sprite + sa|
00009070  76 65 20 61 72 65 61 2e  0a 0a 5a 61 70 52 65 64  |ve area...ZapRed|
00009080  72 61 77 5f 52 65 64 72  61 77 57 69 6e 64 6f 77  |raw_RedrawWindow|
00009090  20 28 2b 26 31 33 29 0a  2d 2d 2d 2d 2d 2d 2d 2d  | (+&13).--------|
000090a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000090b0  2d 2d 2d 2d 2d 0a 0a 54  68 69 73 20 53 57 49 20  |-----..This SWI |
000090c0  70 65 72 66 6f 72 6d 73  20 74 68 65 20 63 61 6c  |performs the cal|
000090d0  6c 73 20 74 6f 20 57 69  6d 70 5f 52 65 64 72 61  |ls to Wimp_Redra|
000090e0  77 57 69 6e 64 6f 77 2c  20 57 69 6d 70 5f 47 65  |wWindow, Wimp_Ge|
000090f0  74 52 65 63 74 61 6e 67  6c 65 2c 0a 5a 61 70 5f  |tRectangle,.Zap_|
00009100  47 65 74 52 65 63 74 61  6e 67 6c 65 2c 20 61 6e  |GetRectangle, an|
00009110  64 20 5a 61 70 5f 52 65  64 72 61 77 41 72 65 61  |d Zap_RedrawArea|
00009120  20 66 6f 72 20 79 6f 75  2e 20 49 74 20 61 73 73  | for you. It ass|
00009130  75 6d 65 73 20 74 68 61  74 20 74 68 65 20 72 65  |umes that the re|
00009140  64 72 61 77 0a 62 6c 6f  63 6b 20 69 73 20 61 6c  |draw.block is al|
00009150  72 65 61 64 79 20 73 65  74 75 70 2e 20 54 68 69  |ready setup. Thi|
00009160  73 20 63 61 6c 6c 20 69  73 20 65 71 75 69 76 61  |s call is equiva|
00009170  6c 65 6e 74 20 74 6f 20  74 68 65 20 62 61 73 69  |lent to the basi|
00009180  63 20 63 6f 64 65 3a 0a  09 53 59 53 20 22 57 69  |c code:..SYS "Wi|
00009190  6d 70 5f 52 65 64 72 61  77 57 69 6e 64 6f 77 22  |mp_RedrawWindow"|
000091a0  2c 2c 64 61 74 61 25 20  54 4f 20 66 6c 61 67 25  |,,data% TO flag%|
000091b0  0a 20 20 20 20 20 20 20  20 57 48 49 4c 45 20 66  |.        WHILE f|
000091c0  6c 61 67 25 0a 20 20 20  20 20 20 20 20 20 53 59  |lag%.         SY|
000091d0  53 20 22 5a 61 70 52 65  64 72 61 77 5f 47 65 74  |S "ZapRedraw_Get|
000091e0  52 65 63 74 61 6e 67 6c  65 22 2c 64 61 74 61 25  |Rectangle",data%|
000091f0  2c 72 65 64 72 61 77 25  0a 20 20 20 20 20 20 20  |,redraw%.       |
00009200  20 20 53 59 53 20 22 5a  61 70 52 65 64 72 61 77  |  SYS "ZapRedraw|
00009210  5f 52 65 64 72 61 77 41  72 65 61 22 2c 2c 72 65  |_RedrawArea",,re|
00009220  64 72 61 77 25 0a 20 20  20 20 20 20 20 20 20 53  |draw%.         S|
00009230  59 53 20 22 57 69 6d 70  5f 47 65 74 52 65 63 74  |YS "Wimp_GetRect|
00009240  61 6e 67 6c 65 22 2c 2c  64 61 74 61 25 20 54 4f  |angle",,data% TO|
00009250  20 66 6c 61 67 25 0a 20  20 20 20 20 20 20 20 45  | flag%.        E|
00009260  4e 44 57 48 49 4c 45 0a  77 68 65 72 65 20 72 65  |NDWHILE.where re|
00009270  64 72 61 77 25 20 69 73  20 74 68 65 20 61 64 64  |draw% is the add|
00009280  72 65 73 73 20 6f 66 20  74 68 65 20 72 65 64 72  |ress of the redr|
00009290  61 77 20 62 6c 6f 63 6b  20 61 6e 64 20 64 61 74  |aw block and dat|
000092a0  61 25 20 74 68 65 20 64  61 74 61 20 62 6c 6f 63  |a% the data bloc|
000092b0  6b 0a 72 65 74 75 72 6e  65 64 20 62 79 20 57 69  |k.returned by Wi|
000092c0  6d 70 5f 50 6f 6c 6c 20  66 6f 72 20 65 76 65 6e  |mp_Poll for even|
000092d0  74 20 31 20 28 72 65 64  72 61 77 20 77 69 6e 64  |t 1 (redraw wind|
000092e0  6f 77 20 72 65 71 75 65  73 74 29 2e 0a 0a 20 45  |ow request)... E|
000092f0  6e 74 72 79 3a 09 52 30  3d 52 65 64 72 61 77 20  |ntry:.R0=Redraw |
00009300  62 6c 6f 63 6b 20 61 73  20 72 65 74 75 72 6e 65  |block as returne|
00009310  64 20 62 79 20 57 69 6d  70 20 66 6f 72 20 57 69  |d by Wimp for Wi|
00009320  6d 70 5f 50 6f 6c 6c 20  31 20 28 64 61 74 61 25  |mp_Poll 1 (data%|
00009330  29 0a 20 09 52 31 3d 5a  61 70 20 72 65 64 72 61  |). .R1=Zap redra|
00009340  77 20 62 6c 6f 63 6b 20  77 69 74 68 20 72 5f 64  |w block with r_d|
00009350  61 74 61 20 63 6f 6e 74  61 69 6e 69 6e 67 20 74  |ata containing t|
00009360  68 65 20 74 65 78 74 20  74 6f 20 72 65 64 72 61  |he text to redra|
00009370  77 2e 20 41 6c 6c 0a 20  09 20 20 20 6f 66 20 74  |w. All. .   of t|
00009380  68 65 20 62 6c 6f 63 6b  20 73 68 6f 75 6c 64 20  |he block should |
00009390  62 65 20 73 65 74 75 70  20 61 70 61 72 74 20 66  |be setup apart f|
000093a0  72 6f 6d 20 72 65 63 74  61 6e 67 6c 65 20 74 6f  |rom rectangle to|
000093b0  20 64 72 61 77 0a 20 09  20 20 20 61 6e 64 20 74  | draw. .   and t|
000093c0  68 65 20 73 63 72 6f 6c  6c 20 6f 66 66 73 65 74  |he scroll offset|
000093d0  73 20 77 68 69 63 68 20  61 72 65 20 66 69 6c 6c  |s which are fill|
000093e0  65 64 20 69 6e 20 66 6f  72 20 79 6f 75 2e 0a 20  |ed in for you.. |
000093f0  09 20 20 20 0a 20 45 78  69 74 3a 09 52 30 20 61  |.   . Exit:.R0 a|
00009400  6e 64 20 66 6c 61 67 73  20 63 6f 72 72 75 70 74  |nd flags corrupt|
00009410  65 64 2e 0a                                       |ed..|
00009414