examples/d6.xyw
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
.include "devices.xyw"
; Get random number and calculate modulo 6
clock.random LDBw $6 modulo JSRw
; Print result+1 and new line
$31 ADD terminal.output STBw
$0d terminal.output STBw
; Terminate
$0 system.state STBw
; Calculate the modulo
; a b -- a%b
.label modulo
POPy POPx
PSHx PSHy PSHx PSHy DIV MUL SUB
RTS
|