2002-11-17 22:45:55 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 17.11.2002
|
|
|
|
;
|
|
|
|
; Common stuff for the read/write routines
|
|
|
|
;
|
|
|
|
|
|
|
|
.export rwcommon
|
|
|
|
|
2018-05-21 14:21:45 +00:00
|
|
|
.import popax, popptr1
|
2002-11-17 22:45:55 +00:00
|
|
|
.importzp ptr1, ptr2, ptr3, tmp2
|
|
|
|
|
2002-11-20 18:14:35 +00:00
|
|
|
.include "errno.inc"
|
2002-11-17 22:45:55 +00:00
|
|
|
.include "filedes.inc"
|
|
|
|
|
|
|
|
|
|
|
|
;--------------------------------------------------------------------------
|
|
|
|
; rwcommon: Pop the parameters from stack, preprocess them and place them
|
|
|
|
; into zero page locations. Return carry set if the handle is invalid,
|
|
|
|
; return carry clear if it is ok. If the carry is clear, the handle is
|
|
|
|
; returned in A.
|
|
|
|
|
|
|
|
.proc rwcommon
|
|
|
|
|
2020-11-01 21:59:07 +00:00
|
|
|
inx
|
|
|
|
stx ptr2+1
|
|
|
|
tax
|
|
|
|
inx
|
|
|
|
stx ptr2 ; Save count with each byte incremented separately
|
2002-11-17 22:45:55 +00:00
|
|
|
|
2018-05-22 09:25:26 +00:00
|
|
|
jsr popptr1 ; Get buf to ptr1, Y=0 by call
|
|
|
|
|
2018-05-21 14:21:45 +00:00
|
|
|
sty ptr3
|
|
|
|
sty ptr3+1 ; Clear ptr3
|
2002-11-17 22:45:55 +00:00
|
|
|
|
|
|
|
jsr popax ; Get the handle
|
|
|
|
cpx #$01
|
2010-06-26 11:28:44 +00:00
|
|
|
bcs @L9
|
|
|
|
cmp #MAX_FDS ; Set carry if fd too large
|
2002-11-20 18:14:35 +00:00
|
|
|
sta tmp2
|
2010-06-26 11:28:44 +00:00
|
|
|
@L9: rts ; Return with result in carry
|
2002-11-17 22:45:55 +00:00
|
|
|
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
|