Changing Fonts in ZX Spectrum :)

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
alban lusitanae
Drutt
Posts: 28
Joined: Fri Jun 28, 2019 1:49 pm
Location: Portugal
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by alban lusitanae »

I will use them, dont have time to write one of my own at the moment
User avatar
alban lusitanae
Drutt
Posts: 28
Joined: Fri Jun 28, 2019 1:49 pm
Location: Portugal
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by alban lusitanae »

just one question, it takes how much, 1k? I am always struggling for memory
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: Changing Fonts in ZX Spectrum :)

Post by Einar Saukas »

A complete font is 768 bytes.

If you don't need lowercase letters, then loading only characters from SPACE to Z will take 472 bytes.
Neil48k
Drutt
Posts: 4
Joined: Fri Sep 20, 2019 10:10 pm

Re: Changing Fonts in ZX Spectrum :)

Post by Neil48k »

spider wrote: Fri Jun 28, 2019 4:14 pm 1. Not really, not unless you 'write' directly to the new font location to 'build' it live. A bit like that character thickener routine that's been used in a few bits of Basic. Not unless you change it in the ROM that is. :D
I’ve been searching for a character thickening routine, but this is the only mention I’ve seen of one. Can anybody point me in the right direction? I had a routine to make text bolder back in the eighties, but that’s lost in the mists of time. I’m hoping the one mentioned is the same thing (or similar).

I’m getting back into Spectrum programming after a 30+ year break, so any help would be appreciated :)

Thanks
Neil
User avatar
Fahnn
Microbot
Posts: 135
Joined: Sun Jan 27, 2019 7:56 pm
Location: Redcar, UK
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by Fahnn »

Neil48k wrote: Thu Sep 26, 2019 4:25 pm
spider wrote: Fri Jun 28, 2019 4:14 pm 1. Not really, not unless you 'write' directly to the new font location to 'build' it live. A bit like that character thickener routine that's been used in a few bits of Basic. Not unless you change it in the ROM that is. :D
I’ve been searching for a character thickening routine, but this is the only mention I’ve seen of one. Can anybody point me in the right direction? I had a routine to make text bolder back in the eighties, but that’s lost in the mists of time. I’m hoping the one mentioned is the same thing (or similar).

I’m getting back into Spectrum programming after a 30+ year break, so any help would be appreciated :)

Thanks
Neil
Something similar to this one? Your mention of "thickening" fits the bill here. But there are plenty of people on this forum who know a lot more about this than I do, so I'm sure someone will have better help. All the best of luck with the programming though. I'm another one who's returned to it after decades and I still find it great fun.
User avatar
spider
Dynamite Dan
Posts: 1081
Joined: Wed May 01, 2019 10:59 am
Location: UK
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by spider »

Neil48k wrote: Thu Sep 26, 2019 4:25 pm
spider wrote: Fri Jun 28, 2019 4:14 pm 1. Not really, not unless you 'write' directly to the new font location to 'build' it live. A bit like that character thickener routine that's been used in a few bits of Basic. Not unless you change it in the ROM that is. :D
I’ve been searching for a character thickening routine, but this is the only mention I’ve seen of one. Can anybody point me in the right direction? I had a routine to make text bolder back in the eighties, but that’s lost in the mists of time. I’m hoping the one mentioned is the same thing (or similar).

I’m getting back into Spectrum programming after a 30+ year break, so any help would be appreciated :)

Thanks
Neil
Not mine but I modded it a tad to make it a bit more helpful! Note I could of made it a lot more effecient but it causes confusion if I type PRINT "" vs PRINT '''' as the former is " and the latter is '

1. If using standard font ignore this step and step 2
2. Load your new font in and 23606/23607 to 'enable' it. Ensure its loaded into higher memory area say above 32768 as otherwise will be overwritten
3. Ready ? Here:

Code: Select all

10 CLEAR 31600 : LET A=31744
20 FOR N=32 TO 127
30 PRINT AT 21,0;CHR$ N
40 FOR Y=7 TO 0 STEP -1
50 FOR X=6 TO 0 STEP -1
60 IF POINT (X,Y) THEN PLOT X+1,Y
70 NEXT X
80 POKE A , PEEK (22432-256*Y)
90 LET A=A+1
100 NEXT Y
110 NEXT I : CLS
120  POKE 23607,60: PRINT : FOR A=32 TO 127: PRINT CHR$ A; : NEXT A
130 POKE 23607,123 : PRINT : PRINT 
140 FOR A=32 TO 127 : PRINT CHR$ A; : NEXT A
Note I had to type that in here!

4. You can "save" the font (try LIST if needed) via SAVE " name " CODE 31744 , 768
5. POKE 23607 , 123 to enable it (at 31744) , POKE 23607 , 60 to switch to default rom one.

Tip: Just try it with the default one first. There's no check for the font in use at the time so if you have a custom one (see '2') make sure its out the way etc.

6. Enjoy!
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: Changing Fonts in ZX Spectrum :)

Post by Ast A. Moore »

Neil48k wrote: Thu Sep 26, 2019 4:25 pm I’m getting back into Spectrum programming after a 30+ year break, so any help would be appreciated :)
Not exactly what you’re looking for, but since you’re getting back to coding, you might find this interesting nevertheless.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Neil48k
Drutt
Posts: 4
Joined: Fri Sep 20, 2019 10:10 pm

Re: Changing Fonts in ZX Spectrum :)

Post by Neil48k »

Thanks to everyone who responded. I’m amazed by the quickness of your kind replies.

I think I may be using this forum a lot! :D
Neil48k
Drutt
Posts: 4
Joined: Fri Sep 20, 2019 10:10 pm

Re: Changing Fonts in ZX Spectrum :)

Post by Neil48k »

Fahnn wrote: Thu Sep 26, 2019 5:28 pm
Neil48k wrote: Thu Sep 26, 2019 4:25 pm I’ve been searching for a character thickening routine, but this is the only mention I’ve seen of one. Can anybody point me in the right direction? I had a routine to make text bolder back in the eighties, but that’s lost in the mists of time. I’m hoping the one mentioned is the same thing (or similar).

I’m getting back into Spectrum programming after a 30+ year break, so any help would be appreciated :)

Thanks
Neil
Something similar to this one? Your mention of "thickening" fits the bill here. But there are plenty of people on this forum who know a lot more about this than I do, so I'm sure someone will have better help. All the best of luck with the programming though. I'm another one who's returned to it after decades and I still find it great fun.
I think it was exactly that. The same routine I copied from a magazine back in the early eighties. Thank you so much :D
Neil48k
Drutt
Posts: 4
Joined: Fri Sep 20, 2019 10:10 pm

Re: Changing Fonts in ZX Spectrum :)

Post by Neil48k »

spider wrote: Thu Sep 26, 2019 5:43 pm
Neil48k wrote: Thu Sep 26, 2019 4:25 pm I’ve been searching for a character thickening routine, but this is the only mention I’ve seen of one. Can anybody point me in the right direction? I had a routine to make text bolder back in the eighties, but that’s lost in the mists of time. I’m hoping the one mentioned is the same thing (or similar).

I’m getting back into Spectrum programming after a 30+ year break, so any help would be appreciated :)

Thanks
Neil
Not mine but I modded it a tad to make it a bit more helpful! Note I could of made it a lot more effecient but it causes confusion if I type PRINT "" vs PRINT '''' as the former is " and the latter is '

1. If using standard font ignore this step and step 2
2. Load your new font in and 23606/23607 to 'enable' it. Ensure its loaded into higher memory area say above 32768 as otherwise will be overwritten
3. Ready ? Here:

Code: Select all

10 CLEAR 31600 : LET A=31744
20 FOR N=32 TO 127
30 PRINT AT 21,0;CHR$ N
40 FOR Y=7 TO 0 STEP -1
50 FOR X=6 TO 0 STEP -1
60 IF POINT (X,Y) THEN PLOT X+1,Y
70 NEXT X
80 POKE A , PEEK (22432-256*Y)
90 LET A=A+1
100 NEXT Y
110 NEXT I : CLS
120  POKE 23607,60: PRINT : FOR A=32 TO 127: PRINT CHR$ A; : NEXT A
130 POKE 23607,123 : PRINT : PRINT 
140 FOR A=32 TO 127 : PRINT CHR$ A; : NEXT A
Note I had to type that in here!

4. You can "save" the font (try LIST if needed) via SAVE " name " CODE 31744 , 768
5. POKE 23607 , 123 to enable it (at 31744) , POKE 23607 , 60 to switch to default rom one.

Tip: Just try it with the default one first. There's no check for the font in use at the time so if you have a custom one (see '2') make sure its out the way etc.

6. Enjoy!
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
User avatar
spider
Dynamite Dan
Posts: 1081
Joined: Wed May 01, 2019 10:59 am
Location: UK
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by spider »

Neil48k wrote: Thu Sep 26, 2019 7: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.
User avatar
spider
Dynamite Dan
Posts: 1081
Joined: Wed May 01, 2019 10:59 am
Location: UK
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by spider »

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. :)
User avatar
presuminged
Drutt
Posts: 11
Joined: Fri Dec 13, 2019 10:54 am
Location: Leeds
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by presuminged »

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.
User avatar
R-Tape
Site Admin
Posts: 6353
Joined: Thu Nov 09, 2017 11:46 am

Re: Changing Fonts in ZX Spectrum :)

Post by R-Tape »

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)
User avatar
presuminged
Drutt
Posts: 11
Joined: Fri Dec 13, 2019 10:54 am
Location: Leeds
Contact:

Re: Changing Fonts in ZX Spectrum :)

Post by presuminged »

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!
Post Reply