1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
kvisc/ka/crt/fmt/printf.k
julianb0 a42786831f
vm
2019-07-04 20:33:49 +02:00

53 lines
716 B
Plaintext

; The OS/K Team licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information.
;
; int putc(int ch)
;
putc:
prn ax0
xor rax, rax
ret
;
; int printf(const char *fmt, ...)
;
printf:
dump 0
mov ax2, ax0
mov ax0, putc
mov ax1, STRLEN_MAX
lea ax3, b[rsp+8]
jmp doprnt
;
; int nprintf(const char *fmt, int n, ...)
;
nprintf:
dump 0
mov ax2, ax0
mov ax0, putc
lea ax3, b[rsp+8]
jmp doprnt
;
; Print a string
;
print:
mov rcx, STRLEN_MAX
b.z b[ax0], 0, .1
prns.rep.nz ax0
.1:
ret
;
; Print exactly ax1 characters
;
print_n:
mov rcx, ax1
b.z b[ax0], 0, .1
prns.rep.nz ax0
.1:
ret