@echo   ""
@echo   " Programmgroesse (ROM) ~ $",endofromcode-startofromcode, "Bytes"
@echo	" Programmgroesse (IRAM)= $",endofiwramcode-startofiwramcode-(endofeiramdata-startofeiramdata), "Bytes"
@echo   ""
@echo   " Datengroesse    (ROM) ~ $",endofromdata-startofromdata, "Bytes"
@echo   " Datengroesse    (WRAM)= $",endofewramcode-startofewramcode, "Bytes"
@echo   " Datengroesse    (IRAM)= $",endofeiramdata-startofeiramdata, "Bytes"
@echo   ""


@define DMAMODE			;für batgba ausschalten

	b	startofromcode		;skip header
	@include source\nintendologo.s	;nintendo logo (sonst macht original ärger)
	@dcb	"game test 1 "		;spiel name (12 byte)
	@dcb	"gt00"			;game code
	@dcb	"le"			;marker code :)
	@dcb	$96			;must be $96
	@dcb	0			;main unit code
	@dcb	0			;device type
	@dcb	0,0,0,0,0,0,0		;resv. area
	@dcb	0			;software version
	@dcb	0			;complement check (wird mit gbarm gesetzt), sonst gehts nicht auf original gba
	@dcb	0,0			;reserved area
	
	@include	source\mem_macros.s

				
;*************************** ROM CODE ***********************************
startofromcode
                  
            
	;**** stack festlegen und füllen
	
	ldr	sp,[mystackadr]		;mystack	
	ldr	r1,[mystackendadr]	;mystackend (begin)
	
	ldr	r0,=$abcddcba		;füllwort
fillst	cmp	sp,r1
	strne	r0,[r1],4
	bne	fillst
	
	;**** schalte prefetch an (+ romtimings)
	
	ldr	r6,=$4000204
	ldr	r0,=$4317
	strh	r0,[r6]
	
	;**** kopiere iramcode            
            
        addr	r0,startofiwramcode    
	mov	r1,#$3000000
	addr 	r3,endofiwramcode
	sub	r2,r3,r0
	bl	dmacpy			     		
	
	;**** setze bildschirm
	
	mov 	r6,#$4000000   		;dma
	mov	r1,#$1c00		;mode 0 bg 2/3 + sprites
	strh 	r1,[r6]			;store
	
	ldr	r1,=$3283		;+32k map / 256 c prio 0	
	strh 	r1,[r6,$c]	
		
	ldr	r1,=$3182		;+32k map / 256   prio 1
	strh 	r1,[r6,$e]

	;**** schalte Interuppts a
	
	ldr	r0,[irq_handleradr]
	ldr	r1,[irqvectoradr]
	str	r0,[r1]

	mov 	r6,#$4000000   		;dma
	mov	r0,#$18			;h/v blank irq enable
	orr	r0,r0,#$1000		;key
	strh	r0,[r6,4]		;dispstat
	
	mov	r0,#$1			;h/v blank / irq master
	add	r5,r6,#$200
	strh	r0,[r5]			;h/v blank irq enable
	
	mov	r0,#1
	strh	r0,[r5,8]		;irq master enable	
	
	;**** dynamischen Speicher initalisieren
	
	mem_init_mc	membaseW_adr,#131072		;init 128k 
	
	;***** kopiere gfx daten
	
	mem_malloc_mc	membaseW_adr, #32768		;get 32k
	mov	r12,r2		
			
	ldr	r0,[picadr]
	mov	r1,r12	
	swi	$110000					;decomp lz77 wram
	
	mov	r0,r12
	mov	r1,#$6000000	
	mov	r2,#(256*128*2)
	bl	dmacpy	
	
	mem_free_mc	membaseW_adr,r12		;free 32

	;**** sprite daten
	
	ldr	r0,=sprite_anim
	ldr	r1,=$6010000
	mov	r2,#(6144)
	bl	dmacpy	
	
	;**** sprite pal
	
	mov	r0,pal
	mov	r1,#$5000000	
	mov	r2,#(256*2)
	bl	dmacpy

	ldr	r0,[mapadr]
	ldr	r1,[bg2map_adr]
	mov	r2,#128*2-(32*2)
	bl	copymap

	ldr	r0,[map2adr]
	ldr	r1,[bg3map_adr]
	mov	r2,#128*2-(32*2)
	bl	copymap
	
	
	
	ldr	r0,=spritepaladr
	ldr	r1,=$5000200
	mov	r2,#256*2
	bl	dmacpy
	
;**** spritemanager
;*
;* r0.w = x	0..511
;* r1.w = y	0..255
;* r2.b = rotatios nummer
;* r3.b = tilenummer
;* r4.b = prio
;* r5.l = mode
;* r6.b = rotnummer
;* r7.l = &spritepointer	// wird gesetzt
;*
	mov	r0,#$100
	mov	r1,#0
	mov	r2,#0
	mov	r4,#0
	bl	spr_calc_rotation
	
	mov	r0,#30
	mov	r1,#20
	mov	r2,#0
	mov	r3,#0
	mov	r4,#0
	ldr	r5,=$21008000
	mov	r6,#0
	
	bl	spr_new_sprite
	
	mov	r0,#40
	mov	r1,#40
	mov	r2,#0
	mov	r3,#0
	mov	r4,#0
	ldr	r5,=$21008000
	mov	r6,#0
	
	bl	spr_new_sprite
	
	mov	r0,r7
	mov	r1,#100
	mov	r2,#80
	;bl	spr_rem_sprite
	bl	spr_change_xy
	bl	spr_getall
	bl	spr_setall
	
h	b	h	

;*********************** Testspiel *******************

	;32x5 ist start

;
; r0        = x
; r1   	    = y
; r9[7-0]   = suchziel
; r9[8]	    = 8 fach modus
; r9[31-24] = nand filter für pixel (byte)
; r11       = breite
;
; r12       = &suchgebiet
; r10       = &buffer (8tel der gr. von Suchgebiet)

	addr	r2,rctrl
	mov	r3,#$80
	str	r3,[r2]

	addr	r2,p1
	mov	r0,#31		;startx
	mov	r1,#5		;starty
	stmia	r2,{r0,r1}
	
loop	


	;mov	r2,#10
	;bl	wait

	mov	r6,#$5000000
	mov	r5,#$1f
	strh	r5,[r6]

	mem_malloc_mc	membaseW_adr, #((64*64*16)/8)	;get 
	stmfd	sp!,{r12}

	;**** clear mem mit dma

	mov	r2,#((64*64*16)/8)
	mov	r1,r12
	
	bl	memclear32
	
	;****
	
	mov	r6,#$5000000
	mvn	r5,#0
	strh	r5,[r6]

	mov	r10,r12		;suchbuffer
	addr	r12,map_spez	;suchgebiet
	mov	r11,#64		;breite
	
	
	;**** lade punkt p1 (startpunt zum suchen)
	
	addr	r2,p1
	ldmia	r2,{r0,r1}

	;**** suche nächste wegmakierung
	
	bl	searchFromTo

	addr	r2,p2
	stmia	r2,{r3,r4}	;merke in p2
		
	ldmfd	sp!,{r12}
	mem_free_mc	membaseW_adr,r12		;free 
	
	mov	r6,#$5000000
	mov	r5,#0
	strh	r5,[r6]


	addr	r5,p1
	addr	r6,p2
	ldmia	r5,{r0,r1}
	ldmia	r6,{r2,r3}

	mov	r4,#$700
	bl	driveFromTo
	
	
	addr	r2,p1
	addr	r3,p2
	
	ldmia	r3,{r0,r1}		
	stmia	r2,{r0,r1}
	
	b	loop

;r0=startx
;r1=starty
;r9=value

;r3=endx
;r4=endy

searchFromTo

	

	stmfd	sp!,{lr}

	addr	r2,rctrl
	ldr	r9,[r2]
	
	add	r9,r9,#$40
	cmp	r9,#$100
	moveq	r9,#$40
	str	r9,[r2]
	
	;orr	r9,r9,#$37000000	;no bgX und richtungshilfe

	;mov	r2,#0
	addr	r2,inrek
	bl	rek
	
	;mov	r3,r0
	;mov	r4,r1
	
	mov	r2,#4
	bl	star_test		;r0,r1 <-> r0,r1	
	
	mov	r3,r0
	mov	r4,r1
	
	ldmfd	sp!,{pc}
	

inrek
	
	;lade indizierte Daten
	
	addr	r3,map_spez_index
	and	r6,r5,#$00ff
	and	r8,r5,#$ff00			;save Kollisionsdaten
	ldr	r5,[r3,r6 lsl 2]
	
	;**** BG Stat übernehmen
	
	addr	r3,carstat
	
	cmp	r6,#$01		
	streq	r6,[r3]
	cmp	r6,#$02
	streq	r6,[r3]
	
	;**** Filtere daten
	
	ldr	r6,[r3]			;carstat
		
	cmp	r5,#$10			;r5=$10 && r6=1 dann r5 and not $10
	cmpeq	r6,#$1
	biceq	r5,r5,#$10
	
	cmp	r5,#$20			;r5=$20 && r6=2 dann r5 and not $20
	cmpeq	r6,#$2
	biceq	r5,r5,#$20	

	bic	r5,r5,#$07		;remove 1,2 & 4	

	orr	r5,r5,r8		;or Kollisionsdaten dran
	
	bx	lr


;r0 = startx
;r1 = starty

;r2 = endx
;r3 = endy

;r4 = speed

driveFromTo


	stmfd	sp!,{r0-r12,lr}

	mov	r0,r0 lsl 16+4
	mov	r1,r1 lsl 16+4
	mov	r2,r2 lsl 16+4
	mov	r3,r3 lsl 16+4

	mov	r12,#0		;x
	mov	r11,#0 		;y

	addr	r6,carxpos
	addr	r7,carypos
	addr	r10,carwinkel
	addr	r11,carspeed
	
	str	r0,[r6]		;carxpos = startx
	str	r1,[r7]		;carypos = starty
	
	stmfd	sp!,{r0,r1,r2,r3,r4}	;save
	
	sub	r8,r2,r0	;dx
	sub	r9,r3,r1	;dy
	
	mov	r0,r8 asr 16	;>>16
	mov	r1,r9 asr 16	;>>16
	
	mov	r2,#$ff
	orr	r2,r2,#$ff00	;1bit sign,1bit integral (?),14bit value 
	
	;and	r0,r0,r2	;clear  16:
	;and	r1,r1,r2	;clear  16:
		
	swi	$a0000		;arctan2 (r0,r1) = r0
	mov	r5,r0		;result
	
	ldmfd	sp!,{r0,r1,r2,r3,r4}	;restore
	
	str	r5,[r10]		;save calculated winkel
	str	r4,[r11]		;speed = r4 

	;r8 = dx (+rechts,  -links) (x2-x1)
	;r9 = dy (+unten,   -oben)
wee

	stmfd	sp!,{r0-r12}
	
	bl	setCarPrio
	
	swi	#$50000			;halt bis irq (VBlank)
	bl	setScreenRelSprite
	
	ldmfd	sp!,{r0-r12}
	
	addr	r6,carxpos
	addr	r7,carypos
	
	mov	r0,#$ff
	orr	r0,r0,#$ff00
	
	ldr	r4,[r6]
	ldr	r5,[r7]
	
	bic	r4,r4,r0	;remove 16bit fract
	bic	r5,r5,r0	;remove 16bit fract
	
	cmp	r8,#0
	
	cmp	r8,#0	;wenn dx+ swap x1,x2
	blt	nxtest
	
	cmp	r2,r4	;x2 mit x1
	blt	weend
	b	nxend	
nxtest
	cmp	r2,r4	;xd,xq
	bgt	weend
nxend	
	
	cmp	r9,#0	;wenn dy+ swap y1,y2
	blt	nytest
	
	cmp	r3,r5	;y2 mit y1
	blt	weend
	b	nyend	
nytest
	cmp	r3,r5	;yd,yq
	bgt	weend
nyend	

	b	wee
	
weend		
	
	ldmfd	sp!,{r0-r12,pc}


SetCarPrio

	stmfd	sp!,{lr}
	
	addr	r2,carxpos
	addr	r3,carypos
	
	ldr	r0,[r2]
	ldr	r1,[r3]
	
	mov	r0,r0 lsr #16+4  		;in 16nern
	mov	r1,r1 lsr #16+4		;

	add	r0,r0,#1
	add	r1,r1,#1

	add	r0,r0,r0		;x*2
	ldr	r6,[map_spez_adr]	;
	mov	r1,r1 lsl #7		;y*128

	add	r6,r6,r0		;+x
	ldrh	r0,[r6,r1]		;+y	-- vba kann das nicht disassemblieren
	
	and	r8,r0,#$ff		;!!! Index tokens !!!!
	cmp	r8,#$c2
	moveq	r8,#2
	cmp	r8,#$05
	moveq	r8,#1
	
	
	;*** setze Sprite bg prio	
		
	ldr	r12,[carbgmode_adr]	;merke bg
		
	mov	r4,#0			;spritenum
	
	cmp	r8,#$02			;wenn mapcode $02 dann über allem
	moveq	r3,#0
	streqh	r3,[r12]
	bleq	setsprite_prio
	
	cmp	r8,#$01			;wenn mapcode $01 dann unter bg1
	moveq	r3,#3
	streqh	r3,[r12]
	bleq	setsprite_prio
	
	
	
	ldmfd	sp!,{pc}


driveSpline

	stmfd	sp!,{r0-r12,lr}

	addr	r3,p1
	ldmia	r3,{r7,r8,r9,r10,r11,r12}	;p1-p3	
	
	mov	r7,r7 lsl 4		;x1
	mov	r8,r8 lsl 4		;y1
	mov	r9,r9 lsl 4		;x2
	mov	r10,r10 lsl 4		;y2
	mov	r11,r11 lsl 4		;x3
	mov	r12,r12 lsl 4		;y3
	
	stmia	r3,{r7,r8,r9,r10,r11,r12}	;p1-p3	
	
;ax = r7
;ay = r8
;bx = r9
;by = r10
;cx = r11
;cy = r12	
;count = r2
	
	
	sub	r0,r9,r7	;x2-x1
	sub	r4,r10,r8	;y2-y1
	
	mul	r0,r0,r0	;(x2-x1)^2
	mla	r0,r4,r4,r0	;+(y2-y1)^2 
	
	swi	$80000		;sqrt
	mov	r1,r0
	
	sub	r0,r11,r9	;x3-x2
	sub	r4,r12,r10	;y3-y2
	
	mul	r0,r0,r0	;(x3-x2)^2
	mla	r0,r4,r4,r0	;+(y3-y2)^2 	
	
	swi	$80000		;sqrt
	
	add	r1,r1,r0	;geschätzte länge
	
	mov	r0,#4096<<8	;schrittgröße=4096:00/länge
	swi	$60000
	mov	r3,r0

	mov	r2,#4096<<8
testloop
	
	stmfd	sp!,{r2,r3}	
	
	mov	r2,r2 lsr 8
		
	addr	r3,p1
	ldmia	r3,{r7,r8,r9,r10,r11,r12}	;p1-p3	
	
	bl	spline3p_x			;->r0,r1

	;r0,r1 = x,y

	addr	r6,carxpos

	mov	r0,r0 lsl 16			;to x
	mov	r1,r1 lsl 16			;to y
	
	stmia	r6,{r0,r1}			;setze xy
	
	
	swi	#$50000			;halt bis irq (VBlank)
	bl	setScreenRelSprite
	

	ldmfd	sp!,{r2,r3}
	subs	r2,r2,r3		;#8<<8
	cmp	r2,#0
	bgt	testloop	

	ldmfd	sp!,{r0-r12,pc}



setScreenRelSprite

	stmfd	sp!,{lr}

	addr	r2,screenx
	addr	r3,screeny
	
	ldr	r11,[r2]
	ldr	r12,[r3]

	mov	r0,r12			;x
	mov	r1,r11			;y
	mov	r2,#2			;bg nummer
	ldr	r3,[mapadr]		;map src
	ldr	r4,[bg2map_adr]		;map dest
	bl	scroll
	
	mov	r0,r12			;x
	mov	r1,r11			;y
	mov	r2,#3			;bg nummer
	ldr	r3,[map2adr]		;map src
	ldr	r4,[bg3map_adr]		;map dest
	bl	scroll

	ldr	r3,[carxposadr]
	ldr	r4,[caryposadr]
	ldr	r5,[carspeedadr]
	ldr	r6,[carwinkeladr]
	bl	calccarpos
	stmfd	sp!,{r6}		;r0,r1 = new pos !!!!!!!!!!!!!!!!!!!!
		
	ldr	r5,[r3]
	ldr	r6,[r4]
	;bl	testCollison
	
	str	r0,[r3]			;save x
	str	r1,[r4]			;save y
	
	mov	r0,#$5000000
	mov	r1,#0
	strh	r1,[r0]
	
	mov	r0,#$100		;zoom min $ad
	ldmfd	sp!,{r1}		;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	mov	r4,#0
	bl	spr_calc_rotation

	ldr	r3,[carxposadr]
	ldr	r4,[caryposadr]
	ldr	r0,[r3]
	ldr	r1,[r4]
	
	;**** 0<carx<1023,  0<cary<1023 
	
	ldr	r5,=(1024-33)<<16
	;mov	r5,#1024<<16
	;sub	r5,r5,#33<<16
	
	cmp	r0,#0
	movlt	r0,#0
	cmp	r1,#0
	movlt	r1,#0
	
	cmp	r0,r5
	movgt	r0,r5
	cmp	r1,r5
	movgt	r1,r5
		
	str	r0,[r3]		;save carx
	str	r1,[r4]
	
	mov	r0,r0 asr 16	;
	mov	r1,r1 asr 16	;
	
	;**** 
	
	mov	r3,r0		;spritex=x
	mov	r4,r1		;spritey=y
	
	cmp	r0,#120
	subgt	r12,r0,#120	;carx>120 then bildx=carx-120
	movgt	r3,#120		;spritex = 120
	
	cmp	r1,#80		
	subgt	r11,r1,#80	;cary>80 then bildy=cary-80	
	movgt	r4,#80		;spritey = 80
	
	
	;**
	
	;mov	r5,#$380
	;orr	r5,r5,#$7	;1023-120
	ldr	r5,=(1023-120)
	
	cmp	r0,r5		;carx>(1024-120) then
	subgt	r12,r5,#120	;bildx=carx-1024-120-120
	subgt	r3,r0,r5	;spritex=carx-1024-120+120
	addgt	r3,r3,#120
	
	;**
	
	;mov	r5,#$3a0	;1023-80
	;orr	r5,r5,#$f
	ldr	r5,=(1023-80)
	
	cmp	r1,r5		;cary>(1023-80)
	subgt	r11,r5,#80	;bildy=cary-1023-80-80
	subgt	r4,r1,r5	;spritey=cary-1023-80+80
	addgt	r4,r4,#80
	
	
	mov	r0,r3		;spritex
	mov	r1,r4		;spritey
	mov	r2,#0		;sprite 0
	mov	r5,#4		;tile 4
	mov	r6,#0		;
	mov	r7,#1		;lasse prio	
	bl	setsprite
	
	;**** setze BackGrounds  

	addr	r2,screenx
	addr	r3,screeny
	
	str	r11,[r2]
	str	r12,[r3]
	
	ldmfd	sp!,{pc}	
	
carbgmode_adr	@dcd	carbgmode	

	
		@dcb	"pool"
poolstart1	@pool
poolend1	@dcb	"loop"
@echo   " Pooleintraege (POOL1) = $",(poolend1-poolstart1)/4

;*********************** Variablenadressen (Pool)*******************

membaseW_adr		@dcd	membaseW
testadr			@dcd	test	

bgXxpos_adr		@dcd	bgXxpos
bgXxposabs_adr		@dcd	bgXxposabs

bg2map_adr		@dcd	$6000000+32768+4096
bg3map_adr		@dcd	$6000000+32768+2048

irq_handleradr		@DCD	irq_handler   
irqvectoradr		@DCD	$03007ffc 

carxposadr		@dcd	carxpos
caryposadr		@dcd	carypos
carspeedadr		@dcd	carspeed
carwinkeladr		@dcd	carwinkel
		      
mystackadr		@dcd	mystack	
mystackendadr		@dcd	mystackend
picadr			@dcd	pic
paladr			@dcd	pal
mapadr			@dcd	map
map2adr			@dcd	map2
;map_spez_adr		@dcd	map_spez

counteradr		@dcd	counter	

spriteadr		@dcd	sprite
spritepaladr		@dcd	spritepal



;*********************** Unterprogramme (extern) *******************


		@include	source\simple.s 
		@include	source\scroll.s
		@include	source\car_sprite_handler.s
		@include	source\sprite.s	
		@include	source\mem.s	
		@include	source\bresenham.s
		@include	source\kollision.s
		@include	source\search_rek.s
		@include	source\spline.s

		
		@dcb	"pool"
poolstart2	@pool
poolend2	@dcb	"loop"
@echo   " Pooleintraege (POOL2) = $",(poolend2-poolstart2)/4			
		
		@include	source\text.s

		
		@include	source\sin.s
	
endofromcode		
		
;*************************** IRAM CODE ************************************
startofiwramcode	
		@textarea $03000000
		
		@include	source\irq.s
		
carxpos		@dcd	0
carypos		@dcd	0
carspeed	@dcd	$80
carwinkel	@dcd	(65536*0)/360

seed		@dcd	1234,5678

;**************************** IRAM DATA ****************************

startofeiramdata
		
irqstackadr	@dcd	irqstack

		@DCD	$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba
		@DCD	$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba,$abcddcba
irqstack	@DCD	$abcddcba

endofeiramdata
	
		@endarea
		
endofiwramcode 		
 	    
 
;*************************** ROM DATA ***********************************
startofromdata

sprite_anim	@include	gfx\fisch_anim.gfx.s
sprite_anim_pal @include	gfx\fisch_anim.pal.s

pic		@include 	gfx\tiles.gfx.lz.s		
pal		@include 	gfx\tiles.pal.s
map		@include	maps\mapcars_test_bg0.s	
map2		@include	maps\mapcars_test_bg1.s
map_spez	@include	maps\mapcars_test_bg_spez.s	
map_spez_index	@include	maps\mapcars_test_bg_spez_index.s

;sprite		@include	gfx\spritecar.gfx.lz.s
;spritepal	@include	gfx\spritecar.pal.s

font_16		@include	gfx\font_16_2.gfx.s
font_16pal	@include	gfx\font_16_2.pal.s
		    
endofromdata 
                         
;*************************** WRAM DATA ***********************************

startofewramcode
		@textarea $02000000
				
;**** globale Variablen 
	
debugmem0	@dcd	0	
debugmem1	@dcd	0
debugmem2	@dcd	0
debugmem3	@dcd	0
		
test		@dcd	0

bgXxpos		
bg0xpos		@dcd	0
bg0ypos		@dcd	0
bg1xpos		@dcd	0
bg1ypos		@dcd	0
bg2xpos		@dcd	0
bg2ypos		@dcd	0
bg3xpos		@dcd	0
bg3ypos		@dcd	0

bgXxposabs
bg0xposabs	@dcd	0
bg0yposabs	@dcd	0
bg1xposabs	@dcd	0
bg1yposabs	@dcd	0
bg2xposabs	@dcd	0
bg2yposabs	@dcd	0
bg3xposabs	@dcd	0
bg3yposabs	@dcd	0

counter		@dcd	0
objectbuf	@dcw	0,0,0	

carbgmode	@dcw	0

screenx		@dcd	0
screeny		@dcd	0

stacksave	@dcd	0

p1		@dcd	0,0
p2		@dcd	0,0
p3		@dcd	0,0

carstat		@dcd	0

rctrl		@dcd	0

;**** User Stack

mystackend	@dup	dcd	4096,$abcddcba
mystack		@dcd	$abcddcba	;	8192 Byte Stack + (4Byte sec)

;****

spr_mg_data	@dup	dcb	4,0


;**** Dynamischer Speicher

membaseW	;@dup	dcb	131072,0

		@endarea
endofewramcode




