CHIP 

extern data _tmpA
extern data _tmpB
extern data T
extern code __INIT@global_

;;------------Define global variables in ram------------
__GlobalVarialbleAtRAM@segment SEGMENT DATA INBANK
_Start_Def_Global_Var:
///*Section of 
_End_Def_Global_Var:
;;--------------Define initial value in rom--------------
__GlobalVarialbleAtROM@segment SEGMENT CODE INBANK
///*Section of 
;;-----------Begin initialize global variables-----------
_SGV_INIT_CODE SEGMENT  CODE
	B0MOV Y, #(__GlobalVarialbleAtROM@segment$M)
	B0MOV Z, #(__GlobalVarialbleAtROM@segment$L)
	MOV A, #(BANK __GlobalVarialbleAtRAM@segment)
	B0MOV _tmpB, A
	MOV A, #__GlobalVarialbleAtRAM@segment
	B0MOV _tmpA, A
	MOV A, #_Start_Def_Global_Var
	B0MOV T, A
	MOV A, #_End_Def_Global_Var
	IF RBANK != 0
	B0MOV RBANK, #0
	ENDIF
	SUB T, A
	MOV A, #0
	CMPRS A, T
	CALL __INIT@global_
