0

I want to find the code of a character printed.

This is the code:

10 Print AT 2,2; "T"
20 Let C=Peek(Peek 16398+256*Peek 16399)
30 Print Peek(C)

It should just print the Code value of T.

I could later use:

40 Print Peek (Code C) 

Or something.

But the 10-30 bit doesn't work. It always returns '0' -With different letters too: G,T 'black graphic' and M,

What am I doing wrong?

Will be used for collision detection.

halfer
  • 19,824
  • 17
  • 99
  • 186
James Andrew
  • 7,197
  • 14
  • 46
  • 62

2 Answers2

1

According to this it is the right address to peek, but maybe the cursor is not at the right position? If I remember well (man, what are you doing with that old thing :-) ! ) the PRINT AT might move the cursor one position after the printed char (or one line under).

jdehaan
  • 19,700
  • 6
  • 57
  • 97
1

jdehaan's right, printing the T without a trailing ; will move the cursor down to the next line after printing. (With ;, it's be one position to the right.)

To read the character you'd just written you'd have to move back a position again:

PRINT AT 2,2;"T";AT 2,2;
PRINT PEEK(PEEK 16398+PEEK 16399*256)

gives me 57, which is the character code for T.

bobince
  • 528,062
  • 107
  • 651
  • 834