]> git.sur5r.net Git - cc65/blobdiff - libsrc/pet/kbhit.s
Squeezed bytes and cycles out of the kbhit functions for almost all platforms.
[cc65] / libsrc / pet / kbhit.s
index 272bad7781211baf2dc38a50406ce0c7641fff38..a09c283219b886268de8e0f6eb31fe06c47b8541 100644 (file)
@@ -1,20 +1,22 @@
 ;
 ; Ullrich von Bassewitz, 26.11.1998
 ;
-; int kbhit (void);
+; unsigned char kbhit (void);
 ;
 
        .export         _kbhit
-       .import         return0, return1
 
        .include        "pet.inc"
 
-_kbhit:
-       lda     KEY_COUNT       ; Get number of characters
-       bne     L1
-       jmp     return0
-L1:    jmp     return1
 
+.proc   _kbhit
 
+        ldx     #0              ; High byte of return is always zero
+       lda     KEY_COUNT       ; Get number of characters
+        beq     L9
+        lda     #1
+L9:     rts
+
+.endproc