;
; GameSupport glue code. This module provides safe (against hard crashes)
; frame buffer and sound handlers.
; (C) 2001 Andreas Dehmel
;

r0	RN	0
r1	RN	1
r2	RN	2
r3	RN	3
r4	RN	4
r5	RN	5
r6	RN	6
r7	RN	7
r8	RN	8
r9	RN	9
r10	RN	10
r11	RN	11
r12	RN	12




	IDFN	(C) 2001 Andreas Dehmel


GameSuppChunk	EQU	0x75240

	AREA	|Asm$$Code|, CODE, READONLY

	ALIGN	4
	EXPORT	|GameSupp_FrameBufferInfo|
	=	"GameSupp_FrameBufferInfo"
	ALIGN	4

|GameSupp_FrameBufferInfo|
	stmdb	sp!,{lr}
	swi	GameSuppChunk
	bvs	|GSFBIerror|
	ldr	r1,[sp,#4]
	str	r0,[r1]
	mov	r0,#0
|GSFBIerror|
	ldmia	sp!,{pc}^



	EXPORT	|GameSupp_ClaimFrameBuffer|
	=	"GameSupp_ClaimFrameBuffer"
	ALIGN	4

|GameSupp_ClaimFrameBuffer|
	stmdb	sp!,{lr}
	swi	GameSuppChunk + 1
	bvs	|GSCFBerror|
	ldr	r1,[sp,#4]
	str	r0,[r1]
	mov	r0,#0
|GSCFBerror|
	ldmia	sp!,{pc}^



	EXPORT	|GameSupp_ReleaseFrameBuffer|
	=	"GameSupp_ReleaseFrameBuffer"
	ALIGN	4

|GameSupp_ReleaseFrameBuffer|
	swi	GameSuppChunk + 2
	movs	pc,lr



	EXPORT	|GameSupp_GetFrameBuffer|
	=	"GameSupp_GetFrameBuffer"
	ALIGN	4

|GameSupp_GetFrameBuffer|
	swi	GameSuppChunk + 3
	movs	pc,lr



	EXPORT	|GameSupp_GetNextFrame|
	=	"GameSupp_GetNextFrame"
	ALIGN	4

|GameSupp_GetNextFrame|
	swi	GameSuppChunk + 4
	mvnvs	r0,#0
	movs	pc,lr



	EXPORT	|GameSupp_MarkFrameNumber|
	=	"GameSupp_MarkFrameNumber"
	ALIGN	4

|GameSupp_MarkFrameNumber|
	swi	GameSuppChunk + 5
	movs	pc,lr



	EXPORT	|GameSupp_DisplayFrameNumber|
	=	"GameSupp_DisplayFrameNumber"
	ALIGN	4

|GameSupp_DisplayFrameNumber|
	swi	GameSuppChunk + 6
	movs	pc,lr



	EXPORT	|GameSupp_SetFlags|
	=	"GameSupp_SetFlags"
	ALIGN	4

|GameSupp_SetFlags|
	swi	GameSuppChunk + 7
	movs	pc,lr



	EXPORT	|GameSupp_SetLogFile|
	=	"GameSupp_SetLogFile"
	ALIGN	4

|GameSupp_SetLogFile|
	swi	GameSuppChunk + 8
	movs	pc,lr



	EXPORT	|GameSupp_InstallAbortGuard|
	=	"GameSupp_InstallAbortGuard"
	ALIGN	4

|GameSupp_InstallAbortGuard|
	stmdb	sp!,{r4,lr}
	mov	r4,r2
	mov	r3,r1
	mov	r2,r11
	mov	r1,r10
	swi	GameSuppChunk + 9
	movvc	r0,#0
	ldmia	sp!,{r4,pc}^



	EXPORT	|GameSupp_RemoveAbortGuard|
	=	"GameSupp_RemoveAbortGuard"
	ALIGN	4

|GameSupp_RemoveAbortGuard|
	swi	GameSuppChunk + 10
	movs	pc,lr



	EXPORT	|GameSupp_InstallExitHandler|
	=	"GameSupp_InstallExitHandler"
	ALIGN	4

|GameSupp_InstallExitHandler|
	swi	GameSuppChunk + 11
	movvc	r0,#0
	movs	pc,lr



	EXPORT	|GameSupp_RemoveExitHandler|
	=	"GameSupp_RemoveExitHandler"
	ALIGN	4

|GameSupp_RemoveExitHandler|
	swi	GameSuppChunk + 12
	movs	pc,lr



	EXPORT	|GameSupp_ClaimSound|
	=	"GameSupp_ClaimSound"
	ALIGN	4

|GameSupp_ClaimSound|
	str	r4,[sp,#-4]!
	ldr	r4,[sp,#4]
	swi	GameSuppChunk + 13
	movvc	r0,#0
	ldr	r4,[sp],#4
	movs	pc,lr



	EXPORT	|GameSupp_ReleaseSound|
	=	"GameSupp_ReleaseSound"
	ALIGN	4

|GameSupp_ReleaseSound|
	swi	GameSuppChunk + 14
	movs	pc,lr



	EXPORT	|GameSupp_ClaimSound16|
	=	"GameSupp_ClaimSound16"
	ALIGN	4

|GameSupp_ClaimSound16|
	swi	GameSuppChunk + 15
	movvc	r0,#0
	movs	pc,lr



	EXPORT	|GameSupp_ClaimDynamicArea|
	=	"GameSupp_ClaimDynamicArea"
	ALIGN	4

|GameSupp_ClaimDynamicArea|
	swi	GameSuppChunk + 16
	movvc	r0,#0
	movs	pc,lr



	EXPORT	|GameSupp_GetDynamicArea|
	=	"GameSupp_GetDynamicArea"
	ALIGN	4

|GameSupp_GetDynamicArea|
	swi	GameSuppChunk + 17
	movs	pc,lr



	EXPORT	|GameSupp_ReleaseDynamicArea|
	=	"GameSupp_ReleaseDynamicArea"
	ALIGN	4

|GameSupp_ReleaseDynamicArea|
	swi	GameSuppChunk + 18
	movs	pc,lr



	EXPORT	|GameSupp_ClaimKeyPress|
	=	"GameSupp_ClaimKeyPress"
	ALIGN	4

|GameSupp_ClaimKeyPress|
	swi	GameSuppChunk + 19
	movvc	r0,#0
	movs	pc,lr



	EXPORT	|GameSupp_ReleaseKeyPress|
	=	"GameSupp_ReleaseKeyPress"
	ALIGN	4

|GameSupp_ReleaseKeyPress|
	swi	GameSuppChunk + 20
	movs	pc,lr



	EXPORT	|GameSupp_FlushKeyPress|
	=	"GameSupp_FlushKeyPress"
	ALIGN	4

|GameSupp_FlushKeyPress|
	swi	GameSuppChunk + 21
	movs	pc,lr



	EXPORT	|GameSupp_GetKeyPress|
	=	"GameSupp_GetKeyPress"
	ALIGN	4

|GameSupp_GetKeyPress|
	swi	GameSuppChunk + 22
	movs	pc,lr


	END
