Hi,
I am trying to learn ASM programming on MS-DOS to get a string from User.
But during the run-time it reboots the OS automatically or hangs or misbehaves while the same program is executed on Windows-XP it does not give any run-time errors.
Could you please help me in this regards as to where am I going wrong.
Below is the environment:
Assembler: Tasm
OS: MS-DOS71, XP
.Model Small
.Stack 100H .Data
CR Equ 0DH
LF Equ 0AH
NL Equ 00H
MsgX db 32H Dup (NL)
.Code
Run:
MOV AX, @Data
MOV DS, AX
MOV AX, Offset MsgX
CALL GetStr
CALL Exit
GetChr:
PUSH BX
PUSH CX
PUSH DX
MOV AH, 01H
INT 21H
POP DX
POP CX
POP BX
RET
GetStr:
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV BX, AX
GetStrLoop:
CALL GetChr
MOV Byte Ptr [BX], AL
CMP Byte Ptr [BX], CR
JE GetStrFree
INC BX
JMP GetStrLoop
GetStrFree:
MOV Byte Ptr [BX], NL
POP DX
POP CX
POP BX
POP AX
RET
Exit:
MOV AH, 4CH
INT 21H
End Run