Loading custom character sets
Moderator: Moderators
Loading custom character sets
Pop quiz, you need to make a custom font for the first 6 character screen codes. What do you do?
1 poke 52, 28: poke 56, 28: clr
2 for i = 7168 to 7679:poke i,peek(i+25600): next
3 poke 36869,255
10 for l=7168 to 7175:read a:poke l,a:next
20 data 60, 66, 165, 129, 165, 153, 66, 60
30 print"{clr} @ @ @ @ "
run
of course this takes care of the first character which is the @ symbol and when run turns the @ into a , but how do you read the next 5 characters?(ABCDE)
1 free up video memory at 7168, clear it
2 move 64 characters from ROM to RAM
3 get characters from RAM now
10 7168 = @, read data for @ put into @
20 make @ =
30 SHIFT + CLR/HOME and then PRINT 4 smiley faces aka @ key
1 poke 52, 28: poke 56, 28: clr
2 for i = 7168 to 7679:poke i,peek(i+25600): next
3 poke 36869,255
10 for l=7168 to 7175:read a:poke l,a:next
20 data 60, 66, 165, 129, 165, 153, 66, 60
30 print"{clr} @ @ @ @ "
run
of course this takes care of the first character which is the @ symbol and when run turns the @ into a , but how do you read the next 5 characters?(ABCDE)
1 free up video memory at 7168, clear it
2 move 64 characters from ROM to RAM
3 get characters from RAM now
10 7168 = @, read data for @ put into @
20 make @ =
30 SHIFT + CLR/HOME and then PRINT 4 smiley faces aka @ key
ok so like i need a way to load the data into the pokes , i came up with this:
1 poke 52, 28: poke 56, 28: clr
2 for i = 7168 to 7679:poke i,peek(i+25600): next
3 poke 36869,255
20 c1=7168:c2=7168+7:c3=c2+7
30 read a,b,c
35 if a=1then : end
40 poke c1,a:poke c2,b:poke c3,c
50 c1=c1+1:c2=c2+1:c3=c3+1:goto30
60 data 0,0,0,0,0,0
65 data 0,0,0,0,0,0
70 data 0,0,0,0,0,0
75 data 0,0,0,0,0,0,1
run
but now its telling me OUT OF DATA error
those are really not 0's I just dont want you guys to know my top secret character font, you understand right ?
im so close here i can smell it
1 poke 52, 28: poke 56, 28: clr
2 for i = 7168 to 7679:poke i,peek(i+25600): next
3 poke 36869,255
20 c1=7168:c2=7168+7:c3=c2+7
30 read a,b,c
35 if a=1then : end
40 poke c1,a:poke c2,b:poke c3,c
50 c1=c1+1:c2=c2+1:c3=c3+1:goto30
60 data 0,0,0,0,0,0
65 data 0,0,0,0,0,0
70 data 0,0,0,0,0,0
75 data 0,0,0,0,0,0,1
run
but now its telling me OUT OF DATA error
those are really not 0's I just dont want you guys to know my top secret character font, you understand right ?
im so close here i can smell it
1 poke 52, 28: poke 56, 28: clr
2 for i = 7168 to 7679:poke i,peek(i+25600): next
3 poke 36869,255
20 c1=7168:c2=c1+7:c3=c2+7
25 for t = 1 to 7
30 read a,b,c
40 poke c1,a:poke c2,b:poke c3,c
50 c1=c1+1:c2=c2+1:c3=c3+1
55 next :goto 25
60 data 48,254,240,48,254,240
65 data 96,192,192,96,204,239
70 data 192,108,239,192,96,118
75 data 254,56,64,254,60,30
run
2 for i = 7168 to 7679:poke i,peek(i+25600): next
3 poke 36869,255
20 c1=7168:c2=c1+7:c3=c2+7
25 for t = 1 to 7
30 read a,b,c
40 poke c1,a:poke c2,b:poke c3,c
50 c1=c1+1:c2=c2+1:c3=c3+1
55 next :goto 25
60 data 48,254,240,48,254,240
65 data 96,192,192,96,204,239
70 data 192,108,239,192,96,118
75 data 254,56,64,254,60,30
run
this has some unusual side effects....
1 poke 52, 28: poke 56, 28: clr
2 for i = 7168 to 7679:poke i,peek(i+25600): next
3 poke 36869,255
20 c1=7168:c2=c1+7:c3=c2+7
25 for t = 1 to 7
30 read a,b,c
35 if a=1then : end
40 poke c1,a:poke c2,b:poke c3,c
50 c1=c1+1:c2=c2+1:c3=c3+1
55 next :restore:goto 25
60 data 48,254,240,48,254,240
65 data 96,192,192,96,204,239
70 data 192,108,239,192,96,118
75 data 254,56,64,254,60,30,1
run
1 poke 52, 28: poke 56, 28: clr
2 for i = 7168 to 7679:poke i,peek(i+25600): next
3 poke 36869,255
20 c1=7168:c2=c1+7:c3=c2+7
25 for t = 1 to 7
30 read a,b,c
35 if a=1then : end
40 poke c1,a:poke c2,b:poke c3,c
50 c1=c1+1:c2=c2+1:c3=c3+1
55 next :restore:goto 25
60 data 48,254,240,48,254,240
65 data 96,192,192,96,204,239
70 data 192,108,239,192,96,118
75 data 254,56,64,254,60,30,1
run
- Kweepa
- Vic 20 Scientist
- Posts: 1315
- Joined: Fri Jan 04, 2008 5:11 pm
- Location: Austin, Texas
- Occupation: Game maker
Re: Loading custom character sets
Ignore.
Last edited by Kweepa on Mon Jan 12, 2009 6:00 pm, edited 1 time in total.
- Kweepa
- Vic 20 Scientist
- Posts: 1315
- Joined: Fri Jan 04, 2008 5:11 pm
- Location: Austin, Texas
- Occupation: Game maker
Re: Loading custom character sets
Just enlarge the L loop!
Code: Select all
1 poke 52, 28: poke 56, 28: clr
2 for i = 7168 to 7679:poke i,peek(i+25600): next
3 poke 36869,255
10 for l=7168 to 7168 + 6*8 - 1:read a:poke l,a:next
20 data 60, 66, 165, 129, 165, 153, 66, 60
21 data 60, 66, 165, 129, 165, 153, 66, 60
22 data 60, 66, 165, 129, 165, 153, 66, 60
23 data 60, 66, 165, 129, 165, 153, 66, 60
24 data 60, 66, 165, 129, 165, 153, 66, 60
25 data 60, 66, 165, 129, 165, 153, 66, 60
30 print"{clr} @ A B C D E "
run
I just dont understand that math, according to you equation, L's first value is 7168 which has been freed up , but the last value should be 7168 + 6 * 8 - 1 which is equal to 57,391 which is way out of the parameters of the original freed up screen memory! 7168-7679. I wish I knew the logic behind it. Maybe im not following order of operations or something. But thank you Kweepa, that did the trick, so now I have to put you in the ending credits
By the way, if you want to define an arbitrary number of characters, this device is quite handy:
10 A=7168
20 READ B:IF B<>-1 THEN POKE A,B:A=A+1:GOTO 20
25 POKE 36869,255:PRINT"@AB"
30 END : REM OR WHATEVER
40 DATA 128,64,32,16,8,4,2,1
42 DATA 24,36,36,24,60,66,66,0
44 DATA 24,60,126,255,255,126,60,24
46 DATA -1
This program will keep reading numbers until it encounters -1, which anyway is quite illegal to use with POKE. Instead of using a FOR loop, the address in A is increased for every byte read. Alternatively one could use a counter and write 7168+A, but it doesn't improve anything more than keeping count how many characters you have defined.
10 A=7168
20 READ B:IF B<>-1 THEN POKE A,B:A=A+1:GOTO 20
25 POKE 36869,255:PRINT"@AB"
30 END : REM OR WHATEVER
40 DATA 128,64,32,16,8,4,2,1
42 DATA 24,36,36,24,60,66,66,0
44 DATA 24,60,126,255,255,126,60,24
46 DATA -1
This program will keep reading numbers until it encounters -1, which anyway is quite illegal to use with POKE. Instead of using a FOR loop, the address in A is increased for every byte read. Alternatively one could use a counter and write 7168+A, but it doesn't improve anything more than keeping count how many characters you have defined.
Anders Carlsson
thanks carlson now i see that it is only really adding up to 47 and since 7168 is the first value being poked that counts as 48 total or 6 data characters of 8 bytes each and will stop at location 7215, I may just have to break down and create a whole new font, but my program is not going to be using alot of text. thanks again!!!
If you need text at all and don't care about the font, it may be good to know that with POKE 36869,255 you get access to the first half of the ROM character set by using RVS ON. That means an inverted A displays as a regular A on screen. It allows for up to 64 custom characters as well as text on screen without using more than 512 bytes of RAM.
Anders Carlsson