Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print out letter in any position on the screen

According to the C64 manual you can print a character using "POKE 1024, 1" where 1024 is the start address (C64-BASIC). The screen is 40*25 which means that 2024 is the position for the end of the screen. This gives the following formula for writing a letter in any row and column from the beginning (1024, top-left of the screen): 1024 + x + 40 * y where x is the row and y is the column. Now, most of the time when you are creating a game like this, you'd like to start from the bottom left point (which should be the address 1984). Now, is there a 'formula' to actually make X and Y work from this point?

Example: Let's say you have a character or something moving from left and it needs to jump, so we need to do some physics calculations and change the X and Y values and write to the screen. If X is updated with 3 and Y with 4, these values needs to be calculated so it will be correct on the screen (from bottom left of the screen as starting point).

I hope I've explained well and this is not all too fuzzy. Otherwise, just ask.

Thanks in advance for any help!

like image 306
user1062704 Avatar asked Dec 02 '25 21:12

user1062704


2 Answers

It's early in the morning here in England (early-ish...) but from what I can tell, you only need to invert the y co-ordinate?

This may need a little tweaking, but wouldn't that make the formula [edited]:

1024 + x + 40 * (24 - y)

Seems like to go from bottom left you only need to figure out what the y co-ordinate would be in your original formula...

like image 52
Jamie - Fenrir Digital Ltd Avatar answered Dec 06 '25 20:12

Jamie - Fenrir Digital Ltd


You can alter print X position with tab():

print tab(8)"test"
like image 43
Jupp3 Avatar answered Dec 06 '25 21:12

Jupp3



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!