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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
section .text,"ax",@progbits
assume adl = 1
section .text,"ax",@progbits
public _main
_main:
BB0_1:
ld iy, -3145600
call _os_ClrLCD
call _os_HomeUp
call _os_DrawStatusBar
ld hl, L_.str
push hl
call _printf_
pop hl
call _getInput
push hl
call _diceRoll
push hl
pop de
pop hl
push de
pop hl
ld bc, -1
or a, a
sbc hl, bc
jq z, BB0_4
push de
ld hl, L_.str.1
push hl
call _printf_
pop hl
pop hl
BB0_3:
call _os_GetCSC
or a, a
jq z, BB0_3
jq BB0_1
BB0_4:
or a, a
sbc hl, hl
ret
section .text,"ax",@progbits
section .text,"ax",@progbits
public _diceRoll
_diceRoll:
ld hl, -4
call __frameset
ld hl, (ix + 6)
ld de, -1
or a, a
sbc hl, de
jq nz, BB1_2
ld hl, -1
jq BB1_3
BB1_2:
pea ix + -4
call _time
pop de
push hl
call _srand
pop hl
call _rand
ld bc, (ix + 6)
call __irems
inc hl
BB1_3:
ld sp, ix
pop ix
ret
section .text,"ax",@progbits
section .text,"ax",@progbits
public _getInput
_getInput:
ld hl, -30
call __frameset
ld.sis hl, 0
ld (ix + -30), l
ld (ix + -29), h
lea hl, ix + -22
ld (ix + -28), hl
BB2_1:
call _os_GetKey
ld e, l
ld d, h
ld.sis bc, 5
or a, a
sbc.sis hl, bc
jq z, BB2_4
ld l, e
ld h, d
ld.sis bc, 9
or a, a
sbc.sis hl, bc
jq z, BB2_5
ld a, e
add a, -94
ld c, (ix + -30)
ld b, (ix + -29)
ld e, b
ld l, e
ld iyl, e
rlc l
sbc hl, hl
push hl
pop de
ld d, iyl
ld e, c
ld hl, (ix + -28)
add hl, de
ld (hl), a
inc.sis bc
ld (ix + -30), c
ld (ix + -29), b
ld l, a
rlc l
sbc hl, hl
ld l, a
push hl
ld hl, L_.str.2
push hl
call _printf_
pop hl
pop hl
jq BB2_1
BB2_4:
ld hl, 10
push hl
pea ix + -25
ld hl, (ix + -28)
push hl
call _strtol
pop de
pop de
pop de
ld c, 8
call __ishl
call __ishrs
jq BB2_6
BB2_5:
ld hl, -1
BB2_6:
ld sp, ix
pop ix
ret
section .text,"ax",@progbits
section .rodata,"a",@progbits
private L_.str
L_.str:
db "Dice Roll",012o,"Press Clear to exit",012o,"How many sides?",012o,"Input: ",000o
section .rodata,"a",@progbits
private L_.str.1
L_.str.1:
db "",012o,"Output: %d",000o
section .rodata,"a",@progbits
private L_.str.2
L_.str.2:
db "%c",000o
ident "clang version 12.0.0 (https://github.com/jacobly0/llvm-project 170be88120e3aa88c20eea5615ba76b8f1d6c647)"
extern __Unwind_SjLj_Register
extern __Unwind_SjLj_Unregister
extern __frameset
extern _srand
extern __irems
extern _printf_
extern _rand
extern _strtol
extern _os_GetCSC
extern _os_ClrLCD
extern _os_DrawStatusBar
extern _os_HomeUp
extern _time
extern _os_GetKey
extern __ishrs
extern __ishl
|