Jump to content
IGNORED

Keyboard Code Test


Recommended Posts

I needed to do some keyboard input, and given that all the books I have list all the various keyboard codes in decimal and not hex, I scratched my itch.  My program opens the K: keyboard device and shows the various codes for each key pressed.  It's a toy, and certainly not perfect, but I wanted to explore CIO and keyboard input in assembly.

KeyTest.s KeyTest.xex

Edited by CaptMatteus
grammar
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

2 hours ago, CaptMatteus said:

I wonder what is causing the problem on Altirra?

I figured it out, you are using a custom display list and are not making sure the screen area is cleared, so

if you've run anything before using this and it used that memory area, it's still there and will display.

I compiled your code using MAC65, it ran ok, but I had a full screen of garbage, I went into BUG65

cleared $9000-$9400, ran it again and it was fine.

 

  • Like 1
Link to comment
Share on other sites

30 minutes ago, TGB1718 said:

I figured it out, you are using a custom display list and are not making sure the screen area is cleared, so

if you've run anything before using this and it used that memory area, it's still there and will display.

I compiled your code using MAC65, it ran ok, but I had a full screen of garbage, I went into BUG65

cleared $9000-$9400, ran it again and it was fine.

 

Ahh, totally makes sense.  So I can add a little code to clear out the screen memory and then it'll be good to go.

 

I love feedback, it (nearly) always makes me a better programmer.  I certainly do not claim to be ANY sort of expert on the Atari platform. So, much appreciated.

 

Edited by CaptMatteus
  • Like 1
Link to comment
Share on other sites

Clear won't do it on it's own, you have the text loaded directly into the screen memory, so a clear clears it too.

 

I changed your code like this:-

comment out the *= and add labels

 

;   *=  $9008
C1       .SBYTE "CHARACTER INPUT TESTER"

.BYTE 255 ; END OF STRING FOR LOOP TEST
; *=  $92D0
C2       .SBYTE "ATASCII:  H(   ) DISPLAY:  H(   )"
.BYTE 255 ; END OF STRING FOR LOOP TEST
;   *=  $92A8
C3       .SBYTE "RAW:   H(   )"
.BYTE 255 ; END OF STRING FOR LOOP TEST

 

then added the following code just after the dlist is set.

 

         LDX #0 ; CLS
         TXA 
CLSLOOP  STA $9000,X
         STA $9100,X
         STA $9200,X
         STA $9300,X
         INX 
         BNE CLSLOOP
         LDX #0 ; TEXT STRINGS TO SCREEN
XLOOP    LDA C1,X
         BMI N1
         STA $9008,X
         INX 
         JMP XLOOP
N1       LDX #0
XLOOP1   LDA C2,X
         BMI N2
         STA $92D0,X
         INX 
         JMP XLOOP1
N2       LDX #0
XLOOP2   LDA C3,X
         BMI N3
         STA $92A8,X
         INX 
         JMP XLOOP2
         ;           FOR GRAPHICS MODE 0, WE CAN SET THE BACKGROUND COLOR AND A FOREGROUND LUMINANCE
         ;           WHEICH HERE WILL BE THE TEXT COLOR
N3       LDA #$00    ; MODE 0 BACKGROUND COLOR

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...