Array: Difference between revisions
→Encoding an Array's End: Added additional clarification
Puppydrum64 (talk | contribs) m (→Encoding an Array's End: Provided more fitting examples that actually relate to the text.) |
Puppydrum64 (talk | contribs) (→Encoding an Array's End: Added additional clarification) |
||
Line 138:
; input: [DS:SI] = string pointer
mov al,[ds:si]
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.
jz EscapeNextChar
cmp al,0h ;check the terminator
jz Terminated ;we've reached the terminator
call PrintChar ;call to hardware-specific printing routine
jmp PrintString
EscapeNextChar:
mov al,[ds:si] ;perform an additional read, except this read doesn't compare the fetched character to anything.
call PrintChar ;print that character as-is
jmp PrintString ;go back to the loop's beginning, skipping the terminator check entirely.
Terminated:
|