Created
October 9, 2020 14:27
-
-
Save samhattangady/9861ab90835c1703312d02b79d9f5c2f to your computer and use it in GitHub Desktop.
Hovalaag Bug?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; The documentation in sample.vasm states that "F=POS(A>>1) is true if and only if A was positive and even before the shift" | |
; This doesn't seem to be the case in v1.08. Even a negative even number seems to give a true value. | |
; Solution for problem 6. | |
get_input: | |
A=IN1, C=0, B=1 | |
D=A | |
loop: | |
F=ZERO(-A) | |
JMPT out, F=ZERO(A&B) | |
JMPF update_c | |
A=A>>1, JMP loop | |
update_c: | |
A=A>>1, DEC, JMP loop | |
out: | |
A=C | |
; A=-A ; -> Commenting/uncommenting this line doesn't make a difference. Both give the correct result. | |
F=POS(A>>1), A=D | |
JMPT even, W=A | |
OUT1=W, JMP get_input | |
even: | |
OUT2=W, JMP get_input | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment