Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :BasicUpstart2(main)
- //./var brkFile = createFile("breakpoints.txt")
- //.macro break() {
- // .eval brkFile.writeln("break " + toHexString(*))
- //}
- main:
- lda #CYAN
- sta $d027
- jsr opoznienie
- ruszaj:
- lda #$00
- sta $d010
- lda #$01 // bit 0 zapalony
- sta $d015 // sprite 0 wyświetlony
- ldx #$00 // ustawienie licznika pętli dla sinusa oraz liniowego przemieszczania sprite
- ruszaj2:
- lda #$01 // bit 0 zapalony
- sta $d015 // sprite 0 wyświetlony
- lda sinus(x*10)//,x // załaduj kolejną wartość z sinusa
- sta $d001 // kooordynaty z sinusa
- sta $0400
- stx $d000 // kooordynaty x+1
- txa // zapamiętanie x
- pha // na stos przed wykonaniem pętli opóźniającej
- jsr opoznienie
- pla // przywrócenie x ze stosu
- tax //
- inx // zwiększenie x
- cpx #$00
- beq dodatkowy_bit_dla_sprite
- jmp ruszaj2
- dodatkowy_bit_dla_sprite:
- lda #$01
- sta $d010
- ruszaj3:
- lda #$01 // bit 0 zapalony
- sta $d015 // sprite 0 wyświetlony
- lda sinus2,x // załaduj kolejną wartość z sinusa
- sta $d001 // kooordynaty z sinusa
- stx $d000 // kooordynaty x+1
- txa // zapamiętanie x
- pha // na stos przed wykonaniem pętli opóźniającej
- jsr opoznienie
- pla // przywrócenie x ze stosu
- tax //
- inx // zwiększenie x
- cpx #$ff
- beq ruszaj
- // :break()
- jmp ruszaj3
- opoznienie:
- ldx #$00
- petla1:
- ldy #$00
- petla2:
- iny
- cpy #$60
- bne petla2
- inx
- cpx #$20
- bne petla1
- rts
- .pc = 64*255 "Default Sprite Bitmap"
- //----------------------------------------------------------
- //.import binary "sprajt1.spr"
- .byte %01111111, %11111111, %11111110
- .byte %11111111, %11111111, %11111111
- .byte %11111111, %11111111, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %00000000, %11111111
- .byte %11111111, %11111111, %11111111
- .byte %11111111, %11111111, %11111111
- .byte %01111111, %11111111, %11111110
- .pc = $c000
- //sinus:
- //.fill 512,<round(0+16256*sin(toRadians(i*360/256+360/512)))
- //.fill 512,>round(0+16256*sin(toRadians(i*360/256+360/512)))
- // sinus:
- .byte $78,$76,$75,$73,$72,$70,$6F,$6D,$6C,$6A,$69,$68,$66,$65,$64,$62
- .byte $61,$60,$5F,$5E,$5D,$5C,$5A,$59,$59,$58,$57,$56,$55,$54,$54,$53
- .byte $53,$52,$51,$51,$51,$50,$50,$50,$50,$50,$50,$50,$50,$50,$50,$50
- .byte $50,$51,$51,$51,$52,$52,$53,$54,$54,$55,$56,$57,$57,$58,$59,$5A
- .byte $5B,$5C,$5E,$5F,$60,$61,$62,$64,$65,$66,$67,$69,$6A,$6C,$6D,$6E
- .byte $70,$71,$73,$74,$76,$77,$79,$7A,$7C,$7D,$7F,$80,$81,$83,$84,$86
- .byte $87,$88,$8A,$8B,$8C,$8E,$8F,$90,$91,$92,$93,$94,$95,$96,$97,$98
- .byte $99,$9A,$9A,$9B,$9C,$9C,$9D,$9D,$9E,$9E,$9F,$9F,$9F,$9F,$9F,$9F
- .byte $9F,$9F,$9F,$9F,$9F,$9F,$9E,$9E,$9E,$9D,$9D,$9C,$9B,$9B,$9A,$99
- .byte $99,$98,$97,$96,$95,$94,$93,$92,$91,$8F,$8E,$8D,$8C,$8A,$89,$88
- .byte $86,$85,$84,$82,$81,$7F,$7E,$7C,$7B,$79,$78,$77,$75,$74,$72,$71
- .byte $6F,$6E,$6C,$6B,$6A,$68,$67,$65,$64,$63,$62,$60,$5F,$5E,$5D,$5C
- .byte $5B,$5A,$59,$58,$57,$56,$55,$55,$54,$53,$53,$52,$52,$51,$51,$50
- .byte $50,$50,$50,$50,$50,$50,$50,$50,$50,$50,$50,$51,$51,$51,$52,$52
- .byte $53,$53,$54,$55,$56,$56,$57,$58,$59,$5A,$5B,$5C,$5D,$5E,$5F,$61
- .byte $62,$63,$64,$66,$67,$68,$6A,$6B,$6D,$6E,$6F,$71,$72,$74,$75,$77
- sinus2:
- .byte $78,$7A,$7B,$7D,$7E,$80,$81,$82,$84,$85,$87,$88,$89,$8B,$8C,$8D
- .byte $8E,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$99,$9A,$9B,$9C,$9C
- .byte $9D,$9D,$9E,$9E,$9E,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F
- .byte $9F,$9E,$9E,$9D,$9D,$9C,$9C,$9B,$9A,$9A,$99,$98,$97,$96,$95,$94
- .byte $93,$92,$91,$90,$8F,$8D,$8C,$8B,$8A,$88,$87,$85,$84,$83,$81,$80
- .byte $7E,$7D,$7B,$7A,$78,$77,$76,$74,$73,$71,$70,$6E,$6D,$6B,$6A,$69
- //.byte $67,$66,$65,$63,$62,$61,$60,$5E,$5D,$5C,$5B,$5A,$59,$58,$57,$56
- //.byte $56,$55,$54,$54,$53,$52,$52,$51,$51,$51,$50,$50,$50,$50,$50,$50
- //.byte $50,$50,$50,$50,$50,$50,$51,$51,$52,$52,$53,$53,$54,$55,$55,$56
- //.byte $57,$58,$59,$5A,$5B,$5C,$5D,$5E,$5F,$60,$61,$63,$64,$65,$67,$68
- //.byte $69,$6B,$6C,$6E,$6F,$70,$72,$73,$75,$76,$78,$79,$7B,$7C,$7E,$7F
- //.byte $81,$82,$83,$85,$86,$88,$89,$8A,$8B,$8D,$8E,$8F,$90,$91,$93,$94
- //.byte $95,$96,$97,$98,$98,$99,$9A,$9B,$9B,$9C,$9D,$9D,$9E,$9E,$9E,$9F
- //.byte $9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F,$9E,$9E,$9E,$9D,$9C
- // .byte $9C,$9B,$9B,$9A,$99,$98,$97,$96,$96,$95,$93,$92,$91,$90,$8F,$8E
- //.byte $8D,$8B,$8A,$89,$87,$86,$85,$83,$82,$80,$7F,$7D,$7C,$7A,$79,$78
- .function sinus(kat) {
- .var y = kat
- .var s = -1
- .for (var i=3; i<=100; i+=2)
- {
- .eval y = y + s * ( pow(kat,i) / silnia(i) )
- .eval s = s * s - 1
- }
- .return y
- }
- .function silnia(liczba)
- {
- .if (liczba == 0)
- {
- .return 1
- }
- .return (liczba * silnia(liczba - 1))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement