Created Snippett: Move in a random direction (markdown)

Ryan Durk 2018-01-04 18:57:27 -05:00
parent fb24b4ff8e
commit 2d5e50dfe2

@ -0,0 +1,18 @@
;This snippett moves the cubot in a random direction.
HWID_RNG equ 0x0007
HWID_HOLO equ 0x0009
HOLO_DISPLAY_DEC equ 0x0003
HWID_LEGS equ 0x0001
LEGS_SET_DIRECTION_AND_WALK equ 0X002
.text
MOV A, HOLO_DISPLAY_DEC
HWI HWID_RNG ; The RNG interrupt puts a random number from 0x000 to 0xFFFF in register B
AND B, 0x0003 ; The LEGS interrupt needs a direction. Directions are represented as numbers from 0x0000 to 0x0003
HWI HWID_HOLO ; Display the direction's numeric representation
MOV A, LEGS_SET_DIRECTION_AND_WALK
HWI HWID_LEGS