Poking a new character set - help please

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
Jodo
Drutt
Posts: 25
Joined: Wed Apr 11, 2018 10:52 am
Location: West Yorkshire, UK

Poking a new character set - help please

Post by Jodo »

Hi all,

I'm trying to poke a new character set in BASIC and am having some trouble. I'm doing it in BasinC and all seems well in the included emulator - e.g. when I run the program A-Z are printed as the new characters as expected.

However, if I load the .tap into either Fuse or ZXSpin, the character set doesn't change although the UDG's display okay.

Am I missing something really simple here? Thanks
User avatar
Alessandro
Dynamite Dan
Posts: 1908
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: Poking a new character set - help please

Post by Alessandro »

Hi, could you please post a copy of your listing? It's hard to tell what is not going as you expect it to.

Probably you already know it, but remember that in order to employ a different character set from that stored in the Spectrum ROM, you have to POKE the CHARS system variable, located at address 23606, in order to make it point at the address in the RAM where the custom character set begins, minus 256. E.g. if the new set is stored at 49152, CHARS should contain the value 49152-256 = 48896.

Also take into account that setting a 2-byte variable in BASIC requires the syntax found in Chapter 25 of the Spectrum BASIC manual, i.e.:

Code: Select all

POKE n,v-256*INT (v/256) 
POKE n+1,INT (v/256)
where n is the address of the variable and v is the value you want to store in it.
Jodo
Drutt
Posts: 25
Joined: Wed Apr 11, 2018 10:52 am
Location: West Yorkshire, UK

Re: Poking a new character set - help please

Post by Jodo »

Thanks Alessandro, I really do appreciate the detailed reply.

I managed to muddle through and it's working. Still not sure how I got there but I'll take it :D

I'm embarrassed to admit I was trying to write over the character set direct to the ROM, doh. Thing is, it works in BasinC, not sure why. That's what threw me off for so long.

Anyway, if it saves someone else doing the same I'm happy to admit to my daft mistakes :lol:
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: Poking a new character set - help please

Post by ZXDunny »

BASin doesn't write protect the ROM in any meaningful sense.
Jodo
Drutt
Posts: 25
Joined: Wed Apr 11, 2018 10:52 am
Location: West Yorkshire, UK

Re: Poking a new character set - help please

Post by Jodo »

ZXDunny wrote: Mon Mar 11, 2019 10:38 pm BASin doesn't write protect the ROM in any meaningful sense.
Okay, that makes sense.

Thanks for BASin by the way. I'd have given up on my first project a long time ago without it.
Post Reply