]> git.sur5r.net Git - cc65/blobdiff - libsrc/cbm/read.s
no TGI_ERR_NO_MEM or TGI_ERR_NO_IOCB anymore: replaced by TGI_ERR_NO_RES
[cc65] / libsrc / cbm / read.s
index 0183946b559ceb69a7243bd4d0004fe5fcbb0973..2a139bde7913c151c7798b06d6c7569ed9e0e5a3 100644 (file)
         .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"
@@ -21,6 +20,8 @@
 
 ;--------------------------------------------------------------------------
 ; initstdin: Open the stdin file descriptors for the keyboard
+     
+.segment        "INIT"
 
 .proc   initstdin
 
 ;--------------------------------------------------------------------------
 ; _read
 
+.code
 
 .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
 
@@ -122,15 +124,6 @@ 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:
@@ -149,4 +142,3 @@ errout: lda     #$FF
 
 
 
-