I give up..
Jayguy5000
Posts: 139
I am trying to make a simple program that will look like such..
1 = $1
2 = $2
(and so on)
10 = $A
' the program i wrote is
counter VAR Word
one VAR Word
one = 1
FOR counter = 1 TO 20
DEBUG DEC one," ", HEX? one
one = one + 1
PAUSE 500
NEXT
' the outcome was
1 one = $1
so my question is, how can i take out the "one" so i only see 1 = $1
( the point of this program is pointless, I just want to see every number in decimal form translated to hexidecimal )
1 = $1
2 = $2
(and so on)
10 = $A
' the program i wrote is
counter VAR Word
one VAR Word
one = 1
FOR counter = 1 TO 20
DEBUG DEC one," ", HEX? one
one = one + 1
PAUSE 500
NEXT
' the outcome was
1 one = $1
so my question is, how can i take out the "one" so i only see 1 = $1
( the point of this program is pointless, I just want to see every number in decimal form translated to hexidecimal )
Comments
·· Modify the code to look like this:
·basicaly remove the question mark from the HEX formatter, and put in the equals sign and dollar sign you specified in the quotes.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Ryan
idx··· VAR··· Byte
Main:
· FOR idx = 1 TO 20
··· DEBUG DEC idx, "·= ", IHEX idx, CR
··· PAUSE 500
· NEXT
Note that you don't need the one = one + 1 line in the program since FOR-NEXT automatically increments the control variable, and that's what's being used for output.· And since you've set a high limit of 20 with the FOR-NEXT loop, you only need a Byte.· In my opinion variable conservation should always be practiced -- even in throw-away demos.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 5/31/2005 9:24:28 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Byte walks into a bar and orders a pint. Bartender asks him "What's wrong?"
Byte says "Parity error." Bartender nods and says "Yeah, I thought you looked a bit off."
Did you get hit in the head with a bowling ball? (rib jab)· I know that YOU know a byte goes up to 255, a word is not needed.
Ryan