Modifying ROM font on the fly

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

Modifying ROM font on the fly

Post by R-Tape »

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?
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 »

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

Re: Modifying ROM font on the fly

Post by R-Tape »

Fahnn wrote: Sun Aug 04, 2019 9: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.
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 »

R-Tape wrote: Sun Aug 04, 2019 10:14 pm
Fahnn wrote: Sun Aug 04, 2019 9: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.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: Modifying ROM font on the fly

Post by ZXDunny »

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.
User avatar
PQR
Manic Miner
Posts: 241
Joined: Sat May 12, 2018 11:35 am
Contact:

Re: Modifying ROM font on the fly

Post by PQR »

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:
User avatar
spider
Dynamite Dan
Posts: 1088
Joined: Wed May 01, 2019 10:59 am
Location: Derby, UK
Contact:

Re: Modifying ROM font on the fly

Post by spider »

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.
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 »

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?
User avatar
PQR
Manic Miner
Posts: 241
Joined: Sat May 12, 2018 11:35 am
Contact:

Re: Modifying ROM font on the fly

Post by PQR »

spider wrote: Mon Aug 05, 2019 3: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.)
catmeows
Manic Miner
Posts: 711
Joined: Tue May 28, 2019 12:02 pm
Location: Prague

Re: Modifying ROM font on the fly

Post by catmeows »

R-Tape wrote: Sun Aug 04, 2019 5: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.
Proud owner of Didaktik M
User avatar
R-Tape
Site Admin
Posts: 6353
Joined: Thu Nov 09, 2017 11:46 am

Re: Modifying ROM font on the fly

Post by R-Tape »

catmeows wrote: Tue Aug 06, 2019 7:01 pm Do RRA/OR twice :) Didaktik has bold font in ROM and the notorious -make bold fount routine- produced quite interesting result.
Like this you mean?

Image

And here it is triple bolded.

Image

Still just about okay I think, with the usual edge case checking for the 'M' and 'W'.

And still a million times better than

Image

(with apologies to 8I08r 58UB85)
User avatar
Morkin
Bugaboo
Posts: 3251
Joined: Mon Nov 13, 2017 8:50 am
Location: Bristol, UK

Re: Modifying ROM font on the fly

Post by Morkin »

Haha... That makes me think we need a separate discussion for 'games with the worst font'... :lol:
My Speccy site: thirdharmoniser.com
Post Reply