-3

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

Community
  • 1
  • 1
  • We understand what you want, you don't understand us. You **do** need it from the PSP, offset 81h. That sample code loaded the address because you need that for that function. Otherwise you can just `mov al, [81h]` or `cmp [81h], 'a'` or similar. PS: use less bold font, thank you. – Jester Jan 03 '17 at 23:43
  • That's exactly what I'm talking about! I tried it in a lot of ways, but doesn't work. Seems that char don't goes to register.... – user3587527 Jan 03 '17 at 23:45
  • Yeah, of course. And I don't know how to debug and program that needs to parameters to work. I'm almost giving up of it... – user3587527 Jan 03 '17 at 23:48
  • Also doesn't work [photo](http://i.imgur.com/rsIP7i9.jpg) In this Test the program only would print if A was send. But it doesn't – user3587527 Jan 04 '17 at 00:10
  • http://thestarman.pcministry.com/asm/debug/debug.htm – Ped7g Jan 04 '17 at 00:32

1 Answers1

2

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.

Jester
  • 56,577
  • 4
  • 81
  • 125