home *** CD-ROM | disk | FTP | other *** search
/ The Grapevine 14 / Grapevine_14_1995-02_TDR_Side_B.d64 / asm.morekeys < prev    next >
Text File  |  2023-02-26  |  1KB  |  59 lines

  1.  
  2. ;key differentiation
  3.  
  4. ;code by reiner richter
  5. ;(c) copyright, not
  6.  
  7. ;this is some demo code to distinguish
  8. ; between different key combinations
  9. ; that notmally give the same ascii
  10. ; result.
  11.  
  12.  
  13. chrout   = $ffd2   ;kernal output char
  14. getin    = $ffe4   ;kernal get char
  15.  
  16. lstx     = 197     ;current key pressed
  17. shflag   = 653     ;keyboard shift key
  18.                      ;1=shift
  19.                      ;2=commodore
  20.                      ;4=control
  21.  
  22.  
  23.          *= $4000
  24.  
  25.  
  26.          cli
  27.          ldx #0
  28. loop     lda introtxt,x  ;print intro
  29.          beq waitloop    ; text so you
  30.          jsr chrout      ; know what to
  31.          inx             ; do.
  32.          bne loop
  33. waitloop jsr getin     ;wait until the
  34.          cmp #19       ; appropriate
  35.          bne waitloop  ; key is pressed.
  36.          ldx #0
  37.          lda shflag    ;check for
  38.          and #4        ; control key.
  39.          beq noctrl
  40.          ldx #txtctrls-txthome
  41. noctrl   lda txthome,x
  42.          beq exit        ; text so you
  43.          jsr chrout      ; know what to
  44.          inx             ; do.
  45.          bne noctrl
  46. exit     rts
  47.  
  48. introtxt .byte 147
  49.          .text "press home or "
  50.          .text "control s..."
  51.          .byte 13,0
  52.  
  53. txthome  .text "home was pressed."
  54.          .byte 0
  55.  
  56. txtctrls .text "control s was pressed."
  57.          .byte 0
  58.  
  59.