Posted by AvionicKnight on 09/18/98 18:42:47:
Ok, um, this is really advanced kinda stuff (but BASIC advanced programming), but I think you might get it, just stay with me, I really think that all you need to know is a *tiny* bit about COMPUTERS to understand what I'm about to say. Everyone else can listen and learn a little about the basic ideas behind the stuff we are used to, and may even call "outdated". Here's how I'll start:
========
MODE 13H= 320x200x256 color mode
========
Ah, Mode 13h. Why on earth would ANYONE want to program in this 'crappy' video mode? Quite simply, not only is it classic (heh), but is the only resolution with 256 colors + to be officially a standard. VESA has managed to be a standard (VESA is used for SVGA programming).
In order to do these quick examples, you will need an 'Assembler'. Assembly is a low level programming language, which can be very hard and annoying to program in, but is the only one to allow complete control and to talk 'directly' to the computer. For things like mouse, keyboard, etc. ASM will be necessary to 'talk' to the devices.
The computer automatically comes with an assembler, or at least, DOS does. (DOS programming is much easier for starting programming). Look for a file called "DEBUG.EXE" or "DEBUG.COM". And run it, then press 'a' for assemble, and type in:
MOV AX,13
INT 10
INT 20
don't worry about not understanding it. Press [ENTER] on a blank line to return back to the '-'. (DEBUG really sucks heh). now what you should see is something like this:
C:\DOS\Debug
-a
146E:0100 mov ax,13
146E:0103 int 10
146E:0105 int 20
146E:0107
-
Now type "ntest.com":
-ntest.com
then type "RCX" followed by '7':
-rcx
CX 0000
:7
and finally type 'w'
-w
Writing 00007 bytes.
Ok, so what does that all mean? well, type in 'test' (HAS to be in DOS- not true DOS, but can't be run through RUN). then the command prompt will suddenly turn into fat text. Thats because its in Mode 13h! This is all thats needed to get into standard Mode 13h.
"What the f*** is?" section --------
1) the MOV statement is a low level, ASM statement. ASM is the hardest language, but there isin't TOO much to it. The hardest part is doing something with the language. The MOV statement is one of many ASM statement. MOV moves a value into a 'register'. A register are things that temporarily hold data, but don't take up memory. Intel designed these, and called them "AX, BX, CX, DX". they each can hold a 16 bit value (up to 65,535).
2) the INT statement calls a PC interrupt. Everything on the PC has an interrupt number, and in the case of INT 10, we were calling the graphics card on the computer, and telling it to go into mode 13h. Because that example has no error checking, if the computer doesn't have a video card, it would probably lock up and force the user to restart. As a rule, be very careful with low level programming.
=========================
Plotting a pixel
----------------
Getting into the graphics mode is all well and good, but what about PLOTTING the pixel? And for the really computer illeterate people- what IS a pixel? :-P. Of course, a pixel is a small dot. The entire resolution is made up of a bunch of these dots, like 800x600 res is 800 pixels possible width, 600 pixels possible up and down. And of course, Mode 13h can handle 320 pixels width, and 200 pixels height.
This resolution, however, can be very poor. Its not just the graininess, and the 8-bit color. Due to the resolution numbers, there are no SQUARE, pixels. Pixels in this res are actually RECTANGLES..
It would take a long time to explain this, actually, if you don't know ASM.. I might as well just write a tutorial for ya instead of waste any more space in this huge message! This stuff is extremely basic, its going to get much harder, and this is in an easy res. If you're still up to it, I'll be working on a tutorial, one you'll get more programming examples out of..
-- AvionicKnight
======================
Follow Ups: