Array: Difference between revisions

Content added Content deleted
m (→‎Encoding an Array's End: Fixed a mistake. The pointer wasn't getting incremented.)
Line 139: Line 139:
; input: [DS:SI] = string pointer
; input: [DS:SI] = string pointer
mov al,[ds:si]
mov al,[ds:si]
inc si
cmp al,5Ch ;ascii for backslash, this is the escape character
cmp al,5Ch ;ascii for backslash, this is the escape character
;notice that the check for the escape character happens before the check for the terminator.
;notice that the check for the escape character happens before the check for the terminator.
Line 149: Line 150:
EscapeNextChar:
EscapeNextChar:
mov al,[ds:si] ;perform an additional read, except this read doesn't compare the fetched character to anything.
mov al,[ds:si] ;perform an additional read, except this read doesn't compare the fetched character to anything.
inc si
call PrintChar ;print that character as-is
call PrintChar ;print that character as-is
jmp PrintString ;go back to the loop's beginning, skipping the terminator check entirely.
jmp PrintString ;go back to the loop's beginning, skipping the terminator check entirely.