Skip to content

Instantly share code, notes, and snippets.

@redvers
Created September 21, 2018 15:11
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 redvers/7ae140ca5cc4ce60f433eed2b6b62cbd to your computer and use it in GitHub Desktop.
Save redvers/7ae140ca5cc4ce60f433eed2b6b62cbd to your computer and use it in GitHub Desktop.
One Board
CON
_clkmode = xtal1 + pll16x
_xinfreq = 6_250_000
VAR
long r0
PUB main
cognew(@entrypoint, @r0)
DAT
org 0
entrypoint or DIRA, DISPLAYPINS
:outside test LOADMSK, INA WZ
IF_Z jmpret WIGGLERET, #:wiggle
test CLKMSK, INA WZ
IF_Z jmpret READBITRET, #:readbit
jmp #:outside
:readbit waitpeq CLKMSK, CLKMSK
test DATAMSK, INA WZ
IF_NZ add INBUFFR, #1
shl INBUFFR, #1
jmp READBITRET
:wiggle or OUTA, DEBUGMSK
waitpeq LOADMSK, LOADMSK
andn OUTA, DEBUGMSK
mov OUTA, INBUFFR
jmp WIGGLERET
WIGGLERET long 0
READBITRET long 0
DEBUGMSK long %00000000_00000000_00000000_00000001 'P0
DATAMSK long %00001000_00000000_00000000_00000000 'P27
CLKMSK long %00000100_00000000_00000000_00000000 'P26
LOADMSK long %00000010_00000000_00000000_00000000 'P25
INBUFFR long %00000000_00000000_00000000_00000000
DISPLAYPINS long %00000001_11111111_11111111_11111111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment