User Tools

Site Tools


loading_20bfont_20files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
loading_20bfont_20files [2018/03/31 13:19] – external edit 127.0.0.1loading_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://mdfs.net/Apps/Font/img/|such as these]]) as the sequences of eight bytes that define each character.\\ \\  These BFont files can be loaded to define characters, and code using VDU similar to the following is often used:\\   8x8 bitmap character definitions (called BFonts) are defined with **VDU 23** and read with OSWORD 10. They can be saved as BFont files ([[http://mdfs.net/Apps/Font/img/|such as these]]) as the sequences of eight bytes that define each character.\\ \\  These BFont files can be loaded to define characters, and code using VDU similar to the following is often used:\\ 
 +<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%
 +</code>
 \\  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%
 +</code>
 \\  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%<>0 for raw file       REM start%=0 for VDU file, start%<>0 for raw file
Line 22: Line 27:
         VDU mem%?A%         VDU mem%?A%
       NEXT A%       NEXT A%
 +</code>
 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%<>0 for raw file     REM start%=0 for VDU file, start%<>0 for raw file
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%?A%:NEXT A%     VDU mem%?A%:NEXT A%
 +</code>
 \\  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 ?mem%<>23 AND (mem% MOD 10)<>0 THEN PRINT "Not a valid BFont file"       IF (len% MOD 8)<>0 AND ?mem%<>23 AND (mem% MOD 10)<>0 THEN PRINT "Not a valid BFont file"
 +</code>
 - [[https://www.wikispaces.com/user/view/jgharston|{{jgharston}}]] [[https://www.wikispaces.com/user/view/jgharston|jgharston]] Dec 26, 2013 - [[https://www.wikispaces.com/user/view/jgharston|{{jgharston}}]] [[https://www.wikispaces.com/user/view/jgharston|jgharston]] Dec 26, 2013
loading_20bfont_20files.1522502368.txt.gz · Last modified: 2024/01/05 00:17 (external edit)