Planet X3 - Part 4 - Memory Map

back2root:reverse-engineering:planet-x3:diagram1.png

main:	CALL		Timer_Setup_CustomHandler	; Timer_Setup_CustomHandler
 
	MOV 		word ptr [g_Seg_Data],DS 	; preserve DS Segment
 
	MOV 		AX,DS	
	ADD 		AX,0x1000                	; Allocate map Segment (at +0x1000) 
	MOV 		[g_Seg_GameMap],AX	
	MOV 		CX,0x8000                	; map Segment 32Kb
	CALL		mem_clear                	; clear map Memory segment
 
	SHR 		CX,0x1	
	SHR 		CX,0x1	
	SHR 		CX,0x1	
	SHR 		CX,0x1                   	; CX = CX [0x8000] div 16 = 0x800
	ADD 		AX,CX	
	MOV 		[g_Seg_Gfx],AX           	; Allocate graphic Segment (at +0x1800)
	MOV 		CX,0xffff                	; Audio Seg : 64Kb
	CALL		mem_clear                	; void mem_clear(void)
 
	ADD 		AX,0x1000	
	MOV 		[g_Seg_Audio],AX         	; Allocate Temp Segment (at +0x2800)
	MOV 		CX,0xc000                	; Temp Size : 48Kb
	CALL		mem_clear                	; void mem_clear(void)
 
	SHR 		CX,0x1	
	SHR 		CX,0x1	
	SHR 		CX,0x1	
	SHR 		CX,0x1	
	ADD 		AX,CX                    	; 0xc00
	MOV 		[g_Seg_Temp],AX          	; temp segment (all above)