Categories
z80

cpm z80 output

Up until now I was using raw serial output for console, but I think this is not the correct way.

write_char:
        in a,(3)
        and 001h
        jp z, write_char
        ld a,b
        out (2),a
        ret

now this works, but it does not work for cpm emulator yaze-ag. I suspect this is because I should be using the syscall to output to the console.

write_char:             push de ; preserve register values
                        push bc
                        ld c,2  ; function 2
                        ld e,a  ; char to write
                        call 5  ; call bios / syscall
                        pop bc  ; restore register values
                        pop de
                        ret