Thread: Mode 19 Graphics in Turbo C++

  1. #1
    destroyerBEACON
    Guest

    Cool Mode 19 Graphics in Turbo C++

    I need some help with the line algorithm given in the graphics tutorial. Whenever I use it, it doesn't draw the line but instead draws lines in opposite directions from my coordinates.

    I am using Turbo C++ V 1.00 in mode 19 (320x200, 256 colors).

  2. #2
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    forget mode 19. Use 13h or MCGA.

  3. #3
    Registered User samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Newport
    Posts
    382
    Originally posted by Xterria
    forget mode 19. Use 13h or MCGA.
    19 decimal = 13 hex.
    Current Setup: Win 10 with Code::Blocks 17.12 (GNU GCC)

  4. #4
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    oooooo....i knew that. someday I should learn that hex crap. How does it work anyway?

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Dec:
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 etc...

    Hex:
    1 2 3 4 5 6 7 8 9 A B C D E F 10 etc...

    Hex is like decimal except when it gets to the 10-15th digits it will substitute a letter, when you get up in the numbers each letter will have a digit in front of it, such as decimal 26 being 1A hexadecimal.

    A google search for Hexadecimal conversion charts will show you a more complete sequence.

    -Prelude
    My best code is written with the delete key.

  6. #6
    Registered User samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Newport
    Posts
    382
    Well, decimal uses hundreds, tens and units.
    Binary uses 4s, 2s and units.
    Hex uses 256s, 16s and units.

    These numeric systems are called base 10, 2 and 16 respectively. Note that each place holder's value is equal to base ^ it's position (least significant = 0). Each placeholder can hold as many unique digits as nominated by the base (so binary: each place holder can be one of two values, decimal: each placeholder can be one of 10 values, etc). As with decimal, the other systems use the digits to express the magnitude of each placeholder, but as there are only 10 digits we have to substitute letters for the other 6.

    Therefore 0x13 = (1 * 16) + (3 * 1) = 19.
    0x2a4 = (2 * 256) + (10 * 16) + (4 *1) = 676.

    Complex? Sorry, but with this knowledge you can construct a numeric system with ANY base!

    Also of note: one hex digit corresponds to four binary digits. This is called a nibble (nibble is half a byte! Geddit?).

    Seriously though, you're doing a lot better that I was at 12. At that age I was still programming in qBasic. I wasn't introduced to C until I was 14.
    Last edited by samGwilliam; 02-13-2002 at 03:43 PM.
    Current Setup: Win 10 with Code::Blocks 17.12 (GNU GCC)

  7. #7
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >nibble is half a byte! Geddit?
    Sadly, I do. I always found that joke both funny and scary at the same time seeing as how it's probably more correct than I'd like to imagine.

    -Prelude
    My best code is written with the delete key.

  8. #8
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Still, though, video modes are always referred to in hex form not decimal.

  9. #9
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    hmm, where did you get the source for your algorithm? is it brensenhams? can we see your code so we can diagnose it?

    http://www.brackeen.com/home/vga/ would help you out for 13h if you are interested.
    hasafraggin shizigishin oppashigger...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c++ help needed
    By ettore in forum C++ Programming
    Replies: 17
    Last Post: 01-18-2008, 12:20 PM
  2. Handling mouse in graphics mode in Turbo C/DOS
    By sureshkumarct in forum C Programming
    Replies: 2
    Last Post: 12-24-2006, 09:36 AM
  3. Replies: 1
    Last Post: 07-28-2003, 12:56 PM
  4. Input a string in graphics mode?
    By Vegettų in forum C++ Programming
    Replies: 3
    Last Post: 03-08-2002, 06:34 PM
  5. graphics help!! for my game under turbo C
    By newbie17 in forum Game Programming
    Replies: 1
    Last Post: 10-26-2001, 01:40 PM