Posted By
PaulK on 2007-11-30 18:12:35
| Chr$ reprogramming
In the 80's I used to write basic games for the c16, i couldn't afford the plus 4 in them days. Anyway I used to change the character set so I could display my own graphics. I know I used to read in the 8 bit no. eg data 255,0,128 and so on but I cannot remember how to get the data into a chr$(), can anybody help please ?. Thanks
|
|
Posted By
Csabo on 2007-11-30 21:29:28
| Re: Chr$ reprogramming
To turn on user defined character sets, you would do this:
10 POKE DEC("FF12"), 0 : POKE DEC("FF13"), DEC("38") : REM $38 = address of character set
This will point the character generator to the $3800 - $4000 area (upper end of C16's memory, I think it's quite common). But by default, there's "garbage" there, so you will have to define the characters. From basic this would work:
20 READ C : FOR I = 0 TO 7 : READ B : POKE DEC("3800") + C * 8 + I, B : NEXT I 30 DATA 255, 1, 2, 4, 8, 16, 32, 64, 128
This would define character 255 as a slanted line. (Keep in mind that character 255 is not visible by default, it would be reverse of 127 - unless you turn on 256 chars by POKE DEC("FF07"), DEC("88") ).
Does it ring a bell? Hope it helps Another good way of getting this info would be looking around in the game archive, and checking the screenshots for basic games with custom chars. Chances are, their basic listing would show something similar to this.
|
|
Posted By
PaulK on 2007-12-01 05:37:42
| Re: Chr$ reprogramming
Thankyou very much. This info is much appreciated
|
|
Posted By
IstvanV on 2007-12-01 05:55:28
| Re: Chr$ reprogramming
Is it safe to use the end of the BASIC memory for the character set ? I would assume that the BASIC interpreter uses that area for storing strings etc., so it is likely to be overwritten on a C16. So the character set could be stored at a lower address (for example, $3000-$3800), or the end of BASIC memory pointer could be moved at the beginning of the program to prevent the overwriting:
1 POKE 51,255: POKE 52,55: POKE 53,255 2 POKE 54,55: POKE 55,255: POKE 56,55
|
|
Posted By
PaulK on 2007-12-01 06:27:34
| Re: Chr$ reprogramming
The program I am writing at the moment is on a plus 4. Its mainly texted based so I only want to change half a dozen characters. I am sure I when I use to use the C16 I never moved the memory adresses, I just use to change a few characters but its all so long ago and the grey matter is not what it used to be.
|
|
Posted By
Ulysses777 on 2007-12-01 08:01:38
| Re: Chr$ reprogramming
Storing the character set at $3800 (14336) is usually fine, provided your program isn't close to occupying 10KB.
BASIC stores variable information in the memory area starting immediately after the program listing.
|
|
Posted By
IstvanV on 2007-12-01 08:49:49
| Re: Chr$ reprogramming
Strings are allocated downwards from the end of available memory.
|
|
|