From dce5a438041b0f314f3bf4711be450e8745e6c61 Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Sun, 31 Dec 2023 01:57:05 +0100 Subject: [PATCH] add printf --- util/string.h65 | 7 ++++++- util/string.s65 | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/util/string.h65 b/util/string.h65 index 0c88298..60105fb 100644 --- a/util/string.h65 +++ b/util/string.h65 @@ -11,7 +11,7 @@ INCLUDE_STRING = 1 .scope str -Import str, strf +Import str, strf, printf_buffer Import str, hex_char_to_uint8, hex_str_to_uint Import str, uint8_to_hex_str, uint_to_hex_str @@ -74,5 +74,10 @@ Import str, uint8_to_hex_str, uint_to_hex_str ; .out .sprintf("info: Strf: called with %d arguments", @N_ARGS) .endmacro +.macro Printf fmt,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9 + Strf fmt,str::printf_buffer,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9 + PrintNC str::printf_buffer +.endmacro + .endscope .endif ; guard diff --git a/util/string.s65 b/util/string.s65 index c726764..6be6543 100644 --- a/util/string.s65 +++ b/util/string.s65 @@ -1,5 +1,8 @@ .include "string.h65" -Export str, strf +Export str, strf, printf_buffer + +.bss +printf_buffer: .res $41 .zeropage fmt_idx: .res 1