]> git.sur5r.net Git - cc65/blobdiff - libsrc/atmos/cgetc.s
* Changed the way that Atmos programs are started.
[cc65] / libsrc / atmos / cgetc.s
index 9883021380c11560954c26a4f97854cf1b85cd92..e4ea15ac659d7741a5e1d5d853ffa692427663d8 100644 (file)
@@ -1,15 +1,17 @@
 ;
-; Ullrich von Bassewitz, 2003-04-13
+; 2003-04-13, Ullrich von Bassewitz
+; 2014-09-04, Greg King
 ;
 ; char cgetc (void);
 ;
 
-       .export         _cgetc
+        .export         _cgetc
         .constructor    initcgetc
-       .import         cursor
 
-       .include        "atmos.inc"
+        .import         cursor
+        .forceimport    disable_caps
 
+        .include        "atmos.inc"
 
 
 ; ------------------------------------------------------------------------
 
 ; No character, enable cursor and wait
 
-        lda     cursor          ; Cursor currently off?
+        lda     cursor          ; Should cursor be off?
         beq     @L1             ; Skip if so
-        lda     STATUS
-        ora     #%00000001      ; Cursor ON
-        sta     STATUS
+        lsr     STATUS
+        sec                     ; Cursor ON
+        rol     STATUS
 @L1:    lda     KEYBUF
         bpl     @L1
 
 
         ldx     cursor
         beq     @L2
-        ldx     #$00            ; Zero high byte
         dec     STATUS          ; Clear bit zero
 
-; We have the character, clear avail flag
+; We have the character, clear the "available" flag
 
 @L2:    and     #$7F            ; Mask out avail flag
         sta     KEYBUF
+        ldx     #>$0000
+        ldy     MODEKEY
+        cpy     #FUNCTKEY
+        bne     @L3
+        ora     #$80            ; FUNCT-key pressed
 
 ; Done
 
-        rts
+@L3:    rts
 
 .endproc
 
 ; ------------------------------------------------------------------------
-; Switch the cursor off, disable capslock. Code goes into the INIT segment
+; Switch the cursor off. Code goes into the INIT segment
 ; which may be reused after it is run.
 
 .segment        "INIT"
 
 initcgetc:
-        lda     STATUS
-        and     #%11111110
-        sta     STATUS
-        lda     #$7F
-        sta     CAPSLOCK
+        lsr     STATUS
+        asl     STATUS          ; Clear bit zero
         rts
-