2 ; Oliver Schmidt, 12.01.2005
4 ; int __fastcall__ write (int fd, const void* buf, unsigned count);
8 .import rwprolog, rwcommon, rwepilog
11 .include "zeropage.inc"
15 .include "filedes.inc"
23 ; Check for write access
24 lda fdtab + FD::FLAGS,y
32 ; Check for append flag
33 lda fdtab + FD::FLAGS,y
38 stx mliparam + MLI::EOF::REF_NUM
47 .assert MLI::MARK::REF_NUM = MLI::EOF::REF_NUM, error
49 ; POSITION already set
50 .assert MLI::MARK::POSITION = MLI::EOF::EOF, error
59 write: lda fdtab + FD::REF_NUM,y
63 ; Save count for epilog
66 stx mliparam + MLI::RW::TRANS_COUNT
67 sta mliparam + MLI::RW::TRANS_COUNT+1
69 ; Check for zero count
77 ; Replace '\n' with '\r'
82 ; Set hi bit and write to device
85 cmp #$E0 ; Test for lowercase
87 and #$DF ; Convert to uppercase
89 output: jsr COUT ; Preserves X and Y
110 errno: jmp __directerrno
113 oserr: jmp __mappederrno