Qbasicnews.com

Full Version: out
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I have seen a lot of example programs that use an "out" comand followed by something like '&h80' What does this command do, and how do I know what I need to put after the out command.
The OUT command is for low level stuff.

There's no way to know what number to put, except to just memorize which numbers do what.

For example. OUT 968 tells the video card what color we want to change, and OUT 969 tells it what we want to change it to.

Example:
Code:
OUT 968, 0  ' Let's change color 0, which is normally black
OUT 969, 63  ' Turn red all the way up
OUT 969, 63  ' Do the same to green
OUT 969, 63  ' And blue
' And now color 0 is white like color 15
I think &H3C8 and &H3C9 is easier to remember than 968 and 969. Wink
Quote:I think &H3C8 and &H3C9 is easier to remember than 968 and 969. Wink
True, also qb programmers usually put those in hex, so remembering it in hex is reinforced when you study other people's programs.

I just like 968 and 969 instead because they make for slightly less typing.
oh, for criminy...

out and inp send output and get input from hardware ports. Most people use them to get keyboard input (inp &h60) or or changing the color palette (inp &h3c7-9), but they can be used for a host of things, like using the sound card and controlling the modem or serial/parallel ports. Here's a list of all the nifty hardware ports in dos you can use:

http://www.betterwebber.com/test2/ports.txt
Quote:
Neo Wrote:I think &H3C8 and &H3C9 is easier to remember than 968 and 969. Wink
True, also qb programmers usually put those in hex, so remembering it in hex is reinforced when you study other people's programs.

I just like 968 and 969 instead because they make for slightly less typing.

But having a "&h" makes you look more than you know. ;*)
Can someone link me to a FAQ or something that lists the codes?
thanx.

EDIT: or are those pretty much it? :???:
Quote:Can someone link me to a FAQ or something that lists the codes?
thanx.

EDIT: or are those pretty much it? :???:

No. But thanks for asking! Big Grin
...what codes?
I think he means which values to read/write from what ports.

Well, the Most Commom Ralph Brown's Interrupt List also contains a port list: http://www.ctyme.com/rbrown.htm. But you still have to find it Wink
Pages: 1 2 3