Instantly share code, notes, and snippets.

@Ersanio /chip8controller.asm Secret
Last active Sep 4, 2018

Embed
What would you like to do?
65c816 chip-8 controller setup
ControllerLayouts:
dw CDefault : db CDefault_end-CDefault ;boot
dw CDefault : db CDefault_end-CDefault ; fifteenpuzzle
dw CBlinky : db CBlinky_end-CBlinky
[...]
!CUP = $0800
!CDOWN = $0400
!CLEFT = $0200
!CRIGHT = $0100
!CY = $4000
!CX = $0040
!CB = $8000
!CA = $0080
!CL = $0020
!CR = $0010
CDefault:
dw !CY : db $01 ; Y
dw !CX : db $02 ; X
dw !CB : db $03 ; B
dw !CA : db $0C ; A
dw !CY|!CL : db $04 ; Y + L
dw !CX|!CL : db $05 ; X + L
dw !CB|!CL : db $06 ; B + L
dw !CA|!CL : db $0d ; A + L
dw !CY|!CR : db $07 ; Y + R
dw !CX|!CR : db $08 ; X + R
dw !CB|!CR : db $09 ; B + R
dw !CA|!CR : db $0e ; A + R
dw !CY|!CL|!CR : db $0a ; Y + LR
dw !CX|!CL|!CR : db $00 ; X + LR
dw !CB|!CL|!CR : db $0b ; B + LR
dw !CA|!CL|!CR : db $0f ; A + LR
;generally accepted directional keys
dw !CUP : db $02 ; up
dw !CLEFT : db $04 ; left
dw !CRIGHT : db $06 ; right
dw !CDOWN : db $08 ; down
.end
CBlinky:
dw !CUP : db $03
dw !CDOWN : db $06
dw !CLEFT : db $07
dw !CRIGHT : db $08
dw !CA : db $0F
dw !CB : db $0F
dw !CY : db $0F
dw !CX : db $0F
.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment