#define SET_16_BIT_A()  rep #$20 : .al
#define SET_8_BIT_A()   sep #$20 : .as


; called from $C03557
RoomScriptFunctionB8:
.(
	.xl
	.as
	
	tyx
	inx
	lda $7F2001,x : sta $2B : inx ;offset lo byte
	lda $7F2001,x : sta $2C : inx ;offset hi byte
	lda $7F2001,x : sta $2D : inx ;page
	
	; Convert address
	
	SET_16_BIT_A()
	lda [$2B]
	cmp #RELOCATED_STRING_SIGNATURE
	bne End
	
	phx
	 ; Increment address by 2
	 ldx $2B : inx : inx : stx $2B
	 ; Load word (offset)
	 lda [$2B]
	 ; Increment address by 2
	 inx : inx : stx $2B
	 tax
	 SET_8_BIT_A()
	 ; Load byte (page)
	 lda [$2B]
	 ; Store new address
	 stx $2B ;write offset
	 sta $2D ;write page
	plx

End:	SET_8_BIT_A()
	
	; Normal ending
	
	sec
	rtl

.)
