1 /*---------------------------------------------------------------------------*
2 Project: Dolphin OS Overview - Getting memory demo
3 File: allocdemo1-gettingmemory.c
4
5 Copyright 1998, 1999 Nintendo. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Log: allocdemo1-gettingmemory.c,v $
14 Revision 1.2 02/20/2006 04:13:11 mitu
15 changed include path from dolphin/ to revolution/.
16
17 Revision 1.1 01/13/2006 11:24:12 hiratsu
18 Initial check in.
19
20
21 1 6/04/99 3:04p Tianli01
22 Initial check-in
23 $NoKeywords: $
24 *---------------------------------------------------------------------------*/
25
26 /*---------------------------------------------------------------------------*
27 This program shows how to get memory from the arena
28 *---------------------------------------------------------------------------*/
29
30 #include <revolution.h>
31
32 #define MY_FIRST_MEMORY_AREA_SIZE 1024
33 #define MY_SECOND_MEMORY_AREA_SIZE 2048
34
35 void * MyFirstMemoryArea;
36 void * MySecondMemoryArea;
37
main()38 void main ()
39 {
40 u8* arenaLo;
41 u8* arenaHi;
42
43 OSInit();
44
45 OSReport("\n-----------------------------------");
46 OSReport("\n Hit Command+Q to quit this demo");
47 OSReport("\n-----------------------------------\n\n");
48
49 arenaLo = OSGetArenaLo();
50 arenaHi = OSGetArenaHi();
51
52 MyFirstMemoryArea = arenaLo;
53 arenaLo += MY_FIRST_MEMORY_AREA_SIZE;
54 OSSetArenaLo(arenaLo);
55
56 MySecondMemoryArea = arenaLo;
57 arenaLo += MY_SECOND_MEMORY_AREA_SIZE;
58 OSSetArenaLo(arenaLo);
59
60 OSReport("First memory area is at 0x%x\n", MyFirstMemoryArea);
61 OSReport("Second memory area is at 0x%x\n", MySecondMemoryArea);
62 OSReport("New arena Lo is at 0x%x\n", OSGetArenaLo());
63
64 OSHalt("Getting memory demo complete");
65 }
66