mirror of
https://github.com/cc65/cc65.git
synced 2024-12-21 20:29:24 +00:00
small optimization; fix line buffered read of length 0
git-svn-id: svn://svn.cc65.org/cc65/trunk@3065 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
5abf10e049
commit
61ca515494
@ -1,5 +1,5 @@
|
||||
;
|
||||
; Christian Groessler, May-2004
|
||||
; Christian Groessler, Jun-2004
|
||||
;
|
||||
; int __fastcall__ read(int fd,void *buf,int count)
|
||||
;
|
||||
@ -87,7 +87,7 @@ newbuf:
|
||||
lda ICBLL,x ; get # of bytes read
|
||||
sta buflen
|
||||
lda #0
|
||||
sta index
|
||||
sta index ; fresh buffer
|
||||
|
||||
; restore user buffer address & length
|
||||
pla
|
||||
@ -103,6 +103,7 @@ newbuf:
|
||||
sta ICBLL,x
|
||||
|
||||
; fall into use_buf
|
||||
lda buflen
|
||||
|
||||
; return bytes from line buffer
|
||||
; use buflen and index to access buffer
|
||||
@ -110,7 +111,6 @@ newbuf:
|
||||
; use dataptr as a temporary pointer
|
||||
|
||||
use_buf:
|
||||
lda buflen
|
||||
sec
|
||||
sbc index ; size of unread data in the buffer
|
||||
sta cbs
|
||||
@ -162,9 +162,7 @@ c1: ldx #0
|
||||
btsmall:
|
||||
lda cbs
|
||||
sta ICBLL,x
|
||||
bne icbll_copy
|
||||
|
||||
; brk ; not reached
|
||||
bpl icbll_copy
|
||||
|
||||
.zeropage
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user