Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6852509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:22:45+00:00 2026-05-27T01:22:45+00:00

I want to compare keystrokes in assembly (CCS64). If I type in the same

  • 0

I want to compare keystrokes in assembly (CCS64).
If I type in the same key in a row I want to do something
example: A A = do this

but if I type this: A B = do something else

Suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:22:46+00:00Added an answer on May 27, 2026 at 1:22 am

    I prepared an example to you just like you’ve wanted. If you press same keys in a row twice, border color changes to red, otherwise stays black.

    Warning! This example uses kernal routines. There is nothing wrong with that. But there is also a lower level way to do this without using $ffd2 (Output Vector, chrout) and $ffe4 (Get From Keyboad) kernal calls. But since it is much more complicated to understand, I prefered this example.

    If you want to know what is happening behind the scenes (kernal calls), you can easily trace the kernal ROM codes from AAY64 documentation. Here is the links:

    Main AAY Page: http://www.the-dreams.de/aay.html

    AAY64 Online HTML Version: http://unusedino.de/ec64/technical/aay/c64/

    Kernal ROM Listing: http://unusedino.de/ec64/technical/aay/c64/krnromma.htm

    $ffd2 (Output Vector, chrout): http://unusedino.de/ec64/technical/aay/c64/romffd2.htm

    $ffe4 (Get From Keyboad): http://unusedino.de/ec64/technical/aay/c64/romffe4.htm

    You can browse deeper by pressing links on the opcodes and addresses.

    Here goes the example code. You can compile this code using ACME Crossassembler which you can find here -> http://www.esw-heim.tu-clausthal.de/~marco/smorbrod/acme/

            !to "keycomp.prg",cbm
    
            zpBuffer = $fa  ; $fa-$fb are reserved for 2 bytes of key buffer
    
            * = $0801
            !byte $0c, $08, $00, $00, $9e, $32, $30, $36, $31, $00, $00, $00
    
            * = $080d
    
            ; key buffer initialization
            ldx #$f0        ; initialize key buffer
            stx zpBuffer    ; with two different
            inx             ; values to avoid instant
            stx zpBuffer+1  ; match at the beginning
    
            ; border color initialization
            lda #$00        ; set startup border color to black
            sta $d020       ; which means "no match"
    
            ; main loop
    mainloop
            lda zpBuffer    ; shift key buffer
            sta zpBuffer+1  ; by one
    readKey
            jsr $ffe4       ; read key
            beq readKey     ; if no key pressed loop forever
            jsr $ffd2       ; show key on the screen
            sta zpBuffer    ; store the key to key buffer
    
            lda zpBuffer    ; compare the last stored key
            cmp zpBuffer+1  ; with the old key value
            beq cmpMatch    ; if there is a match jmp to cmpMatch
    
            lda #$00        ; if two pressed keys are different
            sta $d020       ; change border color to black
    
            jmp cmpOut      ; skip the other condition code block
    cmpMatch
            lda #$02        ; if there is a repeated key
            sta $d020       ; change border color to red
    cmpOut
            jmp mainloop    ; wait for the next key
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to compare a list of lists that have the same length, but
I want to compare lists of this kind: A = [0,1,0,1,0,1,0,0,0,1,0,1,0,1,0] B = [0,1,0,1,0,0,0,1,0,1,0,1,0,1,0]
I want to compare the key pressed in a console to the left arrow
I want to compare and count rows in the same datatabe. myDataTable hours_id(PK) |
I want to compare two List of different lengths and/or same length. The first
I want to compare to strings. But isEqualToString is not useful for me. Because
I want to compare 2 files with the same name in different directories. $1
I want to compare the values of two arrays of type Integer. I get
I want to compare LocalDateTime but end up with an exception. I have these
I want to compare 2 lines, but the one line is in a random

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.