*************›› FANCY FONT DISPLAY ROUTINES› ---------------------------›› For so long now people have been ›after text display routines for ›graphic modes 7 & 15. These routines ›have been provided, but they always ›use a block copy technique which uses ›a standard 8 by 8 bit character set.›› My routines throw away these ›principles and allow the programmer ›to define the individual characters ›in terms of their image, width, ›height and drop.››Example: The word 'Tie' might be ›displayed as follows››+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+›|X|X|X|X|X|X| |X| | | | | | | |›+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+›| | |X| | | | | | | | | | | | |›+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+›| | |X| | | | |X| | |X|X|X| | |›+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+›| | |X| | | | |X| |X| | | |X| |›+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+›| | |X| | | | |X| |X|X|X|X|X| |›+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+›| | |X| | | | |X| |X| | | | | |›+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+›| | |X| | | | |X| | |X|X|X|X| |›+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+››The accompanying data›to go along with the›image for the 'e' would›be as follows:››Height = 5›Width = 6›Drop = 2››Note that the gap should›be included in the width›› This produces output which is ›more pleasing to look at. It's ›difficult to do justice to this with ›words, so run the program ›"D:EGFFDR.BAS" to see what is ›possible.››HOW TO USE THE ROUTINES FROM BASIC›----------------------------------›› For ease of use, the routines are ›loaded upon booting the disk, the ›program being in an AUTORUN.SYS file. ›(Note: on the news-disk the program ›has been called FFDR.COM. It should ›be copied to a fresh disk and renamed ›AUTORUN.SYS). The code is loaded ›above DOS, then it protects itself ›from SYSTEM RESET by altering MEMLO ›and DOSINI addresses. The routines ›and example font (Taken from the ST ›game 'Paradroid 90' which inspired ›these routines) take up ^7.5K but ›this still leaves you with ^30K ›available for your BASIC program.›› There are 4 routines that you can ›use. In order to do this it is best ›that you set up the following ›variables within your program.››e.g. 10 MESSAGE=7459:REM Address› of Display routine vector.› 20 SETXY=MESSAGE+3› 30 COLOUR=SETXY+3› 40 DRWLET=COLOUR+3›› Definitions for each of these ›routines now follow:››SETXY›-----››Format : A=USR(SETXY,xpos,ypos)›Limits : xpos between 0 and 159› ypos between 0 and 191› (for graphics mode 15)› ypos between 0 and 95› (for graphics mode 7)››Desc. : this moves the current› printing position to the› coordinates (xpos,ypos).› Important note - a SETXY› must be executed before› any printing is done (i.e.› a MESSAGE or DRWLET).››COLOUR›------››Format : A=USR(COLOUR,col)›Limits : col between 0 and 3› (Although MC routine will› force any value of col to› be between 0 <-> 3 )››Desc. : Sets the output colour as› follows -›› 0 = COLOR4 (location 712)› (Background)› 1 = COLOR0 (location 708)› 2 = COLOR1 (location 709)› 3 = COLOR2 (location 710)››DRWLET›------››Format : A=USR(DRWLET,ASC("A"))› A=USR(DRWLET,char)›Limits : char between 0 and 127››Desc. : Outputs the character at› the current screen› position (which is› updated accordingly).› Spaces are always drawn› in COLOR4, leaving the› background intact.››MESSAGE›-------››Format : A=USR(MESSAGE,ADR(M$))› A=USR(MESSAGE,ADR("An› Example!"))›Limits : Last character of string› must be inverse.››Desc. : Displays the string on the› screen at the current x,y› position. The last› character of the string› must be inverse (in the› example the '!' is› inverse) in order to› denote the end of string› within the display› routine.››ROUTINES FOR USE BY THE ASSEMBLY ›PROGRAMMER ›--------------------------------------›-----›› Calling protocols are different ›within assembly language:›› SETXY -> LDX xpos› LDY ypos› JSR POSITION›› COLOUR -> LDA col› JSR SETCOL›› DRWLET -> LDA char› JSR ONELET›› MESSAGE -> LDX # >string› LDY # ' and '<' ›symbols as follows:›› # >name becomes #name/256› # Width = 6 (Remember› to include gap!)›› Remember too that in mode 7 & 15, ›each pixel is two bits wide, giving ›four possible colours. So define the ›character for colour 3, i.e. both ›bits set per pixel, as the ›draw_letter routine simply AND'S it ›with the current colour mask to ›produce the right colour. This is ›also why the image is two bytes wide, ›to allow for characters with widths ›up to 8 pixels wide.› The data image is stored in the ›source listing as follows:››1000 LG›1002 .DBYTE ›$3F00,$C0C0,$C0C0,$3FC0,$00C0,$C0C0,$3›F00›› All the characters are referenced ›in the character table (see CHRTAB - ›line 1574). This is best left alone, ›and you should use the same labels ›for your images.› All that's left to do is to store ›the height, width and drop ›information in the correct positions ›in the relevant tables. So for our ›example:›› Height = 7, Width = 6, Drop = 2›› These are stored in position 4 of ›lines 1656, 1686 and 1716 ›respectively, corresponding to the LG ›entry in CHRTAB.›› Hope that's enough for you to be ›able to do your own thing, if you ›have any queries, or just want to ›discuss programming on the 8-bit ›Atari, then write to:›› Mark Keates,› 24 Hayes Mead,› Meadowcroft,› Holbury,› Southampton,› Hampshire,› S04 1JZ,› England.››Enjoy!››(This article was re-formatted and ›edited by Dean Garraghty.), and›reprinted by THE OL' HACKERS ATARI›USERS GROUP, INC., WITH THANKS TO BOTH!›› +-+-+-+-+- END -+-+-+-+-+›