From 2d5e50dfe2a80ff8d56ff67d3eeeb426b3eee038 Mon Sep 17 00:00:00 2001 From: Ryan Durk Date: Thu, 4 Jan 2018 18:57:27 -0500 Subject: [PATCH] Created Snippett: Move in a random direction (markdown) --- Snippett:-Move-in-a-random-direction.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Snippett:-Move-in-a-random-direction.md 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