Changing Fonts in ZX Spectrum :)

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
spider
Microbot
Posts: 112
Joined: Wed May 01, 2019 9:59 am
Location: UK
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by spider » Thu Sep 26, 2019 6:22 pm

Neil48k wrote:
Thu Sep 26, 2019 6:13 pm
Thanks for all the work you’ve put into answering my question. Am I right in thinking this relates to emulators? I haven’t tried those yet. I’m using an original 48k Spectrum. I think I may have to investigate this :geek:

Thank you :D
You're welcome.

No that will work on a real machine. Just type it in and RUN it :)

Takes about a minute / minute and a half or so to 'work' as it has to 'draw' onto each character row.

At the end it will show the normal default font (or whatever was chosen at the time) then the 'new' one and leave the new one active. See POKE's provided and the SAVE if needed.

Note you can run it again to thicken the font again! But it gets very messy.

If you're stuck and can type blind then POKE 23607 , 60 and (not needed here but worth knowing) POKE 23606 , 0 should restore normality.
1 x

User avatar
spider
Microbot
Posts: 112
Joined: Wed May 01, 2019 9:59 am
Location: UK
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by spider » Fri Sep 27, 2019 9:05 am

If anything posted does not make sense or you cannot get it to work, don't struggle - just post back and someone will likely try to assist. :)
2 x

User avatar
presuminged
Berk
Posts: 11
Joined: Fri Dec 13, 2019 10:54 am
Location: Leeds
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by presuminged » Fri Dec 13, 2019 10:58 am

Newbie here, how do you calculate the value to poke 23607? For example, I am working on an AGD project with a basic loader and I'd like to use the font in the AGD code in the loader. I know that the font address is 31232. Thanks.
0 x

User avatar
R-Tape
Site Admin
Posts: 2888
Joined: Thu Nov 09, 2017 11:46 am

Re: Changing Fonts in ZX Spectrum :)

Post by R-Tape » Fri Dec 13, 2019 1:05 pm

presuminged wrote:
Fri Dec 13, 2019 10:58 am
Newbie here, how do you calculate the value to poke 23607?
Hello!

Here's how it works:

The 16bit font address is stored in memory as two 8bit bytes, at 23606 and 23607.

Here's how to work it out:

-take your font address and minus 256 from it*
-divide it by 256, put the whole number in 23607
-whatever's left goes in 23606

So if your font is at 31232

23606: 0
23607: 121

Or if your font is at 64126, then it should be this:
23606: 126
23607: 249

*this is because your first printable character is ASCII 32 (a space), so you need 23606/7 to point to 256 bytes below where your font actually is. It's 256 because each character is 8 bytes, so it's 32 x 8.
For example, I am working on an AGD project with a basic loader and I'd like to use the font in the AGD code in the loader. I know that the font address is 31232. Thanks.
Trouble there is, you'll need a loader to load the font, before your loader that loads your game uses it! (If I understand right)
0 x

User avatar
presuminged
Berk
Posts: 11
Joined: Fri Dec 13, 2019 10:54 am
Location: Leeds
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by presuminged » Fri Dec 13, 2019 5:30 pm

Thanks for the quick reply. Yes, my basic loader loads the code and then I'm going to build a menu in basic to handle things like define keys, etc. Anyway, I tried what you suggested and it works perfectly, thank you!
0 x

Post Reply