home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
batutl
/
batutl2.arc
/
ANSWER.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-04-20
|
3KB
|
141 lines
TITLE ANSWER 2-3-86 [4-15-88]
;Toad Hall Disassembly
;Didn't get very far in the documentation on this one.
.RADIX 16
LF EQU 0AH
CR EQU 0DH
;
;INITIAL VALUES : CS:IP 0000:0100
; SS:SP 0000:FFFF
CodeSeg SEGMENT
ASSUME DS:CodeSeg,SS:CodeSeg,CS:CodeSeg,ES:CodeSeg
ORG 100H
Answer proc
MOV SI,80H ;PSP cmd line
LODSB ;snarf length byte
AND AX,7FH ;mask
JZ L0117 ;zero, no cmd line
MOV DI,AX ;length
ADD DI,SI ;point into cmd line
MOV BYTE PTR [DI],'$' ;stuff terminating $
MOV DX,SI ;command line
INC DX ;bump past length byte
MOV AH,9 ;print string
INT 21
L0117: MOV DX,OFFSET kbdbuf_1D3 ;keyboard input buffer
MOV AH,0AH ;buffered kbd input
INT 21
CALL L01A0
MOV CX,BX
MOV ES,AX
XOR DI,DI
XOR AL,AL ;scan for a 0
CLD ;insure fwd
Lup12A: REPNZ SCASB
JNZ Endit_16C
CMP AL,ES:[DI]
JZ L0171
MOV DX,DI
MOV BP,CX
MOV SI,OFFSET LOGO ;compare with our logo
MOV CX,7 ;7 bytes
REPZ CMPSB
JZ L0147 ;didn't find a match
MOV DI,DX ;refresh DI
MOV CX,BP
JMP SHORT Lup12A ;reloop
L0147: MOV CX,51H ;scan for 51H bytes
REPNZ SCASB
JNZ Endit_16C ;die, Errorlevel 1
MOV SI,DI
MOV DI,DX
MOV CX,ES
MOV DS,CX
MOV CX,BX
SUB CX,SI
Lup15A: LODSB
AND AL,AL
JZ L0171
Lup15F: STOSB
LOOP Lup164
JMP SHORT Endit_16C ;die, errorlevel 1
Lup164: LODSB
AND AL,AL
JNZ Lup15F
STOSB
LOOP Lup15A
Endit_16C:
MOV AX,4C01H ;Exit, Errorlevel 1
INT 21
L0171: MOV BYTE PTR ES:[DI],0
MOV AX,CS
MOV DS,AX
MOV AL,blen_1D4
XOR AH,AH
ADD AX,8
ADD AX,DI
CMP AX,BX
JNB Endit_16C ;die, Errorlevel 1
MOV SI,OFFSET LOGO ;'ASK=VERSION...'
MOV CX,7 ;move 7 bytes
REPZ MOVSB
MOV SI,OFFSET buff_1D5
MOV CL,blen_1D4 ;length byte
REPZ MOVSB ;move the buffer
XOR AX,AX ;terminate with 0
STOSW
MOV AX,4C00H ;Terminate, no error
INT 21
Answer endp
;L01A0 L011E CC
L01A0 proc near
PUSH ES
MOV AX,CS
MOV ES,AX
ASSUME ES:CodeSeg
MOV AX,ES:14H
MOV ES,AX
ASSUME ES:Nothing
MOV AX,ES:2CH
AND AX,AX
JNZ L01C0
MOV AX,ES
DEC AX
MOV ES,AX
ADD AX,ES:3
; ADD AX,2
inc ax
inc ax
L01C0: DEC AX
MOV ES,AX
INC AX
MOV BX,ES:3
SHL BX,1
SHL BX,1
SHL BX,1
SHL BX,1
POP ES
RET
L01A0 endp
;L01D3 L0117 DI
kbdbuf_1D3 DB 50H
;L01D4 L0179 DR L0192 DR
blen_1D4 DB 0
;L01D5 L018F DI
buff_1D5 DB 50H DUP(0)
;L0225 L0137 DI L0187 DI
LOGO DB 'ANSWER=VER 1.00'
CodeSeg ENDS
;
END Answer