Advertisement
yugorin

Sinus pełny ponad 255

Jun 11th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :BasicUpstart2(main)
  2.  
  3. .var brkFile = createFile("breakpoints.txt")
  4.  
  5. .macro break() {
  6.   .eval brkFile.writeln("break " + toHexString(*))
  7. }
  8.  
  9. main:
  10.  
  11.     lda CYAN
  12.     sta $d027
  13.     jsr opoznienie
  14.  
  15.    
  16. ruszaj:
  17.     lda #$00
  18.     sta $d010
  19.  
  20.     lda #$01            // bit 0 zapalony
  21.     sta $d015           // sprite 0 wyświetlony
  22.     ldx #$00            // ustawienie licznika pętli dla sinusa oraz liniowego przemieszczania sprite
  23.  
  24. ruszaj2:
  25.     lda #$01            // bit 0 zapalony
  26.     sta $d015           // sprite 0 wyświetlony
  27.  
  28.     lda sinus,x     // załaduj kolejną wartość z sinusa
  29.     sta $d001           // kooordynaty z sinusa
  30.     stx $d000           // kooordynaty x+1
  31.     txa                 // zapamiętanie x
  32.     pha                 // na stos przed wykonaniem pętli opóźniającej
  33.     jsr opoznienie 
  34.     pla                 // przywrócenie x ze stosu
  35.     tax                 //
  36.     inx                 // zwiększenie x
  37.     cpx #$00
  38.     beq dodatkowy_bit_dla_sprite
  39.     jmp ruszaj2
  40.  
  41. dodatkowy_bit_dla_sprite:
  42.     lda #$01
  43.     sta $d010
  44.  
  45. ruszaj3:
  46.     lda #$01            // bit 0 zapalony
  47.     sta $d015           // sprite 0 wyświetlony
  48.  
  49.     lda sinus2,x        // załaduj kolejną wartość z sinusa
  50.     sta $d001           // kooordynaty z sinusa
  51.     stx $d000           // kooordynaty x+1
  52.     txa                 // zapamiętanie x
  53.     pha                 // na stos przed wykonaniem pętli opóźniającej
  54.     jsr opoznienie 
  55.     pla                 // przywrócenie x ze stosu
  56.     tax                 //
  57.     inx                 // zwiększenie x
  58.     cpx #$ff
  59.     beq ruszaj
  60.     jmp ruszaj3
  61.  
  62.    
  63. opoznienie:
  64.             ldx #$00   
  65.  
  66. petla1:
  67.             ldy #$00
  68.  
  69. petla2:
  70.             iny
  71.             cpy #$60
  72.             bne petla2
  73.             inx
  74.             cpx #$20
  75.             bne petla1
  76.             rts
  77.    
  78.    
  79. .pc = 64*255 "Default Sprite Bitmap"
  80.  
  81. .byte %01111111, %11111111, %11111110
  82. .byte %11111111, %11111111 , %11111111
  83. .byte %11111111, %11111111, %11111111
  84. .byte %11111111, %00000000, %11111111
  85. .byte %11111111, %00000000, %11111111
  86. .byte %11111111, %00000000, %11111111
  87. .byte %11111111, %00000000, %11111111
  88. .byte %11111111, %00000000, %11111111
  89. .byte %11111111, %00000000, %11111111
  90. .byte %11111111, %00000000, %11111111
  91. .byte %11111111, %00000000, %11111111
  92. .byte %11111111, %00000000, %11111111
  93. .byte %11111111, %00000000, %11111111
  94. .byte %11111111, %00000000, %11111111
  95. .byte %11111111, %00000000, %11111111
  96. .byte %11111111, %00000000, %11111111
  97. .byte %11111111, %00000000, %11111111
  98. .byte %11111111, %00000000, %11111111
  99. .byte %11111111, %11111111, %11111111
  100. .byte %11111111, %11111111, %11111111
  101. .byte %01111111, %11111111, %11111110
  102.  
  103.  
  104.  
  105. .pc = $c000
  106. //sinus:
  107.  
  108. //.fill 512,<round(0+16256*sin(toRadians(i*360/256+360/512)))
  109.  
  110. //.fill 512,>round(0+16256*sin(toRadians(i*360/256+360/512)))
  111.  
  112.  
  113.  
  114. sinus:
  115.  
  116. .byte $78,$76,$75,$73,$72,$70,$6F,$6D,$6C,$6A,$69,$68,$66,$65,$64,$62
  117. .byte $61,$60,$5F,$5E,$5D,$5C,$5A,$59,$59,$58,$57,$56,$55,$54,$54,$53
  118. .byte $53,$52,$51,$51,$51,$50,$50,$50,$50,$50,$50,$50,$50,$50,$50,$50
  119. .byte $50,$51,$51,$51,$52,$52,$53,$54,$54,$55,$56,$57,$57,$58,$59,$5A
  120. .byte $5B,$5C,$5E,$5F,$60,$61,$62,$64,$65,$66,$67,$69,$6A,$6C,$6D,$6E
  121. .byte $70,$71,$73,$74,$76,$77,$79,$7A,$7C,$7D,$7F,$80,$81,$83,$84,$86
  122. .byte $87,$88,$8A,$8B,$8C,$8E,$8F,$90,$91,$92,$93,$94,$95,$96,$97,$98
  123. .byte $99,$9A,$9A,$9B,$9C,$9C,$9D,$9D,$9E,$9E,$9F,$9F,$9F,$9F,$9F,$9F
  124. .byte $9F,$9F,$9F,$9F,$9F,$9F,$9E,$9E,$9E,$9D,$9D,$9C,$9B,$9B,$9A,$99
  125. .byte $99,$98,$97,$96,$95,$94,$93,$92,$91,$8F,$8E,$8D,$8C,$8A,$89,$88
  126. .byte $86,$85,$84,$82,$81,$7F,$7E,$7C,$7B,$79,$78,$77,$75,$74,$72,$71
  127. .byte $6F,$6E,$6C,$6B,$6A,$68,$67,$65,$64,$63,$62,$60,$5F,$5E,$5D,$5C
  128. .byte $5B,$5A,$59,$58,$57,$56,$55,$55,$54,$53,$53,$52,$52,$51,$51,$50
  129. .byte $50,$50,$50,$50,$50,$50,$50,$50,$50,$50,$50,$51,$51,$51,$52,$52
  130. .byte $53,$53,$54,$55,$56,$56,$57,$58,$59,$5A,$5B,$5C,$5D,$5E,$5F,$61
  131. .byte $62,$63,$64,$66,$67,$68,$6A,$6B,$6D,$6E,$6F,$71,$72,$74,$75,$77
  132.  
  133.  
  134. sinus2:
  135. .byte $78,$7A,$7B,$7D,$7E,$80,$81,$82,$84,$85,$87,$88,$89,$8B,$8C,$8D
  136. .byte $8E,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$99,$9A,$9B,$9C,$9C
  137. .byte $9D,$9D,$9E,$9E,$9E,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F
  138. .byte $9F,$9E,$9E,$9D,$9D,$9C,$9C,$9B,$9A,$9A,$99,$98,$97,$96,$95,$94
  139. .byte $93,$92,$91,$90,$8F,$8D,$8C,$8B,$8A,$88,$87,$85,$84,$83,$81,$80
  140. .byte $7E,$7D,$7B,$7A,$78,$77,$76,$74,$73,$71,$70,$6E,$6D,$6B,$6A,$69
  141. //.byte $67,$66,$65,$63,$62,$61,$60,$5E,$5D,$5C,$5B,$5A,$59,$58,$57,$56
  142. //.byte $56,$55,$54,$54,$53,$52,$52,$51,$51,$51,$50,$50,$50,$50,$50,$50
  143. //.byte $50,$50,$50,$50,$50,$50,$51,$51,$52,$52,$53,$53,$54,$55,$55,$56
  144. //.byte $57,$58,$59,$5A,$5B,$5C,$5D,$5E,$5F,$60,$61,$63,$64,$65,$67,$68
  145. //.byte $69,$6B,$6C,$6E,$6F,$70,$72,$73,$75,$76,$78,$79,$7B,$7C,$7E,$7F
  146. //.byte $81,$82,$83,$85,$86,$88,$89,$8A,$8B,$8D,$8E,$8F,$90,$91,$93,$94
  147. //.byte $95,$96,$97,$98,$98,$99,$9A,$9B,$9B,$9C,$9D,$9D,$9E,$9E,$9E,$9F
  148. //.byte $9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9E,$9E,$9E,$9D,$9C
  149. // .byte $9C,$9B,$9B,$9A,$99,$98,$97,$96,$96,$95,$93,$92,$91,$90,$8F,$8E
  150. //.byte $8D,$8B,$8A,$89,$87,$86,$85,$83,$82,$80,$7F,$7D,$7C,$7A,$79,$78
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement