42 Column Print Routine (BASIC extension)
-----------------------------------------
By Andy Jenkinson

A well featured PRINT addition using stream 7, allowing a 42 column font to be used within BASIC.


Instructions
------------


There are two TAP files that include everything needed, an insturction and a demonstration.


42.tap  -  a BASIC program showing how to use the PRINT #7 syntax, and the features in action. This .tap file has the files on it.
SENSE.tap  -  a demonstration of the 42 column routine, with the data (text) stored more efficiently in memory, rather than within the BASIC program.



42.tap
------

You are free to use this routine within your own BASIC program


As can be seen in the BASIC listing for the demo program (42.tap) it is relatively easy to use this within your own BASIC program.

SAVE "c" CODE 64768,768   -  saves the machine code routine needed to initialise the PRINT #7
SAVE "f" CODE 64000,768   -  saves a tidy replacement font that works well at 42 columns

These files are also found in the 42.tap file if you wish to move them directly to your own tape image.


In your own program you would load these, and initialise the routine:

Eg.

10 CLEAR 63999
20 LOAD "c" CODE 64768
30 LOAD "f" CODE 64900
40 RANDOMIZE USR 64900
50 REM Now PRINT #7 will print using the 42 column routine


The 42.tap program explains how the PRINT #7 routine can be used, with demonstrations.



SENSE.tap
---------

"A Sense Of Balance", a short story presented using the 42 column routine, but via machine code (setting up which text would be printed using basic POKES).  See listing.

A Sense Of Balance is (c) 2014, Andy Jenkinson, and was first published in the Eating My Words anthology of short fiction https://www.amazon.co.uk/Eating-My-Words-Flash-Fiction-Anthology/dp/1500110876




Using PRINT #7 Reference
------------------------
[See 42.tap demo for better illustrations of these]

PRINT #7; AT 17,35;"Hello"	Prints AT ROW (0-23), COLUMN (0-41)							Unlike AT you can print in the lowest two rows of the screen
PRINT #7; OVER 1;"-------"	OVER 1 turns ON over printing, OVER 0 must be issued to turn it off again		Unlike normal OVER this sets the OVER flag permanently, rather than just for the statement
PRINT #7; INVERSE 1;"-------"	INVERSE 1 turns ON inverse printing, INVERSE 0 must be issued to turn it off again	Unlike normal INVERSE this sets the INVERSE flag permanently, rather than just for the statement

Colour is unlike INK and PAPER in normal use

PRINT #7;INK n;"Hello"		Sets the colour printing attribute to 'n' (where n=0-255).  But see also PAPER
PRINT #7;PAPER m;"Hello"	Sets the attribute MASK that is used when printing.  It masks out which attributes are to be left alone using the following formula INK 7, PAPER 56, BRIGHT 64, FLASH 128
					PRINT #7;PAPER 56;"Hello" will NOT change the paper colour when printing.
					PRINT #7;PAPER 0;"Hello" will change ALL attributes (ink, paper, bright, flash) as set by a previous PRINT #7;INK n statement
					PRINT #7;PAPER 255;"Hello" would leave all attributes alone									

BRIGHT and FLASH are used entirely differently to normal, to set left and right limits to printing.

PRINT #7;BRIGHT 3;FLASH 21	Sets the left hand limit to be column 3, the right hand limit as column 21. This is useful when printing text in boxes. When a carriage return (CHR$ 13) is printed the position moves to the next row, ant he column defined by the BRIGHT command

Changing the behaviour of the PRINT #7 routine

POKE 64886,61			- use system font
POKE 64886,250  		- use custom font stored at 64840
POKE 64885,m:POKE 64886,n	- use custom font stored at [n*256+m]

RANDOMIZE USR 64840 		- copy system colour to attribute settings for PRINT #7		(remember you'll also need PRINT #7;PAPER 0)
RANDOMIZE USR 64849 		- copy attribute settings for PRINT #7 to system colour

Utility Machine Code Routines

RANDOMIZE USR 64801 - resets the print position to 0,0. Sets OVER and INVERSE off. Sets the print limits to the edges of the screen, and sets the attribute mask to 255 (leaves the attributes alone when printing).

RANDOMIZE USR 64786 - as ablove, and floods screen with current attribute (does NOT clear screen)

RANDOMIZE USR 64773 - as above, and DOES clear the screen

RANDOMIZE USR 64768 - as above and sets the attribute to 56 (white paper, black ink, no flash/bright).  This can be changed using POKE 64769,n

RANDOMIZE USR 64819 - prints the string stored at the address (low byte, high byte) stored in 64823/64824.  A Sense Of Balance uses this technique. The length of the string to be printed is stored in 64823/64824




			

Source Code
-----------

.asm is included.
Apologies for the sloppiness


