mads 1.9.0 build 21 (16 Aug 09)
Source: C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\bin/sprite.asm
     1 = 0000			_TEMPADR equ 0
     2 = 401E			CPU_PROF_START equ 16414
     3 = 401F			CPU_PROF_END equ 16415
     4 = 2000			PPU_REG1 equ 8192
     5 = 2001			PPU_REG2 equ 8193
     6 = 2002			PPU_STAT_REG equ 8194
     7 = 4014			PPU_DMA_ADR equ 16404
     8 = 0002			_SPR_XSIZE equ 2
     9 = 0003			_SPR_YSIZE equ 3
    10 = 0004			_SPR_XPOS equ 4
    11 = 0005			_SPR_YPOS equ 5
    12 = 0006			_TEMPADRSPR equ 6
    13 = 0008			_SPR_NR equ 8
    14 = 0009			_SPR_ANIM_NR equ 9
    15 = 000A			_SPR_ATTR equ 10
    16 = 000B			_SPR_PRECALC equ 11
    17 = 0013			_OAM_INDEX equ 19
    18 = 0014			_LAST_FRAME_OAM_INDEX equ 20
    19 = 0000			sprLoadPal___22 equ _TEMPADR
    20 = 0004			setMultiSprite__xPos equ _SPR_XPOS
    21 = 0005			setMultiSprite__yPos equ _SPR_YPOS
    22 = 0008			setMultiSprite__sprNr equ _SPR_NR
    23 = 0009			setMultiSprite__sprAnim equ _SPR_ANIM_NR
    24 = 0000			setMultiSprite___29 equ _TEMPADR
    25 = 0006			setMultiSprite___30 equ _TEMPADRSPR
    26 = 0008			setMultiSprite___31 equ _SPR_NR
    27 = 0004			setMultiSprite___32 equ _SPR_XPOS
    28 = 0005			setMultiSprite___33 equ _SPR_YPOS
    29 = 000A			setMultiSprite___34 equ _SPR_ATTR
    30 = 0002			setMultiSprite___35 equ _SPR_XSIZE
    31 = 0003			setMultiSprite___36 equ _SPR_YSIZE
    32 = 0013			setMultiSprite___37 equ _OAM_INDEX
    33 = 0009			setMultiSprite___38 equ _SPR_ANIM_NR
    34 = 000B			setMultiSprite___39 equ _SPR_PRECALC
    35 = 0000			bgLoadPal___55 equ _TEMPADR
    36 = 0015			sprXPos equ 21
    37 = 001B			sprYPos equ 27
    38 = 0021			sprAnim equ 33
    39 = 0027			frame equ 39
    40 = 0028			windowStartIndex equ 40
    41 = 0029			i equ 41
    42 = 002A			_s3__sprIndex equ 42
    43 				;### (0) 
    44 				    opt h-
    45  4E 45 53 1A 02 01 10 +   .byte('N', 'E', 'S', $1A, $02, $01,$10,$00,$01,$00,$00,$00,$00,$00,$00,$00)
    46 				 org $8000
    47 				RESET:
    48 8000 78			   sei
    49 8001 D8			   cld
    50 8002 A2 FF		   ldx #$FF
    51 8004 9A			   txs
    52 8005			start_example:
    53 				;### sprite.atl(83) waitvbl
    54 8005 20 58 81		   jsr waitvbl
    55 				;### sprite.atl(84) waitvbl
    56 8008 20 58 81		   jsr waitvbl
    57 				;### sprite.atl(85) waitvbl
    58 800B 20 58 81		   jsr waitvbl
    59 				;### sprite.atl(90) setMMC1Ctrl 24
    60 800E A9 18		   lda #24
    61 8010 20 6F B0		   jsr setMMC1Ctrl
    62 				;### sprite.atl(92) setMMC1Prog 0
    63 8013 A9 00		   lda #0
    64 8015 20 88 B0		   jsr setMMC1Prog
    65 				;### sprite.atl(94) setMMC1Chr0 0
    66 8018 A9 00		   lda #0
    67 801A 20 9C B0		   jsr setMMC1Chr0
    68 				;### sprite.atl(96) setMMC1Chr1 1
    69 801D A9 01		   lda #1
    70 801F 20 B0 B0		   jsr setMMC1Chr1
    71 				;### sprite.atl(98) setDisplayMode %00001000 %00010000
    72 8022 A9 08		   lda #8
    73 8024 8D 00 20		   sta PPU_REG1
    74 8027 A9 10		   lda #16
    75 8029 8D 01 20		   sta PPU_REG2
    76 				;### sprite.atl(101) waitvbl
    77 802C 20 58 81		   jsr waitvbl
    78 				;### sprite.atl(102) sprLoadPal hanuspritePal
    79 802F A9 E7		   lda #<hanuspritePal
    80 8031 A2 80		   ldx #>hanuspritePal
    81 8033 20 62 81		   jsr sprLoadPal
    82 				;### sprite.atl(103) waitvbl
    83 8036 20 58 81		   jsr waitvbl
    84 				;### sprite.atl(104) bgLoadPal hanusBGPal
    85 8039 A9 F7		   lda #<hanusBGPal
    86 803B A2 80		   ldx #>hanusBGPal
    87 803D 20 C4 B0		   jsr bgLoadPal
    88 				;### sprite.atl(110) anim  = 0
    89 8040 A9 00		   lda #0
    90 				;### sprite.atl(111) frame = 0
    91 8042 85 27		   sta frame
    92 				;### sprite.atl(117) test1 = sprite1
    93 				;### sprite.atl(118) test1 = sprite2
    94 				;### sprite.atl(119) test1 = hanuSpriteMulti1
    95 				;### sprite.atl(120) test1 = hanuSpriteMulti2
    96 				;### sprite.atl(121) test1 = hanuSpriteMulti3
    97 				;### sprite.atl(125) sprXPos(0) = 32
    98 8044 A9 20		   lda #32
    99 8046 85 15		   sta sprXPos-0
   100 				;### sprite.atl(126) sprYPos(0) = 128
   101 8048 A9 80		   lda #128
   102 804A 85 1B		   sta sprYPos-0
   103 				;### sprite.atl(128) sprXPos(1) = 64
   104 804C A9 40		   lda #64
   105 804E 85 16		   sta sprXPos-0+1
   106 				;### sprite.atl(129) sprYPos(1) = 128
   107 8050 A9 80		   lda #128
   108 8052 85 1C		   sta sprYPos-0+1
   109 				;### sprite.atl(131) sprXPos(2) = 128
   110 8054 85 17		   sta sprXPos-0+2
   111 				;### sprite.atl(132) sprYPos(2) = 64
   112 8056 A9 40		   lda #64
   113 8058 85 1D		   sta sprYPos-0+2
   114 				;### sprite.atl(134) sprXPos(3) = 200
   115 805A A9 C8		   lda #200
   116 805C 85 18		   sta sprXPos-0+3
   117 				;### sprite.atl(135) sprYPos(3) = 128
   118 805E A9 80		   lda #128
   119 8060 85 1E		   sta sprYPos-0+3
   120 				;### sprite.atl(137) sprXPos(4) = 200
   121 8062 A9 C8		   lda #200
   122 8064 85 19		   sta sprXPos-0+4
   123 				;### sprite.atl(138) sprYPos(4) = 128
   124 8066 A9 80		   lda #128
   125 8068 85 1F		   sta sprYPos-0+4
   126 				;### sprite.atl(140) sprAnim(0) = 0
   127 806A A9 00		   lda #0
   128 806C 85 21		   sta sprAnim-0
   129 				;### sprite.atl(141) sprAnim(1) = 0
   130 806E 85 22		   sta sprAnim-0+1
   131 				;### sprite.atl(142) sprAnim(2) = 0
   132 8070 85 23		   sta sprAnim-0+2
   133 				;### sprite.atl(143) sprAnim(3) = 0
   134 8072 85 24		   sta sprAnim-0+3
   135 				;### sprite.atl(144) sprAnim(4) = 0
   136 8074 85 25		   sta sprAnim-0+4
   137 				;### sprite.atl(146) _LAST_FRAME_OAM_INDEX = 0
   138 8076 85 14		   sta _LAST_FRAME_OAM_INDEX
   139 				;### sprite.atl(147) frame = 0
   140 				;### sprite.atl(148) _OAM_INDEX = 0
   141 8078 85 13		   sta _OAM_INDEX
   142 807A			main:
   143 				;### sprite.atl(151) waitvbl
   144 807A 20 58 81		   jsr waitvbl
   145 				;### sprite.atl(152) PPU_DMA_ADR= 3
   146 807D A9 03		   lda #3
   147 807F 8D 14 40		   sta PPU_DMA_ADR
   148 				;### sprite.atl(153) _LAST_FRAME_OAM_INDEX =_OAM_INDEX
   149 8082 A5 13		   lda _OAM_INDEX
   150 8084 85 14		   sta _LAST_FRAME_OAM_INDEX
   151 				;### sprite.atl(154) _OAM_INDEX = 0
   152 8086 A9 00		   lda #0
   153 8088 85 13		   sta _OAM_INDEX
   154 				;### sprite.atl(156) CPU_PROF_START = 1
   155 808A A9 01		   lda #1
   156 808C 8D 1E 40		   sta CPU_PROF_START
   157 				;### sprite.atl(159) windowStartIndex = frame 
   158 808F A5 27		   lda frame
   159 8091 85 28		   sta windowStartIndex
   160 				;### sprite.atl(162) for i
   161 8093 A9 00		   lda #0
   162 8095 85 29		   sta i
   163 8097			_lbl11:
   164 				;### sprite.atl(163)     sprIndex = (windowStartIndex + i) bitand 3 
   165 8097 A5 28		   lda windowStartIndex
   166 8099 18			   clc
   167 809A 65 29		   adc i
   168 809C 29 03		   and #3
   169 809E 85 2A		   sta _s3__sprIndex
   170 				;### sprite.atl(164)     setMultiSprite spriteArray sprXPos(sprIndex) sprYPos(sprIndex) sprIndex sprAnim(sprIndex)
   171 				   ;
   172 80A0 AA			   tax
   173 80A1 B5 15		   lda sprXPos-0,x
   174 80A3 85 04		   sta setMultiSprite__xPos
   175 80A5 B5 1B		   lda sprYPos-0,x
   176 80A7 85 05		   sta setMultiSprite__yPos
   177 80A9 A5 2A		   lda _s3__sprIndex
   178 80AB 85 08		   sta setMultiSprite__sprNr
   179 80AD B5 21		   lda sprAnim-0,x
   180 80AF 85 09		   sta setMultiSprite__sprAnim
   181 80B1 A9 4F		   lda #<spriteArray
   182 80B3 A2 81		   ldx #>spriteArray
   183 80B5 20 7D 81		   jsr setMultiSprite
   184 80B8 E6 29		   inc i
   185 80BA A5 29		   lda i
   186 80BC C9 04		   cmp #4
   187 80BE D0 D7		   jne _lbl11
   188 				;### sprite.atl(167) if _LAST_FRAME_OAM_INDEX >_OAM_INDEX
   189 80C0 A5 13		   lda _OAM_INDEX
   190 80C2 C5 14		   cmp _LAST_FRAME_OAM_INDEX
   191 80C4 B0 03		   jcs _lbl12
   192 				;### sprite.atl(168) 	resetUnusedSprites
   193 80C6 20 DE 81		   jsr resetUnusedSprites
   194 80C9			_lbl12:
   195 				;### sprite.atl(170) frame = frame + 1
   196 80C9 E6 27		   inc frame
   197 				;### sprite.atl(172) if frame == 3
   198 80CB A5 27		   lda frame
   199 80CD C5 27		   cmp frame
   200 80CF D0 0A		   jne _lbl13
   201 80D1 A5 27		   lda frame
   202 80D3 C9 03		   cmp #3
   203 80D5 D0 04		   jne _lbl13
   204 				;### sprite.atl(173)    frame = 0
   205 80D7 A9 00		   lda #0
   206 80D9 85 27		   sta frame
   207 80DB			_lbl13:
   208 				;### sprite.atl(175) sprAnim(0) = 2
   209 80DB A9 02		   lda #2
   210 80DD 85 21		   sta sprAnim-0
   211 				;### sprite.atl(177) CPU_PROF_END = 1
   212 80DF A9 01		   lda #1
   213 80E1 8D 1F 40		   sta CPU_PROF_END
   214 				;### sprite.atl(179) goto main
   215 80E4 4C 7A 80		   jmp main
   216 80E7			hanuspritePal:
   217 				;### sprite.atl(36) const hanuspritePal:sprPal = ($21,$16,$0f,$38,$21,$16,$38,$18,$21,$30,$2e,$06,$21,$17,$27,$28)
   218 80E7 21			   dta b(33)
   219 80E8 16			   dta b(22)
   220 80E9 0F			   dta b(15)
   221 80EA 38			   dta b(56)
   222 80EB 21			   dta b(33)
   223 80EC 16			   dta b(22)
   224 80ED 38			   dta b(56)
   225 80EE 18			   dta b(24)
   226 80EF 21			   dta b(33)
   227 80F0 30			   dta b(48)
   228 80F1 2E			   dta b(46)
   229 80F2 06			   dta b(6)
   230 80F3 21			   dta b(33)
   231 80F4 17			   dta b(23)
   232 80F5 27			   dta b(39)
   233 80F6 28			   dta b(40)
   234 80F7			hanusBGPal:
   235 				;### sprite.atl(37) const hanusBGPal:bgPal = ($21,$16,$0f,$38,$21,$16,$38,$18,$21,$30,$2e,$06,$21,$17,$27,$28)
   236 80F7 21			   dta b(33)
   237 80F8 16			   dta b(22)
   238 80F9 0F			   dta b(15)
   239 80FA 38			   dta b(56)
   240 80FB 21			   dta b(33)
   241 80FC 16			   dta b(22)
   242 80FD 38			   dta b(56)
   243 80FE 18			   dta b(24)
   244 80FF 21			   dta b(33)
   245 8100 30			   dta b(48)
   246 8101 2E			   dta b(46)
   247 8102 06			   dta b(6)
   248 8103 21			   dta b(33)
   249 8104 17			   dta b(23)
   250 8105 27			   dta b(39)
   251 8106 28			   dta b(40)
   252 8107			hanuSpriteMulti1:
   253 				;### sprite.atl(48) const hanuSpriteMulti1:array = ($04,$04,$00,$00,
   254 8107 04			   dta b(4)
   255 8108 04			   dta b(4)
   256 8109 00			   dta b(0)
   257 810A 00			   dta b(0)
   258 				;### sprite.atl(49) 				$00,$03,$04,$00,
   259 810B 00			   dta b(0)
   260 810C 03			   dta b(3)
   261 810D 04			   dta b(4)
   262 810E 00			   dta b(0)
   263 				;### sprite.atl(50) 				$05,$06,$09,$0a,
   264 810F 05			   dta b(5)
   265 8110 06			   dta b(6)
   266 8111 09			   dta b(9)
   267 8112 0A			   dta b(10)
   268 				;### sprite.atl(51) 				$0b,$0c,$0f,$10,
   269 8113 0B			   dta b(11)
   270 8114 0C			   dta b(12)
   271 8115 0F			   dta b(15)
   272 8116 10			   dta b(16)
   273 				;### sprite.atl(52) 				$00,$13,$14,$00)
   274 8117 00			   dta b(0)
   275 8118 13			   dta b(19)
   276 8119 14			   dta b(20)
   277 811A 00			   dta b(0)
   278 811B			hanuSpriteMulti2:
   279 				;### sprite.atl(55) const hanuSpriteMulti2:array = ($04,$04,$00,$00,
   280 811B 04			   dta b(4)
   281 811C 04			   dta b(4)
   282 811D 00			   dta b(0)
   283 811E 00			   dta b(0)
   284 				;### sprite.atl(56) 				$00,$01,$02,$00, 
   285 811F 00			   dta b(0)
   286 8120 01			   dta b(1)
   287 8121 02			   dta b(2)
   288 8122 00			   dta b(0)
   289 				;### sprite.atl(57) 				$05,$06,$07,$08,  
   290 8123 05			   dta b(5)
   291 8124 06			   dta b(6)
   292 8125 07			   dta b(7)
   293 8126 08			   dta b(8)
   294 				;### sprite.atl(58) 				$0b,$0c,$0d,$0e,
   295 8127 0B			   dta b(11)
   296 8128 0C			   dta b(12)
   297 8129 0D			   dta b(13)
   298 812A 0E			   dta b(14)
   299 				;### sprite.atl(59) 				$00,$011,$12,$00)
   300 812B 00			   dta b(0)
   301 812C 11			   dta b(17)
   302 812D 12			   dta b(18)
   303 812E 00			   dta b(0)
   304 812F			hanuSpriteMulti3:
   305 				;### sprite.atl(62) const hanuSpriteMulti3:array = ($04,$04,$00,$00,
   306 812F 04			   dta b(4)
   307 8130 04			   dta b(4)
   308 8131 00			   dta b(0)
   309 8132 00			   dta b(0)
   310 				;### sprite.atl(63) 				$00,$00,$00,$00, 
   311 8133 00			   dta b(0)
   312 8134 00			   dta b(0)
   313 8135 00			   dta b(0)
   314 8136 00			   dta b(0)
   315 				;### sprite.atl(64) 				$05,$15,$16,$17,  
   316 8137 05			   dta b(5)
   317 8138 15			   dta b(21)
   318 8139 16			   dta b(22)
   319 813A 17			   dta b(23)
   320 				;### sprite.atl(65) 				$18,$19,$1a,$1b,
   321 813B 18			   dta b(24)
   322 813C 19			   dta b(25)
   323 813D 1A			   dta b(26)
   324 813E 1B			   dta b(27)
   325 				;### sprite.atl(66) 				$00,$00,$00,$00)
   326 813F 00			   dta b(0)
   327 8140 00			   dta b(0)
   328 8141 00			   dta b(0)
   329 8142 00			   dta b(0)
   330 8143			sprite1:
   331 				;### sprite.atl(68) const  sprite1:array = (hanuSpriteMulti1,hanuSpriteMulti2,hanuSpriteMulti3)
   332 8143 07 81		   dta a(hanuSpriteMulti1)
   333 8145 1B 81		   dta a(hanuSpriteMulti2)
   334 8147 2F 81		   dta a(hanuSpriteMulti3)
   335 8149			sprite2:
   336 				;### sprite.atl(69) const  sprite2:array = (hanuSpriteMulti1,hanuSpriteMulti2,hanuSpriteMulti3)
   337 8149 07 81		   dta a(hanuSpriteMulti1)
   338 814B 1B 81		   dta a(hanuSpriteMulti2)
   339 814D 2F 81		   dta a(hanuSpriteMulti3)
   340 814F			spriteArray:
   341 				;### sprite.atl(71) const  spriteArray:array = (sprite1 , sprite2 , sprite2 , sprite1)
   342 814F 43 81		   dta a(sprite1)
   343 8151 49 81		   dta a(sprite2)
   344 8153 49 81		   dta a(sprite2)
   345 8155 43 81		   dta a(sprite1)
   346 8157 60			   rts
   347 8158			waitvbl .proc
   348 8158			_lbl3:
   349 				;### nes.atl(66) 		until PPU_STAT_REG bitand 128 <> 0 
   350 8158 AD 02 20		   lda PPU_STAT_REG
   351 815B 29 80		   and #128
   352 815D C9 00		   cmp #0
   353 815F F0 F7		   jeq _lbl3
   354 8161			_lbl2:
   355 8161 60			   rts
   356 				.endp
   357 8162			   icl 'C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes.asm'
Source: C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes.asm
     1 8162			_adr_putchr .proc
     2 				;Write byte to address specified by _arr and increment the address by 1.
     3 						 	
     4 				;	write the char to specified address	
     5 				;	ldy #0
     6 				;	sta (_arr),y
     7
     8 				;	inc _arr
     9 				;	bne skip1
    10 				;	inc _arr+1
    11 				;skip1
    12 				;	rts
    13 				.endp
    14
    15 8162			_out_putchr .proc
    16 				;Write character from A to output.
    17 				;	
    18 				;		tax
    19 				;		lda $347	;ICPUTB+1
    20 				;		pha
    21 				;		lda $346	;ICPUTB
    22 				;		pha
    23 				;		txa
    24 						rts
    25
    26 				.endp
   358 8162			   icl 'C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\processor\m6502\m6502.asm'
Source: C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\processor\m6502\m6502.asm
     1 				;********************************************************
     2 				;
     3 				;  ATALAN 6502 processor definition support routines
     4 				;
     5 				;  Parts of code have been taken from Effectus library.
     6 				;
     7 				;********************************************************
     8
     9
    10 				;Noname
    11 				;651-655         028B-028F
    12 				;
    13 				;More spare bytes that you shouldn't use because future versions of the OS might use them. 
    14 				;Locations 651 and 652 are already used by version "B" as part of the interrupt handler routines.
    15
    16 				;OS registers we use as temporary:
    17 				;
    18 				;BUFRLO,BUFRHI   50,51 $32,$33
    19 				;BFENLO,BFENHI   52,53 $34,$35
    20
    21 				;ADRESS  100,101   $64,$65  A temporary storage location used by the display handler for so many things that it made my mind spin and I forgot what they were.
    22 				;MLTTMP  102,103   $66,$67  More temporary storage, with aliases OPNTMP and TOADR.
    23 				;SAVADR  104,105   $68,$69  Also know as FRMADR. Also used for temporary storage. 
    24 				;                           Also not significant enough to explain (look at the OS listing if, for some reason, you really care).
    25
    26 				;Registers used when drawing line
    27 				;ROWAC   112,113   $70,$71
    28 				;COLAC   114,115   $72,$73
    29 				;ENDPT   116,117   $74,$75
    30 				;COUNTR  126,127   $7E,$7F  COUNTR tells how many points have to be plotted before the line is finished.
    31
    32 				;
    33 = 0001			_SYS_PRINT_SIGNED = 1
    34
    35 				;_putchr_proc_adr = $653  ;+$654 
    36 = 0032			?argptr =   $32		;$33
    37 = 0034			?varptr	=	$34
    38 = 0015			?size	=	$15		;15		//$16 BUFADR
    39 						.IF _SYS_PRINT_SIGNED = 1 
    40 = 0016			?sign = $16
    41 						.ENDIF
    42 = 0038			?aux2	=	$38
    43 = 0039			?aux	=	$39
    44
    45 				;Following assigns are defined by mc6502.atl
    46
    47 = 0032			_TW1 = $32	;$33  mc6502.atl defines these labels as _TEMPW1, _TEMPW2.
    48 = 0034			_TW2 = $34  ;$35
    49 = 0015			_TW3 = $15	;$16
    50 = 0070			_TL1 = $70	;four byte register ($70-$73) defined under name _TEMPL1 in mc6502.atl		
    51
    52 				;_stdbuf    = $600		;TODO: use LINBUF ($247-$26E)  (100,101 can point to it)
    53
    54 				;Argument list:
    55 				;	0	end of list
    56 				;	1..127  Constant string of specified lenght
    57 				; 128     EOL
    58
    59 				;   7 6 5 4 3 2 1 0 
    60 				;  |0| | | | | | | |		String of length 0..127
    61 				;  |1|0|0| | | | | |    Pointer to unsigned integer of length 1..31 bytes
    62 				;  |1|0|1| | | | | |    Pointer to signed integer of length 1..31 bytes
    63
    64 				;         ---- ptr to unsigned integer ---- (7-bit set)
    65 				; 129     one byte integer reference
    66 				;	130     two byte integer reference
    67 				;	131     three byte integer eference
    68 				;	132     four byte integer reference
    69 				;         ---- ptr to signed -----  (5-bit set)
    70 				; 161     one byte
    71 				; 162     two byte
    72 				; 163     three byte
    73 				; 164     four byte
    74
    75 8162			_std_print_adr .proc
    76
    77 						lda #<_adr_putchr
    78 						ldx #>_adr_putchr
    79 						clc
    80 						bcc system__print
    81 						.endp
    82 						
    83 8162			_std_print_out .proc
    84 						lda #<_out_putchr
    85 						ldx #>_out_putchr
    86 						clc											;TODO: No Jump, if we are directly before the _std_print
    87 						bcc system__print
    88 						.endp
    89
    90 				 .IF .NOT .DEF _EOL_CHAR
    91 						_EOL_CHAR equ 0
    92 				 .ENDIF
    93
    94 8162			system__print .proc
    95 						sta _putchr_proc_adr 
    96 						stx _putchr_proc_adr+1
    97 						
    98 						;... continue to _std_print
    99 				;.endp
   100 						
   101 				;_std_print	.proc
   102
   103 						;Get address of argument from stack
   104 						pla
   105 						sta ?argptr
   106 						pla
   107 						sta ?argptr+1
   108 						jsr _read_byte	;just skip next byte (that is part of return address)
   109
   110 						;Read command from input				
   111 8162			command
   112 						jsr _read_byte
   113 						sta ?size
   114 						tay				; to set the flags
   115 						beq done		;command 0 means end of sequence
   116 						bpl str			;1..127 constant string
   117
   118 						;Write n-byte integer variable
   119
   120 						and #$7f		; zero top bit (it's always 1)
   121 						sta ?size
   122 						beq eol			;size 0 means end of line (0 byte integer would be nonsense)
   123
   124 				    ;Read address of the variable
   125
   126 						jsr _read_byte
   127 						sta ?varptr		
   128 						jsr _read_byte
   129 						sta ?varptr+1
   130
   131 						.IF _SYS_PRINT_SIGNED = 1 
   132 						;signed number has bit 5 set
   133 						lda #0
   134 						sta ?sign
   135 						
   136 						lda ?size
   137 				    and #32		;%00100000
   138 				    beq unsigned
   139
   140 						lda ?size	;size uses only 4 bits
   141 						and #31		;%00011111
   142 						sta ?size
   143 				    
   144 				    tay				;test, whether the integer is negative (i.e. top byte is negative)
   145 				    dey
   146 				    lda (?varptr),y
   147 				    bpl unsigned
   148 						 
   149 				    dec ?sign				;sign = $ff  (-1)
   150 						
   151 						lda #'-'
   152 						jsr _std_putchr
   153 						
   154 8162			unsigned
   155 						.ENDIF
   156 						    
   157 						jsr _std_bin_to_bcd
   158 						jsr _std_print_hex
   159 						clc
   160 						bcc command		;jmp command
   161 8162			eol
   162 						lda #_EOL_CHAR	
   163 						jsr _std_putchr
   164 						clc
   165 						bcc command		;jmp command
   166 						;Write constant string (size is 1..127, already stored)
   167 									
   168 8162			str
   169 						jsr _read_byte
   170 						jsr _std_putchr
   171 						dec ?size
   172 						bne str
   173 						beq	command
   174 										
   175 8162			done		
   176 						jmp (?argptr)	
   177 						rts
   178 						
   179 8162			_read_byte
   180 						ldy #0
   181 						lda (?argptr),y
   182 						inc ?argptr
   183 						bne skip
   184 						inc ?argptr+1
   185 8162			skip
   186 						rts
   187 				.endp
   188
   189 8162			_std_putchr .proc
   190 						jmp (_putchr_proc_adr)
   191 						rts
   192 				.endp
   193
   194
   195 8162			.proc _std_print_hex
   196 				;Print hexadecimal number of arbitrary length (?size). 
   197 				;Leading zeroes are not printed.
   198 				;In:
   199 				;	?varptr		Pointer to memory containing the number
   200 				;	?size		  Number of bytes to print
   201 				;Uses:
   202 				;	?aux
   203 				;	?aux2
   204 					
   205 						lda ?size
   206 						sta ?aux
   207 						lda #0
   208 						sta ?aux2		; number of non-zero digits on output
   209 						beq _loop
   210 8162			_outbyte
   211 						ldy ?aux		
   212 						lda (?varptr),y
   213 						pha
   214 						lsr
   215 						lsr
   216 						lsr
   217 						lsr
   218 						jsr _write_digit
   219 					
   220 						pla
   221 						and #$0f
   222 						jsr _write_digit
   223 8162			_loop	
   224 						dec ?aux
   225 						bpl _outbyte
   226 						
   227 						;If no character has been written, write at least one 0		
   228 						lda ?aux2
   229 						bne _no_empty
   230 						lda #48
   231 						jsr _std_putchr
   232 8162			_no_empty
   233 				 
   234 						rts
   235 					
   236 8162			_write_digit
   237 				;In: a 4 bit digit
   238
   239 						tax
   240 						bne _non_zero
   241 						lda ?aux2
   242 						beq _done		;this is zero and there has been no char before - no output
   243 8162			_non_zero
   244 						lda hex,x
   245 						jsr _std_putchr
   246 						inc ?aux2
   247 8162			_done
   248 						rts
   249
   250 8162			hex     dta c"0123456789ABCDEF"
   251
   252 				.endp
   253
   254 8162			.proc _std_bin_to_bcd
   255 				;Convert binary number to BCD. 
   256 				;Arbitrary size (up to 127 bytes) are supported.
   257 				;In:
   258 				;	?varptr	pointer to binary number
   259 				; a   0 means unsigned number
   260 				;     $ff means signed number
   261 				;	?size	number of bytes
   262 				;Out:
   263 				;	?size	on output, returns size of resulting bcd number
   264 				;   ?varptr	on output, containg pointer to converted BCD
   265 				;Uses:
   266 				;	_stdbuf
   267 				;	?aux
   268 				;	?aux2
   269
   270 						;Compute size of resulting number 
   271 						ldy ?size
   272 						sty ?aux		; used to count later
   273 						iny				;add space to result
   274 						sty ?size
   275 						
   276 						;Zero the destination buffer
   277 						lda #0
   278 8162			zero	sta _stdbuf-1,y
   279 						dey
   280 						bne zero
   281 						
   282 						;**** We convert the number byte a time
   283 						sed
   284 						
   285 						;?aux = varptr(?aux)
   286 8162			bytes
   287 						dec ?aux
   288 						ldy ?aux
   289 						lda (?varptr),y	
   290 						.IF _SYS_PRINT_SIGNED = 1 
   291 						eor ?sign
   292 						.ENDIF	
   293 						sta ?aux2
   294 						sec				;set top bit to 1
   295 						bcs loop		
   296
   297 8162			shift_byte			
   298 						ldx #0
   299 						ldy ?size
   300 8162			bcd_mul2
   301 						lda _stdbuf,x
   302 						adc	_stdbuf,x			;buf2(x) = buf2(x) * 2 + carry
   303 						sta _stdbuf,x
   304 						inx
   305 						dey								;TODO: cpx ?size
   306 						bne bcd_mul2
   307 							
   308 						clc
   309 8162			loop	rol ?aux2		;divide by two, if result is 0, end
   310 						bne shift_byte		
   311 						
   312 						lda ?aux
   313 						bne bytes
   314 					
   315 						.IF _SYS_PRINT_SIGNED = 1 
   316 						;If this is negative number, add 1
   317 						;In case sign is $ff, asl will set the C to 1, otherwise to 0	
   318 						lda ?sign
   319 						asl
   320 						ldx #0
   321 8162			carry1
   322 						lda _stdbuf,x
   323 						adc #0
   324 						sta _stdbuf,x
   325 						inx
   326 						bcs carry1
   327 						.ENDIF
   328 									
   329 						cld		
   330 						
   331 						lda #<_stdbuf
   332 						sta ?varptr	
   333 						lda #>_stdbuf
   334 						sta ?varptr+1	
   335 						rts
   336
   337 				.endp
   338 				 
   339 				/*
   340 				  Mul8 - 8-bit multiplication routine
   341 				  
   342 				  Original source:
   343 				  Book Atari Roots (Chapter Ten - Assembly Language Math)
   344 				  Hyperlink: http://www.atariarchives.org/roots/chapter_10.php
   345 				  
   346 				  Parameters:
   347 					  a First multiplicant
   348 					  x Second multiplicant
   349 				  Result: 
   350 						TEMPW2,TEMPW2+1	high byte of the result
   351 				*/
   351
   352
   353 8162			_sys_mul8  .proc
   354
   355 = 0032			MUL1 = _TW1
   356 = 0033			MUL2 = _TW1+1
   357 = 0034			RES  = _TW2		;_TW2+1
   358
   359 						sta MUL1			;input comes in A and X
   360 						stx MUL2
   361 						
   362 						lda #0			;RES = 0
   363 						sta RES
   364 						
   365 						ldx #8  
   366 8162			loop
   367 						lsr MUL1		;MUL1 = MUL1 / 2
   368 						bcc noadd
   369 						
   370 						clc					;RES = RES + (MUL2 * $ff)
   371 						adc MUL2	  
   372 8162			noadd 
   373 						ror @				;RES = RES / 2		(Carry is 0, when there was no add)
   374 						ror RES
   375
   376 						dex
   377 						bne loop
   378 						
   379 						sta RES+1
   380 						rts
   381
   382 						.endp
   383
   384 				/*
   385 				  Mul16 - 16-bit multiplication routine
   386 				    
   387 				  Parameters:
   388 					  _TW1 First multiplicant (we use only two bytes now)
   389 					  _TW2 Second multiplicant
   390 				  Result: 
   391 						_TL1 Result
   392 				*/
   392
   393
   394 8162			_sys_mul16  .proc
   395
   396 = 0032			MUL1 = _TW1
   397 = 0034			MUL2 = _TW2
   398 = 0070			RES  = _TL1
   399 						
   400 						lda #0      ;RES = 0;
   401 						sta RES
   402 						sta RES+1
   403 						sta RES+2
   404 						sta RES+3
   405 						
   406 						ldx #16  
   407 8162			loop
   408 						lsr MUL1+1		;MUL1 = MUL1 / 2
   409 						ror MUL1
   410 						bcc noadd
   411 						
   412 						lda RES+2			;RES = RES + (MUL2 * $ffff)  (only upper half) 
   413 						clc		
   414 						adc MUL2
   415 						sta RES+2
   416 						lda RES+3
   417 						adc MUL2+1
   418 						sta RES+3
   419 8162			noadd
   420 						ror RES+3				;RES = RES / 2		(Carry is 0, when there was no add)
   421 						ror RES+2
   422 						ror RES+1
   423 						ror RES+0
   424 						 
   425 						dex
   426 						bne loop
   427 						
   428 						rts
   429
   430 						.endp
   431 				 
   432 				/*
   433 				  Div8 - 8-bit division routine
   434 				 
   435 				  Original source:
   436 				  Book Atari Roots (Chapter Ten - Assembly Language Math)
   437 				  Hyperlink: http://www.atariarchives.org/roots/chapter_10.php
   438 				 
   439 				  Parameters:
   440 				  _TEMPW1		16-bit dividend
   441 				  a					 p1_math:  8-bit divisor
   442 				  x          number of bits of an divisir (8 max)
   443 				 
   444 				  Result:
   445 				  x STORE1: 8-bit quotient
   446 				  a STORE2: 8-bit remainder
   447 				*/
   447
   448
   449 8162			_sys_div8  .proc
   450 				  ldx #08  ; For an 8-bit divisor
   451 					
   452 8162			_sys_div
   453
   454 = 0034			divisor  = _TW2
   455 = 0035			quotient = _TW2+1
   456
   457 				  sta divisor
   458 					lda #0     				; for non-8 divis
   459 					sta quotient
   460 				  lda _TW1+1
   461 				  sec 
   462 				  sbc divisor
   463 8162			dloop 
   464 				  php  					; The loop that divides 
   465 				  rol quotient
   466 				  asl _TW1
   467 				  rol @
   468 				  plp
   469 				  bcc addit
   470 				  sbc divisor
   471 				  jmp next
   472 8162			addit 
   473 				  adc divisor
   474 8162			next  
   475 				  dex
   476 				  bne dloop
   477 				  bcs fini
   478 				  adc divisor
   479 				  clc
   480 8162			fini
   481 					tax            ; x = remainder
   482 				  lda quotient   ; a = quotient
   483 				  rol
   484 				  rts
   485 				 
   486 				  .endp
   487
   488 				/*
   489
   490 				  Square Root
   491
   492 				  Calculates the 8 bit root and 9 bit remainder of a 16 bit unsigned integer in
   493 				  Numberl/Numberh. The result is always in the range 0 to 255 and is held in
   494 				  Root, the remainder is in the range 0 to 511 and is held in Reml/Remh
   495
   496 				  partial results are held in templ/temph
   497
   498 				  Destroys A, X registers.
   499
   500 					Arguments:
   501 					
   502 					_TEMPW1  16-bit number to compute root of
   503 					
   504 					<a        Square root
   505 					<_TEMPW2  Remainder of square
   506 					
   507 				*/
   507
   508
   509 8162			_sys_sqrt16 .proc
   510
   511 = 0032			Numberl		= _TW1		; number to find square root of low byte
   512 = 0033			Numberh		= _TW1+1	; number to find square root of high byte
   513 = 0034			Reml		  = _TW2		; remainder low byte
   514 = 0035			Remh		  = _TW2+1	; remainder high byte
   515 = 0070			templ		  = _TL1		; temp partial low byte
   516 = 0071			temph		  = _TL1+1	; temp partial high byte
   517 = 0072			Root		  = _TL1+2	; square root
   518
   519 					LDA	#$00		; clear A
   520 					STA	Reml		; clear remainder low byte
   521 					STA	Remh		; clear remainder high byte
   522 					STA	Root		; clear Root
   523 					LDX	#$08		; 8 pairs of bits to do
   524 8162			Loop
   525 					ASL	Root		; Root = Root * 2
   526
   527 					ASL	Numberl		; shift highest bit of number ..
   528 					ROL	Numberh		;
   529 					ROL	Reml		; .. into remainder
   530 					ROL	Remh		;
   531
   532 					ASL	Numberl		; shift highest bit of number ..
   533 					ROL	Numberh		;
   534 					ROL	Reml		; .. into remainder
   535 					ROL	Remh		;
   536
   537 					LDA	Root		; copy Root ..
   538 					STA	templ		; .. to templ
   539 					LDA	#$00		; clear byte
   540 					STA	temph		; clear temp high byte
   541
   542 					SEC			; +1
   543 					ROL	templ		; temp = temp * 2 + 1
   544 					ROL	temph		;
   545
   546 					LDA	Remh		; get remainder high byte
   547 					CMP	temph		; comapre with partial high byte
   548 					BCC	Next		; skip sub if remainder high byte smaller
   549
   550 					BNE	Subtr		; do sub if <> (must be remainder>partial !)
   551
   552 					LDA	Reml		; get remainder low byte
   553 					CMP	templ		; comapre with partial low byte
   554 					BCC	Next		; skip sub if remainder low byte smaller
   555
   556 								; else remainder>=partial so subtract then
   557 								; and add 1 to root. carry is always set here
   558 8162			Subtr
   559 					LDA	Reml		; get remainder low byte
   560 					SBC	templ		; subtract partial low byte
   561 					STA	Reml		; save remainder low byte
   562 					LDA	Remh		; get remainder high byte
   563 					SBC	temph		; subtract partial high byte
   564 					STA	Remh		; save remainder high byte
   565
   566 					INC	Root		; increment Root
   567 8162			Next
   568 					DEX			; decrement bit pair count
   569 					BNE	Loop		; loop if not all done
   570
   571 					lda Root
   572 					
   573 					RTS
   574 				.endp
   359 8162			   icl 'C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes_sprite.asm'
Source: C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes_sprite.asm
     1 				;********************************
     2 				;ATALAN nes sprite asm functions
     3 				;********************************
     4 				; created by Marcel Cevani 31.01.2011
     5 				; tnx to Atalan the snake & rudla :)
     6
     7 				;_TEMPB1 equ 54  array offset
     8 				;_TEMPB2 equ 55  array offset
     9
    10 				;  ATALAN code	 
    11 				;  PPU_DATA_ADR = $3F
    12 				;  PPU_DATA_ADR = $10
    13 				;  for i:0..15
    14 				;        PPU_DATA  = spritePal(i)
    15 							    
    16 8162			sprLoadPal .proc
    17 8162 85 00					sta _TEMPADR
    18 8164 86 01					stx _TEMPADR+1
    19 8166 A2 10					ldx #$10
    20 8168 A0 00					ldy #$00
    21 816A A9 3F					lda #$3F
    22 816C 8D 06 20		            sta $2006
    23 816F 8E 06 20					stx $2006
    24 8172 B1 00		cpyloop_sr: lda (_TEMPADR),y
    25 8174 8D 07 20					sta $2007
    26 8177 C8						iny
    27 8178 C0 10					cpy #$10
    28 817A D0 F6					bne cpyloop_sr 
    29 817C 60						rts
    30 							.endp
    31
    32
    33 				;3440
    34 817D			setMultiSprite .proc
    35 817D 85 00				    sta _TEMPADR     ; save spr array adr to zerro page
    36 817F 86 01					stx _TEMPADR+1   ; 
    37 						
    38 8181 A5 08					lda _SPR_NR
    39 8183 0A						asl
    40 8184 A8						tay
    41
    42 8185 B1 00					lda  (_TEMPADR),y  
    43 8187 85 06					sta _TEMPADRSPR
    44 8189 C8						iny
    45 							
    46 818A B1 00					lda  (_TEMPADR),y  
    47 818C 85 07					sta _TEMPADRSPR+1
    48 						
    49 818E A5 09					lda _SPR_ANIM_NR
    50 8190 0A						asl
    51 8191 A8						tay
    52
    53 8192 B1 06					lda  (_TEMPADRSPR),y  
    54 8194 85 00					sta _TEMPADR
    55 8196 C8						iny
    56 							
    57 8197 B1 06					lda  (_TEMPADRSPR),y  
    58 8199 85 01					sta _TEMPADR+1
    59 							
    60
    61 819B A0 00					ldy #$00		 ; set y pointer = 0
    62 						
    63 							; load xsize,ysize and attribute byte
    64 819D B1 00					lda  (_TEMPADR),y  
    65 819F AA						tax					; copy x size to X reg
    66 81A0 C8						iny
    67 81A1 B1 00					lda  (_TEMPADR),y  
    68 81A3 85 03					sta _SPR_YSIZE
    69 81A5 C8						iny
    70 81A6 B1 00					lda  (_TEMPADR),y  
    71 81A8 85 0A					sta _SPR_ATTR
    72 81AA C8						iny
    73 81AB B1 00					lda  (_TEMPADR),y  
    74 							; set pointer to drawCol
    75 81AD 85 06					sta _TEMPADRSPR
    76 81AF AD 6E B0					lda table+1
    77 81B2 85 07					sta _TEMPADRSPR+1
    78
    79 							; calc XPos table 
    80 81B4 A5 04					lda	_SPR_XPOS
    81 81B6 CA						dex
    82 81B7			precalc:
    83 81B7 95 0B					sta _SPR_PRECALC , x
    84 81B9 F0 07					beq precalc_end
    85 81BB 18						clc					  ; shift xpos + 8
    86 81BC 69 08					adc #$08
    87 81BE CA						dex
    88 81BF 4C B7 81					jmp precalc
    89 81C2			precalc_end:
    90 81C2 A0 03					ldy #$03
    91 81C4 A6 13					ldx _OAM_INDEX   ; load back oam index of last write
    92 81C6			copy_row:	
    93 81C6 20 DB 81					jsr jumpTable2
    94 81C9 C6 03					dec	_SPR_YSIZE	       ; ySize = ySize -1
    95 81CB F0 0A					beq copy_end
    96 81CD A5 05					lda	_SPR_YPOS
    97 81CF 18						clc	
    98 81D0 69 08					adc #$08
    99 81D2 85 05					sta _SPR_YPOS
   100 81D4 4C C6 81					jmp copy_row
   101 81D7			copy_end:			
   102 												  ; save x pointer to _OAM_INDEX
   103 81D7 8A						txa
   104 81D8 85 13					sta	_OAM_INDEX	
   105 81DA 60						rts
   106 							.endp
   107
   108
   109
   110 81DB			jumpTable2 .proc
   111 81DB 6C 06 00			jmp (_TEMPADRSPR)
   112 					.endp
   113
   114 81DE			resetUnusedSprites .proc
   115 81DE A6 13					ldx _OAM_INDEX
   116 81E0 A9 FF			fill:	lda #$FF 
   117 81E2 9D 00 03					sta $0300 , x		  ; y pos
   118 81E5 E8						inx 
   119 81E6 E8						inx 
   120 81E7 E8						inx 
   121 81E8 E8						inx
   122 81E9 E4 14					cpx _LAST_FRAME_OAM_INDEX
   123 81EB D0 F3					bne fill 
   124 81ED 60						rts
   125 							.endp
   126
   127 81EE 00 00 00 00 00 00 + .align $B000,$00
   128 B000			drawSpriteColum .proc
   129 B000			s_size_4:
   130 B000 C8					 iny				  ; copy a tile to ram
   131 B001 B1 00			     lda  (_TEMPADR),y    ; get byte out of sprite array
   132 B003 F0 16			     beq notCopy1
   133 											  ; copy data to OAM
   134 B005 9D 01 03				 sta $0301 , x		  ; store tile nr
   135 						
   136 B008 A5 05				 lda _SPR_YPOS			  
   137 B00A 9D 00 03			 	 sta $0300 , x		  ; y pos
   138 						
   139 B00D A5 0A				 lda _SPR_ATTR
   140 B00F 9D 02 03				 sta $0302 , x		  ; store attribute byte 
   141 						
   142 B012 A5 0E				 lda  _SPR_PRECALC+3; 
   143 B014 9D 03 03				 sta $0303 , x		  ; store x pos
   144 							
   145 B017 E8					 inx 
   146 B018 E8					 inx 
   147 B019 E8					 inx 
   148 B01A E8					 inx 
   149 B01B			notCopy1:
   150 B01B			s_size_3:
   151 B01B C8					 iny				  ; copy a tile to ram
   152 B01C B1 00			     lda  (_TEMPADR),y    ; get byte out of sprite array
   153 B01E F0 16			     beq notCopy2
   154 											  ; copy data to OAM
   155 B020 9D 01 03				 sta $0301 , x		  ; store tile nr
   156 						
   157 B023 A5 05				 lda _SPR_YPOS			  
   158 B025 9D 00 03			 	 sta $0300 , x		  ; y pos
   159 						
   160 B028 A5 0A				 lda _SPR_ATTR
   161 B02A 9D 02 03				 sta $0302 , x		  ; store attribute byte 
   162 						
   163 B02D A5 0D				 lda  _SPR_PRECALC+2; 
   164 B02F 9D 03 03				 sta $0303 , x		  ; store x pos
   165 							
   166 B032 E8					 inx 
   167 B033 E8					 inx 
   168 B034 E8					 inx 
   169 B035 E8					 inx 
   170 B036			notCopy2:
   171 B036			s_size_2:
   172 B036 C8					 iny				  ; copy a tile to ram
   173 B037 B1 00			     lda  (_TEMPADR),y    ; get byte out of sprite array
   174 B039 F0 16			     beq notCopy3
   175 											  ; copy data to OAM
   176 B03B 9D 01 03				 sta $0301 , x		  ; store tile nr
   177 						
   178 B03E A5 05				 lda _SPR_YPOS			  
   179 B040 9D 00 03			 	 sta $0300 , x		  ; y pos
   180 						
   181 B043 A5 0A				 lda _SPR_ATTR
   182 B045 9D 02 03				 sta $0302 , x		  ; store attribute byte 
   183 						
   184 B048 A5 0C				 lda  _SPR_PRECALC+1; 
   185 B04A 9D 03 03				 sta $0303 , x		  ; store x pos
   186 							
   187 B04D E8					 inx 
   188 B04E E8					 inx 
   189 B04F E8					 inx 
   190 B050 E8					 inx 
   191 B051			notCopy3:
   192 B051			s_size_1:
   193 B051 C8					 iny				  ; copy a tile to ram
   194 B052 B1 00			     lda  (_TEMPADR),y    ; get byte out of sprite array
   195 B054 F0 16			     beq notCopy4
   196 											  ; copy data to OAM
   197 B056 9D 01 03				 sta $0301 , x		  ; store tile nr
   198 						
   199 B059 A5 05				 lda _SPR_YPOS			  
   200 B05B 9D 00 03			 	 sta $0300 , x		  ; y pos
   201 						
   202 B05E A5 0A				 lda _SPR_ATTR
   203 B060 9D 02 03				 sta $0302 , x		  ; store attribute byte 
   204 						
   205 B063 A5 0B				 lda  _SPR_PRECALC; 
   206 B065 9D 03 03				 sta $0303 , x		  ; store x pos
   207 							
   208 B068 E8					 inx 
   209 B069 E8					 inx 
   210 B06A E8					 inx 
   211 B06B E8					 inx 
   212 B06C			notCopy4:
   213 B06C 60					rts
   214 				.endp
   215
   216
   217 B06D			table:
   218 B06D 00 B0		 .word drawSpriteColum
   360 B06F			   icl 'C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes_mmc1.asm'
Source: C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes_mmc1.asm
     1 				;  code addapted from http://wiki.nesdev.com/w/index.php/Programming_MMC1
     2
     3 B06F			setMMC1Ctrl .proc
     4 							; reset shift reg
     5 B06F A2 80					LDX #$80
     6 B071 8E 00 80					STX $8000
     7 							; now write 
     8 B074 8D 00 80					STA $8000
     9 B077 4A						LSR
    10 B078 8D 00 80					STA $8000
    11 B07B 4A						LSR
    12 B07C 8D 00 80					STA $8000
    13 B07F 4A						LSR
    14 B080 8D 00 80					STA $8000
    15 B083 4A						LSR
    16 B084 8D 00 80					STA $8000
    17 B087 60						rts
    18 							.endp
    19
    20
    21 B088			setMMC1Prog .proc
    22 B088 8D 00 E0					STA $E000
    23 B08B 4A						LSR
    24 B08C 8D 00 E0					STA $E000
    25 B08F 4A						LSR
    26 B090 8D 00 E0					STA $E000
    27 B093 4A						LSR
    28 B094 8D 00 E0					STA $E000
    29 B097 4A						LSR
    30 B098 8D 00 E0					STA $E000
    31 B09B 60						rts
    32 							.endp
    33
    34
    35 B09C			setMMC1Chr0 .proc 
    36 B09C 8D 00 A0					STA $A000
    37 B09F 4A						LSR
    38 B0A0 8D 00 A0					STA $A000
    39 B0A3 4A						LSR
    40 B0A4 8D 00 A0					STA $A000
    41 B0A7 4A						LSR
    42 B0A8 8D 00 A0					STA $A000
    43 B0AB 4A						LSR
    44 B0AC 8D 00 A0					STA $A000
    45 B0AF 60						rts
    46 							.endp
    47
    48 B0B0			setMMC1Chr1 .proc 
    49 B0B0 8D 00 C0					STA $C000
    50 B0B3 4A						LSR
    51 B0B4 8D 00 C0					STA $C000
    52 B0B7 4A						LSR
    53 B0B8 8D 00 C0					STA $C000
    54 B0BB 4A						LSR
    55 B0BC 8D 00 C0					STA $C000
    56 B0BF 4A						LSR
    57 B0C0 8D 00 C0					STA $C000
    58 B0C3 60						rts
    59 							.endp
   361 B0C4			   icl 'C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes_bg.asm'
Source: C:\Users\Anwender\Desktop\My Dropbox\studium\nes\freezed version\beta 2\scratchalan\atalan\platform\nes\nes_bg.asm
     1 				;********************************
     2 				;ATALAN nes background asm functions
     3 				;********************************
     4 				; created by Marcel Cevani 31.01.2011
     5 				; tnx to Atalan the snake & rudla :)
     6
     7 				;_TEMPB1 equ 54  array offset
     8 				;_TEMPB2 equ 55  array offset
     9
    10 				; ATALAN code
    11 				; PPU_DATA_ADR = $20
    12 				; PPU_DATA_ADR = $00
    13 				; for x:0..1023
    14 				;       PPU_DATA = titleNametable(x)
    15
    16 B0C4			bgLoadNameTable .proc
    17 							sta _TEMPADR
    18 							stx _TEMPADR+1
    19 							;tsc 
    20 							ldy #$00
    21 							;ldy #$20
    22 							ldx #04
    23 							lda #$20 
    24 B0C4			copyArray: 
    25 							sta $2006
    26 							sty $2006
    27 B0C4			cpyloop_n: 
    28 							lda (_TEMPADR),y
    29 							sta $2007
    30 							iny
    31 							bne cpyloop_n
    32 							inc _TEMPADR+1
    33 							dex
    34 							bne cpyloop_n 
    35 							rts
    36 							.endp
    37
    38 				;  ATALAN code	 
    39 				;  PPU_DATA_ADR = $3F
    40 				;  PPU_DATA_ADR = $00
    41 				;  for i:0..15
    42 				;        PPU_DATA  = bgPal(i)
    43 							    
    44 B0C4			bgLoadPal .proc
    45 B0C4 85 00					sta _TEMPADR
    46 B0C6 86 01					stx _TEMPADR+1
    47 B0C8 A0 00					ldy #$00
    48 B0CA A9 3F					lda #$3F
    49 B0CC			copyArray: 
    50 B0CC 8D 06 20					sta $2006
    51 B0CF 8C 06 20					sty $2006
    52 B0D2			cpyloop_p: 
    53 B0D2 B1 00					lda (_TEMPADR),y
    54 B0D4 8D 07 20					sta $2007
    55 B0D7 C8						iny
    56 B0D8 C0 10					cpy #$10
    57 B0DA D0 F6					bne cpyloop_p 
    58 B0DC 60						rts
    59 							.endp
   362 B0DD 00 00 00 00 00 00 +     .align $FFF9,$00
   363 FFF9			NMI:
   364 FFF9 40			    rti
   365 FFFA			   org $FFFA
   366 FFFA 00 80		   .dw RESET
   367 FFFC 00 80		  .dw RESET
   368 FFFE 00 00		   .dw 0
