2 ; Oliver Schmidt, 12.01.2005
4 ; int __fastcall__ write (int fd, const void* buf, unsigned count);
8 .import rwprolog, rwcommon, rwepilog
9 .import errnoexit, oserrexit
12 .include "zeropage.inc"
16 .include "filedes.inc"
24 ; Check for write access
25 lda fdtab + FD::FLAGS,y
33 ; Check for append flag
34 lda fdtab + FD::FLAGS,y
39 stx mliparam + MLI::EOF::REF_NUM
48 .assert MLI::MARK::REF_NUM = MLI::EOF::REF_NUM, error
50 ; POSITION already set
51 .assert MLI::MARK::POSITION = MLI::EOF::EOF, error
60 write: lda fdtab + FD::REF_NUM,y
64 ; Save count for epilog
67 stx mliparam + MLI::RW::TRANS_COUNT
68 sta mliparam + MLI::RW::TRANS_COUNT+1
70 ; Check for zero count
78 ; Replace '\n' with '\r'
83 ; Set hi bit and write to device
86 cmp #$E0 ; Test for lowercase
88 and #$DF ; Convert to uppercase
90 output: jsr COUT ; Preserves X and Y