Skip to content

Commit 0870443

Browse files
committed
notes on unauth
1 parent f074e80 commit 0870443

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

unauthorized/notes.md

+36-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,42 @@ parse_and_maybe_set_flag_printer(input){
149149
if (saved_position != 0x1f)
150150
die_and_remember
151151

152-
152+
TODO
153+
154+
## `ROM:046D get_valid_rand`
155+
156+
This function is called by the `parse_and_maybe_set_flag_printer` function above. At this point I couldn't handle keeping track of `Y+NN` anymore so I wrote a stack-variable making script basing Y as the stack pointer (which avr-gcc appears to use).
157+
158+
maybe_test_const_rng(illegal_rand) {
159+
word last_rand;
160+
for (i=0; i<= 0xff; i++)
161+
last_rand = prob_get_rand();
162+
if (last_rand == illegal_rand) {
163+
illegal_rand = last_rand;
164+
for (i=0; i<0x400; i++) {
165+
last_rand = prob_get_rand();
166+
}
167+
if (last_rand == illegal_rand)
168+
die();
169+
}
170+
if (illegal_rand > 0x21 ) {
171+
illegal_rand =- 0x30;
172+
illegal_rand[H] = -1 * (illegal_rand[L] << 1 - illegal_rand[L] << 1);
173+
illegal_rand[L] = illegal_rand[L] << 2;
174+
}
175+
illegal_rand_copy = illegal_rand;
176+
j=0;
177+
while(j < illegal_rand && illegal_rand_copy != 0) {
178+
busy_mux();
179+
j++;
180+
busy_mux();
181+
illegal_rand_copy--;
182+
}
183+
if (j != illegal_rand || illegal_rand_copy == 0)
184+
die_and_remember();
185+
busy_mux()
186+
return illegal_rand_copy;
187+
}
153188

154189

155190

0 commit comments

Comments
 (0)