How to receive parameters from MS-DOS and compares it in Assembly 16-bits?

393 views Asked by At

Good night, what's the simpliest way to receive a simple char as parameter in Assembly 16-BITS, and compares to test if is the right one? I'm for 2 days searching for examples of how to do it, but no one had worked for me... I tried that code from StackOverflow and it doesn't work, the dx has 81h no the hex of the char that I need. I'm very newbie in Assembly, so I need little examples of code to understand... I want the simpliest way possible, I don't want to waste your time... Thanks. In MS-DOS shell I'll call my program with a char in front, like "MOVE A". The example in that code cited above works like an Echo, but I can't compares the char inserted on command line. I'm on Windows 98 with TASM 4.1 I tried the example of the book Art of Assembly cited on the link, of chapter 13.3.12, the one talking about PSP, and, doesn't work for what I need. I think people are not understanding what I wanna learn. Thanks guys

1

There are 1 answers

7
Jester On BEST ANSWER

Yes, the command line is at 81h as you have already been told. In those examples however the address had to be passed to a print string function. If you want to access the character itself, you will need a memory load, not just its address. At least with the dosbox version I have available, the command name is not included, but the separating space is. So the actual argument character if you invoke your program as move a will be at offset 82h. This sample code will thus load and print the letter:

org 100h

mov dl, ds:[82h]
mov ah, 06h
int 21h
mov ax, 4c00h
int 21h

Apparently tasm needs the ds: prefix otherwise it emits a [Constant] assumed to mean immediate constant warning and proceeds to use it as an immediate not an address.

PS: learn to use a debugger.