'The hexadecimal representation of 127 is 7F'
Is there any way to convert the hexidecimal output back to it's original form?
So: 7F (hexadecimal) = 127
Thanks in advance!
ログイン/登録して投稿
'The hexadecimal representation of 127 is 7F'
Is there any way to convert the hexidecimal output back to it's original form?
So: 7F (hexadecimal) = 127
Thanks in advance!
Some examples (direct values, numeric variables, string variables, etc.): https://msxpen.com/codes/-Mt8zELDCkcccBKxLzlW
Print &H7F
Thank you for these answers!
Do you know how to convert the character back from (when it's stored in) a string? (a$=f7 to A=127
A=VAL("&H"+A$)
About hexadecimal conversion, does anyone know why this program is not working and how to make it work?
10 L=PEEK(&HF673)*256+PEEK(&HF672): PRINT HEX$(L) 20 FOR M=&HC000 TO L: PRINT HEX$(M): NEXT
At start, L = F360 on a MSX without drive but the loop doen't stop at this value. If I use FOR M=&HC000 TO &hF360, it works.
The problem is that &HC000 equals -16384, so it's effectively looping from -16384 to 61800.
Try:
10 L=PEEK(&HF673)*256+PEEK(&HF672): IF L>&H7FFF THEN L=L-65536
Or if you know that it's going to be > 7FFF always:
10 L=(PEEK(&HF673)-256)*256+PEEK(&HF672)
About hexadecimal conversion, does anyone know why this program is not working and how to make it work?
10 L=PEEK(&HF673)*256+PEEK(&HF672): PRINT HEX$(L) 20 FOR M=&HC000 TO L: PRINT HEX$(M): NEXT
At start, L = F360 on a MSX without drive but the loop doen't stop at this value. If I use FOR M=&HC000 TO &hF360, it works.
Stop converting the addresses to integer. Just use single or double precision directly.
10 L=PEEK(&HF673)*256+PEEK(&HF672): PRINT HEX$(L) 20 FOR M=49152 TO L: PRINT HEX$(M): NEXT
The problem is an hexa value cannot be interpreted as a no signed value. I thought that there would be another solution than a condition or to put the values yourself in decimal. So I'll do it pretty much as Pgimeno advises.
L=PEEK(&HF673)*256+PEEK(&HF672): L=L+(L>&H7FFF)*65536!
The problem is an hexa value cannot be interpreted as a no signed value. I thought that there would be another solution than a condition or to put the values yourself in decimal. So I'll do it pretty much as Pgimeno advises.
L=PEEK(&HF673)*256+PEEK(&HF672): L=L+(L>&H7FFF)*65536!
The problem is your starting point is a negative integer and your finishing point is a positive double precision float. If you used the same data type for both ranges of the FOR loop, you wouldn't get this behaviour. For instance:
10 L%=CVI(CHR$(PEEK(&HF672))+CHR$(PEEK(&HF673))): PRINT HEX$(L%) 20 FOR M=&HC000 TO L%: PRINT HEX$(M): NEXT
No and yes it depends on what point you focus. It not work when I use also integer or single/double precision.
Anyway thank for CVI. So the explanation from de wiki is wrong.
Don't you have an account yet? Become an MSX-friend and register an account!