Change char set, how does that work from 0-255 please?

All aspects of programming on the Commander X16.
Post Reply
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Change char set, how does that work from 0-255 please?

Post by funkheld »

Hi good afternoon.

I changed the char 0 - 3 :
@ a b c

But is it a coincidence?

These addresses, how do they work please:
cx16.vaddr_autoincr(1, VERA_CHARSET, 0, 1)
b=255
b=129
.....
.....

Code: Select all

       txt.color(3) 	 
       txt.plot(1,1)
       txt.print("@ a b c ")

const uword VERA_CHARSET = $f000 

sub makechar() {
        ubyte b
		
        cx16.vaddr_autoincr(1, VERA_CHARSET, 0, 1)        
                        b=255
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b		
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=255
			cx16.VERA_DATA0 = b   

			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b		
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b     

			b=255
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b		
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b           	

			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b		
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=129
			cx16.VERA_DATA0 = b			
			b=255
			cx16.VERA_DATA0 = b        
      
    }
thanks
greeting
Attachments
charneu.jpg
charneu.jpg (10.63 KiB) Viewed 436 times
Last edited by funkheld on Fri Mar 08, 2024 9:21 pm, edited 3 times in total.
TomXP411
Posts: 1799
Joined: Tue May 19, 2020 8:49 pm

Re: Change char set, how does that work from 0-255 please?

Post by TomXP411 »

Back in the day, Commodore packed the display bitmap for the character set in a different order than the ASCII/PETSCII order. So there's some translation needed when outputting text to the screen.

Here's a reference tool to help with that:

https://www.pagetable.com/?p=1404
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: Change char set, how does that work from 0-255 please?

Post by funkheld »

Thanks for the help.

I am now looking for this address structure in the x16.
I cannot recognize the structure of this address as it is up to
address 255 is constructed. 8 bytes are always added and then it continues... but how?

cx16.vaddr_autoincr(1, VERA_CHARSET, 0, 1)
How are these last two numbers evaluated for the structure?

thanks

greeting
Post Reply