]> git.sur5r.net Git - cc65/commitdiff
Made the CBM stdin consoles echo '\n' to the screen.
authorGreg King <gregdk@users.sf.net>
Mon, 23 Dec 2013 16:48:58 +0000 (11:48 -0500)
committerGreg King <gregdk@users.sf.net>
Mon, 23 Dec 2013 16:48:58 +0000 (11:48 -0500)
That fix makes Commodore platforms be consistent with other platforms' consoles.

libsrc/cbm/read.s

index 92d7ac6dae52d30e34aefcb2f47f79fca3c77cdc..6227f7e0a118e61a9545dc22545e631dfdc0f101 100644 (file)
@@ -1,5 +1,6 @@
 ;
 ;
-; Ullrich von Bassewitz, 16.11.2002
+; 2002-11-16, Ullrich von Bassewitz
+; 2013-12-18, Greg King
 ;
 ; int read (int fd, void* buf, unsigned count);
 ;
 ;
 ; int read (int fd, void* buf, unsigned count);
 ;
@@ -7,7 +8,7 @@
         .export         _read
         .constructor    initstdin
 
         .export         _read
         .constructor    initstdin
 
-        .import         SETLFS, OPEN, CHKIN, BASIN, CLRCH, READST
+        .import         SETLFS, OPEN, CHKIN, BASIN, CLRCH, BSOUT, READST
         .import         rwcommon
         .import         popax
         .importzp       ptr1, ptr2, ptr3, tmp1, tmp2, tmp3
         .import         rwcommon
         .import         popax
         .importzp       ptr1, ptr2, ptr3, tmp1, tmp2, tmp3
         lda     fdtab-LFN_OFFS,x; Get flags for this handle
         bmi     eof
 
         lda     fdtab-LFN_OFFS,x; Get flags for this handle
         bmi     eof
 
+; Remember the device number.
+
+        ldy     unittab-LFN_OFFS,x
+        sty     unit
+
 ; Valid lfn. Make it the input file
 
         jsr     CHKIN
 ; Valid lfn. Make it the input file
 
         jsr     CHKIN
 
 @L0:    jsr     BASIN
         sta     tmp1            ; Save the input byte
 
 @L0:    jsr     BASIN
         sta     tmp1            ; Save the input byte
+        ldx     unit
+        bne     @L0_1           ; Not keyboard/screen-editor
+        cmp     #$0D            ; Is it a Carriage Return?
+        bne     @L0_1
+        jsr     BSOUT           ; Yes, echo it (because editor didn't)
 
 
-        jsr     READST          ; Read the IEEE status
+@L0_1:  jsr     READST          ; Read the IEEE status
         sta     tmp3            ; Save it
         and     #%10111111      ; Check anything but the EOI bit
         bne     devnotpresent   ; Assume device not present
         sta     tmp3            ; Save it
         and     #%10111111      ; Check anything but the EOI bit
         bne     devnotpresent   ; Assume device not present
@@ -138,4 +149,10 @@ invalidfd:
 .endproc
 
 
 .endproc
 
 
+;--------------------------------------------------------------------------
+
+.bss
+
+unit:   .res    1
+