1
0
mirror of https://github.com/cc65/cc65.git synced 2026-04-23 23:17:45 +00:00

Finally: Commodore file I/O

git-svn-id: svn://svn.cc65.org/cc65/trunk@1531 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-11-16 23:45:15 +00:00
parent 9e74c2b26f
commit 751aaee63d
23 changed files with 1023 additions and 273 deletions
+2 -3
View File
@@ -27,8 +27,7 @@ OBJS = _scrsize.o \
randomize.o \
readjoy.o \
rs232.o \
tgi_mode_table.o \
write.o
tgi_mode_table.o
TGIS = c64-320-200-2.tgi
@@ -44,4 +43,4 @@ all: $(OBJS) $(TGIS)
clean:
@rm -f $(OBJS) $(TGIS:.tgi=.o)
-51
View File
@@ -1,51 +0,0 @@
;
; Ullrich von Bassewitz, 30.05.1998
;
; int read (int fd, void* buf, int count);
;
; THIS IS A HACK!
;
.export _read
.import popax
.importzp ptr1, ptr2, ptr3
.include "../cbm/cbm.inc"
_read: jsr popax ; get count
sta ptr2
stx ptr2+1 ; save it for later
jsr popax ; get buf
sta ptr1
stx ptr1+1
jsr popax ; get fd and discard it
lda #0
sta ptr3
sta ptr3+1 ; set count
L1: lda ptr2
ora ptr2+1 ; count zero?
beq L9
dec ptr2
bne L1a
dec ptr2+1
L1a: jsr BASIN
ldy #0
sta (ptr1),y ; save char
inc ptr1
bne L2
inc ptr1+1
L2: inc ptr3 ; increment count
bne L3
inc ptr3+1
L3: cmp #$0D ; CR?
bne L1
; Done, return the count
L9: lda ptr3
ldx ptr3+1
rts
-47
View File
@@ -1,47 +0,0 @@
;
; Ullrich von Bassewitz, 30.05.1998
;
; int write (int fd, const void* buf, int count);
;
; THIS IS A HACK!
;
.export _write
.import popax
.importzp ptr1, ptr2, ptr3
.include "../cbm/cbm.inc"
_write: jsr popax ; get count
sta ptr2
stx ptr2+1 ; save it for later
sta ptr3
stx ptr3+1 ; save for function result
jsr popax ; get buf
sta ptr1
stx ptr1+1
jsr popax ; get fd and discard it
L1: lda ptr2
ora ptr2+1 ; count zero?
beq L9
ldy #0
lda (ptr1),y
jsr BSOUT
inc ptr1
bne L2
inc ptr1+1
L2: lda ptr2
bne L3
dec ptr2
dec ptr2+1
jmp L1
L3: dec ptr2
jmp L1
; No error, return count
L9: lda ptr3
ldx ptr3+1
rts