Thread: The weird world of C

  1. #1
    Registered User Sunny's Avatar
    Join Date
    Nov 2001
    Posts
    101

    Arrow The weird world of C

    Hi guys.
    I was writing some code recently, and it's a set of around 10 modules-60000 Compiled
    lines. Everything was fine until recently I added a simple module with some very simple void
    functions. However, when I compile this time i get error messages telling
    me "Segment Code _TEXT exceeds 64k". The compiler is the basic BC31. The Help
    system is very dry, short and jargonic. So, I turn to you, my friends, as my last hope...
    No, i don't want to change memory model from 'Compact' to Large or Huge.


    Thanks.



    Discover the XBlue:
    http://www.angelfire.com/my/bahairom...html:confused:

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    Your program is too large. Split it up in submodules.
    Last edited by Shiro; 05-31-2002 at 11:38 AM.

  3. #3
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    You said the compiler you use is BC31? If that means Turbo C++ 3.1, then just change the memory modual to huge.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > No, i don't want to change memory model from 'Compact' to Large or Huge
    I don't think you have a choice - compact is 64K max of code (ie TEXT segment) - whether its in 1 source file or 10

    Scroll down to the end of
    this to see what each memory model gives you.

    Your other choice is to look through your code to see if there is any dead code which can be removed. But you are at the limit with this memory model, and without changing it, your options are few.

  5. #5
    Registered User Sunny's Avatar
    Join Date
    Nov 2001
    Posts
    101

    Talking Thinking

    Split it up into smaller modules
    could that really work?

    I'll try changing to "Large", but changing to "huge" will just jam all the graphicsa routines.

    Thanks a lot for talking to me about this.


    Stef

  6. #6
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >could that really work?

    Yes, but ofcourse I'm not talking only about splitting the source code into different files, but mainly about splitting binaries. In large software projects, programmers usually create libraries with functions. Create one or more libraries and use these.

  7. #7
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Doesn't your compiler have any other options? Mine has like 6! And they all would increase something, so I would think it would work on Medium or even small.

  8. #8
    Registered User Sunny's Avatar
    Join Date
    Nov 2001
    Posts
    101

    I c

    Yes, of course it has other options. But I wanted to
    know from the right source.
    Now, by making libraries, you mean those files with
    the '.lib' extension? If so, I really didn't know they were so
    eficient....

    I was also wondering about DOS. And if anyone still
    uses it nowadays... I know I do sometimes, but that's
    until I get my Linux installed. Then It's bye bye, and i'm
    off to the wonderfull world of DOS Emulators and WINE
    if I ever need to use Ms Compatible software.

    So, let's think about it. Should I still develop any software under DOS?

    Of course, I did try to learn the Windows API but it
    was too much of a headache. Really distressing. But
    i'll keep trying if it's the case.


    Thanks a lot guys for taking your time to reply.



    Stef

    My website:
    www.angelfire.com/my/bahairomania/freegui.html
    Yes...YES!!! I did it! Ha ha ha...I'm king of the world...No..No..please-wait-no...!!!!-- This program has performed an illegal operation AND WILL be shut down....Ack-Choking..help...ack..

  9. #9
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >So, let's think about it. Should I still develop any software under DOS?

    You don't need to. Unless you want people who use DOS be able to use your software. So it depends on what kind of software you want to write.

  10. #10
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    I only do DOS because a lot of the programming I do is utilities and stuff. I originally learned how to program because my brother's mother in law had a virus on her computer, where the second you turned it on, it started creating directories. I made a batch file that would put itself as first priority (via something similar to that preprocessor directive where you can specify urgency of tasks), start deleting directories, and deletes the program. The program would install itself again somehow, but wouldn't start until you turned it on (Trojan Horse type thing). So the next time, it would continue deleteing the superfluous directories, and eventually everything was back to normal. When the directories were no longer there, I had a system where it would search out the program installer. Problem solved! I enjoyed doing it so much I started learning C. Anyway - I just do utilities in DOS because its very closely linked with the PC architecture itself. You don't have to keep programming in DOS. It's a personal choice really.

  11. #11
    Registered User Sunny's Avatar
    Join Date
    Nov 2001
    Posts
    101

    Unhappy

    Mmm. .. I think I targeted my question at something else.
    If there is however a large group of people who still
    use DOS, for example?


    C ya.

  12. #12
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Oh yeah - a lot of people still use DOS. Most people think Windows is all there is (excluding Linux and all that - I'm talking Microsoft exclusive) because that's what most programmers learn about. But that's the reason itself why Assembly programmers are so highly paid - they're so rare nowadays.

  13. #13
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Well I've been doing a lot of DirectX coding and let me tell you, assembly is still used. In fact my knowledge of assembly has helped me a lot in DirectX. Granted that the HEL probably performs what I want to do but just in case it does not I code my own.

    For instance I coded my own bi-linear interpolation function for DirectX in assembly. Yes video cards do bi-linear interpolate but its always on textures which is no good for me. If you want to find the altitude of an object and you know the altitude of the four corners of the grid the object is in - and you know how far into the grid on x and y the object is, you can bi-linear interpolate to find the height of the object.


    Code:
    USHORT Bi_Linear(WORD v1,WORD v2,WORD v3,WORD v4,
    double offset_x,double offset_y)
    {
      USHORT value1=0,value2=0,final_value=0;
      __asm {
       
        fild [v2]
        fisub [v1]
        fmul [offset_x]
        fiadd [v1]
        fistp [value1]
    
        fild [v4]
        fisub [v3]
        fmul [offset_y]
        fiadd [v3]
        fistp [value2]
    
        fild [value2]
        fisub [value1]
        fmul [offset_y]
        fiadd [value1]
        fistp [final_value]
        }
        return (final_value);
    }

    You could just as easily store final_value in the eax register to return it since this is where C looks for integral return values, but since I did this in inline assembly it looks more logical to use a return (and the compiler does not whine at me) instead of placing the correct value in the eax register (or st(0) for floating point values).

    So assembly is not dead (might be used less in Direct3D, but I'm sure I'll still use some) - at least not for games where speed is the prime factor.

  14. #14
    Registered User Zeeshan's Avatar
    Join Date
    Oct 2001
    Location
    London, United Kingdom
    Posts
    226
    IMO, most people don't actually use DOS to run programs get their jobs done. They use DOS as a mezanine floor b/w nothing and windows. Infact, a majority of people using Windows don't even know a single DOS command.

    It's just that they're stuck with DOS, whenever something wrong happens with their Macro.......... Winblows 98...

    Hence, programming in DOS to learn programming in fine, as there is usually no overhead involved in writing DOS programs. You get what you write which is what you want. On the other hand, Windows programming involves much overhead.

    However, writing software in DOS, other than for personal purposes is a BAD idea, b/c most people won't probably like it (ofcourse, b/c they're comparing it's features to all the basic charms that windows offers)...
    Last edited by Zeeshan; 06-09-2002 at 11:15 PM.

  15. #15
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Assembly and DOS will always be used a little as long as people use the current style of PC. They what everything else is built on. Right now, we have a really tall tower, and as long as people are going to use the tower and do maintenance on it, the foundations need maintenance as well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. The 7 New Wonders of the World
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 36
    Last Post: 12-08-2006, 01:55 PM
  2. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 05:39 PM
  3. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 12:51 PM
  4. Too much to ask ?
    By deflamol in forum C Programming
    Replies: 2
    Last Post: 05-06-2004, 04:30 PM
  5. No More Technology After World War Three
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-20-2001, 07:02 PM