1 Year
Discussion Span
Last Post by Hanif1993

You'll have to give us a good deal more detail about the problem, I'm afraid. What kind of constant are you trying to use? I assume it is an integer, in which case you probably don't have many options - Turbo Assembler (which is the TASM I assume you mean - there were at least two others which went by that acronym) was a 16-bit real mode assembler for MS-DOS, and did not work directly with values greater than FFFF hex (65536 decimal). There are ways to work around this, but they aren't particularly easy.

Which leads to the next question: why TASM? is this for coursework (in which case you probably don't have any choice), and is there a reason why it is in an archaic 16-bit assembly dialect for MS-DOS? Current versions of Windows (Vista and later) won't even run 16-bit real mode programs except through an emulator such as DosBox; if you have any choice at all in the matter, I recommend that you ditch TASM for a modern assembler that actually still runs, such as NASM or FASM.


Yes, you are right, i am sorry about that, i don't mean integer i mean string constant. for example

     .model tiny

     ORG    100h
     mov    ah,9
     mov    dx, OFFSET MSG
     int    21h

     mov    ah, 4C00h
     int    21h
MSG  db  'Hello I'm not a virus$.'

When i compile it, it say constan too long Error is at line 10
I am using TASM 1.4 and Intel Core i3 CPU

Edited by Hanif1993


You may want to check your code. Examples of the call show


Edited by pritaeas: Fixed markdown.

Votes + Comments

Well, aside from the fact that 4C00 hex is far too large to fit in to fit into a byte (the maximum value for a single byte - that is to say, 8 bits - is FF hex, or 256 decimal), a quick check of Ralf Brown's Interrupt List's entry for interrupt vector 21h shows no parametric function for 4C00h. Are you sure you didn't want (INT 21h, AH=4Ch)[http://www.ctyme.com/intr/rb-2974.htm] (exit with a shell return value)? That would be the usual function to call at the end of a MS-DOS program, IIRC.


I think you'll find that it was AH, and that you wanted to set that to 4Ch; however, since AH is the high byte of AX, using MOV AX, 4C00h is the same as assigning MOV AH, 4Ch followed by MOV AL, 00h. The effect is (almost) the same, since you were returning a zero to the shell anyway (zero is used by the shell to indicate a successful completion of the program), but this is misleading; for other interrupt calls, you will sometimes need to pass an argument through AL, and if you had set AX instead of AH, you'd have a serious problem. In this case, it works out (and even saves an instruction, technically speaking), but you should be aware of why it works, and what is really happening, in order to see the potential problems in that approach.

Votes + Comments
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.