How To

Unable to save 7 variables in ram not sure what I am doing incorrectly

2

CLIGUI 2022-09-17 13:33

I tried this code;

AA=PEEKL($A001)
AB=PEEKL($A002)
AC=PEEKL($A003)
AD=PEEKL($A004)
AE=PEEKL($A005)
AF=PEEKL($A006)
AG=PEEKL($A007)


POKEL $A001,AA
POKEL $A002,AB
POKEL $A003,AC
POKEL $A004,AD
POKEL $A005,AE
POKEL $A006,AF
POKEL $A007,AG

And I also tried using $E000
And using letters like this $E00A


CLIGUI 2022-09-17 13:34

Every time I check the numbers they are way off. Instead of 5 I get something like 1.6554E 05.


qwaffe 2022-09-17 14:42

POKEL and PEEKL deal with 4-byte values so the POKELs and PEEKLs have to be spaced at least 4 addresses apart for the values to not overlap

e.g.

AA=PEEKL($A000)
AB=PEEKL($A004)
AC=PEEKL($A008)
AD=PEEKL($A00C)
AE=PEEKL($A010)
...

POKEL $A000,AA
POKEL $A004,AB
POKEL $A008,AC
POKEL $A00C,AD
POKEL $A010,AE
...


CLIGUI 2022-09-17 15:09

It works now thanks


was8bit 2022-09-17 15:52

Issues do to the math being off can be most frustrating to find ;)

One approach to debugging these is to use TRACE to post all variables each time one variable is changed... if you only changed one variable and yet more than one is getting changed, then something fishy is going on ;)


was8bit 2022-09-17 15:56

Just as a footnote, for complicated code, i use SOUND command with WAIT 15 to identify WHICH portion of code is being used, and when... use different notes and sounds so you can tell WHERE the code execution is taking place ;)


Log in to reply.