I don't know much asm so I want to know how you draw a pixel on the screen (you can also provide the x and y positions). I have seen this exaple in an asm tutorial but I can't find that.
BTW will the code of drawing pixel only work with DOS?
Printable View
I don't know much asm so I want to know how you draw a pixel on the screen (you can also provide the x and y positions). I have seen this exaple in an asm tutorial but I can't find that.
BTW will the code of drawing pixel only work with DOS?
Drawing pixels is only for DOS apps, windows doesn't allow it. You can draw pixels directly to the screen using DirectX, there you could assembly.
There are many books about DirectX and Game Programming, most of them by André LaMothe.
You can Get the Destktop DC, and then (assuming MSVC++ here)
I dont know if that will work (it does sometimes, in Pascal...). ASk in the Assembly Forums.Code:__asm
{
push DC
push x
push y
call [SetPixelV]
}
Z.
[edit]
it may be push DWORD DC, and push WORD x, but I dont know. The order might be wrong as well.
yeah, but I'm sure that's not what he wanted to do. Why go through this when you can simply write:
SetPixel(dc, x, y, etc.);
and forget asm?
Writing directly to the video memory is only possible in DOS or DirectX (IDirectDrawSurface::Lock to get pointer to memory)
I don't want to use windows API (which is SetPixel or SetPixelV). You know how you use asm to move the row and column # and the pixel color to two registers and then you call a function or something like that to draw a simple dot. That is how I want to do but I want to give it x and y positions instead to row and column#.
Will that asm code of drawing pixel (using CPU register,memory and video card access) work without DOS or Window Console. I actually thought that I could use my code in DOS and when the computer boots up.
basically, yes it will. Just remember that by this, you're dooming yourself by entering the area of hardware specific code (just don't think this works the same way on every video card) :P
Remember the Miles Sound System? That must have made game developers' lives much happier :)
That is cool:). But what is the actual code to draw the pixel by privding it x and y positions?
I am searching for that code in asm but can't find that yet.
It is just a few lines long.
Well, I think the video memory is something like 0xA0000000 (no idea) and you just index into that.
However, that won't work under Windows. Most of the knowledge on doing this is long gone, but look up Allegro, that shows you how :)
I dont know (never actually gotten it to work, in DOS or otherwise), but I have two demos that use mode 13h, and they work fine on Win2K.
Z.
But they would most likely be dos programs that run in special mode. Either 16-bit or Protected Mode 32-bit as created by DJGPP.
Sure, but that isn't the point =). If you are just learning this stuff, as long as it runs, it's great!
Oh, and parksie, I was reading over some source code last night, and I think you had the memory address for mode13h right. Mah Bad! =).
Z.
Did I? It was just a guess (well, I remembered it was all 0s apart from one A...;))