×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Silly question

Silly question

Silly question

(OP)
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

RE: Silly question

You can't use b800 under Windows in a Windows application (not usual and not console)!

RE: Silly question

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
http://www.geocities.com/thevhbcompany/
Don't worry what people think about you. They're too busy wondering what you think about them.

RE: Silly question


What is that "int 21h" after the "mov [bx],ax"?
What is it for?
I don't think it does anything...

RE: Silly question

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
http://www.geocities.com/thevhbcompany/
Don't worry what people think about you. They're too busy wondering what you think about them.

RE: Silly question

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close