mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-21 03:26:44 +00:00
Created Snippett: Move in a random direction (markdown)
parent
fb24b4ff8e
commit
2d5e50dfe2
18
Snippett:-Move-in-a-random-direction.md
Normal file
18
Snippett:-Move-in-a-random-direction.md
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user