CharROM Character Set ROM ========================= J.G.Harston v1.24 16-Jun-1990 mdfs.net/Apps/Font - jgh@mdfs.net 70 Camm Street, Walkley, Sheffield S6 3TR Introduction ============ This ROM provides various different character sets that you can use to brighten up your programs, or just make things look different. It also provides commands to allow you to load and save character definitions on disk. The commands available are: Commands ======== *FONT ------------ Selects a font (characters 32 to 126). The fonts available are: 0 Standard BBC font. 1 Amstrad CPC font. 2 Spectrum font. 3 Italic font. 4 Thick font. 5 Thin font. 6 Magnetic Ink Character Recognision font. 7 Bubble font. 8 Middle Earth Role Playing font. 9 Runes. 10 Cursive font. 11 Typewriter typeface. 12 Gothic font, the kind old German newspapers used to use. 13 Cyrillic If you give a number over 13, then font 0 is selected instead. The font selected is preserved over Break. This can slow down the effect of pressing Break slightly, as the font and udc set have to be reselected, and this takes about one second to go though all the characters. *UDC ---------- Selects a group of User Defined Characters (characters 128 to 255). The UDC sets in the ROM are: 0 Standard BBC Master characters. 1 Amstrad CPC characters. 2 Spectrum/Sigma characters. 3 IBM characters. The UDC set selected is also preserved over Break. *EXPLODE (ON/OFF) ----------------- On the BBC models B and B+, the character set is by default not exploded. To be able to use all the characters, you must first explode them. *EXPLODE ON explodes the character set and re-explodes it every time the Break key is pressed, thereby permanently exploding the characters. After using *EXPLODE ON, select a font using *FONT, then press Break or type *BASIC to re-enter Basic. With the character set fully exploded you will lose 6 pages of memory. This means that PAGE will rise by &600. On the Master series or with a second processor active the character set is permanently exploded. On a Tube system, you will only get the 'Characters exploded' message on Break if CharROM is in a higher numbered socket than the DNFS ROM. Also, on a Tube system, the font is not preserved over Break because the DNFS Tube support code does a *FX20,6 which clears the definitions. On the Master computers, the character set is already fully exploded, and *EXPLODE does nothing. *NOFONT ------- This disables the CharROM, in effect unplugging it from your machine. To re-enable it, use *FX90,1. *CLOAD (/VDU) --------------------------- This allows you to load in a set of character definitions. The optional start parameter is the hex code of the character to start at. If the 'VDU' (or 'V') parameter is not given, then the file is loaded as binary in groups of eight bytes for each character. If no start character is given, then the length of the file rounded up to 256 bytes is examined. If the file length is &300 or is greater than &400 bytes then the loading starts at character 32 (20), otherwise loading starts at character 128 (80). If the 'V' parameter is given instead of a start character or the file has a load address of &FFFFF7xx (ie is file-typed to &FF7), then the file is loaded as a RISC OS BBC Font file with ten bytes per character definition, with the actual VDU 23 string in the file, so no start parameter is needed. *CSAVE (VDU) --------------------------------- This allows you to save a set of character definitions to disk. You must give the hex code of the first character and last character to be saved. If the 'VDU' (or 'V') parameter is not given, then the file is saved in binary as eight bytes for each character. If the 'V' parameter is given, the file is saved as a RISC OS BBC Font file with ten bytes per character definition, and is file-typed to &FF7 by setting the load address to &FFFFF700 and the execution address to &FFFFFFFF. This means that you can *RUN the file from ADFS, ANFS or HADFS and have it *Exec'd instead. Possible errors --------------- 133: Font not exploded - on a BBC/Electron *EXPLODE or *FX20 needed 192: Can't save file - *CSAVE couldn't save a file 214: File not found - *CLOAD couldn't load a file 220: Bad syntax - No parameters given when needed 252: Bad number - Bad numeric parameter to *CLOAD or *CSAVE *FX25 and OSBYTE 25 ------------------- On the Master and later, OSBYTE 25 will reset a block of character definitions. CharROM implements this call so the same functionality is available on the BBC and Electron. On entry: X=&00+n : set font group n to ROM, resetting characters X=&80+n : set font group n to use RAM n=0 CHR$32-CHR$255 n=4 CHR$128-CHR$159 n=1 CHR$32-CHR$63 n=5 CHR$160-CHR$191 n=2 CHR$64-CHR$95 n=6 CHR$192-CHR$223 n=3 CHR$96-CHR$127 n=7 CHR$224-CHR$255 On exit: X<&80 if implemented Unsupported calls are passed on to other ROMs. Font Support ROM ================ The Font Support ROM implements some additional font control OSBYTEs. *FX20 and OSBYTE 20 ------------------- On entry: X=&00+n : set font explosion state, resetting characters &20-&7F n=0 &80-&9F n=4 &20-&3F, &80-&FF n=1 &80-&BF n=5 &20-&5F, &80-&FF n=2 &80-&DF n=6 &20-&FF n=3 &80-&FF n>6 &20-&FF Extensions: X=&07 : reserved X=&08+n : explode full font and set font base the font base is set to X*256, eg X=&11 sets the font to occupy &1100-&17FF. On exit: X<&80 : font permanently exploded X>&7F : font explodable/implodable *FX163 and OSBYTE 163 --------------------- On entry: X=&80+n : set font control for font group n for n=1..7 Y>&07 : set font page number to Y*256, eg X=&81,Y=&08 sets font block 1 (&20-&3F) to occupy &800-&8FF. On exit: X,Y : preserved if unimplemented X<&80 : implemented OSBYTE 90 - in the CharROM ROM ============================== CharROM responds to OSBYTE 90 with a program ID of 1, and by default the ROM is disabled. To enable it, you can use *FX90,1. The ROM will re-disable itself on a power-on reset, a memory-clear reset or with *FX90,1,1. On entry: A=90 X=ID number, or zero Y=call number Y=0: Enable ROM Y=1: Disable ROM Y=255: Read ROM status On exit: A=90 X=b7-b6 ROM status, b5-b0 other specific info. Y=number of fonts held in the ROM, also the ROM's binary version number. X returns the following information: b7 ROM disabled b6 If disabled: ROM not present, if enabled: EXPLODE setting b5\ b4/ Current UDC b3\ b2 \ b1 / Current FONT b0/ Y is only readable if OSBYTE is called from the I/O processor. All ROMs respond to X=0, Y=0 on entry (ie *FX90) by displaying their ID number and their name, eg: >*FX90 6: Harston ADFS 9: Z80 BASIC When calling from a second processor using the OSBYTE call, the Y register is ignored and zero is used instead. This means that if you use a call with Y=255 to read the status, and it returns saying that the ROM was disabled, the ROM will actually have been enabled. To get round this, use something like: A%=90:X%=number:Y%=255:S%=(USR&FFF4 AND&FF00)DIV256 IF (S%AND&C0)=&80 THEN OSCLI "FX90,"+STR$(number)+",1" This will re-disable a ROM found to be actually disabled. General Notes ============= CharROM has been used the following systems without any difficulty: BBC OS 1.20 BBC B+ Master (various) with DFS, HADFS, ADFS, NFS, and 6502, Z80, PDP11 and ARM Tubes. It also works on RISC OS under !65Host. Thanks to Greg Heslington for designing some of the character sets: the MICR, merp, runes, cursive, and typewriter.