This commit is contained in:
Matthias@Dell 2023-12-23 14:18:15 +01:00
parent 2d06c9700b
commit 7b97ca096d
2 changed files with 30 additions and 30 deletions

View File

@ -1,9 +1,9 @@
;********************************************************************************
; @module string
; @type utility
; @details
; String utility
;********************************************************************************
;;********************************************************************************
;; @module string
;; @type utility
;; @details
;; String utility
;;********************************************************************************
.ifndef INCLUDE_STRING
INCLUDE_STRING = 1
@ -29,15 +29,15 @@ Import str, hex_char_to_uint8, hex_str_to_uint, uint8_to_hex_str
.endif
.endmacro
;********************************************************************************
; @function Macro for passing arguments to strf
; @param fmt: Format string address or string literal
; @param out: Output string address
; @param x0-x9: Additional parameters
; @warning Addresses as additional paramters must be passed like this `#<addr,#>addr`
; @modifies: A, X, Y
; @see strf
;********************************************************************************
;;********************************************************************************
;; @function Macro for passing arguments to strf
;; @param fmt: Format string address or string literal
;; @param out: Output string address
;; @param x0-x9: Additional parameters
;; @warning Addresses as additional paramters must be passed like this `#<addr,#>addr`
;; @modifies: A, X, Y
;; @see strf
;;********************************************************************************
.macro Strf fmt,out,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9
@N_ARGS .set 0 ; @ so that it doesnt break cheap labels
.if .match(fmt, "") ; fmt is a string literal -> store in rodata

View File

@ -2,21 +2,21 @@
Export str, strf
.code
;********************************************************************************
; @function Format a string
; @details
; If there is no value to be read, the Pz will be set
; Formats:
; - x: unsigned hex integer (1 byte) -> 2 chars
; - X: unsigned hex integer (2 byte) -> 4 chars TODO
; - u: unsigned decimal integer (1 byte) TODO
; - U: unsigned decimal integer (2 bytes) TODO
; @param ARG0-1: Format string address
; @param ARG2-3: Output string address
; @param ARG4+: Additional parameters
; @returns
; @modifies: A, X, Y
;********************************************************************************
;;********************************************************************************
;; @function Format a string
;; @details
;; If there is no value to be read, the Pz will be set
;; Formats:
;; - x: unsigned hex integer (1 byte) -> 2 chars
;; - X: unsigned hex integer (2 byte) -> 4 chars TODO
;; - u: unsigned decimal integer (1 byte) TODO
;; - U: unsigned decimal integer (2 bytes) TODO
;; @param ARG0-1: Format string address
;; @param ARG2-3: Output string address
;; @param ARG4+: Additional parameters
;; @returns
;; @modifies: A, X, Y
;;********************************************************************************
out_idx := str::out_idx
fmt_idx := str::fmt_idx
.proc strf