3

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!

Peter Kofler
  • 9,252
  • 8
  • 51
  • 79
user1062704
  • 438
  • 4
  • 14

2 Answers2

4

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...

  • 2
    That would be `24-y` -- the '1024' is not on the first line but on the zeroeth, and the lines are counted 0..24. And the last valid position is 2023, not 2024. – Jongware Sep 29 '13 at 20:59
  • I thought that might be the case, I realised this shortly after I posted, but was already on the road by then! – Jamie - Fenrir Digital Ltd Sep 30 '13 at 08:07
1

You can alter print X position with tab():

print tab(8)"test"
Jupp3
  • 221
  • 1
  • 1