From d3d229a9188d98f27dee229a053fd3ec9e968b02 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 22 Apr 2019 21:52:33 -0400 Subject: [PATCH] shell: support string arguments No consumer yet, but it's coming... --- parts/shell.asm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/parts/shell.asm b/parts/shell.asm index f986bf9..401f5c4 100644 --- a/parts/shell.asm +++ b/parts/shell.asm @@ -280,6 +280,10 @@ shellPrintErr: ; Bit 2 - optional: If set and not present during parsing, we don't error out ; and write zero ; +; Bit 3 - String argument: If set, this argument is a string. A pointer to the +; read string, null terminated (max 0x20 chars) will +; be placed in the next two bytes. This has to be the +; last argument of the list and it stops parsing. ; Sets A to nonzero if there was an error during parsing, zero otherwise. ; If there was an error during parsing, carry is set. shellParseArgs: @@ -318,6 +322,14 @@ shellParseArgs: jr z, .error ; not set? then we have too many args ld c, a ; save the specs for the next loop inc hl ; (hl) points to a space, go next + bit 3, a ; is our arg a string? + jr z, .notAString + ; our arg is a string. Let's place HL in our next two bytes and call + ; it a day. Little endian, remember + ld (ix), l + ld (ix+1), h + jr .success ; directly to success: skip endofargs checks +.notAString: call parseHexPair jr c, .error ; we have a good arg and we need to write A in (IX).