#include <stdio.h>

int putchar(int c) __naked {
    c;

    __asm
        ; If a is 0xA:
        ld a, l
        push hl
        push bc
        .db 0x01, 0xFF, 0x00
        or h
        sbc hl,bc
        pop bc
        pop hl
        jr nz, do_print

            push ix
            rst 0x28
            .dw 0x452E
            pop ix
            ret
        
        do_print:
            push ix
            rst 0x28
            .dw 0x4504
            pop ix
            ret
    __endasm;
}