/gist:8494d062e11a432d8dd3 Secret
Created
February 24, 2016 22:41
Star
You must be signed in to star a gist
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
%FOLLOW THE BEAR PROG | |
%NOT WORK CORRECTLY | |
LOOP: | |
INT &2 % scan interrupt | |
INT &F0 % damage interrupt | |
CAL :FINDBEAR | |
INT &1 | |
JMP :LOOP | |
FINDBEAR: | |
MOV RC &0 | |
LSTART: | |
LD RD RC % load byte from "video" memory | |
CMP RD &62 | |
JE :FOUND | |
INC RC | |
CMP RC &19 | |
JNE :LSTART | |
RET | |
FOUND: | |
MOV RA RC | |
MOV RB RC | |
DIV RA &5 | |
MOD RB &5 | |
CMP RA &2 | |
JL :RIGHT %jump-if-less | |
JG :LEFT %jump-if-more | |
CMP RB &2 | |
JL :UP | |
JG :DOWN | |
RET | |
LEFT: | |
MOV R0 &4 | |
RET | |
UP: | |
MOV R0 &3 | |
RET | |
RIGHT: | |
MOV R0 &2 | |
RET | |
DOWN: | |
MOV R0 &1 | |
RET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment