1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-05 06:28:57 +00:00

Merge pull request #653 from IrgendwerA8/cbm_rw_popptr1

* Saved 6 bytes by using popptr1.

* Fix typo for import.

* Beautified comment.
This commit is contained in:
greg-king5 2018-05-23 00:31:53 -04:00 committed by GitHub
commit 486678e557
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 20 deletions

View File

@ -88,10 +88,10 @@
ldy #0 ldy #0
lda tmp1 lda tmp1
sta (ptr2),y sta (ptr1),y
inc ptr2 inc ptr1
bne @L1 bne @L1
inc ptr2+1 ; *buf++ = A; inc ptr1+1 ; *buf++ = A;
; Increment the byte count ; Increment the byte count
@ -107,9 +107,9 @@
; Decrement the count ; Decrement the count
@L3: inc ptr1 @L3: inc ptr2
bne @L0 bne @L0
inc ptr1+1 inc ptr2+1
bne @L0 bne @L0
beq done ; Branch always beq done ; Branch always

View File

@ -6,7 +6,7 @@
.export rwcommon .export rwcommon
.import popax .import popax, popptr1
.importzp ptr1, ptr2, ptr3, tmp2 .importzp ptr1, ptr2, ptr3, tmp2
.include "errno.inc" .include "errno.inc"
@ -22,18 +22,15 @@
.proc rwcommon .proc rwcommon
eor #$FF eor #$FF
sta ptr1 sta ptr2
txa txa
eor #$FF eor #$FF
sta ptr1+1 ; Remember -count-1 sta ptr2+1 ; Remember -count-1
jsr popax ; Get buf jsr popptr1 ; Get buf to ptr1, Y=0 by call
sta ptr2
stx ptr2+1
lda #$00 sty ptr3
sta ptr3 sty ptr3+1 ; Clear ptr3
sta ptr3+1 ; Clear ptr3
jsr popax ; Get the handle jsr popax ; Get the handle
cpx #$01 cpx #$01

View File

@ -61,10 +61,10 @@
; Output the next character from the buffer ; Output the next character from the buffer
@L0: ldy #0 @L0: ldy #0
lda (ptr2),y lda (ptr1),y
inc ptr2 inc ptr1
bne @L1 bne @L1
inc ptr2+1 ; A = *buf++; inc ptr1+1 ; A = *buf++;
@L1: jsr BSOUT @L1: jsr BSOUT
; Check the status ; Check the status
@ -84,9 +84,9 @@
; Decrement count ; Decrement count
@L2: inc ptr1 @L2: inc ptr2
bne @L0 bne @L0
inc ptr1+1 inc ptr2+1
bne @L0 bne @L0
; Wrote all chars or disk full. Close the output channel ; Wrote all chars or disk full. Close the output channel

View File

@ -13,7 +13,7 @@
FILEDES = 3 ; first free to use file descriptor FILEDES = 3 ; first free to use file descriptor
.importzp ptr1, ptr2, ptr3, tmp1 .importzp ptr1, ptr2, ptr3, tmp1
.import addysp, popax, poptr1 .import addysp, popax, popptr1
.import __oserror .import __oserror
.import _FindFile, _ReadByte .import _FindFile, _ReadByte
.export _open, _close, _read .export _open, _close, _read