home *** CD-ROM | disk | FTP | other *** search
/ Futura 21 / Futura_Issue_21_1997_NOSAUG_Side_A_BASIC.atr / string.doc < prev    next >
Text File  |  2023-02-26  |  4KB  |  1 lines

  1. ¢CHARACTER SETS - IN AN INSTANT¢¢by Alan Hitchen¢¢¢Ed. The programs which accompany this article can be found on Side B:¢¢ROSETTA.COM  INSTCHAR.BAS CURSIVE.LST¢CONVERT.BAS  OUTLINE.LST  LOADER.LST¢DISPLAY.BAS  FUTURE.LST   DISPLAY.COM¢¢¢    Usually you will find that most Basic programs load new character sets in from a data table, using the FOR I=0 TO 1023 loop method that seems to take forever.  Disk drive users can speed things up by loading in a file using an IOCB block, but by using a character set held in a string, loading can be done in an instant.¢¢    Here's how it's done.  First find ROSETTA.COM, this is a machine code program which will take a standard nine sector font file, and create DATA statements for use in Basic as mentioned above.¢¢    Run the program without Basic and follow the prompts on the screen.  Set the start line to 200 when asked. Increments should be set to 5.  If the font file has an extender (usually .FNT), then you will have to specify this in the filename.  I suggest you give the DATA statements output file a .DTA extender.¢¢    Having got the font into DATA statements, you can now run the Basic program CONVERT.BAS to convert the DATA statements into a string.  This program will then LIST out the string data to disk.  Just give a filename for the .LST file when asked.¢¢    The .LST file created can be ENTERed into the program called DISPLAY.BAS.  This program will load the new font into memory instantly, and display a few lines in the new font. ¢¢    You can then LIST out the code and use it in your own Basic programs.¢¢    Three fonts have been included on the disk in the form of .LST files for merging into the DISPLAY program.  They are OUTLINE.LST, CURSIVE.LST and FUTURE.LST.¢¢    And there we are - instant font loads!¢¢DISPLAY .BAS is the loading program provided, which works as follows.¢¢10 DIM CC$(1024), the program must find this varible first.  If the subroutine has been added to an existing program it must be listed, entered and saved to correct the variable table.¢¢GOSUB 29000, takes you to the subroutine.  ¢¢29000 MTOP=PEEK (106)-4, location 106 holds the the size of available ram in pages (256 bytes), -4 reserves 4 pages or 1024 bytes for the new character set. A half set, punctuation, numbers and uppercase letters, as used in GR.1 & 2 needs only 2 pages.¢¢29020 POKE 106,MTOP-4, this reserves another 4 pages of memory.  This is needed to protect the character set, as a GRAPHICS or clear (? CHR$(125)) command will erase 64 bytes above ramtop, and scrolling a text window in a graphics mode will clear 800 bytes.  This protection is not needed for the XL/XE as the bug was fixed.  Simply POKE 106,MTOP.¢¢GRAPHICS 0, this graphics call is necessary to re-establish the display list and screen data below the new ramtop.¢¢29030 D=PEEK(140)+256*PEEK(141), this finds the start of the string and array table.  ¢¢R=PEEK(134)+256*PEEK(135), this finds the beginning of the variable value table.  Bytes 3 & 4 hold the address of the string in the form of the number of bytes it is from the beginning of the string and array table.¢¢29040 Q=MTOP*256-D, calculates the number of bytes from the string and array table for the new address.¢¢R1=INT(Q/256), calculates the most significant byte of the value in Q.¢¢T=Q-R1*256, calculates the least significant byte of Q.¢¢20950 POKE R+2,T: POKE R+3,R1, these pokes change the address of the string in the variable value table.  When run the program will store the string at the new address in reserved memory.¢¢31000 to 31120, the string itself, which must be added to this program.¢¢31150 POKE 756,MTOP, points the character base register to the address of the new character set, which is now ready and waiting.  A GRAPHICS or DOS call or RESET will restore 756 to the default value, so it will have to be re-poked to reactivate the new character set.  Several character sets can be stored, depending on available memory, and can be selected simply by changing the address in location 756 as required. ¢¢    The above program can also found as INSTCHAR.BAS with the SPACE font string pre-installed.¢¢    This disk also contains several font files and an IOCB loader subroutine for them called LOADER.LST.  DISPLAY.COM will allow you to view up to 7 fonts at once, use the joystick to select your choice from the menu.  ¢¢    The Create-a-Font program also supplied will allow you to edit existing fonts or make a new one.¢¢Ed. CAFONT.BAS is available from the Side A menu.¢