Maths error


Author Message
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3364
Posted: 06:45am 27 Jun 2011      

Both the integer divide and the MOD operator convert both arguments to an integer first. The value held by addr is outside of the 32 bit integer range (+/- 2147483647).

This trick might help. The code for PEEK/POKE actually shifts hiword up by 16 bits then adds loword to get the address. So, to access video memory you could do:

10 FOR X = &HD250 to &H1378F
20 A=PEEK(&HA000,X)
30 NEXT X

This works (or should work because I have not tested it) because &H1378F is within the range that a float can represent without loosing accuracy (the variable X is a float).

Geoff
Geoff Graham - http://geoffg.net