Apple2.gs Forums
Discussions for Apple IIgs Programming and other fun stuff. // Infinitum!

Home » Apple IIgs Programming » Video Game Programming » Memory Allocation under GS/OS
Re: Memory Allocation under GS/OS [message #65 is a reply to message #60] Fri, 10 October 2014 01:00 Go to previous messageGo to previous message
Oz is currently offline  Oz
Messages: 21
Registered: October 2014
Location: France
Member
Hi,

Quote:
I've started messing around with graphics programming on the IIGS again and so far I've just been writing to the shadow memory in $01/2000 without actually asking for it. Since I'm starting to work on something that I'd actually like to release one day, I need to do it the proper way and request the memory through the memory manager.


The $01/2000 area may be use for anything else than as a second graphic page area, so it is better to ask for it (in order to prevent any other software to get it). You reserve this area in the same way you allocate other memory parts, using a _NewHandle call :

            PushLong  #0                   ; Ask Shadowing Screen ($8000 bytes from $01/2000)
            PushLong  #$8000
            PushWord  myID
            PushWord  #%11000000_00000011
            PushLong  #$012000
            _NewHandle
            PLA
            PLA


The difference with a dynamic memory allocation routine as we have seen in the first part of this topic is about the address of the area. We don't need to get the pointer to the area because we already know its address ! We use anyway two PLA to extract the handle from the stack, even if we don't use it.

This code has been already included in the GS/OS programming 'minimum' code provided in the Sample there : http://apple2.gs/forum/index.php?t=msg&th=15&start=0

Olivier

[Updated on: Fri, 10 October 2014 01:07]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Loading Files from Disk in Assembly Language using GS/OS
Next Topic: Unpack a Picture using the PackBytes compression format
Goto Forum:
  


Current Time: Wed Feb 05 16:44:44 MST 2025

Total time taken to generate the page: 0.00962 seconds