Learning 13h Graphics, can't compiel some given code

This is a discussion on Learning 13h Graphics, can't compiel some given code within the C Programming forums, part of the General Programming Boards category; First Dev-C++ compiler Problem 30 d:\docume~1\iamien\mydocu~1\c\newfol~1\untitl~1.cp p aggregate `union REGS regs' has incomplete type and cannot be initialized Code can ...

  1. #1
    Wen Resu
    Join Date
    May 2003
    Posts
    219

    Learning 13h Graphics, can't compiel some given code

    First
    Dev-C++ compiler
    Problem
    30 d:\docume~1\iamien\mydocu~1\c\newfol~1\untitl~1.cp p
    aggregate `union REGS regs' has incomplete type and cannot be initialized


    Code can be found here
    http://www.brackeen.com/home/vga/sou...1/pixel.c.html

    Part which declares reg
    <line 49 > union REGS regs;

    Is it my compiler, or is code wrong <which i doubt>
    Using windows xp,
    On a precompiled program that i try to run i get message, cannot access first 640k of memory
    Last edited by Iamien; 10-27-2003 at 01:12 AM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,750
    Because mode 13h is all about low level access to the hardware and your OS no longer allows such nonsense from unprivileged programs.

    Because your compiler is incapable of producing that ancient 16bit real mode code which would be required.

    Because....
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    I think you should get yourself a DOS-based compiler such is Turbo C++ 3.0. You cannot work with 13h graphics with Windows-based compilers. So that's might be your problem.
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  4. #4
    Wen Resu
    Join Date
    May 2003
    Posts
    219
    makes sense.
    I'll go crap Borlan C CLI compiler or some such,

  5. #5
    Xei
    Xei is offline
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    I haven't done a whole lot of low-level coding, but when I tried to access the parallel port at a low-level in windows it would fail, but in DOS or Debug it would not. So I finally learnt that I would have had to create a device driver to gain Ring 0, or ring 3(I can't remember, sorry!), hardware access. I found an example at a website that used undocumented win API to give the thread access to that hardware. I'll try to find the link again, I've reformatted since then and did not save my favorites. Yup, go here: http://www.beyondlogic.org/ it may help, I don't know. Maybe you'llhave to create a DLL in MASM or something. Good luck!
    Last edited by Xei; 10-27-2003 at 06:52 PM.
    "What are you after - the vague post of the week award?" - Salem
    IPv6 Ready.
    Travel the world, meet interesting people...kill them.
    Trying to fix or change something, only guaruntees and perpetuates its existence.
    I don't know about angels, but it is fear that gives men wings.
    The problem with wanting something is the fear of losing it, or never having it. The thought makes you weak.

    E-Mail Xei

  6. #6
    Wen Resu
    Join Date
    May 2003
    Posts
    219
    Simply needed old compiler. playign round with 13h now.
    Thansk for input, its always appreciated

  7. #7
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Don't use 13h graphics unless you're programming for a dinosaur. It's not worth even learning anymore.
    Away.

  8. #8
    Wen Resu
    Join Date
    May 2003
    Posts
    219
    meh i'm bored, figure why not. kinda fun playing round in it

  9. #9
    Wen Resu
    Join Date
    May 2003
    Posts
    219
    Originally posted by confuted
    Don't use 13h graphics unless you're programming for a dinosaur. It's not worth even learning anymore.
    what would you suggest then. i wana do something on my own. not using Dx or the like, learn fro mground up so to speak

  10. #10
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,750
    Suggest

    Dev-C++ and libsdl

    DJGPP and Allegro
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  11. #11
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Because mode 13h is all about low level access to the hardware and your OS no longer allows such nonsense from unprivileged programs.

    Because your compiler is incapable of producing that ancient 16bit real mode code which would be required.

    Because....

    Not exactly all there is to it...but if you want to use mode 13h graphics you can do it in DirectX. Just get DirectX up and running and tell Windows to go play with itself and you can treat DirectX exactly like you would any old DOS mode 13h program. The beauty of it though is that you have oodles and oodles of memory to play with and yet you can still use mode 13h and access the frame buffer directly - either from C or from assembly via a pointer that DX will give to you when you lock the buffer.

    I'm working on a DirectX shell for new comers so that people interested in starting with graphics or games can get up and running w/o having to mess with all of the DirectX init crapola which has little to nothing to do with actually programming the game.

    And your compiler can produce the so-called ancient 16-bit code but it requires a bit of manipulation on your part. Best bet is to use DirectX for mode 13h, that way you don't have to mess with 16 bit code or fighting with your compiler - which is something you don't want to do. It all might sound hard right now, but really its not.

    Gimme some time and I'll get the shell up and running - pure C mind you not C++. My current shell is in in a class and I'm working on removing the class and making it easier to get up and running for people just like you.

    In fact, the goal in DirectX programming is to get the system as close to a pure 32-bit DOS environment as is possible. We don't want Windows screwing around with anything and we don't want to call Windows to do much because its so doggone slow. All it takes is to create a simple window, message loop, and some other housekeeping chores and you basically have control of the system and access to its hardware as well as all of that memory - a programmer's dream come true.

    My advice to would be to get a book on DirectX programming by Andre Lamothe or another well-known author - it will help you a lot.

  12. #12
    Wen Resu
    Join Date
    May 2003
    Posts
    219
    Thanks. I will look into what you said. Ahh no sleep tonight!:P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 08:34 AM
  2. learning to work with SDKs & source code out there...
    By psasidisrcum in forum C++ Programming
    Replies: 3
    Last Post: 05-14-2005, 10:26 PM
  3. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 05:39 PM
  4. Replies: 4
    Last Post: 01-16-2002, 12:04 AM
  5. learning to code
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 10-30-2001, 08:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21