Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Arkon

help in asm, djgpp

This topic is 6478 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

#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?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
if i recall well i asked why it doesn''t work well, right??
i didn''t ask you to teach how buffers work!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
if i recall well i asked why it doesn''t work well, right??
i didn''t ask you to teach how buffers work!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!