Modifying ROM font on the fly

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
R-Tape
Site Admin
Posts: 2588
Joined: Thu Nov 09, 2017 11:46 am

Modifying ROM font on the fly

Post by R-Tape » Sun Aug 04, 2019 4:20 pm

Even though it's rare that there isn't enough memory to store a custom font in RAM, I like the idea of making the ROM font look better on the fly. The best known method must be using RRA and OR to make the font bold, I tweaked it slightly by only bolding the left hand side (RRA > AND 240 > OR (hl). Here's the result:

Image

As usual the lower case 'm' and 'w' look dodgy, but overall I think it looks pretty good.

Any more?
4 x

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

Re: Modifying ROM font on the fly

Post by Fahnn » Sun Aug 04, 2019 8:36 pm

I have a question, is the bold font one

33, 0, 61, 17, 57, 252, 1, 0, 3, 126, 203, 47, 182, 18, 19, 35, 11, 121, 176, 32, 244, 33, 57, 251, 34, 54, 92, 201

?

I used to use that in all my games at 65338, to fit (as I thought) directly below the UDGs but it did create some weirdness especially if a BASIC program more or less filled the memory. I'm sure I was doing it wrong. The more I read here, the more I realise that I didn't really know what I was doing :lol:
0 x

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

Re: Modifying ROM font on the fly

Post by R-Tape » Sun Aug 04, 2019 9:14 pm

Fahnn wrote:
Sun Aug 04, 2019 8:36 pm
I have a question, is the bold font one

33, 0, 61, 17, 57, 252, 1, 0, 3, 126, 203, 47, 182, 18, 19, 35, 11, 121, 176, 32, 244, 33, 57, 251, 34, 54, 92, 201
Yep that will make a bold font. Where did you get it from?
I used to use that in all my games at 65338, to fit (as I thought) directly below the UDGs but it did create some weirdness especially if a BASIC program more or less filled the memory. I'm sure I was doing it wrong. The more I read here, the more I realise that I didn't really know what I was doing :lol:
Do you mean 65368? That's where the UDGs start, but from a fresh reset the stack is at 65334, so you'd need to be below that (say 256 bytes?) to be safe. Are these pre-published days btw? Your games only show custom or ROM font.
0 x

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

Re: Modifying ROM font on the fly

Post by Fahnn » Sun Aug 04, 2019 11:38 pm

R-Tape wrote:
Sun Aug 04, 2019 9:14 pm
Fahnn wrote:
Sun Aug 04, 2019 8:36 pm
I have a question, is the bold font one

33, 0, 61, 17, 57, 252, 1, 0, 3, 126, 203, 47, 182, 18, 19, 35, 11, 121, 176, 32, 244, 33, 57, 251, 34, 54, 92, 201
Yep that will make a bold font. Where did you get it from?
I used to use that in all my games at 65338, to fit (as I thought) directly below the UDGs but it did create some weirdness especially if a BASIC program more or less filled the memory. I'm sure I was doing it wrong. The more I read here, the more I realise that I didn't really know what I was doing :lol:
Do you mean 65368? That's where the UDGs start, but from a fresh reset the stack is at 65334, so you'd need to be below that (say 256 bytes?) to be safe. Are these pre-published days btw? Your games only show custom or ROM font.

Honestly I don't remember. It would have been from some type-in program in a magazine, I think. Certainly I didn't come up with it myself. But when going through my tapes of the awful old stuff I'd written, a lot of it would have something like this in it, usually in the loader:

Image

It worked fine for most things but I never really knew why. I started off using it for the Trine Michelson game but like I said, that game filled the BASIC memory and certain weirdnesses started to happen, so I ditched it. As I said, I really don't know what I'm doing most of the time.
1 x

User avatar
ZXDunny
Manic Miner
Posts: 250
Joined: Tue Nov 14, 2017 3:45 pm

Re: Modifying ROM font on the fly

Post by ZXDunny » Mon Aug 05, 2019 9:56 am

This reminds me of a book I had when I was a kid - there was as short(ish) stub of code that made the system font appear handwritten. I wish I could remember which book it was.
0 x

User avatar
PQR
Berk
Posts: 26
Joined: Sat May 12, 2018 10:35 am
Contact:

Re: Modifying ROM font on the fly

Post by PQR » Mon Aug 05, 2019 11:14 am

The October ’85 issue of Computer + Video Games has a type-in for a game called Moon Buggy.
Line 120 of that program contains almost exactly the same code for making a bold version of the ROM font:

Image

Here is the whole listing (Thank you archive.org!)

How do I remember? I typed the whole thing in myself and still have a copy on my computer. :lol:
2 x

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

Re: Modifying ROM font on the fly

Post by spider » Mon Aug 05, 2019 2:12 pm

I used that listing too a while back.

IIRC there was YS type-in game (I can see the game in my head just about) called Time-Bomb that would 'thicken' the font too, similar thing. Seem to recall actually that was also known as something else a few months later.
0 x

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

Re: Modifying ROM font on the fly

Post by Fahnn » Mon Aug 05, 2019 4:17 pm

One thing that I did notice when I was writing the porn game - even after ditching the font routine - is that once the program got too big, it started overwriting the UDG area. I never had any intention of using UDGs in the game so I figured that it shouldn't matter as long as I didn't go too far. But it did create some really interesting effects as the UDGs would redefine themselves with pretty much every keypress. I wonder if this could be exploited to create pseudo-random backgrounds that change in what might look like an organic way?
0 x

User avatar
PQR
Berk
Posts: 26
Joined: Sat May 12, 2018 10:35 am
Contact:

Re: Modifying ROM font on the fly

Post by PQR » Tue Aug 06, 2019 9:19 am

spider wrote:
Mon Aug 05, 2019 2:12 pm
I used that listing too a while back.

IIRC there was YS type-in game (I can see the game in my head just about) called Time-Bomb that would 'thicken' the font too, similar thing. Seem to recall actually that was also known as something else a few months later.
Indeed. Time Bomb was in the November ’86 issue of Your Sinclair. It used pure Basic to create a bold font.
Check out lines 700-715

(Yeah. I typed that one in too.)
0 x

catmeows
Berk
Posts: 37
Joined: Tue May 28, 2019 11:02 am

Re: Modifying ROM font on the fly

Post by catmeows » Tue Aug 06, 2019 6:01 pm

R-Tape wrote:
Sun Aug 04, 2019 4:20 pm
Even though it's rare that there isn't enough memory to store a custom font in RAM, I like the idea of making the ROM font look better on the fly. The best known method must be using RRA and OR to make the font bold, I tweaked it slightly by only bolding the left hand side (RRA > AND 240 > OR (hl). Here's the result:
Do RRA/OR twice :) Didaktik has bold font in ROM and the notorious -make bold fount routine- produced quite interesting result.
0 x

Post Reply