os-workshop

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 4092b1573f340bed550e20c77bf09e1fb5ad0992
parent b8b0952792447e6754a831e0d8f140e4e261de8d
Author: Brian Swetland <swetland@frotz.net>
Date:   Sat, 21 May 2022 16:26:10 -0700

hw/debug: add vxprintf(fmt, ap)

Diffstat:
Mhw/inc/hw/debug.h | 3++-
Mhw/src/debug-printf.c | 6++++++
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/inc/hw/debug.h b/hw/inc/hw/debug.h @@ -4,6 +4,7 @@ #pragma once #include <stdint.h> +#include <stdarg.h> // debug-io.c -- can be replaced with alternate impls void xputc(unsigned c); @@ -12,4 +13,4 @@ int xgetc(void); // debug-printf.c -- calls xputs() void xprintf(const char* fmt, ...); - +void vxprintf(const char* fmt, va_list ap); diff --git a/hw/src/debug-printf.c b/hw/src/debug-printf.c @@ -15,3 +15,9 @@ void xprintf(const char* fmt, ...) { xputs(msg); } +void vxprintf(const char* fmt, va_list ap) { + char msg[128]; + vsnprintf(msg, sizeof(msg), fmt, ap); + xputs(msg); +} +