; *** simple genesis gamepad 3-button read example ; The program displays different color slices for the status of ; of the A, B, C, and Start buttons. ; processor 6502 include "vcs.h" include "macro.h" SEG ORG $F000 ; memory to store the genesis button results... genesisButtonA = $80 genesisButtonB = $81 genesisButtonC = $82 genesisButtonStart = $83 jmp ($FFFC) RESET: CLEAN_START ;macro.h lda #2 sta VBLANK KERNEL lda #02 ;f lda WSYNC sta VSYNC sta WSYNC sta WSYNC lda #0 sta WSYNC sta VSYNC lda #45 sta TIM64T ;when the paddle cap isn't grounded we read the regular buttons... ldy INPT4 sty genesisButtonB ldy INPT1 sty genesisButtonC sta WSYNC lda #$82 sta VBLANK sta WSYNC ;while the paddle cap is grounded we read the alternate buttons... ldy INPT4 sty genesisButtonA ldy INPT1 sty genesisButtonStart lda #2 sta VBLANK ; unground the paddle cap so it can charge again... sta WSYNC VB_LOOP lda INTIM bne VB_LOOP lda #0 sta WSYNC sta VBLANK PLAYFIELD lda #227 sta TIM64T sta WSYNC ldy #3 buttonreport lda genesisButtonA,y sta COLUBK ldx #12 blockloop sta WSYNC dex bpl blockloop lda #0 sta COLUBK sta WSYNC dey bpl buttonreport PFWAIT lda INTIM bne PFWAIT OVERSCAN lda #2 sta WSYNC sta VBLANK lda #36 sta TIM64T OS_LOOP lda INTIM bne OS_LOOP sta WSYNC jmp KERNEL ORG $FFFC .word RESET .word RESET END