shithub: riscv

ref: fb96a050f8a9d5f23da3557ba89251ffb73889bf
dir: /sys/src/games/gba/rom/l.s/

View raw version
/*		MOVW PC, R1		ADD 5, R1		BX R1 */
#define THUMB	WORD $0xE1A0100F;	WORD $0xE2811005;	WORD $0xE12FFF11

TEXT _main(SB), 1, $-4
	THUMB
TEXT _maint(SB), 4, $-4
	MOVW	$setR12(SB), R1	/* load the SB */
	MOVW	R1,R12
	B	,main(SB)

TEXT _isr(SB), 1, $-4
	THUMB
TEXT _isrt(SB), 4, $-4
	SUB	$36,SP
	WORD	$0x4672		/* MOV LR,R2 */
	MOVW	R2,0(SP)

	MOVW	R4,4(SP)
	MOVW	R5,8(SP)
	MOVW	R6,12(SP)
	MOVW	R7,16(SP)

	MOVW	R8,R2
	MOVW	R2,20(SP)
	MOVW	R9,R2
	MOVW	R2,24(SP)
	MOVW	R10,R2
	MOVW	R2,28(SP)
	MOVW	R11,R2
	MOVW	R2,32(SP)

	BL	,isr(SB)

	MOVW	0(SP),R2
	WORD	$0x4696		/* MOV R2,LR */
	
	MOVW	4(SP),R4
	MOVW	8(SP),R5
	MOVW	12(SP),R6
	MOVW	16(SP),R7

	MOVW	20(SP),R2
	MOVW	R2,R8
	MOVW	24(SP),R2
	MOVW	R2,R9
	MOVW	28(SP),R2
	MOVW	R2,R10
	MOVW	32(SP),R2
	MOVW	R2,R11

	ADD	$36,SP
	WORD	$0x4770		/* BX LR */