loading_20bfont_20files
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
loading_20bfont_20files [2018/03/31 13:19] – external edit 127.0.0.1 | loading_20bfont_20files [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
8x8 bitmap character definitions (called BFonts) are defined with **VDU 23** and read with OSWORD 10. They can be saved as BFont files ([[http:// | 8x8 bitmap character definitions (called BFonts) are defined with **VDU 23** and read with OSWORD 10. They can be saved as BFont files ([[http:// | ||
+ | <code bb4w> | ||
REM file loaded to mem% | REM file loaded to mem% | ||
FOR C%=start% TO end% | FOR C%=start% TO end% | ||
Line 9: | Line 10: | ||
NEXT B% | NEXT B% | ||
NEXT C% | NEXT C% | ||
+ | </ | ||
\\ A more efficient way to do this is to notice that the **VDU 23,C%** can be done within the loop just before every eighth byte: | \\ A more efficient way to do this is to notice that the **VDU 23,C%** can be done within the loop just before every eighth byte: | ||
+ | <code bb4w> | ||
FOR A%=0 TO len%-1 | FOR A%=0 TO len%-1 | ||
IF (A% AND 7)=0 THEN VDU 23,(A% DIV 8)+start% | IF (A% AND 7)=0 THEN VDU 23,(A% DIV 8)+start% | ||
VDU mem%?A% | VDU mem%?A% | ||
NEXT A% | NEXT A% | ||
+ | </ | ||
\\ Bitmap fonts can also be saved as streams of **VDU 23** sequences. As these include the character number that is being defined **start%** is not needed, so it can be used as a flag so the same code can read 8-byte raw BFont files and 10-byte VDU sequence BFont files: | \\ Bitmap fonts can also be saved as streams of **VDU 23** sequences. As these include the character number that is being defined **start%** is not needed, so it can be used as a flag so the same code can read 8-byte raw BFont files and 10-byte VDU sequence BFont files: | ||
+ | <code bb4w> | ||
REM BFont file loaded to mem%, length in len% | REM BFont file loaded to mem%, length in len% | ||
REM start%=0 for VDU file, start%<> | REM start%=0 for VDU file, start%<> | ||
Line 22: | Line 27: | ||
VDU mem%?A% | VDU mem%?A% | ||
NEXT A% | NEXT A% | ||
+ | </ | ||
or:\\ | or:\\ | ||
+ | <code bb4w> | ||
REM BFont file loaded to mem%, length in len% | REM BFont file loaded to mem%, length in len% | ||
REM start%=0 for VDU file, start%<> | REM start%=0 for VDU file, start%<> | ||
Line 28: | Line 35: | ||
FOR A%=0 TO len%:IF start%:IF (A% AND 7)=0:VDU 23,(A% DIV 8)+start% | FOR A%=0 TO len%:IF start%:IF (A% AND 7)=0:VDU 23,(A% DIV 8)+start% | ||
VDU mem%? | VDU mem%? | ||
+ | </ | ||
\\ If **len%** is not a whole multiple of 8 bytes with a raw BFont file, or a whole multiple of 10 bytes with a VDU BFont file then the code will end in the middle of a VDU sequence. You should test that **len%** is valid beforehand with code such as the following: | \\ If **len%** is not a whole multiple of 8 bytes with a raw BFont file, or a whole multiple of 10 bytes with a VDU BFont file then the code will end in the middle of a VDU sequence. You should test that **len%** is valid beforehand with code such as the following: | ||
+ | <code bb4w> | ||
IF (len% MOD 8)<>0 AND ? | IF (len% MOD 8)<>0 AND ? | ||
+ | </ | ||
- [[https:// | - [[https:// |
loading_20bfont_20files.1522502368.txt.gz · Last modified: 2024/01/05 00:17 (external edit)