funkheld Wrote:hello, thanks for the help.
maybe you can explain the complicated stuff about the characters to me?
at 76 I still want to learn something new.
(you have to set CHARS ROM var to the address of your data minus 256)
zx-basic can asm.
thanks.
greetings
ZX Spectrum ROM uses some variables (System Variables, see https://skoolkid.github.io/rom/buffers/sysvars.html).
The variable CHARS (at position 23606, UInteger) points to the ROM charset used to print the text font. You can change this to point to another location and use our own font (or custom graphics) the same way as UDG. The only difference is that CHARS points to the position minus 256.
Also, unlike UDG, you need to reserve a block of memory to store these new fonts, and you can use an array of Ubytes for that. For example:
Code:
DIM chars_ptr As UInteger AT 23606: REM declares a variable mapped to CHARS
DIM original_value As Uinteger
REM declare 5 characters (8 bytes each)
DIM graphic_data(5 * 8) => {
254, 0, 0, 254, ... _
253, 0, 0, 253, ... _
...
}
LET original_value = chars_ptr: REM save original value, which should be 15360
LET chars_ptr = @graphics_data(0) - 256: REM new position of the 1st char minus 256
PRINT PAPER 1; INK 6;" ": REM printing a space now prints the 1st character of the new charset
LET chars_ptr = original_value : REM restore ROM value to use normal charset font
PRINT PAPER 1; INK 6; " ": REM should print a SPACE now
---
Boriel
Boriel