home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
batutl
/
batutl2.arc
/
ASK1.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-04-20
|
2KB
|
89 lines
TITLE ASK0 1-10-85 [4-19-88]
;Toad Hall Disassembly, tweak
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
Ask1 proc near
CALL Check_CmdLine ;check command line for prompt, display
CALL GetChar ;get user key (Y or N)
MOV AH,4CH ;terminate, Errorlevel in AL
INT 21H
Ask1 endp
Check_CmdLine proc near
MOV CL,24H ;'$'
MOV DI,80H ;check cmd line
MOV DX,[DI] ;snarf length byte
xor dh,dh ;clear msb
or dx,dx ;anything there?
JZ Prompt_12E ;nope, go prompt him
CMP DX,3CH ;60 chars?
JZ Prompt_12E ; yep, go prompt him
ADD DX,80H ;+128 into code space
MOV SI,DX ;pointer
INC SI ;bump
MOV [SI],CL ;stuff terminating '$'
MOV DX,82H ;cmd line first char
MOV AH,9 ;display string
INT 21H
ret ;done
Check_CmdLine endp
Prompt_12E proc near
MOV DX,OFFSET pressYNPrompt ;'Press Y or N'
MOV AH,9 ;display string
INT 21H
RET
Prompt_12E endp
GetChar proc near
mov ax,0C07H ;clear kbd,
INT 21H ; do direct kbd input w/o echo
xor bx,bx ;assume yes, Errorlevel = 0
CMP AL,'Y' ;answered yes?
JZ Show_Response ; ok
CMP AL,'y' ;answered yes?
JZ Show_Response ; ok
inc bx ;assume no, Errorlevel = 1
CMP AL,'N' ;answered no?
; JZ L0162 ; ok
je Show_Response ; ok
CMP AL,'n' ;answered no?
; JZ L0162 ; ok
je Show_Response ; ok
MOV DX,OFFSET ynPrompt ;dummy .. 'Y or N' prompt
MOV AH,9 ;display string
INT 21H
JMP SHORT GetChar ; and try again
Show_Response:
MOV response,AL ;stuff char in string
MOV DX,OFFSET response ;display char, newline
MOV AH,9 ;display string
INT 21H
MOV AL,bl ;return Errorlevel = whatever
RET
;L0162: MOV response,AL ;stuff char in string
; MOV DX,OFFSET response ;display char, new line
; MOV AH,9 ;display string
; INT 21H
; MOV AL,1 ;return Errorlevel = 1
; RET
ynPrompt DB CR,LF,'(Y/N) ? $'
pressYNPrompt DB 'Press Y or N ? $'
response DB ' ',CR,LF,'$'
GetChar endp
CodeSeg ENDS
END Ask1