2024-01-30 17:51:00 +01:00
|
|
|
;
|
|
|
|
; Colin Leroy-Mira, 2024
|
|
|
|
;
|
|
|
|
; int __fastcall__ fputs (const char* s, register FILE* f)
|
|
|
|
;
|
|
|
|
|
|
|
|
.export _fputs
|
|
|
|
.importzp ptr1, ptr2
|
2024-01-30 18:11:10 +01:00
|
|
|
.import _write, _strlen, checkferror
|
2024-01-30 17:51:00 +01:00
|
|
|
.import swapstk, pushax, returnFFFF
|
|
|
|
|
|
|
|
.include "stdio.inc"
|
|
|
|
.include "_file.inc"
|
|
|
|
|
|
|
|
_fputs:
|
|
|
|
sta ptr1
|
|
|
|
stx ptr1+1
|
|
|
|
|
2024-01-30 18:11:10 +01:00
|
|
|
jsr checkferror
|
2024-01-30 17:51:00 +01:00
|
|
|
bne ret_eof
|
|
|
|
|
|
|
|
; Push _write parameters
|
|
|
|
ldy #_FILE::f_fd
|
|
|
|
lda (ptr1),y
|
|
|
|
ldx #$00
|
|
|
|
jsr swapstk ; Push fd, get s
|
|
|
|
|
|
|
|
jsr pushax ; Push s
|
2024-01-30 17:59:33 +01:00
|
|
|
|
2024-01-30 17:51:00 +01:00
|
|
|
jsr _strlen ; Get length
|
2024-01-30 17:59:33 +01:00
|
|
|
|
2024-01-30 17:51:00 +01:00
|
|
|
; Write
|
|
|
|
jmp _write
|
|
|
|
|
|
|
|
ret_eof:
|
|
|
|
jmp returnFFFF
|