| |
|
|
|
Source watts on the 15.07.2007 from the MMJ-Quellcodesammlung (Dietmar horn) in The Babyklappe on XProfan.Com stored:
Zahlenumwandlung (Dezimalzahl in Hexadezimalzahl)
executable ex Profan-Version 5.0
IntToHex
(c) 1996 Thomas Hölzer, Johann-Hus-Str. 8, 57078 Siegen
Contact: thoelzer@tehsoft.de
http://www.prfellow.de
a (Long)-Integerwert in Hex transfiguring (How Hex$ ex Profan 5)
Parameter: Vorzeichenloser Longint
Def HiByte(1) Div&(&(1),$100)
Def LoByte(1) And(&(1),$FF)
Def HiWord(1) Div&(&(1),$10000)
Def LoWord(1) And(&(1),$FFFF)
Def byte2Hex(1) Add$(Mid$(0123456789ABCDEF,Add(Div&(%(1),16),1),1),
Mid$(0123456789ABCDEF,Add(Mod(%(1),16),1),1))
Proc IntToHex
Parameters z&
Declare hx$,hiw&,low&
Proc Word2Hex
Parameters z%
Return Add$(byte2Hex(HiByte(z%)),byte2Hex(LoByte(z%)))
ENDPROC
Let low&=LoWord(z&)
Let hiw&=HiWord(z&)
If hiw&
Word2Hex hiw&
Let hx$=$(0)
Else
Let hx$=0000
EndIf
If low&
Word2Hex low&
Let hx$=hx$;$(0)
Else
Let hx$=hx$;0000
EndIf
While Equ$(Mid$(hx$,1,1),0)
Let hx$=Del$(hx$,1,1)
Wend
Let hx$=$;hx$
Case Equ(Len(hx$),1): Let hx$=$0
Return hx$
ENDPROC
example
Declare Test$
Cls
WhileNot Equ(%button,2)
Let Test$=Input$(Dezimalzahl prompt - Hex appear in the cover,$(0),)
Case Equ(%button,1): IntToHex Test$
Wend
|
|
|
| |
|
|