
	;this version is only sd card bootable	
	
; dram
;
;	$d000 0000 	frame buffer
;	


; sram
;	$f000 0000 	texture_1024_1024
;
	
	;sd header is placed here
	
	.incdir	"F:\git\goldmomo_endlos\assembler_files\ucore\"
	.include "boot_level_sdHeader.s"
	.include "include\ucore_ctrl.i"

	;start at address 32 here
	
;***********************************************************************
;* loader
;***********************************************************************	
	
	;read sdcard to sram
	
	movei	r0,startBlock
	nop
	moveih	r0,>startBlock
	nop
	rqldi	r0,0	;low
	rqldi	r0,1	;high
	nop
	ld	r2
	ld	r3
	
	addi	r2,64	;64 blocks offset (ucore code/data)
	addtqi	r3,r3,0
	
	;read blocks

	movei	r1,$00
	movei	r0,$00
	moveih	r1,$f0		;r1:r0 = $f000 0000 (dest start)
	
	movei	r6,sdCardReadBlocks
	nop
	moveih	r6,>sdCardReadBlocks
	
	gpci	r7,2		;
	jmpi	r6,0
	movei	r4,$ff		;256blocks-1	delay slot
	nop			;delay slot
	moveih	r4,$0		;delay slot
	nop			;delay slot
		
;***********************************************************************
;* real code
;***********************************************************************
	
	;setup video
		
	movei	r0,setupVideo
	nop
	moveih	r0,>setupVideo
	gpci	r7,2	;next 4 + X
	jmpi	r0,0
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	
	;reset PS2 buffer
	
	gpci	r7,2	;next 4 + X
	br	PS2Reset
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	
	;scanline struct
	
	.def	drScanXStart			0		
	.def	drScanXEnd			1
	.def	drScanY				2
	.def	drScanU				3
	.def	drScanV				4
	.def	drScanDu			5
	.def	drScanDv			6
	.def	drScanSourceDataLow             7
	.def	drScanSourceDataHigh            8
	.def	drScanDestDataLow               9
	.def	drScanDestDataHigh              10
	.def	drScanDestWidth			11
	.def	drScanDestWorkLow		12
	.def	drScanDestWorkHigh		13
	.def	drScanReturn			14
	.def	drScanStructLength		15
	
	;screen struct
	
	.def	scrU				0
	.def	scrV				1
	.def	scrSu                           2
	.def	scrSv                           3
	.def	scrDu                           4
	.def	scrDv                           5
	.def	scrAngel			6
	.def	scrZoom				7
	.def	scrStructLength			8
	
	;pre setup
	
	movei	r6,scrStruct
	movei	r0,0
	moveih	r6,>scrStruct
	moveih	r0,$1
	ssto	scrZoom
	stwo	r6,r0
	movei	r1,0
	ssto	scrAngel
	stwo	r6,r1
	
	;test scan
	
screenLoop	

	movei	r6,scrStruct
	nop
	moveih	r6,>scrStruct

	;process ps2 keys
	
	gpci	r7,2		;next 4 + X
	br	PS2Process
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot

	;check key A
	
	movei	r0,$1c		;a?
	gpci	r7,2
	br	PS2TestKey
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	
	cmpeqi	r0,0
	brtc	notAPressed
	rqldi	r6,scrZoom	;delay slot
	nop                     ;delay slot
	nop                     ;delay slot
	ld	r0              ;delay slot
	
	nop
	addi	r0,4
	ssto	scrZoom		;zoom+
	stwo	r6,r0
		
notAPressed	

	;check key S
	
	movei	r0,$1b		;s?
	gpci	r7,2
	br	PS2TestKey
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	
	cmpeqi	r0,0
	brtc	notSPressed
	rqldi	r6,scrZoom	;delay slot
	nop                     ;delay slot
	nop                     ;delay slot
	ld	r0              ;delay slot
	
	nop
	subi	r0,4
	ssto	scrZoom		;zoom-
	stwo	r6,r0
		
notSPressed	

	;check key D
	
	movei	r0,$23		;d?
	gpci	r7,2
	br	PS2TestKey
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	
	cmpeqi	r0,0
	brtc	notDPressed
	rqldi	r6,scrAngel	;delay slot
	nop                     ;delay slot
	nop                     ;delay slot
	ld	r0              ;delay slot
	
	nop
	addi	r0,1
	ssto	scrAngel	;scrAngle+
	stwo	r6,r0
		
notDPressed	

	;check key F
	
	movei	r0,$2b		;f?
	gpci	r7,2
	br	PS2TestKey
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	
	cmpeqi	r0,0
	brtc	notFPressed
	rqldi	r6,scrAngel	;delay slot
	nop                     ;delay slot
	nop                     ;delay slot
	ld	r0              ;delay slot
	
	nop
	subi	r0,1
	ssto	scrAngel	;zoom-
	stwo	r6,r0
		
notFPressed	


	;start per screen calculation
	
	movei	r7,sinTable
	nop
	moveih	r7,>sinTable
	
	;angel trim
	
	rqldi	r6,scrAngel
	nop
	movei	r1,$ff
	ld	r0
	moveih	r1,1
	addi	r0,0
	nop
	and	r0,r0,r1	;0..511
	ssto	scrAngel
	stwo	r6,r0
	
	;calculate du,dv, su,sv
	
	add	r5,r7,r0	;sintable + angel
	nop
	rqldi	r5,0		;get sin
	rqldi	r5,128		;get cos
	rqldi	r6,scrZoom	;get zoom
	ld	r1		;sin
	ld	r2		;cos
	ld	r3		;zoom
	
	nop
	muls	r0,r1,r3
	gmulhi	r1		;sin * zomm
	muls	r0,r2,r3
	gmulhi	r2		;cos * zomm
		
	movei	r3,0		
	ssto	scrSu		;su = Cos(winkel) * zoom
	stwo	r6,r2
	ssto	scrDv		;dv = Cos(winkel) * zoom
	stwo	r6,r2
	ssto	scrSv		;sv = Sin(winkel) * zoom
	stwo	r6,r1
	sub	r1,r3,r1	;0-
	ssto	scrDu		;du = Sin(winkel) * -zoom
	stwo	r6,r1
	
	
	;setup scanline
	
	getsp	r7,0
	nop
	subi	r7,drScanStructLength
	nop
	setsp	r7	;
	
	movei	r1,$68
	movei	r0,0			;xstart = 0
	moveih	r1,1			;xend = 360
	ssto	drScanXStart
	stwo	r7,r0
	ssto	drScanXEnd
	stwo	r7,r1
	
	movei	r1,0
	movei	r0,0			
	moveih	r1,$f0			;source = $f000 0000
	ssto	drScanSourceDataLow
	stwo	r7,r0
	ssto	drScanSourceDataHigh
	stwo	r7,r1
	
	movei	r1,0
	movei	r0,0			
	moveih	r1,$d0			;destinatin = $d000 0000
	ssto	drScanDestDataLow
	stwo	r7,r0
	ssto	drScanDestDataHigh
	stwo	r7,r1
		
	movei	r0,$68			;drScanDestWidth = 360
	nop
	moveih	r0,$1
	ssto	drScanDestWidth
	stwo	r7,r0
	
	rqldi	r6,scrDu
	rqldi	r6,scrDv
	nop
	ld	r0		;du
	ld	r1		;dv
	ssto	drScanDu
	stwo	r7,r0
	ssto	drScanDv
	stwo	r7,r1
	
	;r2 = u
	;r3 = v
	;r4 = su
	;r5 = sv
	;r6 = y
	;r7 = scan struct
	
	rqldi	r6,scrSu
	rqldi	r6,scrSv
	nop
	ld	r4		;su
	ld	r5		;sv
	
	movei	r2,0		;u
	movei	r3,0		;v

	
	;.stop
	;
	
	movei	r6,0		;y start
scanY	
	
	;setup data
	
	ssto	drScanV
	stwo	r7,r3
	ssto	drScanU
	stwo	r7,r2
	ssto	drScanY
	stwo	r7,r6
	
	;draw scanline
	
	gpci	r0,2
	br	drawScanline
	ssto	drScanReturn	;delay slot
	stwo	r7,r0		;delay slot
	nop			;delay slot
	nop			;delay slot
	
	;
	
	cmpeqi	r6,224		;y end - 1
	brtc	scanY
	addi	r6,1		; y++			;delay slot
	add	r2,r2,r4	; u += su;		;delay slot
	add	r3,r3,r5	; v += sv;		;delay slot
	nop			;delay slot
	
	;make stake ok
	
	getsp	r7,0
	nop
	addi	r7,drScanStructLength
	nop
	setsp	r7	;
	
	;
	
	br	screenLoop
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	
;*********************************************************************
;* functions
;*********************************************************************	
	
	.include	"components\sdCardLoader.s"
	.include	"components\ps2keyboard.s"

;******************************
;*
;* drawScanline (texture size is fixed to 1024x1024)
;* 
;* r7 data array on stack
;*	 
	
drawScanline

	push	r1
	push	r2
	push	r3
	push	r4
	push	r5
	push	r6
	
	;calculate destiniation position
	
	rqldi	r7,drScanDestWidth
	rqldi	r7,drScanY
	rqldi	r7,drScanXStart
	ld	r0
	ld	r1
	ld	r2
	
	mul	r1,r1,r0	;      = y * width
	gmulhi	r3		;r3:r1
	add	r1,r1,r2	;
	addtqi	r3,r3,0		;r3:r1 += x
	
	rqldi	r7,drScanDestDataLow
	rqldi	r7,drScanDestDataHigh
	nop
	ld	r0
	ld	r2
	
	add	r0,r0,r1	;destData += r3:r1
	addt	r2,r2,r3	
	
	ssto	drScanDestWorkLow
	stwo	r7,r0
	ssto	drScanDestWorkHigh
	stwo	r7,r2
 
	;prepare loop
	
	rqldi	r7,drScanXStart
	rqldi	r7,drScanXEnd
	rqldi	r7,drScanU
	ld	r0
	ld	r1
	ld	r2
	
	sub	r1,r1,r0	;r1 = drScanXEnd-drScanXStart
 
	rqldi	r7,drScanV
	rqldi	r7,drScanDu
	rqldi	r7,drScanDv
	ld	r3
	ld	r4
	ld	r5
	
	subqi	r6,r1,1		;loop count 
	nop
		
scanLineLoop
	
	push	r6	;store counter
	
 ;r0 tmp
 ;r1 tmp
 ;r2 u
 ;r3 v
 ;r4 du
 ;r5 dv
 ;r6 tmp
 ;r7 	
	;source address = address in[u>>8+v>>8<<8]
	;
	
	swp	r0,r2
	swp	r1,r3
	moveih	r0,0	;r0 = u >> 8
	moveih	r1,0	;r1 = v >> 8
	nop
	swp	r1,r1
		
	rqldi	r7,drScanSourceDataLow 
	rqldi	r7,drScanSourceDataHigh
	or	r0,r0,r1	;r0 = u>>8+v>>8<<8
	ld	r1
	ld	r6
	
	nop
	esadr	r6,r1
	erqld	r0	;value
	
	add	r2,r2,r4	; u += du;
	add	r3,r3,r5	; v += dv;
	
	rqldi	r7,drScanDestWorkLow
	rqldi	r7,drScanDestWorkHigh
	nop
	ld	r0
	ld	r1
	
	nop
	eld	r6		;get color
	esadr	r1,r0
	est	r6,0		;store
		
	rqpop
	addi	r0,1		;dest ++
	addtqi	r1,r1,0
	pop	r6
	nop
		
	subi	r6,1
	brts	scanLineLoop		
	ssto	drScanDestWorkLow	;delay slot
	stwo	r7,r0                   ;delay slot
	ssto	drScanDestWorkHigh      ;delay slot
	stwo	r7,r1                   ;delay slot
	
	;epilog
	
	rqldi	r7,drScanReturn
	nop
	nop
	ld	r0
	nop

	rqpop
	rqpop
	rqpop
	pop	r6
	pop	r5
	pop	r4
	
	rqpop
	rqpop
	rqpop
	pop	r3
	pop	r2
	pop	r1
	
	jmpi	r0,0
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	nop			;delay slot
	
	
	
	
	
	
 
;  unsafe private void drawScanline(UInt32* bmData, UInt32* smData, UInt16 x_start, UInt16 x_end, UInt16 y, UInt16 u, UInt16 v, UInt16 du, UInt16 dv)  // hard
;        {
;            bmData += x_start + y * visibleWidth;   // calc dest start position
;         
;            for (UInt16 x = x_start; x < x_end; x++)
;            {                                
;                int rx = u >> 8;
;                int ry = v >> 8;
;              
;                *bmData++ = (UInt32)smData[rx + (ry * sourceWidth)];
;
;                u += du;
;                v += dv;
;            }
;        }
;	
;******************************
;*
;* setupVideo
;*

setupVideo

	
	movei	r0,videoDefault		;source
	movei	r1,UcTimer2Ctrl		;dest-1
	moveih	r0,>videoDefault
	moveih	r1,>UcTimer2Ctrl			
	movei	r2,26			;27-1
	
setupVideoLoop

	rqldi	r0,0
	addi	r0,1
	addi	r1,1
	ld	r3
	subi	r2,1
	brts	setupVideoLoop
	st	r1,r3	;delay slot
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
		
	jmpi	r7,0
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot	
		
;*********************************************************************
;* data
;*********************************************************************
	
videoDefault		;AD NAME								DEFAULT
	
	word	$0001	;10 VIDEO_ON								1 (ON)
	word	$0097	;11 HSYNC (D = 11 .. 0)							152-1
	word	$017f	;12 HSTART (D = 11 .. 0)						384-1
	word	$017d	;13 HMEMSTART (D = 11 .. 0)						382-1
	word	$071f	;14 HSTOP (D = 11 .. 0)							1824-1
	word	$076f	;15 HTOTAL (D = 11 .. 0)						1904-1
	word	$0002	;16 VSYNC (D = 10 .. 0)							3-1
	word	$001e	;17 VSTART (D = 10 .. 0)						31-1
	word	$03a2	;18 VSTOP  (D = 10 .. 0)						931-1
	word	$03a3	;19 VTOTAL  (D = 10 .. 0)						932-1
	word	$0000	;1a LC ADDER LOW							$0000
	word	$0040	;1b LC ADDER HIGH							$0040	
	word	$0000	;1c LC ADDER LATCH							X
	word	$0000	;1d LC START (10 .. 0) Pixeloffset					$0000	
	word	$0000	;1e									X
	word	$0000	;1f									X
	word	$0008	;20 HLOADSTART 								8
	word	$00bc	;21 HLOADSTOP								180+8
	word	$001e	;22 VLOADSTART 								31-1
	word	$03a2	;23 VLOADSTOP 								931-1
	word	$0004	;24 VLOADNEXT								4
	word	$0000	;25 MEM_STARTADR_store low						$0000
	word	$d000	;26 MEM_STARTADR_store high						$f000
	word	$0000	;27 MEM_LINEOFFSET_store low						$0000
	word	$0000	;28 MEM_LINEOFFSET_store high						$0000
	word	$0002	;29 MEM_MODE_store 							2 (X1R5G5B5X1R5G5B5)
	word	$0000	;2a LATCH MEM_STARTADR/LINEOFFSET/MODE					X
		
		
scrStruct
		
	.space	32		
		
sinTable	;512*1.25

    word    0   ;0
    word    402   ;1
    word    804   ;2
    word    1206   ;3
    word    1608   ;4
    word    2009   ;5
    word    2411   ;6
    word    2811   ;7
    word    3212   ;8
    word    3612   ;9
    word    4011   ;10
    word    4410   ;11
    word    4808   ;12
    word    5205   ;13
    word    5602   ;14
    word    5998   ;15
    word    6393   ;16
    word    6787   ;17
    word    7179   ;18
    word    7571   ;19
    word    7962   ;20
    word    8351   ;21
    word    8740   ;22
    word    9126   ;23
    word    9512   ;24
    word    9896   ;25
    word    10279   ;26
    word    10660   ;27
    word    11039   ;28
    word    11417   ;29
    word    11793   ;30
    word    12167   ;31
    word    12540   ;32
    word    12910   ;33
    word    13279   ;34
    word    13645   ;35
    word    14010   ;36
    word    14372   ;37
    word    14733   ;38
    word    15091   ;39
    word    15446   ;40
    word    15800   ;41
    word    16151   ;42
    word    16500   ;43
    word    16846   ;44
    word    17189   ;45
    word    17531   ;46
    word    17869   ;47
    word    18205   ;48
    word    18538   ;49
    word    18868   ;50
    word    19195   ;51
    word    19520   ;52
    word    19841   ;53
    word    20160   ;54
    word    20475   ;55
    word    20787   ;56
    word    21097   ;57
    word    21403   ;58
    word    21706   ;59
    word    22005   ;60
    word    22302   ;61
    word    22595   ;62
    word    22884   ;63
    word    23170   ;64
    word    23453   ;65
    word    23732   ;66
    word    24007   ;67
    word    24279   ;68
    word    24547   ;69
    word    24812   ;70
    word    25073   ;71
    word    25330   ;72
    word    25583   ;73
    word    25832   ;74
    word    26078   ;75
    word    26319   ;76
    word    26557   ;77
    word    26790   ;78
    word    27020   ;79
    word    27245   ;80
    word    27467   ;81
    word    27684   ;82
    word    27897   ;83
    word    28106   ;84
    word    28310   ;85
    word    28511   ;86
    word    28707   ;87
    word    28898   ;88
    word    29086   ;89
    word    29269   ;90
    word    29447   ;91
    word    29621   ;92
    word    29791   ;93
    word    29956   ;94
    word    30117   ;95
    word    30273   ;96
    word    30425   ;97
    word    30572   ;98
    word    30714   ;99
    word    30852   ;100
    word    30985   ;101
    word    31114   ;102
    word    31237   ;103
    word    31357   ;104
    word    31471   ;105
    word    31581   ;106
    word    31685   ;107
    word    31785   ;108
    word    31881   ;109
    word    31971   ;110
    word    32057   ;111
    word    32138   ;112
    word    32214   ;113
    word    32285   ;114
    word    32351   ;115
    word    32413   ;116
    word    32469   ;117
    word    32521   ;118
    word    32568   ;119
    word    32610   ;120
    word    32647   ;121
    word    32679   ;122
    word    32706   ;123
    word    32728   ;124
    word    32745   ;125
    word    32758   ;126
    word    32765   ;127
    word    32767   ;128
    word    32765   ;129
    word    32758   ;130
    word    32745   ;131
    word    32728   ;132
    word    32706   ;133
    word    32679   ;134
    word    32647   ;135
    word    32610   ;136
    word    32568   ;137
    word    32521   ;138
    word    32469   ;139
    word    32413   ;140
    word    32351   ;141
    word    32285   ;142
    word    32214   ;143
    word    32138   ;144
    word    32057   ;145
    word    31971   ;146
    word    31881   ;147
    word    31785   ;148
    word    31685   ;149
    word    31581   ;150
    word    31471   ;151
    word    31357   ;152
    word    31237   ;153
    word    31114   ;154
    word    30985   ;155
    word    30852   ;156
    word    30714   ;157
    word    30572   ;158
    word    30425   ;159
    word    30273   ;160
    word    30117   ;161
    word    29956   ;162
    word    29791   ;163
    word    29621   ;164
    word    29447   ;165
    word    29269   ;166
    word    29086   ;167
    word    28898   ;168
    word    28707   ;169
    word    28511   ;170
    word    28310   ;171
    word    28106   ;172
    word    27897   ;173
    word    27684   ;174
    word    27467   ;175
    word    27245   ;176
    word    27020   ;177
    word    26790   ;178
    word    26557   ;179
    word    26319   ;180
    word    26078   ;181
    word    25832   ;182
    word    25583   ;183
    word    25330   ;184
    word    25073   ;185
    word    24812   ;186
    word    24547   ;187
    word    24279   ;188
    word    24007   ;189
    word    23732   ;190
    word    23453   ;191
    word    23170   ;192
    word    22884   ;193
    word    22595   ;194
    word    22302   ;195
    word    22005   ;196
    word    21706   ;197
    word    21403   ;198
    word    21097   ;199
    word    20787   ;200
    word    20475   ;201
    word    20160   ;202
    word    19841   ;203
    word    19520   ;204
    word    19195   ;205
    word    18868   ;206
    word    18538   ;207
    word    18205   ;208
    word    17869   ;209
    word    17531   ;210
    word    17189   ;211
    word    16846   ;212
    word    16500   ;213
    word    16151   ;214
    word    15800   ;215
    word    15446   ;216
    word    15091   ;217
    word    14733   ;218
    word    14372   ;219
    word    14010   ;220
    word    13645   ;221
    word    13279   ;222
    word    12910   ;223
    word    12540   ;224
    word    12167   ;225
    word    11793   ;226
    word    11417   ;227
    word    11039   ;228
    word    10660   ;229
    word    10279   ;230
    word    9896   ;231
    word    9512   ;232
    word    9126   ;233
    word    8740   ;234
    word    8351   ;235
    word    7962   ;236
    word    7571   ;237
    word    7179   ;238
    word    6787   ;239
    word    6393   ;240
    word    5998   ;241
    word    5602   ;242
    word    5205   ;243
    word    4808   ;244
    word    4410   ;245
    word    4011   ;246
    word    3612   ;247
    word    3212   ;248
    word    2811   ;249
    word    2411   ;250
    word    2009   ;251
    word    1608   ;252
    word    1206   ;253
    word    804   ;254
    word    402   ;255
    word    0   ;256
    word    -402   ;257
    word    -804   ;258
    word    -1206   ;259
    word    -1608   ;260
    word    -2009   ;261
    word    -2411   ;262
    word    -2811   ;263
    word    -3212   ;264
    word    -3612   ;265
    word    -4011   ;266
    word    -4410   ;267
    word    -4808   ;268
    word    -5205   ;269
    word    -5602   ;270
    word    -5998   ;271
    word    -6393   ;272
    word    -6787   ;273
    word    -7179   ;274
    word    -7571   ;275
    word    -7962   ;276
    word    -8351   ;277
    word    -8740   ;278
    word    -9126   ;279
    word    -9512   ;280
    word    -9896   ;281
    word    -10279   ;282
    word    -10660   ;283
    word    -11039   ;284
    word    -11417   ;285
    word    -11793   ;286
    word    -12167   ;287
    word    -12540   ;288
    word    -12910   ;289
    word    -13279   ;290
    word    -13645   ;291
    word    -14010   ;292
    word    -14372   ;293
    word    -14733   ;294
    word    -15091   ;295
    word    -15446   ;296
    word    -15800   ;297
    word    -16151   ;298
    word    -16500   ;299
    word    -16846   ;300
    word    -17189   ;301
    word    -17531   ;302
    word    -17869   ;303
    word    -18205   ;304
    word    -18538   ;305
    word    -18868   ;306
    word    -19195   ;307
    word    -19520   ;308
    word    -19841   ;309
    word    -20160   ;310
    word    -20475   ;311
    word    -20787   ;312
    word    -21097   ;313
    word    -21403   ;314
    word    -21706   ;315
    word    -22005   ;316
    word    -22302   ;317
    word    -22595   ;318
    word    -22884   ;319
    word    -23170   ;320
    word    -23453   ;321
    word    -23732   ;322
    word    -24007   ;323
    word    -24279   ;324
    word    -24547   ;325
    word    -24812   ;326
    word    -25073   ;327
    word    -25330   ;328
    word    -25583   ;329
    word    -25832   ;330
    word    -26078   ;331
    word    -26319   ;332
    word    -26557   ;333
    word    -26790   ;334
    word    -27020   ;335
    word    -27245   ;336
    word    -27467   ;337
    word    -27684   ;338
    word    -27897   ;339
    word    -28106   ;340
    word    -28310   ;341
    word    -28511   ;342
    word    -28707   ;343
    word    -28898   ;344
    word    -29086   ;345
    word    -29269   ;346
    word    -29447   ;347
    word    -29621   ;348
    word    -29791   ;349
    word    -29956   ;350
    word    -30117   ;351
    word    -30273   ;352
    word    -30425   ;353
    word    -30572   ;354
    word    -30714   ;355
    word    -30852   ;356
    word    -30985   ;357
    word    -31114   ;358
    word    -31237   ;359
    word    -31357   ;360
    word    -31471   ;361
    word    -31581   ;362
    word    -31685   ;363
    word    -31785   ;364
    word    -31881   ;365
    word    -31971   ;366
    word    -32057   ;367
    word    -32138   ;368
    word    -32214   ;369
    word    -32285   ;370
    word    -32351   ;371
    word    -32413   ;372
    word    -32469   ;373
    word    -32521   ;374
    word    -32568   ;375
    word    -32610   ;376
    word    -32647   ;377
    word    -32679   ;378
    word    -32706   ;379
    word    -32728   ;380
    word    -32745   ;381
    word    -32758   ;382
    word    -32765   ;383
    word    -32768   ;384
    word    -32765   ;385
    word    -32758   ;386
    word    -32745   ;387
    word    -32728   ;388
    word    -32706   ;389
    word    -32679   ;390
    word    -32647   ;391
    word    -32610   ;392
    word    -32568   ;393
    word    -32521   ;394
    word    -32469   ;395
    word    -32413   ;396
    word    -32351   ;397
    word    -32285   ;398
    word    -32214   ;399
    word    -32138   ;400
    word    -32057   ;401
    word    -31971   ;402
    word    -31881   ;403
    word    -31785   ;404
    word    -31685   ;405
    word    -31581   ;406
    word    -31471   ;407
    word    -31357   ;408
    word    -31237   ;409
    word    -31114   ;410
    word    -30985   ;411
    word    -30852   ;412
    word    -30714   ;413
    word    -30572   ;414
    word    -30425   ;415
    word    -30273   ;416
    word    -30117   ;417
    word    -29956   ;418
    word    -29791   ;419
    word    -29621   ;420
    word    -29447   ;421
    word    -29269   ;422
    word    -29086   ;423
    word    -28898   ;424
    word    -28707   ;425
    word    -28511   ;426
    word    -28310   ;427
    word    -28106   ;428
    word    -27897   ;429
    word    -27684   ;430
    word    -27467   ;431
    word    -27245   ;432
    word    -27020   ;433
    word    -26790   ;434
    word    -26557   ;435
    word    -26319   ;436
    word    -26078   ;437
    word    -25832   ;438
    word    -25583   ;439
    word    -25330   ;440
    word    -25073   ;441
    word    -24812   ;442
    word    -24547   ;443
    word    -24279   ;444
    word    -24007   ;445
    word    -23732   ;446
    word    -23453   ;447
    word    -23170   ;448
    word    -22884   ;449
    word    -22595   ;450
    word    -22302   ;451
    word    -22005   ;452
    word    -21706   ;453
    word    -21403   ;454
    word    -21097   ;455
    word    -20787   ;456
    word    -20475   ;457
    word    -20160   ;458
    word    -19841   ;459
    word    -19520   ;460
    word    -19195   ;461
    word    -18868   ;462
    word    -18538   ;463
    word    -18205   ;464
    word    -17869   ;465
    word    -17531   ;466
    word    -17189   ;467
    word    -16846   ;468
    word    -16500   ;469
    word    -16151   ;470
    word    -15800   ;471
    word    -15446   ;472
    word    -15091   ;473
    word    -14733   ;474
    word    -14372   ;475
    word    -14010   ;476
    word    -13645   ;477
    word    -13279   ;478
    word    -12910   ;479
    word    -12540   ;480
    word    -12167   ;481
    word    -11793   ;482
    word    -11417   ;483
    word    -11039   ;484
    word    -10660   ;485
    word    -10279   ;486
    word    -9896   ;487
    word    -9512   ;488
    word    -9126   ;489
    word    -8740   ;490
    word    -8351   ;491
    word    -7962   ;492
    word    -7571   ;493
    word    -7179   ;494
    word    -6787   ;495
    word    -6393   ;496
    word    -5998   ;497
    word    -5602   ;498
    word    -5205   ;499
    word    -4808   ;500
    word    -4410   ;501
    word    -4011   ;502
    word    -3612   ;503
    word    -3212   ;504
    word    -2811   ;505
    word    -2411   ;506
    word    -2009   ;507
    word    -1608   ;508
    word    -1206   ;509
    word    -804   ;510
    word    -402   ;511
    word    0   ;512
    word    402   ;513
    word    804   ;514
    word    1206   ;515
    word    1608   ;516
    word    2009   ;517
    word    2411   ;518
    word    2811   ;519
    word    3212   ;520
    word    3612   ;521
    word    4011   ;522
    word    4410   ;523
    word    4808   ;524
    word    5205   ;525
    word    5602   ;526
    word    5998   ;527
    word    6393   ;528
    word    6787   ;529
    word    7179   ;530
    word    7571   ;531
    word    7962   ;532
    word    8351   ;533
    word    8740   ;534
    word    9126   ;535
    word    9512   ;536
    word    9896   ;537
    word    10279   ;538
    word    10660   ;539
    word    11039   ;540
    word    11417   ;541
    word    11793   ;542
    word    12167   ;543
    word    12540   ;544
    word    12910   ;545
    word    13279   ;546
    word    13645   ;547
    word    14010   ;548
    word    14372   ;549
    word    14733   ;550
    word    15091   ;551
    word    15446   ;552
    word    15800   ;553
    word    16151   ;554
    word    16500   ;555
    word    16846   ;556
    word    17189   ;557
    word    17531   ;558
    word    17869   ;559
    word    18205   ;560
    word    18538   ;561
    word    18868   ;562
    word    19195   ;563
    word    19520   ;564
    word    19841   ;565
    word    20160   ;566
    word    20475   ;567
    word    20787   ;568
    word    21097   ;569
    word    21403   ;570
    word    21706   ;571
    word    22005   ;572
    word    22302   ;573
    word    22595   ;574
    word    22884   ;575
    word    23170   ;576
    word    23453   ;577
    word    23732   ;578
    word    24007   ;579
    word    24279   ;580
    word    24547   ;581
    word    24812   ;582
    word    25073   ;583
    word    25330   ;584
    word    25583   ;585
    word    25832   ;586
    word    26078   ;587
    word    26319   ;588
    word    26557   ;589
    word    26790   ;590
    word    27020   ;591
    word    27245   ;592
    word    27467   ;593
    word    27684   ;594
    word    27897   ;595
    word    28106   ;596
    word    28310   ;597
    word    28511   ;598
    word    28707   ;599
    word    28898   ;600
    word    29086   ;601
    word    29269   ;602
    word    29447   ;603
    word    29621   ;604
    word    29791   ;605
    word    29956   ;606
    word    30117   ;607
    word    30273   ;608
    word    30425   ;609
    word    30572   ;610
    word    30714   ;611
    word    30852   ;612
    word    30985   ;613
    word    31114   ;614
    word    31237   ;615
    word    31357   ;616
    word    31471   ;617
    word    31581   ;618
    word    31685   ;619
    word    31785   ;620
    word    31881   ;621
    word    31971   ;622
    word    32057   ;623
    word    32138   ;624
    word    32214   ;625
    word    32285   ;626
    word    32351   ;627
    word    32413   ;628
    word    32469   ;629
    word    32521   ;630
    word    32568   ;631
    word    32610   ;632
    word    32647   ;633
    word    32679   ;634
    word    32706   ;635
    word    32728   ;636
    word    32745   ;637
    word    32758   ;638
    word    32765   ;639

		
		
;*********************************************************************
;* sd data after code segment
;*********************************************************************		
		
	;gfx
		
	.org	16384
	.incdir "F:\git\goldmomo_endlos\gfx"
	.incbin	"texture_256_256.raw"
	
				