;GetChar
; Return next character at ES:[SI] in AL
; unless the next character is a blank
; in which case return a 0 in AL
; or unless the next character is a
; [carriage return] in which case return
; 255 in AL
; Advance SI one byte location unless the
; next character is a [carriage return]
; in which case leave SI pointing to the
; [carriage return]
GETCHAR PROC NEAR
MOV AL,ES:[SI]
CMP AL,0Dh
JZ END_OF_LINE
INC SI ;advance ptr unless at EOL
CMP AL,20h
JNZ DONE_GET ;if not a blank, its a normal char
MOV AL,0 ;return 0 in AL if it is a blank
JMP DONE_GET
END_OF_LINE:
MOV AL,255 ;return 255 in AL if it is a [carriage return]
DONE_GET:
RET
GETCHAR ENDP