Change the charset in SAM

Play it once, SAM. For old times' sake.
Post Reply
User avatar
+3code
Manic Miner
Posts: 434
Joined: Sat Mar 19, 2022 7:40 am

Change the charset in SAM

Post by +3code »

I think someone asked previously about this, but can't find it. I'm not very used to the SAM, how is to change the charset from BASIC? Is somewhere needed two pokes pointing the adress in RAM or what?
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: Change the charset in SAM

Post by flatduckrecords »

The font (CHR$ 32 to 168) is in RAM at 0x5190 (20880) so you can load in a new font with:

Code: Select all

LOAD "font" CODE 20880
CHR$ 128-143 are displayed as block graphics unless you switch them off with:

Code: Select all

BLOCKS 0
The location of CHR$ 169-254 is set by the HUDG system variable (0x5C7D). Initially set to 0 so you get garbage ROM data if you use those chars without defining them. SAM BASIC has DPOKE so you can POKE an address in with e.g.

Code: Select all

DPOKE &5C7D,address
User avatar
TMD2003
Rick Dangerous
Posts: 2045
Joined: Fri Apr 10, 2020 9:23 am
Location: Airstrip One
Contact:

Re: Change the charset in SAM

Post by TMD2003 »

I found it could be done with the UDG function. So whereas on a Spectrum, you'd have POKE USR "a" and POKE USR "A" both altering the first line of the UDG A, on the SAM, those would change the characters a and A respectively. To change the UDG, that required POKE UDG CHR$ (whatever the code of "UDG A" was).

It's a long, tedious process, but it'd still work to change the entire character set. Then again, it's an equally long, tedious process to do it from BASIC on the Spectrum and you're better off loading in 768 bytes of code and poking CHARS to the correct value.
Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
SamC
Microbot
Posts: 168
Joined: Sun Sep 29, 2019 9:07 pm

Re: Change the charset in SAM

Post by SamC »

Here are several important values, in my 10 years old doc...
https://sam.speccy.cz/sam-coupe_keyb-char-map.pdf
dvduk
Drutt
Posts: 35
Joined: Sat Apr 08, 2023 6:29 pm

Re: Change the charset in SAM

Post by dvduk »

Thats rather handy.

BTW - that is a really useful site indeed.
Can also be found at SamstersVideos - which does occasionally update when I have time...
Post Reply