Advertisement

I saw some asm code a few months ago for basic DOS graphics..

Started by September 23, 2001 11:30 AM
8 comments, last by Rottbott 23 years, 2 months ago
..and I can''t find it anymore It was to stick pixels onscreen in some sort of low-res DOS mode (I don''t remember exactly), and also code to switch into that mode. I really want to have a go at this, but I can''t find where it was originally posted (I did a search for "asm" and "2d". It was two seperate C++ functions, one to set up the screen and one to plot pixels. They had some asm stuff like: void InitScreen(blah) { asm { blah blah } return; } I forget how it went now. Anyone got any ideas? Rottbott
You''re probably referring to DOS mode 13h.

But before I continue: What compiler are you using? If you''re using Visual C++, you cannot do this. And if you''re using DJGPP, you need to use some compiler-specific DPMI commands to do this. So, essentially, unless you''re using the Borland compiler, you need to find another way to do this than using ASM (it''s easy to find the DJGPP code, if you need it).

http://www.inversereality.org has good tutorials on these subjects.
Advertisement
Mode13h...rings a bell.

The compiler I''m using is Dev-C++ from http://www.bloodshed.net

I don''t really mind how I get into/use this thing, I just want an easy way to stick pixels onscreen without worrying about Windows/DirectX/OpenGL code for a change


Rottbott
You can''t use inline ASM to switch to mode 13h in Dev-C++. If you want to do graphics without worrying about Win32/GDI/OpenGL/DirectX, I would recommend Allegro.

~~~~~~~~~~
Martee
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
For dos graphics, use a dos compiler
In this web page www.cprogramming.com in tutorials section there is a tutorial for dos graphics.It is starting from plotting a single pixel and advance to complex things like a 3D rotating wireframe cube.
But to compile this i use turbo c++ v3.0.
This is first time i send a reply to this forum.
I hope it''s usefull for you.
Bye ...

carpe diem baby
carpe diem baby
Advertisement
Thanks for the replies/links guys, I'm having a look round now

EDIT - Beer Hunter, did I see your name in PC Gamer?

Rottbott

Edited by - Rottbott on September 24, 2001 9:45:38 AM
I doubt it... but it''s possible that someone else has this name, too.
nEW sCOOLERS wHAT yOU aRE sEARCHING fOR iS!

Memory Model:Large (always FAR DA rEAL sTUFF)

unsigned char *VPTR=(unsigned char *)MK_FP(0x0a000,0);
void InitMode13h()
{
asm {
mov ax,13h;
int 10h;
}
}

void ExitMode13h()
{
asm {
mov ax,03h;
int 10h;
};
}

void PutPixel(unsigned short x,unsigned short y,unsigned short color) //wORD pARAMTERES sPEED iT uP....
{
VPTR[(y<<8)+(y<<6)+x]=color; //y*320+x cOME gET sOME
}

void main()
{
InitMode13h();
PutPixel(160,100,1); //Puts a Blue Pixel in the Center(x and y) of the Sreen
getch();
ExitMode13h();
}



//USE BC3.1 tpo code old dos Programms is the best compiler for dos .....
BC3.1 is not the best compiler for real mode apps, bc5.02 prolly is.. That said BC3.1 is a wonderful but quirky thing
Any way, I was thinking about this tutorial series that I could do, sort of Cross platform graphics programming. A series on basic graphics and graphics system design, where the objective would be to start of with a small foundation of compiler/platform dependant code and then show how by clewer design be able to just "plug and play" a base and use the extended lib on many more platforms. If there is enough intrest in this I could do it.

The compilers and platforms I have or can get are:

BC3.1 (DOS Real Mode)
BC5.02 (DOS Real Mode)
DJGPP (DOS Protected Mode)
MCVC++ 6.0 (Windows (Would use DDraw)

Im sorry to not have linux installed and I''ve done no coding on that, but, I think that could be fixed and Im planning on learning OpenGL and/or D3D and well... thise API''s could actually be added to the above..

what do you ppl think?
is there a demend for this sort of thing?
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats

This topic is closed to new replies.

Advertisement