Advertisement

help in asm, djgpp

Started by August 26, 2000 04:07 PM
9 comments, last by Arkon 24 years, 3 months ago
#define _memcpy_(src, dest, numwords) \ __asm__ __volatile__ ( \ "cld\n\t" \ "rep\n\t" \ "movsl" \ : : "S" (src), "D" (dest), "c" (numwords) \ : "%ecx", "%edi", "%esi") i try, unsigned char *buffer[64000]; unsigned char *sprite[32*32]; _memcpy_(&buffer[0], &sprite[0], 1); why doesn''t it work?
Well, I don''t read DJGPP AT&T assembly too well (not at all), so I will assume that your memcpy function works. Here is what I saw. I am guessing that ''unsigned char *buffer[64000];'' is for a backbuffer for Mode13 (320x200x256 VGA), right? I don''t think you are doing what you meant to do. You are declaring an array of 64000 unsigned char pointers. Thus, when you do your memcpy, you are copying your sprite into an unitialized pointer (big no no). Try getting rid of the * before buffer.

Try this:

unsigned char buffer[64000];
unsigned char sprite[32*32];

_memcpy_(buffer, sprite, 1);

(BTW, why are you only copying one word?)

If I misinterpreted what you are trying to do, please yell at me.

-e
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein
Advertisement
well i don''t init it cuz it''s just an example!

hmmm i think something is wrong in the code

i''ll test it later again
thx neways
Just an idea....
unsigned char* buffer=(unsigned char*)malloc(64000);
This is the "correct" way to make buffers (by which I mean that''s how I make mine, and it works). But I don''t know if the buffer was your problem...

Martee
Magnum Games
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
if i recall well i asked why it doesn''t work well, right??
i didn''t ask you to teach how buffers work!
if i recall well i asked why it doesn''t work well, right??
i didn''t ask you to teach how buffers work!
Advertisement
You''re welcome. And I don''t see how anything I said was teaching how buffers work.

Now to fix your code, try changing the "%ecx", "%edi", "%esi" to a "memory". I couldn''t compile it before, but with "memory" instead of the registers, it will compile.


Martee
Magnum Games
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
I''ll try
thx for the help!
Hi Arkon,

First of all, you cannot do what you''re trying to do. Anyway, not in protected-mode !!

Dont forget that you''re in DJGGP (32-bit DOS compiler), so like windows it''s run in Protected-Mode !!


In Real-Mode, you need to assign a ptr to Memory Area A000

In P-M, you need to create a selector to that area in memory, then map it!

But if you wanna do Dos Graphic Programming, use Linear Frame Buffer of SVGA Card !! that great for 640x480x8 up to 1280x1024x32 even higher !!!

D/L Vesa Reference, that settup your graphic adapter to display in those mode !!

Happy Coding

LowRad
ok...
well i just asked a simple question but NO!!!
you all gotta talk about other things...
and yes i know VESA already but nm...
i just hate AT&T Syntax that''s it

thx for helping anyways

This topic is closed to new replies.

Advertisement