.gba
.open "zm.gba","semitrans.gba",0x8000000
.definelabel eventtrue,0x8   ;put the event that enables semitransparency
.definelabel eventfalse,0x4e ;put the event that disables semitransparency
.definelabel freq,0x1
.definelabel freespace,0x8800000

.org 0x800c042
	ldr		r2,=samusbody
	mov		r15,r2
.pool

.org 0x800c0ba
	ldr		r2,=samusarmleft
	mov		r15,r2
.pool

.org 0x800bfda
	ldr		r2,=samusarmright
	mov		r15,r2
.pool



.org freespace

samusarmright:
	ldr		r2,=0x3000e7c  ;--
	add		r3,r3,r2       ;
	mov		r2,r8          ; original code
	add		r0,r1,r2       ;
	strb	r0,[r3]        ;--
	
	bl		freqcontrol
	cmp		r0,0x0
	beq		@@return
	
	ldrb	r0,[r3,0x1]    ;
	mov		r1,0x2         ;
	orr		r1,r0          ;
	strb	r1,[r3,0x1]    ;_____
@@return:
	ldr		r1,=0x800bfe4  ;return
	mov		r15,r1         ;
						   ;
						   
samusarmleft:
	ldr		r2,=0x3000e7c  ;--
	add		r3,r3,r2       ;
	mov		r2,r8          ; original code
	add		r0,r1,r2       ;
	strb	r0,[r3]        ;--
	
	bl		freqcontrol
	cmp		r0,0x0
	beq		@@return
	
	ldrb	r0,[r3,0x1]    ;
	mov		r1,0x2         ;
	orr		r1,r0          ;
	strb	r1,[r3,0x1]    ;_____
@@return:
	ldr		r1,=0x800c0c4  ;return
	mov		r15,r1         ;
						   
samusbody:                 ;
	ldr		r2,=0x3000e7c  ;--
	add		r3,r3,r2       ;
	mov		r2,r8          ; original code
	add		r0,r1,r2       ;
	strb	r0,[r3]        ;--
	
	bl		freqcontrol
	cmp		r0,0x0
	beq		@@return
	
	ldrb	r0,[r3,0x1]    ;
	mov		r1,0x2         ;
	orr		r1,r0          ;
	strb	r1,[r3,0x1]    ;_____
@@return:
	ldr		r1,=0x800c04c  ;  return
	mov		r15,r1         ;




freqcontrol:
	push	r14
	push	r2,r3
	ldr		r0,=0x3000C77  ;--
	ldrb	r0,[r0]        ;
	mov		r1,freq        ; check frequency
	and		r0,r1          ;
	cmp		r0,freq        ;
	beq		@@returnfalse  ;--
	ldr		r2,=0x80608BC
	mov		r1,eventtrue
	mov		r0,0x3
	bl		WrapperR2
	cmp		r0,0x0
	beq		@@returnfalse
	ldr		r2,=0x80608BC
	mov		r1,eventfalse
	mov		r0,0x3
	bl		WrapperR2
	cmp		r0,0x0
	bne		@@returnfalse
	mov		r0,0x1
	pop		r2,r3
	pop		r14
	bx		r14
	

@@returnfalse:
	mov		r0,0x0
	pop		r2,r3
	pop		r14
	bx		r14

.pool

WrapperR2:
	mov		r15,r2
.close