DMA

Access a DMA buffer via the following arrays:

dma.byte[offset];	// 0 to 256
dma.word[offset];	// 0 to 65536 - takes up two bytes.
dma.quad[offset];	// 0 to 4294967296 - takes up four bytes.
dma.sbyte[offset];	// -128 to 127
dma.sword[offset];	// -32768 to 32767 - takes up two bytes.
dma.squad[offset];	// -2147483648 to 2147483647 - takes up four bytes.

The latter three use a signed representation of the data for reading purposes. Quads cannot be read as unsigned, as they need to be converted into integers in order to be used (which are signed quads)

int buf = malloc(10);
int ofs = 4;
dma.byte[buf+ofs] = -1;
messagebox(dma.byte[buf+ofs]); //will display 255
messagebox(dma.sbyte[buf+ofs]); //will display -1
  • Malloc() Allocates a chunk of memory and returns a pointer handle to it.
  • MemCopy() Copies a block of memory from one location to another.
  • MemFree() Frees a malloc()-allocated block of memory. (Incompatible with non-DMA memory.)
  • Talkback

    Post a new comment?

    Talkback #2 written by Omni on 2004-06-09.

    Who wants to learn about binary, hexadecimal, and every thing else you'll need for DMA? What? You, sir? Perfect. You may wish to view these links: Introduction to Binary and Hexadecimal Simple Binary Operations Binary Manipulation Memory in the PC These tutorials are curtesy of Atrevida, a good place for general "we should know this" stuff about memory and computer programming.

    Talkback #1 written by Interference22 on 2004-06-09.

    DMA (Direct Memory Access) is largely unnecessary and most operations you may wish to execute in VC (such as loading image files) have their own specific functions that automatically handle the amount of memory they use themselves. Only use DMA if you know exactly what you're doing and the operation requires it, since messing with it without a working knowledge may result in some fairly funky errors.

    Post a new comment?

    Doc Nav

    Your docs
    View All Docs

    If you log in, you can edit the documentation, or create your own documents and tutorials!

    Ben McGraw's lovingly crafted this website from scratch for years.
    It's a lot prettier this go around because of Jon Wofford.
    Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.