oldefoxx wrote:
Now this is interesting. I set the code back to 0xffffffff as I had it originally, and changed
Str() in the later part to Hex(), and got back an answere with 16 F's in it. Eight would have
been enough. Sixteen is like a quad, not a long.
Use Hex(tmp(),#PB_Long).
Hex() takes a quad by default, so the .l 0xffffffff (it is -1, because PB uses signed types)
is converted to .q 0xffffffffffffffff (-1 for quads).
RSet is used to fill the string on the left side, so the byte display "1" becomes "01"
and long "FF" becomes "000000FF".
Variables do not need to be defined by default. Use EnableExplicit for enabling it.
Yes, procedures are always used with (), for example the address of the procedure is: @tmp().
Without () it is a simple variable.
Code:
EnableExplicit
Procedure.l tmp()
label1:
!mov eax, 0xfffffffe
label2:
!add eax,1
label3:
ProcedureReturn
label4:
EndProcedure
Procedure.s GetByteCode( *_start.Ascii, *_end.Ascii, _msg.s="" )
While *_start < *_end
_msg + " " + RSet( Hex( *_start\a , #PB_Byte ) , 2, "0")
*_start + 1
Wend
ProcedureReturn _msg
EndProcedure
Define s.s
s = GetByteCode(?label1,?label2,"!mov eax, 0xfffffffe ==>")
s + #CRLF$
s + GetByteCode(?label2,?label3,"!add eax,1 ==>")
s + #CRLF$ + "ProcedureReturn (EAX) = " + RSet( Hex(tmp(),#PB_Long) , 8, "0" )
MessageRequester("Output" , s)