]> git.sur5r.net Git - cc65/blobdiff - libsrc/cbm/read.s
added sleep() implementation
[cc65] / libsrc / cbm / read.s
index 5a2157b998bb8e636fc82aef84509e53780bac1d..1e9fdbd5cb0aec643a8991d1d191afccfbffc3ef 100644 (file)
@@ -6,13 +6,13 @@
 
         .export         _read
         .constructor    initstdin
-           
+
+        .import         SETLFS, OPEN, CHKIN, BASIN, CLRCH, READST
         .import         rwcommon
         .import         popax
-        .import         __errno, __oserror
+        .import         __oserror
         .importzp       ptr1, ptr2, ptr3, tmp1, tmp2, tmp3
 
-        .include        "errno.inc"
         .include        "fcntl.inc"
         .include        "cbm.inc"
         .include        "filedes.inc"
@@ -41,7 +41,7 @@
 .proc   _read
 
         jsr     rwcommon        ; Pop params, check handle
-        bcs     invalidfd       ; Branch if handle not ok
+        bcs     errout          ; Invalid handle, errno already set
 
 ; Check if the LFN is valid and the file is open for writing
 
@@ -121,21 +121,12 @@ eof:    lda     ptr3
         ldx     ptr3+1
         rts
 
-; Error entry, file descriptor is invalid
-
-invalidfd:
-        lda     #EINVAL
-        sta     __errno
-        lda     #0
-        sta     __errno+1
-        beq     errout
-
 ; Error entry, file is not open
 
 notopen:
         lda     #3              ; File not open
         bne     error
-                    
+
 ; Error entry, status not ok
 
 error5: lda     #5              ; Device not present
@@ -148,4 +139,3 @@ errout: lda     #$FF
 
 
 
-