delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/30/09:01:43

From: edey AT geocities DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Getting Started
Date: Tue, 29 Apr 1997 21:53:01 -0600
Organization: University of Lethbridge
Lines: 78
Message-ID: <3366C21D.2F71@geocities.com>
References: <5k5f5g$lkc AT news DOT interlog DOT com>
NNTP-Posting-Host: linc-pc-1.lib.uleth.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gautam N. Lad wrote:
> 
> Hi,
> I would like to get started in VGA programming (Mode 13) and then move on to
> SVGA.  But first, I would like to learn the following.
> 
> 1) What the operators << and >> do and what is their use in programming (If
> this involves converting HEX and/or Binary, I'd like info. on that too).

<< and >> are bitwise operators.  They essentially function as exrteamly
fast multiply and divide operators.  The differences being that they
only work on integers and only mult and div by powers of 2.  To see why
consider what the above means to the binary representations of a
effected number.  Ex. take the number (dec)5, binary equv=101.  (5 << 1)
= (101 << 1) = (1010) = 10, (5 >> 1) = (101 >> 1) = (10) = 2. 
Multipying and dividing by powers of two in base two is very similar to
mult and div by 10 in base 10, simply move the decimal (or more
accuratly the integral/fractional operator) the appropriate number of
places and (if multiplying) stuff in the rquired number of 0's.

> 
> 2) What the operator & does and what is it's use in programming

the & operator is also a bitwise operator.  & is the bitwise and
operator.  Rules for &, (1&1) = 1, (1&0) = (0&1) = 0.  (a&b) returns a
number containing only the bits common between a and b.  Ex. (5&3) =
(101&011) = (001) = 1, (7&4) = (111&100) = (100) = 4.  & is most often
used with bitmasks.  If it important to know if x has the 3rd bit set
one can test.

> 
> 3) I want to program using registers and interrupts (NO ASSEMBLY -
> PLEASE),  and I would like info on how to use interrupts and registers and what
> they mean and do.
> 

I am afraid that the best way to learn the signicance of the various
int's and reg's is to learn some asm.  It sounds like you would like to
see Brennan Underwood's page, it contains some asm reasources as well as
a good intro to vga prog with djgpp.  I don't recall what the url is,
but can point you to a link.  At the bottom of
http://www.geocities.com/SiliconValley/Park/3516/demos.html there is
long list of usefull djgpp related links.  Brennan's is there.  I also
provide at this page a small selection of very simple graphics effects. 
The code isn't commented but is small and easy to follow.

> I'd like info. that's available on the 'Net; I do not have books, and I do not plan on
> buying any you recommend either.  However, I may ask my local library to get
> it!
> 
> Oh, thanks to those who explained me what '>>, <<, and &' operators do.  But I
> still need more info.  Thanks anyways!
> 

I assume that the 'more info.' applys to '>>, <<, and &' as well.  If
so, I hope the above serves.  If not (and even if so :)) check out 
http://www.cm.cf.ac.uk/Dave/C/CE.html for a good list of c/c++ tutorials
available on the net.

> Thanks!
> Bye!
> 

You're welcome ;).

> ****************************************************
> * Gautam N. Lad                                    *
> *--------------------------------------------------*
> *                                                  *
> * E-Mail    : gautam AT interlog DOT com                  *
> * Website   : http://www.interlog.com/~gautam      *
> *                                                  *
> * OS/2, DOS/Windows, Graphics Gallery, Software,   *
> * Links, Rayzor Editor/2, POV-Ray, TexturEyes,     *
> * POV-PAK and lots lots lots more!!!!!!!           *
> ****************************************************

--"Sanity is not statistical.", George Orwell, "1984".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019