| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | #include <aram.h>
 | 
					
						
							|  |  |  | #include <stdio.h>
 | 
					
						
							|  |  |  | #include <stdlib.h>
 | 
					
						
							|  |  |  | #include <string.h>
 | 
					
						
							|  |  |  | #include <malloc.h>
 | 
					
						
							|  |  |  | #include <ogcsys.h>
 | 
					
						
							|  |  |  | #include <gccore.h>
 | 
					
						
							|  |  |  | #include <iostream>
 | 
					
						
							|  |  |  | #include <iomanip>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void *xfb = NULL; | 
					
						
							|  |  |  | static GXRModeObj *rmode = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | void Initialise(); | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | #define NUM_BLOCKS 10
 | 
					
						
							|  |  |  | u32 aram_blocks[NUM_BLOCKS]; | 
					
						
							|  |  |  | u32 start_addr = -1; | 
					
						
							| 
									
										
										
										
											2009-01-16 21:57:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | int main(int argc, char **argv) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Initialise(); | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | 	start_addr = AR_Init(aram_blocks, NUM_BLOCKS); | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | 	while(1) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | 		PAD_ScanPads(); | 
					
						
							|  |  |  | 		VIDEO_ClearFrameBuffer(rmode, xfb, 0); | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | 		std::cout<<"\x1b[2;0H"; // Position the cursor (on 2nd row)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-16 21:57:19 +00:00
										 |  |  | 		std::cout << "Aram is " << (AR_GetDMAStatus() ? "In Progress" : "Idle") << std::endl; | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | 		std::cout << "Aram Start is 0x" << std::setbase(16) << start_addr << ", Allocated 0x" << AR_GetSize() << " Of memory" << std::setbase(10) << std::endl; | 
					
						
							|  |  |  | 		std::cout << "Internal Size is 0x" << std::setbase(16) << AR_GetInternalSize() << std::setbase(10) << std::endl; | 
					
						
							|  |  |  | 		VIDEO_WaitVSync(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | void Initialise() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	// Initialise the video system
 | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | 	VIDEO_Init(); | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// This function initialises the attached controllers
 | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | 	PAD_Init(); | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Obtain the preferred video mode from the system
 | 
					
						
							|  |  |  | 	// This will correspond to the settings in the Wii menu
 | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | 	rmode = VIDEO_GetPreferredMode(NULL); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | 	// Allocate memory for the display in the uncached region
 | 
					
						
							|  |  |  | 	xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Initialise the console, required for printf
 | 
					
						
							|  |  |  | 	console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Set up the video registers with the chosen mode
 | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | 	VIDEO_Configure(rmode); | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Tell the video hardware where our display memory is
 | 
					
						
							|  |  |  | 	VIDEO_SetNextFramebuffer(xfb); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Make the display visible
 | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | 	VIDEO_SetBlack(FALSE); | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Flush the video register changes to the hardware
 | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | 	VIDEO_Flush(); | 
					
						
							| 
									
										
										
										
											2009-02-02 22:11:49 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Wait for Video setup to complete
 | 
					
						
							| 
									
										
										
										
											2008-12-08 05:30:24 +00:00
										 |  |  | 	VIDEO_WaitVSync(); | 
					
						
							|  |  |  | 	if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); | 
					
						
							|  |  |  | } |