-
Notifications
You must be signed in to change notification settings - Fork 1
/
convhex.inc
79 lines (73 loc) · 1.53 KB
/
convhex.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#IFNDEF CONVHEX_INC
#DEFINE CONVHEX_INC
;convhex.inc
;By Galandros (with help of NanoWar and Spencer)
;You can now echo in hex! yay
#macro zconvhex(hexn)
#if hex_remain == 0
"$",return
#else
#define hex_digit eval(hexn & $0F)
#define hex_remain eval(hexn/16)
#ifndef return
#define return ""
#endif
#if hex_digit == 0
#define hex_char "0"
#endif
#if hex_digit == 1
#define hex_char "1"
#endif
#if hex_digit == 2
#define hex_char "2"
#endif
#if hex_digit == 3
#define hex_char "3"
#endif
#if hex_digit == 4
#define hex_char "4"
#endif
#if hex_digit == 5
#define hex_char "5"
#endif
#if hex_digit == 6
#define hex_char "6"
#endif
#if hex_digit == 7
#define hex_char "7"
#endif
#if hex_digit == 8
#define hex_char "8"
#endif
#if hex_digit == 9
#define hex_char "9"
#endif
#if hex_digit == 10
#define hex_char "A"
#endif
#if hex_digit == 11
#define hex_char "B"
#endif
#if hex_digit == 12
#define hex_char "C"
#endif
#if hex_digit == 13
#define hex_char "D"
#endif
#if hex_digit == 14
#define hex_char "E"
#endif
#if hex_digit == 15
#define hex_char "F"
#endif
#define return eval(hex_char,return)
zconvhex(eval(hex_remain))
#endif
#endmacro
;wrap the main macro up with another macro to clear the global defines to work more times
#macro convhex(zn)
#define hex_remain -1
#define return ""
zconvhex(zn)
#endmacro
#ENDIF