mirror of
https://github.com/cc65/cc65.git
synced 2024-12-22 12:30:41 +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)
|
; int __fastcall__ read(int fd,void *buf,int count)
|
||||||
;
|
;
|
||||||
@ -87,7 +87,7 @@ newbuf:
|
|||||||
lda ICBLL,x ; get # of bytes read
|
lda ICBLL,x ; get # of bytes read
|
||||||
sta buflen
|
sta buflen
|
||||||
lda #0
|
lda #0
|
||||||
sta index
|
sta index ; fresh buffer
|
||||||
|
|
||||||
; restore user buffer address & length
|
; restore user buffer address & length
|
||||||
pla
|
pla
|
||||||
@ -103,6 +103,7 @@ newbuf:
|
|||||||
sta ICBLL,x
|
sta ICBLL,x
|
||||||
|
|
||||||
; fall into use_buf
|
; fall into use_buf
|
||||||
|
lda buflen
|
||||||
|
|
||||||
; return bytes from line buffer
|
; return bytes from line buffer
|
||||||
; use buflen and index to access buffer
|
; use buflen and index to access buffer
|
||||||
@ -110,7 +111,6 @@ newbuf:
|
|||||||
; use dataptr as a temporary pointer
|
; use dataptr as a temporary pointer
|
||||||
|
|
||||||
use_buf:
|
use_buf:
|
||||||
lda buflen
|
|
||||||
sec
|
sec
|
||||||
sbc index ; size of unread data in the buffer
|
sbc index ; size of unread data in the buffer
|
||||||
sta cbs
|
sta cbs
|
||||||
@ -162,9 +162,7 @@ c1: ldx #0
|
|||||||
btsmall:
|
btsmall:
|
||||||
lda cbs
|
lda cbs
|
||||||
sta ICBLL,x
|
sta ICBLL,x
|
||||||
bne icbll_copy
|
bpl icbll_copy
|
||||||
|
|
||||||
; brk ; not reached
|
|
||||||
|
|
||||||
.zeropage
|
.zeropage
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user