fmt
This commit is contained in:
parent
2d06c9700b
commit
7b97ca096d
@ -1,9 +1,9 @@
|
|||||||
;********************************************************************************
|
;;********************************************************************************
|
||||||
; @module string
|
;; @module string
|
||||||
; @type utility
|
;; @type utility
|
||||||
; @details
|
;; @details
|
||||||
; String utility
|
;; String utility
|
||||||
;********************************************************************************
|
;;********************************************************************************
|
||||||
.ifndef INCLUDE_STRING
|
.ifndef INCLUDE_STRING
|
||||||
INCLUDE_STRING = 1
|
INCLUDE_STRING = 1
|
||||||
|
|
||||||
@ -29,15 +29,15 @@ Import str, hex_char_to_uint8, hex_str_to_uint, uint8_to_hex_str
|
|||||||
.endif
|
.endif
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
;********************************************************************************
|
;;********************************************************************************
|
||||||
; @function Macro for passing arguments to strf
|
;; @function Macro for passing arguments to strf
|
||||||
; @param fmt: Format string address or string literal
|
;; @param fmt: Format string address or string literal
|
||||||
; @param out: Output string address
|
;; @param out: Output string address
|
||||||
; @param x0-x9: Additional parameters
|
;; @param x0-x9: Additional parameters
|
||||||
; @warning Addresses as additional paramters must be passed like this `#<addr,#>addr`
|
;; @warning Addresses as additional paramters must be passed like this `#<addr,#>addr`
|
||||||
; @modifies: A, X, Y
|
;; @modifies: A, X, Y
|
||||||
; @see strf
|
;; @see strf
|
||||||
;********************************************************************************
|
;;********************************************************************************
|
||||||
.macro Strf fmt,out,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9
|
.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
|
@N_ARGS .set 0 ; @ so that it doesnt break cheap labels
|
||||||
.if .match(fmt, "") ; fmt is a string literal -> store in rodata
|
.if .match(fmt, "") ; fmt is a string literal -> store in rodata
|
||||||
|
@ -2,21 +2,21 @@
|
|||||||
Export str, strf
|
Export str, strf
|
||||||
|
|
||||||
.code
|
.code
|
||||||
;********************************************************************************
|
;;********************************************************************************
|
||||||
; @function Format a string
|
;; @function Format a string
|
||||||
; @details
|
;; @details
|
||||||
; If there is no value to be read, the Pz will be set
|
;; If there is no value to be read, the Pz will be set
|
||||||
; Formats:
|
;; Formats:
|
||||||
; - x: unsigned hex integer (1 byte) -> 2 chars
|
;; - x: unsigned hex integer (1 byte) -> 2 chars
|
||||||
; - X: unsigned hex integer (2 byte) -> 4 chars TODO
|
;; - X: unsigned hex integer (2 byte) -> 4 chars TODO
|
||||||
; - u: unsigned decimal integer (1 byte) TODO
|
;; - u: unsigned decimal integer (1 byte) TODO
|
||||||
; - U: unsigned decimal integer (2 bytes) TODO
|
;; - U: unsigned decimal integer (2 bytes) TODO
|
||||||
; @param ARG0-1: Format string address
|
;; @param ARG0-1: Format string address
|
||||||
; @param ARG2-3: Output string address
|
;; @param ARG2-3: Output string address
|
||||||
; @param ARG4+: Additional parameters
|
;; @param ARG4+: Additional parameters
|
||||||
; @returns
|
;; @returns
|
||||||
; @modifies: A, X, Y
|
;; @modifies: A, X, Y
|
||||||
;********************************************************************************
|
;;********************************************************************************
|
||||||
out_idx := str::out_idx
|
out_idx := str::out_idx
|
||||||
fmt_idx := str::fmt_idx
|
fmt_idx := str::fmt_idx
|
||||||
.proc strf
|
.proc strf
|
||||||
|
Loading…
Reference in New Issue
Block a user