[Coco] Assembly code scans keyboard but doesn't repeat

Glen Hewlett glen.hewlett at sympatico.ca
Mon Mar 6 17:28:19 EST 2017


Hi All,

Can anyone show me a little assembly code to scan the keyboard for key presses so they don’t repeat?  The code below works for the Up and Down arrows but the keypresses repeat.

Thanks,
Glen

ScanKeys:
        LDX     #PIA0_Byte_0_KeyRow_Joy             * PIA0
; Up Arrow
        LDA     #%11110111                          * Bit 3
        STA     $02,X
        LDA     ,X
        BITA    #%00001000                          * and bit 3 = Up Arrow pushed
        BNE     >                                   * If not, scan for another key
        LDA     #1
        STA     MovePointer
        BRA     CheckedKeys
; Down Arrow
!       LDA     #%11101111                          * Bit 4
        STA     $02,X
        LDA     ,X
        BITA    #%00001000                          * and bit 3 = Down Arrow pushed
        BNE     >                                   * If not, scan for another key
        LDA     #2
        STA     MovePointer
        BRA     CheckedKeys
!…




More information about the Coco mailing list