Extrn Get$Loc: Far
Extrn Rls$Alloc: Far
MCODE Segment Byte
Assume CS: MCODE
Public xwords
xwords Proc Far
ARG mchar:WORD, StrHandle: WORD = Retbytes
push BP
mov BP,SP
push DS
mov AX, StrHandle
push AX
call Get$Loc
mov DS,DX
mov SI,AX
mov AX,0
jcxz Exit
xor BX,BX
mov DX,0
mov BX,1
ReadChar:
lodsb
cmp AX,mchar
jnz Notsp
mov BX,0
jmp R2
Notsp:
cmp BX,2
jz R2
mov BX,2
inc DX
R2:
loop ReadChar
Exit:
mov AX,DX
push AX
push Word Ptr StrHandle
call Rls$Alloc
pop AX
pop DS
pop BP
retf Retbytes
xwords EndP
MCODE EndS
End