Skip to content

Instantly share code, notes, and snippets.

@echojc
Created November 27, 2016 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save echojc/2a2af1c4eb2cf833959864269bbbce00 to your computer and use it in GitHub Desktop.
Save echojc/2a2af1c4eb2cf833959864269bbbce00 to your computer and use it in GitHub Desktop.
Stoked that I hacked together a rudimentary Simon Says game in Shenzhen I/O! http://puu.sh/sw3gW/107bebc92d.png
[name] simon says
[puzzle] SzSandbox
[traces]
......................
..154.....1555554.....
......14..1555D54.15C.
...94.154..14.2...1CA.
..16...14..955555556A.
.....1414.161414....A.
.....14...155555555CA.
.....14......8.14..AA.
......955C...3554.16A.
......A..34.......1CA.
..1C.1E.1D5414.15556A.
..1E.16.1614........A.
...355555554155555556.
......................
[chip]
[type] DX3
[x] 11
[y] 1
[rotated] true
[chip]
[type] BTN
[x] 1
[y] 2
[chip]
[type] BTN
[x] 4
[y] 2
[chip]
[type] BTN
[x] 7
[y] 2
[chip]
[type] BRIDGE
[x] 10
[y] 2
[chip]
[type] UC6
[x] 13
[y] 2
[code]
# check input
slx x3
mov x3 acc
l1:
teq x1 0
+ slp 1
+ jmp l1
sub x1
l2:
tgt x1 0
+ slp 1
+ jmp l2
mov acc x3
[chip]
[type] LEDR
[x] 1
[y] 3
[chip]
[type] LEDW
[x] 4
[y] 3
[chip]
[type] LEDA
[x] 7
[y] 3
[chip]
[type] UC6
[x] 16
[y] 4
[code]
# next expected
slx x3
mov x3 acc
mov 0 x0
loop:
mov x1 x2
slx x2
teq x2 0
+ sub 1
+ tgt acc 0
+ jmp loop
mov acc x3
[chip]
[type] LEDRGB
[x] 3
[y] 6
[chip]
[type] DX3
[x] 6
[y] 6
[rotated] true
[chip]
[type] BRIDGE
[x] 13
[y] 6
[chip]
[type] BRIDGE
[x] 15
[y] 6
[chip]
[type] UC6
[x] 8
[y] 7
[code]
mov 010 x1
mov 0 x0
add 1
slp 1
loop:
mov acc x3
slx x3
mov x3 x2
mov 100 x1
slx x2
mov x2 dat
tgt dat 0
+ mov 001 x1
+ jmp loop
[chip]
[type] BRIDGE
[x] 12
[y] 8
[chip]
[type] BRIDGE
[x] 14
[y] 8
[chip]
[type] RNG
[x] 1
[y] 9
[chip]
[type] BRIDGE
[x] 7
[y] 9
[chip]
[type] UC6
[x] 4
[y] 10
[code]
# rng
slx x3
mov x3 null
# rand % 3
mov 60 x0
mov p0 x0
mov 3 x0
mov x0 acc
# 10 ^ acc
mov 70 x0
mov 10 x0
mov acc x0
mov x0 x2
[chip]
[type] RAMXL
[x] 8
[y] 10
[chip]
[type] BRIDGE
[x] 11
[y] 10
[chip]
[type] UC6
[x] 16
[y] 10
[code]
# playback
slx x2
mov x2 acc
mov acc dat
mov 0 x1
loop:
mov x0 x3
slp 5
mov 0 x3
slp 5
sub 1
tgt acc 0
+ jmp loop
mov dat x2
[chip]
[type] MATH
[x] 1
[y] 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment