Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Hexadecimal numbers for array dimensioning and printing -what am I doing wrong?
#1
Hi all,
I have an old MCS BASIC-52 program that I want to run in QB64pe.  There is an external memory function XBY, that looks a lot like an array, so I wanted to preserve the hexadecimal addresses as much as possible.  However it seems that I have to use a suffix, even on hexadecimal numbers for them to either print or be used as an array index.  Yes, I could use the decimal equivalent but as these addresses represent IO points I wanted to keep as much hex as possible.  Is it understood or expected behaviour that you can't correctly print a 'long' hex number without a suffix?
This example is a little longer than it needs to be but I think you will get the point.  In the real code there is a lot of address (now array index) and content manipulation, so I would like to reduce the amount of suffixes I need to add and also limit the use of decimal number representation (if possible) 

Code: (Select All)
Dim XBY(&HE800~% To &HFFFF~%) As _Unsigned _Byte
Dim XBYD(59392 To 65635) As _Unsigned _Byte
Dim XBYFAIL(&HE800 To &HFFFF) As _Unsigned _Byte

E9 = &HE900~%: EA& = &HEA00: EB = &HEB00&: EF = &HEF00
XBY(&HE800~%) = 255: XBYD(59392) = 255
XBYFAIL(E9) = 255

Print &HE800~%, &HFFFF~%
Print &HE800, &HFFFF
Print 59392, 65635, E9, EA&, EB

Rem - typical line of code
Rem 3410 XBY(EA + PT) = 2 ^ B * (1 - UM)

Thanks
Reply


Messages In This Thread
Using Hexadecimal numbers for array dimensioning and printing -what am I doing wrong? - by dowster - 08-13-2024, 10:19 AM



Users browsing this thread: 2 Guest(s)