Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Silly question

Status
Not open for further replies.

SmileeTiger

Programmer
Mar 13, 2000
200
0
0
US
I am trying to write to the display using assembly code. I used the same code under 'debug' and it seems to work. However when I compile it under VC++ (with MASM integrated)It doesn't seem to know what b800 is. Any ideas?

Here is my code:
title display (text.asm)
.model small
.stack 100h
.data

.code
main proc
mov bx,900h
mov ax, B800h
mov ds,ax
mov ax,0724h
mov [bx],ax
int 21h

mov ax,4c00h
int 21h
main endp
end main


Thanks!
Cory
 
You can't use b800 under Windows in a Windows application (not usual and not console)!
 
That's not true, the reason why some compilers don't accept a B800 immediate value is that they confuse it with a (not declared) variable or constant. If you put a zero before the value, the compiler knows it is dealing with a number and not with a variable. And sometimes you even need to put an "h" at the end to specify the number as hexadecimal (using Turbo Pascal inline assembly, for example). Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 

What is that "int 21h" after the "mov [bx],ax"?
What is it for?
I don't think it does anything...
 
In assembly language every line is important!
INT calls an interrupt, an interrupt is a piece of code somewhere in memory that is executed immediately when it is called (the program that is currently running is paused until the interrupt passes an IRET at the end). Also an interrupt searches for parameters in some specific registers. In this case (INT 21h) a call for the most important DOS interrupt is made! so it does really something. Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
The B200 number is in hex, and for most systems, a hex number has to start with an integer and end with an h. Otherwise, how do you tell whether B200 is a variable or a number? Guess!? So, if 0B200h is the hex value, there's no doubt, because it starts with an integer, which a variable name can't do, and ends with h, which an integer can't do. The hex number 200 and the integer 200 are very different, and the only way to tell them apart is with the h, eg.
200
200h

Now, it's possible to tell the difference in numbers. As always, I hope that helped!

Disclaimer:
Beware: Studies have shown that research causes cancer in lab rats.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top