Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

DOS, Memory problems and wait retrace

DukeboyDukeboy Member Posts: 2
Hi, sorry for my bad english.
I know c and I would like learn to code demos under dos, but I have many problems with lack of memory. Borland c++ 3 doesn't let my create array bigger than ~64k (I don't remember the exact size) and now I'm wondering how to skip this limitation without have to learn doing it in 80386 assembly.
The lack of memory makes many troubles to me when I must load files (big images for example).
What are the most common solutions?
Another question, I would know more about the "wait retrace" routine... are there any tutorials? A friend of mine explained to me a simple routine but it's damn slow, so I think that there are some quicker ways to do it.
Thanks

Comments

  • baobao Member Posts: 13
    : Hi, sorry for my bad english.
    : I know c and I would like learn to code demos under dos, but I have many problems with lack of memory. Borland c++ 3 doesn't let my create array bigger than ~64k (I don't remember the exact size) and now I'm wondering how to skip this limitation without have to learn doing it in 80386 assembly.
    : The lack of memory makes many troubles to me when I must load files (big images for example).
    : What are the most common solutions?
    : Another question, I would know more about the "wait retrace" routine... are there any tutorials? A friend of mine explained to me a simple routine but it's damn slow, so I think that there are some quicker ways to do it.
    : Thanks
    :
    :

  • baobao Member Posts: 13
    : Hi, sorry for my bad english.
    : I know c and I would like learn to code demos under dos, but I have many problems with lack of memory. Borland c++ 3 doesn't let my create array bigger than ~64k (I don't remember the exact size) and now I'm wondering how to skip this limitation without have to learn doing it in 80386 assembly.
    : The lack of memory makes many troubles to me when I must load files (big images for example).
    : What are the most common solutions?
    : Another question, I would know more about the "wait retrace" routine... are there any tutorials? A friend of mine explained to me a simple routine but it's damn slow, so I think that there are some quicker ways to do it.
    : Thanks

    there must be functions like allocmem() and freemem(). i've also heard of XMS and EMS. assembly or not, you'll still have the limitations.
    common solutions are image compression and/or going with newer technologies. DOS is a thing of the past.
    on most video cards reading a byte from port $3DA and testing the 3rd least-significant-bit gives a boolean where a value of 1 means the electron beam is currently redrawing the screen and 0 means it's done drawing and is on it's way back to the top-left of the screen.
    (actually it means whether video memory is currently in access by the hardware - so you shouldn't read or write to it when it's retracing)
    i don't know what you mean by 'damn slow'. maybe you're talking about double buffering?


  • blipblip Member Posts: 756
    A fast way to use the vertical retrace would be to use the PIT to interrupt because most video cards don't generate IRQ2 for that purpose. Allocate as much memory as you'd need for a full screen and use that as you would the normal screen. When the interrupt from the PIT occurs (IRQ0), blit the memory buffer to the real video screen. Just use a lot of 64KB arrays and span them, DOS can't load more than 64KB from a file at once anyway.
  • DukeboyDukeboy Member Posts: 2
    Thanks both of you :)
    I solved by myself many of the problems i had. Now I have a brand new question ^^;
    By waiting retrace I obtain a very smooth sprite scrolling (~70 Hz), but what about if I want decrease the speed of the animation?
    Some tutorial say that I have to use di PIT to temporize the animation (blit the sprite every N ticks instead of every vertical retrace... skipping the frames). I tried and the animation slow down, yep, but.... it's not fluent like the PIT-free version :(
    Is it a problem without solution? Is there a method to have fluid animation and accelerate/decelerate it?
    thanks
  • blipblip Member Posts: 756
    Use multiples of the vertical retrace, it won't hurt. ;-) I personally recommend syncing the PIT with the vertical retrace.
Sign In or Register to comment.