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:​\\ ​