VOGONS

Common searches


First post, by Stojke

User metadata
Rank l33t
Rank
l33t

Hey guys, i started learning C a few weeks ago, and i pretty much understand most of it. I am about to learn pointers and some more advanced things soon.
I was wondering, does any one have any reference documentation on graphical application programming in MS DOS? I want to mess around with that a bit.
I am using Borland C/C++ (IBM 380ED).

Note | LLSID | "Big boobs are important!"

Reply 1 of 24, by Gemini000

User metadata
Rank l33t
Rank
l33t

Since you're using Borland C/C++ you should have access to Borland Graphics Interface files. Using those would be the simplest way to start doing graphics, however, if you want to do anything high-performance you're gonna need to learn how to directly access the VGA hardware. It's actually not that hard to do and there do still exist tutorials on how to do it, such as this one: http://www.brackeen.com/vga/

If you want to learn to do other graphics adapters like CGA, EGA, Tandy, etc., then I'm sure someone out there knows how to do it and that you could find tutorials, but I've only ever done VGA so I don't know what would be involved, though I do know that VGA is supposed to be a LOT easier to work with than anything prior. :P

--- Kris Asick (Gemini)
--- Pixelmusement Website: www.pixelships.com
--- Ancient DOS Games Webshow: www.pixelships.com/adg

Reply 3 of 24, by snorg

User metadata
Rank Oldbie
Rank
Oldbie

Zen of Graphics Programming by Michael Abrash is (or was) the bible for graphics programming on the PC.
It is more oriented towards game programming and simulation type stuff than to programming windowed apps.
Perhaps that might be useful for you?

Reply 4 of 24, by Stojke

User metadata
Rank l33t
Rank
l33t

I am not planning on making anything high performance just yet 😀
I am well aware i first need to master basic concepts and move onto other things.

I was thinking of improving even further, once i fully understand pointers and other things from this book I'm learning from, to making something with colors, like a calculator or something. Maybe get to know how to make an MS DOS installer.
The link you provided seems to have a lot of interesting info, thanks for that 😁

--

I've heard of allegro, but i don't want to get into games just yet. I do like the idea of being able to make an NES style game someday, maybe something like Adventure Island 4 (damn nice game), but that can come latter 😀
Plus i have my own schoolwork to study for, C#, various SQL crap and similar.

--

I've snagged and PDF copy of that book, wonder if i could get a printed copy somewhere, i will definitely check it out, thanks! 😀

----

Speaking of games, how do NES games, such as Mega Man series, Adventure Island, Mario 3, and similar, manage to have such smooth scrolling and really nice jumping/shooting? Most DOS games i played are clunky (Some would say laggy) and sprites "teleport" all around the place. I can get a basic hint why, since i am aware how Counter Strike (Half Life) hit boxes work, but i dont know nothing in detail.

Note | LLSID | "Big boobs are important!"

Reply 5 of 24, by leileilol

User metadata
Rank l33t++
Rank
l33t++

That answer's simple - NES had hardware for sprites and backgrounds. A DOS PC had to painstakingly blit everything in software. This of course was before 3D cards and DirectX... Carmack fought tooth and nail to get smooth scrolling going in Dave and Keen back in '91.

apsosig.png
long live PCem

Reply 6 of 24, by Stojke

User metadata
Rank l33t
Rank
l33t

I think i understand.
So technically if some one codes an engine that functions as an NES console (scrolling and movement, not the whole console) its possible to get the same type of movement/scrolling?

Note | LLSID | "Big boobs are important!"

Reply 7 of 24, by Gemini000

User metadata
Rank l33t
Rank
l33t
leileilol wrote:

you didn't mention allegro :O

Old versions of Allegro need to be run in 32-bit protected mode. I didn't think Borland C/C++ could handle that. :P

Stojke wrote:

I think i understand.
So technically if some one codes an engine that functions as an NES console (scrolling and movement, not the whole console) its possible to get the same type of movement/scrolling?

Yes, except having to emulate all those hardware aspects at a software level would result in something SLOWER than if you just tailored what you were writing to work the way you wanted it to. :P

As Lei was explaining, the NES has a radically different design paradigm to PCs, and as such, is able to handle things at a hardware level that PCs can't. Likewise, this is why 3D games tended to run so much better on PCs than on consoles, since the different design paradigm made it easier to get 3D graphics working on the PC.

This also leads into why we have dedicated graphics cards now for all our modern games. The GPUs we have are technically less powerful than the CPUs we have, but their design is so incredibly different that, for the specific kind of work they're doing, they're able to do it hundreds to thousands of times faster than a CPU could! ;)

--- Kris Asick (Gemini)
--- Pixelmusement Website: www.pixelships.com
--- Ancient DOS Games Webshow: www.pixelships.com/adg

Reply 8 of 24, by Stojke

User metadata
Rank l33t
Rank
l33t

That sounds right 😀
Thanks for all the info, helps clear some things and gives me more to think on 😁

For now since im running MS DOS and Borland C i will focus on making graphical apps for that. And latter hopefully for something newer.

Note | LLSID | "Big boobs are important!"

Reply 9 of 24, by Kahenraz

User metadata
Rank l33t
Rank
l33t

I have a small stack of books by Borland from this era that I'd just had cut for scanning. You're welcome to the pdfs for free. I'd also be happy to send you the books if you like for free + ship. They would do better with a spiral binding anyways so you can lay then out flat.

The books are otherwise getting thrown out.

I'm trying to move and just donated away at least 100-150 books out of my programming collection. Shipping would have killed you though. 😉

Gemini000 is right. Borland has a nice set of libraries for just about anything.

Reply 10 of 24, by akula65

User metadata
Rank Oldbie
Rank
Oldbie

For low-level programming, I would recommend a copy of Richard F. Ferraro's Programmer's Guide to the EGA and VGA Cards if you can find one. I have a copy of the Second Edition (ISBN 0-201-57025-4), and I know that a Third Edition was released. The book uses C and assembly language code examples. One caveat though, the programming examples do have some errors (usually typos or missing lines of code due to poor typesetting).

Reply 11 of 24, by VileR

User metadata
Rank l33t
Rank
l33t
Gemini000 wrote:

I do know that VGA is supposed to be a LOT easier to work with than anything prior. 😜

How so? Obviously something like CGA would be a lot simpler - fixed palettes, simple pixel-packed framebuffer, no funny stuff like bitplanes or multiple graphics pages. Sure, it's as limited as you can get, but that's not a bad thing if you're getting into the very basics of what video programming is all about; and there's all kinds of tweaks you can get if you really want to experiment (I should really get around to revealing an interesting one that I came across myself...)
Raise high the Tetracolore! \o/

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 12 of 24, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
leileilol wrote:

Carmack fought tooth and nail to get smooth scrolling going in Dave and Keen back in '91.

Specifically: http://en.wikipedia.org/wiki/Adaptive_tile_refresh

Details as to how Duke Nukem and its contemporaries, not to mention the later Keen games, accomplished the same effect are not quite as well-known.

Reply 13 of 24, by VileR

User metadata
Rank l33t
Rank
l33t
Jorpho wrote:
leileilol wrote:

Carmack fought tooth and nail to get smooth scrolling going in Dave and Keen back in '91.

Specifically: http://en.wikipedia.org/wiki/Adaptive_tile_refresh

Details as to how Duke Nukem and its contemporaries, not to mention the later Keen games, accomplished the same effect are not quite as well-known.

The scrolling in Duke was certainly not as smooth as any of the Keen games - DN only scrolls in increments of 8 pixels horizontally and 16 pixels vertically.

As for Keen 4-6, here's Romero's explanation (source):

Keen 4-6's engine was different in that it not only used the EGA panning register for pixel-smooth horizontal scrolling but it also used the CRTC ADDRESS register to change the start of screen memory as the screen scrolled. This means that the entire 64k area of EGA RAM was used for the 2 page-flipped screens. As the player moved around, the start address of screen RAM changed and tiles were drawn off the edges so when it scrolled to that area of memory the tiles were already there.

For example, if the player started falling down a hole the CRTC ADDR start would be moving down through memory as the engine drew tiles off the bottom of the visible screen area. Eventually you would be wrapping around the EGA screen segment (0xa000) - it didn't take too long because both screens (for page-flipping) were in the same segment and ate twice the RAM.

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 14 of 24, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
VileRancour wrote:

The scrolling in Duke was certainly not as smooth as any of the Keen games - DN only scrolls in increments of 8 pixels horizontally and 16 pixels vertically.

I never noticed. What about Duke II?

Reply 16 of 24, by idspispopd

User metadata
Rank Oldbie
Rank
Oldbie
VileRancour wrote:
Gemini000 wrote:

I do know that VGA is supposed to be a LOT easier to work with than anything prior. 😜

How so? Obviously something like CGA would be a lot simpler - fixed palettes, simple pixel-packed framebuffer, no funny stuff like bitplanes or multiple graphics pages. Sure, it's as limited as you can get, but that's not a bad thing if you're getting into the very basics of what video programming is all about; and there's all kinds of tweaks you can get if you really want to experiment (I should really get around to revealing an interesting one that I came across myself...)
Raise high the Tetracolore! \o/

VGA 320x200x256 is very easy to use. One byte equals one pixel, everything fits into 64k so no bank switching as long as you don't need double buffering and 16-bit-arithmetic is sufficient. And you don't have to change the palette, you can just use the standard one. Of course a lot of tweaks are possible (Mode-X) but those are not strictly necessary.
For CGA 320x200x4 on the other hand a pixel equals two bits (four pixels in one byte) so there is a lot of bit-shifting going on. You can't do double buffering even if you wanted to because there is just enough memory for one screen. And the memory layout is interlaced so address calculation is slightly more complex. (At least it is only interlaced 2 times, not 4 times like Hercules 720x348.)

Reply 17 of 24, by Stojke

User metadata
Rank l33t
Rank
l33t
akula65 wrote:

For low-level programming, I would recommend a copy of Richard F. Ferraro's Programmer's Guide to the EGA and VGA Cards if you can find one. I have a copy of the Second Edition (ISBN 0-201-57025-4), and I know that a Third Edition was released. The book uses C and assembly language code examples. One caveat though, the programming examples do have some errors (usually typos or missing lines of code due to poor typesetting).

That sounds pretty cool! How much is shipping for those?
Do you have any C++ books? Or maybe some on Micro Controller programming?

Note | LLSID | "Big boobs are important!"

Reply 18 of 24, by akula65

User metadata
Rank Oldbie
Rank
Oldbie

You probably want to see if you can get a copy from a Central or Eastern European used book merchant given your location and the fact that Ferraro's book is over 1000 pages (it's a paperback).

If you are interested in learning C++, you need to be aware that C++ has been evolving ever since Bjarne Stroustrup first released it in the late 1970s. A Borland compiler that supports DOS won't implement the more recent developments in the language and any C++ books written when your Borland compiler was current will also be comparatively out-of-date. So you need to decide whether you want to learn up-to-date C++ (using recent books, tutorials and compilers) or stick with older books that embrace the same C++ features implemented by your Borland compiler. If you are interested in a more recent C/C++ compiler for DOS, you might consider Open Watcom (it's free):

http://www.openwatcom.org

I'm not sure what you are referring to when you say Micro Controller. If you mean Intel 8086/8088 family processors, there were dozens of good books like Peter Norton's Programmer's Guide to the IBM PC (ISBN 0-914845-46-2) that provided a wealth of information for assembler/machine language programmers. I found a number of The Waite Group volumes on PC & XT programming to be very useful (Assembly Language Primer and Bluebook of Assembly Routines for example). If you are referring to things like PICs or Atmel devices (Arduino), I am not personally familiar with any printed texts that would be useful, although I am sure there is a wealth of online information devoted to those devices.

Reply 19 of 24, by bristlehog

User metadata
Rank Oldbie
Rank
Oldbie

One more vote for Open Watcom C. It is pretty compatible with old Watcom C compilers, which in their turn many professional game developers used. Thus you can compile lots of available source code with Open Watcom C. Also there is built-in protected mode support, with four different DPMI hosts. I even made a vertical Tyrian-like scroller in Watcom C back in my youth.

Hardware comparisons and game system requirements: https://technical.city