Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clarification using _MEM
#1
In the wiki under _MEM is this:

TYPE memory_type
  OFFSET AS _OFFSET      'start location of block(changes with byte position)
  SIZE AS _OFFSET        'size of block remaining at offset(changes with position)
  TYPE AS _OFFSET        'type description of variable used(never changes)
  ELEMENTSIZE AS _OFFSET  'byte size of values inside the block(never changes)
  IMAGE AS LONG          'the image handle used when _MEMIMAGE(handle) is used
  SOUND AS LONG          'the sound handle used when _MEMSOUND(handle) is used
END TYPE

I'm interested in using SIZE to determine how much of the memory block is left to process, if that's possible.

I'm getting an image's memory location:

MemBlock = _MEMIMAGE(ImageHandle)

Then getting its offset:

Offset = MemBlock.OFFSET

Then iterating through the memory block:

DO
    _MEMGET MemBlock, Offset, Pixel
    'other code here
    _MEMPUT Memblock, Offset, Pixel
    Offset = Offset + 4
LOOP UNTIL MemBlock.SIZE = 4 ' (or perhaps 0?)

However MemBlock.SIZE never changes in value as I navigate through the memory block. What does the wiki mean by stating " size of block remaining at offset(changes with position) "?

Any help would be appreciated. I'm delving into the MEM statements and making great progress but this has me baffled.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
Clarification using _MEM - by TerryRitchie - 01-23-2024, 06:52 PM
RE: Clarification using _MEM - by SpriggsySpriggs - 01-23-2024, 07:03 PM
RE: Clarification using _MEM - by DSMan195276 - 01-23-2024, 07:12 PM
RE: Clarification using _MEM - by SMcNeill - 01-23-2024, 07:21 PM
RE: Clarification using _MEM - by DSMan195276 - 01-23-2024, 07:41 PM
RE: Clarification using _MEM - by TerryRitchie - 01-23-2024, 07:45 PM



Users browsing this thread: 1 Guest(s)