diff --git a/Snippett:-Move-in-a-random-direction.md b/Snippett:-Move-in-a-random-direction.md new file mode 100644 index 0000000..cbbd667 --- /dev/null +++ b/Snippett:-Move-in-a-random-direction.md @@ -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 \ No newline at end of file