_TEMPADR equ 0
CPU_PROF_START equ 16414
CPU_PROF_END equ 16415
PPU_REG1 equ 8192
PPU_REG2 equ 8193
PPU_STAT_REG equ 8194
PPU_DMA_ADR equ 16404
_SPR_XSIZE equ 2
_SPR_YSIZE equ 3
_SPR_XPOS equ 4
_SPR_YPOS equ 5
_TEMPADRSPR equ 6
_SPR_NR equ 8
_SPR_ANIM_NR equ 9
_SPR_ATTR equ 10
_SPR_PRECALC equ 11
_OAM_INDEX equ 19
_LAST_FRAME_OAM_INDEX equ 20
sprLoadPal___22 equ _TEMPADR
setMultiSprite__xPos equ _SPR_XPOS
setMultiSprite__yPos equ _SPR_YPOS
setMultiSprite__sprNr equ _SPR_NR
setMultiSprite__sprAnim equ _SPR_ANIM_NR
setMultiSprite___29 equ _TEMPADR
setMultiSprite___30 equ _TEMPADRSPR
setMultiSprite___31 equ _SPR_NR
setMultiSprite___32 equ _SPR_XPOS
setMultiSprite___33 equ _SPR_YPOS
setMultiSprite___34 equ _SPR_ATTR
setMultiSprite___35 equ _SPR_XSIZE
setMultiSprite___36 equ _SPR_YSIZE
setMultiSprite___37 equ _OAM_INDEX
setMultiSprite___38 equ _SPR_ANIM_NR
setMultiSprite___39 equ _SPR_PRECALC
bgLoadPal___55 equ _TEMPADR
sprXPos equ 21
sprYPos equ 27
sprAnim equ 33
frame equ 39
windowStartIndex equ 40
i equ 41
_s3__sprIndex equ 42
;### (0) 
    opt h-
 .byte('N', 'E', 'S', $1A, $02, $01,$10,$00,$01,$00,$00,$00,$00,$00,$00,$00)
 org $8000
RESET:
   sei
   cld
   ldx #$FF
   txs
start_example:
;### sprite.atl(83) waitvbl
   jsr waitvbl
;### sprite.atl(84) waitvbl
   jsr waitvbl
;### sprite.atl(85) waitvbl
   jsr waitvbl
;### sprite.atl(90) setMMC1Ctrl 24
   lda #24
   jsr setMMC1Ctrl
;### sprite.atl(92) setMMC1Prog 0
   lda #0
   jsr setMMC1Prog
;### sprite.atl(94) setMMC1Chr0 0
   lda #0
   jsr setMMC1Chr0
;### sprite.atl(96) setMMC1Chr1 1
   lda #1
   jsr setMMC1Chr1
;### sprite.atl(98) setDisplayMode %00001000 %00010000
   lda #8
   sta PPU_REG1
   lda #16
   sta PPU_REG2
;### sprite.atl(101) waitvbl
   jsr waitvbl
;### sprite.atl(102) sprLoadPal hanuspritePal
   lda #<hanuspritePal
   ldx #>hanuspritePal
   jsr sprLoadPal
;### sprite.atl(103) waitvbl
   jsr waitvbl
;### sprite.atl(104) bgLoadPal hanusBGPal
   lda #<hanusBGPal
   ldx #>hanusBGPal
   jsr bgLoadPal
;### sprite.atl(110) anim  = 0
   lda #0
;### sprite.atl(111) frame = 0
   sta frame
;### sprite.atl(117) test1 = sprite1
;### sprite.atl(118) test1 = sprite2
;### sprite.atl(119) test1 = hanuSpriteMulti1
;### sprite.atl(120) test1 = hanuSpriteMulti2
;### sprite.atl(121) test1 = hanuSpriteMulti3
;### sprite.atl(125) sprXPos(0) = 32
   lda #32
   sta sprXPos-0
;### sprite.atl(126) sprYPos(0) = 128
   lda #128
   sta sprYPos-0
;### sprite.atl(128) sprXPos(1) = 64
   lda #64
   sta sprXPos-0+1
;### sprite.atl(129) sprYPos(1) = 128
   lda #128
   sta sprYPos-0+1
;### sprite.atl(131) sprXPos(2) = 128
   sta sprXPos-0+2
;### sprite.atl(132) sprYPos(2) = 64
   lda #64
   sta sprYPos-0+2
;### sprite.atl(134) sprXPos(3) = 200
   lda #200
   sta sprXPos-0+3
;### sprite.atl(135) sprYPos(3) = 128
   lda #128
   sta sprYPos-0+3
;### sprite.atl(137) sprXPos(4) = 200
   lda #200
   sta sprXPos-0+4
;### sprite.atl(138) sprYPos(4) = 128
   lda #128
   sta sprYPos-0+4
;### sprite.atl(140) sprAnim(0) = 0
   lda #0
   sta sprAnim-0
;### sprite.atl(141) sprAnim(1) = 0
   sta sprAnim-0+1
;### sprite.atl(142) sprAnim(2) = 0
   sta sprAnim-0+2
;### sprite.atl(143) sprAnim(3) = 0
   sta sprAnim-0+3
;### sprite.atl(144) sprAnim(4) = 0
   sta sprAnim-0+4
;### sprite.atl(146) _LAST_FRAME_OAM_INDEX = 0
   sta _LAST_FRAME_OAM_INDEX
;### sprite.atl(147) frame = 0
;### sprite.atl(148) _OAM_INDEX = 0
   sta _OAM_INDEX
main:
;### sprite.atl(151) waitvbl
   jsr waitvbl
;### sprite.atl(152) PPU_DMA_ADR= 3
   lda #3
   sta PPU_DMA_ADR
;### sprite.atl(153) _LAST_FRAME_OAM_INDEX =_OAM_INDEX
   lda _OAM_INDEX
   sta _LAST_FRAME_OAM_INDEX
;### sprite.atl(154) _OAM_INDEX = 0
   lda #0
   sta _OAM_INDEX
;### sprite.atl(156) CPU_PROF_START = 1
   lda #1
   sta CPU_PROF_START
;### sprite.atl(159) windowStartIndex = frame 
   lda frame
   sta windowStartIndex
;### sprite.atl(162) for i
   lda #0
   sta i
_lbl11:
;### sprite.atl(163)     sprIndex = (windowStartIndex + i) bitand 3 
   lda windowStartIndex
   clc
   adc i
   and #3
   sta _s3__sprIndex
;### sprite.atl(164)     setMultiSprite spriteArray sprXPos(sprIndex) sprYPos(sprIndex) sprIndex sprAnim(sprIndex)
   ;
   tax
   lda sprXPos-0,x
   sta setMultiSprite__xPos
   lda sprYPos-0,x
   sta setMultiSprite__yPos
   lda _s3__sprIndex
   sta setMultiSprite__sprNr
   lda sprAnim-0,x
   sta setMultiSprite__sprAnim
   lda #<spriteArray
   ldx #>spriteArray
   jsr setMultiSprite
   inc i
   lda i
   cmp #4
   jne _lbl11
;### sprite.atl(167) if _LAST_FRAME_OAM_INDEX >_OAM_INDEX
   lda _OAM_INDEX
   cmp _LAST_FRAME_OAM_INDEX
   jcs _lbl12
;### sprite.atl(168) 	resetUnusedSprites
   jsr resetUnusedSprites
_lbl12:
;### sprite.atl(170) frame = frame + 1
   inc frame
;### sprite.atl(172) if frame == 3
   lda frame
   cmp frame
   jne _lbl13
   lda frame
   cmp #3
   jne _lbl13
;### sprite.atl(173)    frame = 0
   lda #0
   sta frame
_lbl13:
;### sprite.atl(175) sprAnim(0) = 2
   lda #2
   sta sprAnim-0
;### sprite.atl(177) CPU_PROF_END = 1
   lda #1
   sta CPU_PROF_END
;### sprite.atl(179) goto main
   jmp main
hanuspritePal:
;### sprite.atl(36) const hanuspritePal:sprPal = ($21,$16,$0f,$38,$21,$16,$38,$18,$21,$30,$2e,$06,$21,$17,$27,$28)
   dta b(33)
   dta b(22)
   dta b(15)
   dta b(56)
   dta b(33)
   dta b(22)
   dta b(56)
   dta b(24)
   dta b(33)
   dta b(48)
   dta b(46)
   dta b(6)
   dta b(33)
   dta b(23)
   dta b(39)
   dta b(40)
hanusBGPal:
;### sprite.atl(37) const hanusBGPal:bgPal = ($21,$16,$0f,$38,$21,$16,$38,$18,$21,$30,$2e,$06,$21,$17,$27,$28)
   dta b(33)
   dta b(22)
   dta b(15)
   dta b(56)
   dta b(33)
   dta b(22)
   dta b(56)
   dta b(24)
   dta b(33)
   dta b(48)
   dta b(46)
   dta b(6)
   dta b(33)
   dta b(23)
   dta b(39)
   dta b(40)
hanuSpriteMulti1:
;### sprite.atl(48) const hanuSpriteMulti1:array = ($04,$04,$00,$00,
   dta b(4)
   dta b(4)
   dta b(0)
   dta b(0)
;### sprite.atl(49) 				$00,$03,$04,$00,
   dta b(0)
   dta b(3)
   dta b(4)
   dta b(0)
;### sprite.atl(50) 				$05,$06,$09,$0a,
   dta b(5)
   dta b(6)
   dta b(9)
   dta b(10)
;### sprite.atl(51) 				$0b,$0c,$0f,$10,
   dta b(11)
   dta b(12)
   dta b(15)
   dta b(16)
;### sprite.atl(52) 				$00,$13,$14,$00)
   dta b(0)
   dta b(19)
   dta b(20)
   dta b(0)
hanuSpriteMulti2:
;### sprite.atl(55) const hanuSpriteMulti2:array = ($04,$04,$00,$00,
   dta b(4)
   dta b(4)
   dta b(0)
   dta b(0)
;### sprite.atl(56) 				$00,$01,$02,$00, 
   dta b(0)
   dta b(1)
   dta b(2)
   dta b(0)
;### sprite.atl(57) 				$05,$06,$07,$08,  
   dta b(5)
   dta b(6)
   dta b(7)
   dta b(8)
;### sprite.atl(58) 				$0b,$0c,$0d,$0e,
   dta b(11)
   dta b(12)
   dta b(13)
   dta b(14)
;### sprite.atl(59) 				$00,$011,$12,$00)
   dta b(0)
   dta b(17)
   dta b(18)
   dta b(0)
hanuSpriteMulti3:
;### sprite.atl(62) const hanuSpriteMulti3:array = ($04,$04,$00,$00,
   dta b(4)
   dta b(4)
   dta b(0)
   dta b(0)
;### sprite.atl(63) 				$00,$00,$00,$00, 
   dta b(0)
   dta b(0)
   dta b(0)
   dta b(0)
;### sprite.atl(64) 				$05,$15,$16,$17,  
   dta b(5)
   dta b(21)
   dta b(22)
   dta b(23)
;### sprite.atl(65) 				$18,$19,$1a,$1b,
   dta b(24)
   dta b(25)
   dta b(26)
   dta b(27)
;### sprite.atl(66) 				$00,$00,$00,$00)
   dta b(0)
   dta b(0)
   dta b(0)
   dta b(0)
sprite1:
;### sprite.atl(68) const  sprite1:array = (hanuSpriteMulti1,hanuSpriteMulti2,hanuSpriteMulti3)
   dta a(hanuSpriteMulti1)
   dta a(hanuSpriteMulti2)
   dta a(hanuSpriteMulti3)
sprite2:
;### sprite.atl(69) const  sprite2:array = (hanuSpriteMulti1,hanuSpriteMulti2,hanuSpriteMulti3)
   dta a(hanuSpriteMulti1)
   dta a(hanuSpriteMulti2)
   dta a(hanuSpriteMulti3)
spriteArray:
;### sprite.atl(71) const  spriteArray:array = (sprite1 , sprite2 , sprite2 , sprite1)
   dta a(sprite1)
   dta a(sprite2)
   dta a(sprite2)
   dta a(sprite1)
   rts
waitvbl .proc
_lbl3:
;### nes.atl(66) 		until PPU_STAT_REG bitand 128 <> 0 
   lda PPU_STAT_REG
   and #128
   cmp #0
   jeq _lbl3
_lbl2:
   rts
.endp
   icl 'C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes.asm'
   icl 'C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\processor\m6502\m6502.asm'
   icl 'C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes_sprite.asm'
   icl 'C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes_mmc1.asm'
   icl 'C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes_bg.asm'
    .align $FFF9,$00
NMI:
    rti
   org $FFFA
   .dw RESET
  .dw RESET
   .dw 0
