Advertisement
yugorin

stabilne rastry, muzyka. jeden font

Nov 16th, 2016
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :BasicUpstart2(main)
  2.  
  3. .label PamiecEkranu = $4400
  4. .label Ramka = $d020
  5. .label Ekran = $d021
  6.  
  7. .label memory_setup_register_D018 = $d018
  8. .label VIC_bank = $dd00
  9. //----------------------------------------------------------
  10. // Code for creating the breakpoint file sent to Vice.
  11. //----------------------------------------------------------
  12. .var _useBinFolderForBreakpoints = cmdLineVars.get("usebin") == "true"
  13. .var _createDebugFiles = cmdLineVars.get("afo") == "true"
  14. .print "File creation " + [_createDebugFiles
  15.     ? "enabled (creating breakpoint file)"
  16.     : "disabled (no breakpoint file created)"]
  17. .var brkFile
  18. .if(_createDebugFiles) {
  19.     .if(_useBinFolderForBreakpoints)
  20.         .eval brkFile = createFile("bin/breakpoints.txt")
  21.     else
  22.         .eval brkFile = createFile("breakpoints.txt")
  23. }
  24. .macro break() {
  25. .if(_createDebugFiles) {
  26.     .eval brkFile.writeln("break " + toHexString(*))
  27.     }
  28. }
  29. //------------------------------------------------------
  30.  
  31. .macro trybTekstowy () {
  32. lda #$1b
  33. sta $d011
  34. lda #$c8
  35. sta $d016
  36.        
  37. }
  38.  
  39. .macro trybGraficzny()
  40. {
  41.     lda #$3b
  42.      sta $d011        
  43.  
  44.  
  45.   lda #$08
  46.   sta $d016
  47. }
  48.  
  49. .macro wybierz_index_charmem_pamieci_D018(index) {
  50.   lda memory_setup_register_D018
  51.   and #%11110001 // ustawia tylko bity oznaczone 0
  52.   ora #[index << 1]  // wybiera numer strony pamięci według mapy C64 z netu
  53.   sta memory_setup_register_D018 // zapisuje do $D018
  54. }
  55.  
  56. .macro wybierz_index_screen_memory_pamieci_D018(index) {
  57.   lda memory_setup_register_D018
  58.   and #%00001111 // ustawia tylko bity oznaczone 0
  59.   ora #[index << 4]  // wybiera numer strony pamięci według mapy C64 z netu
  60.   sta memory_setup_register_D018 // zapisuje do $D018
  61. }
  62.  
  63.  
  64. .macro wybierz_index_banku_pamieci_VIC_DD00(index) {
  65.     lda VIC_bank  
  66.     and #%11111100 // zeruje bit #0 i #1
  67.     ora #[index ^ %00000011] // XOR na wartości z index
  68.     sta VIC_bank
  69. }
  70.  
  71. .macro ClearScreen(PamiecEkranu, clearByte) {
  72.   lda #clearByte
  73.   ldx #0
  74. !loop:
  75.   sta PamiecEkranu, x
  76.   sta PamiecEkranu + $100, x
  77.   sta PamiecEkranu + $200, x
  78.   sta PamiecEkranu + $300, x
  79.   inx
  80.   bne !loop-
  81. }
  82.  
  83. .macro ClearScreen_DOL(PamiecEkranu, clearByte) {
  84.   lda #clearByte
  85.   ldx #0
  86. !loop:
  87.   sta PamiecEkranu+633, x
  88.   sta PamiecEkranu+633+100, x
  89.  
  90.   inx
  91.   bne !loop-
  92. }
  93.  
  94. .pseudocommand pause cycles {
  95.   :ensureImmediateArgument(cycles)
  96.   .var x = floor(cycles.getValue())
  97.   .if (x<2) .error "Cant make a pause on " + x + " cycles"
  98.  
  99.   // Take care of odd cyclecount  
  100.   .if ([x&1]==1) {
  101.     bit $00
  102.     .eval x=x-3
  103.   }
  104.  
  105.   // Take care of the rest
  106.   .if (x>0)
  107.     :nop #x/2
  108. }
  109.  
  110.  
  111. //---------------------------------
  112. // repetition commands
  113. //---------------------------------
  114. .macro ensureImmediateArgument(arg) {
  115.   .if (arg.getType()!=AT_IMMEDIATE) .error "The argument must be immediate!"
  116. }
  117. .pseudocommand asl x {
  118.   :ensureImmediateArgument(x)
  119.   .for (var i=0; i<x.getValue(); i++) asl
  120. }
  121. .pseudocommand lsr x {
  122.   :ensureImmediateArgument(x)
  123.   .for (var i=0; i<x.getValue(); i++) lsr
  124. }
  125. .pseudocommand rol x {
  126.   :ensureImmediateArgument(x)
  127.   .for (var i=0; i<x.getValue(); i++) rol
  128. }
  129. .pseudocommand ror x {
  130.   :ensureImmediateArgument(x)
  131.   .for (var i=0; i<x.getValue(); i++) ror
  132. }
  133.  
  134. .pseudocommand pla x {
  135.   :ensureImmediateArgument(x)
  136.   .for (var i=0; i<x.getValue(); i++) pla
  137. }
  138.  
  139. .pseudocommand nop x {
  140.   :ensureImmediateArgument(x)
  141.   .for (var i=0; i<x.getValue(); i++) nop
  142. }
  143.  
  144. main:
  145.  
  146.           sei         //wyłączenie flafi przerwania
  147.  
  148.            
  149.             ldy #$7f    ////; $7f = %01111111
  150.             sty $dc0d   ////; wyłączamy timer CIA
  151.             sty $dd0d   ////; ; wyłączamy timer CIA
  152.             lda $dc0d   ////; kasuje wszystki przerwania CIA w kolejce
  153.             lda $dd0d   ////; kasuje wszystki przerwania CIA w kolejce
  154.          
  155.             lda #$01    ////; Set Interrupt Request Mask...
  156.             sta $d01a   ////; ...we want IRQ by Rasterbeam
  157.  
  158.             lda #<irq1   ////; wskaźnik to IRQ
  159.             ldx #>irq1
  160.             sta $314    ////; zapisz tutaj
  161.             stx $315  
  162.  
  163.             lda #$00    ////; ustawiam pierwsze przerwanie na raster 0
  164.             sta $d012
  165.             lda $d011   ////; ustawiam 9 bit z $d011 na 0            
  166.             and #$7f    ////;
  167.             sta $d011   ////;
  168.           lda #$00
  169.           jsr $1000
  170.  
  171.  
  172. //            :trybGraficzny()
  173.  //       :wybierz_index_charmem_pamieci_D018(0)
  174.   //      :wybierz_index_screen_memory_pamieci_D018(15)
  175.         :wybierz_index_banku_pamieci_VIC_DD00(1)                                        
  176.  
  177.            // jsr obrazek
  178.     :ClearScreen(PamiecEkranu,$20)
  179.             cli         ////; clear interrupt disable flag
  180.          
  181.  
  182.             jsr wyswietl_text_1
  183.             jsr wyswietl_text_2
  184.  
  185.             :ClearScreen_DOL(PamiecEkranu,$20)
  186.  
  187.             jsr wyswietl_text_3
  188.  
  189.             :ClearScreen_DOL(PamiecEkranu,$20)
  190.  
  191.             jsr wyswietl_text_4
  192.             jmp *       ////; infinite loop
  193.  
  194.  
  195. ////;============================================================
  196. ////;    custom interrupt routine
  197. ////;============================================================
  198.  
  199.                
  200. irq1:  
  201.         inc $d019
  202. //        inc Ramka
  203.         lda #$37
  204.         sta $d012
  205.  
  206.         :pause #11
  207. //  :trybTekstowy()
  208.  
  209.   //      :wybierz_index_charmem_pamieci_D018(2)      
  210.         // kod poniej wykonuje się pomiędzy rastrem 34 a 80
  211.         // przerwanie jest od rastra 54 do 63
  212. ///////////////////////////////////////////////////////////////////////        
  213.  
  214.                       ldy #$00
  215. !cykl:
  216.                       ldx cykle2,y
  217. !petla:
  218.                       dex
  219.                       bne !petla-
  220.  
  221.                       lda brazowe,y
  222.                       sta Ekran
  223.                       sta Ramka
  224.                       iny
  225.                       cpy #$08
  226.                       bne !cykl-    
  227.  
  228.                       lda #$06
  229.                       sta Ekran
  230. ///////////////////////////////////////////////////////////////////////        
  231.  
  232.  
  233.  
  234.  
  235.  
  236.         lda #<irq2
  237.         sta $0314
  238.         lda #>irq2
  239.         sta $0315
  240.         pla
  241.         tay
  242.         pla
  243.         tax
  244.         pla
  245.   //      dec Ramka
  246.  
  247.         rti
  248.  
  249.  
  250.  
  251.  
  252.  
  253. irq2:  
  254.         inc $d019
  255.         //inc Ramka
  256.  
  257.         lda #$7a // pozycja środkowego rastra
  258.         sta $d012
  259.         :wybierz_index_charmem_pamieci_D018(1)
  260.   //      :wybierz_index_charmem_pamieci_D018(2)      
  261.         // kod poniej wykonuje się pomiędzy rastrem 34 a 80
  262.         // przerwanie jest od rastra 54 do 63
  263. ///////////////////////////////////////////////////////////////////////        
  264.  
  265. jsr colwash
  266. jsr $1003          
  267.  
  268. ///////////////////////////////////////////////////////////////////////        
  269.  
  270.  
  271.  
  272.  
  273.  
  274.         lda #<irq3
  275.         sta $0314
  276.         lda #>irq3
  277.         sta $0315
  278.         pla
  279.         tay
  280.         pla
  281.         tax
  282.         pla
  283.         //dec Ramka
  284.  
  285.         rti
  286.  
  287.  
  288.  
  289. irq3:  
  290.  
  291.         inc $d019
  292.  
  293.         lda #$aa // pozycja ostatniego rastra
  294.         sta $d012
  295. :pause#10
  296.  
  297.   //      :wybierz_index_charmem_pamieci_D018(2)      
  298.         // kod poniej wykonuje się pomiędzy rastrem 34 a 80
  299.         // przerwanie jest od rastra 54 do 63
  300. ///////////////////////////////////////////////////////////////////////        
  301.              ldy #$00
  302.              :break()
  303.              :pause#7
  304. !cykl:
  305.                       ldx cykle,y
  306. !petla:
  307.                       dex
  308.                       bne !petla-
  309.  
  310.                       lda niebieskie,y
  311.                       sta Ekran
  312.                       sta Ramka
  313.                       iny
  314.                       cpy #$0f
  315.                       bne !cykl-    
  316.  
  317.  
  318. ///////////////////////////////////////////////////////////////////////        
  319.  
  320.  
  321.         lda #<irq1
  322.         sta $0314
  323.         lda #>irq1
  324.         sta $0315
  325.         pla
  326.         tay
  327.         pla
  328.         tax
  329.         pla
  330.         rti
  331.  
  332.  
  333.  
  334.  
  335. ///////////////////////////////////////////////////////////////// wyświetyla tekst na górnym przerwaniu
  336. wyswietl_text_1:
  337.     ldx #$00
  338.  
  339. !petla:
  340.     lda teksty,x
  341.     sta PamiecEkranu,x
  342.     jsr opoznienie
  343.     cpx #119
  344.     beq powrot
  345.     inx
  346.     bne !petla-
  347.  
  348. powrot:  
  349.     rts
  350. ///////////////////////////////////////////////////////////////// wyświetyla tekst na górnym przerwaniu
  351.  
  352.  
  353.  
  354.  
  355. ///////////////////////////////////////////////////////////////// wyświetyla tekst na dolnym przerwaniu
  356. wyswietl_text_2:
  357.     ldx #$00
  358. !petla:
  359.     lda tekst_2,x
  360.     sta PamiecEkranu+640,x
  361.     jsr opoznienie
  362.     cpx #200
  363.     beq !powrot+
  364.     inx
  365.     bne !petla-
  366. !powrot:
  367.     rts
  368. ///////////////////////////////////////////////////////////////// wyświetyla tekst na dolnym przerwaniu
  369.  
  370.  
  371.  
  372. ///////////////////////////////////////////////////////////////// wyświetyla tekst na dolnym przerwaniu - zmiana ekranu
  373. wyswietl_text_3:
  374.     ldx #$00
  375. !petla:
  376.     lda tekst_8,x
  377.     sta PamiecEkranu+845,x
  378.     jsr opoznienie
  379.     cpx #31
  380.     beq !powrot+
  381.     inx
  382.     bne !petla-
  383. !powrot:
  384.     rts
  385. ///////////////////////////////////////////////////////////////// wyświetyla tekst na dolnym przerwaniu - zmiana ekranu
  386.  
  387.  
  388.  
  389. wyswietl_text_4:
  390.     ldx #$00
  391. !petla:
  392.     lda tekst_10,x
  393.     sta PamiecEkranu+640,x
  394.     jsr opoznienie
  395.     cpx #239
  396.     beq !powrot+
  397.     inx
  398.     bne !petla-
  399. !powrot:
  400.     rts
  401.  
  402.  
  403. wyswietl_text_5:
  404.     ldx #$00
  405. !petla:
  406.     lda tekst_15,x
  407.     sta PamiecEkranu+642,x
  408.     jsr opoznienie
  409.     cpx #255
  410.     beq !powrot+
  411.     inx
  412.     bne !petla-
  413. !powrot:
  414.     rts
  415.  
  416. wyswietl_text_6:
  417.     ldx #$00
  418. !petla:
  419.     lda tekst_16,x
  420.     sta PamiecEkranu+880,x
  421.     jsr opoznienie
  422.     cpx #51
  423.     beq !powrot+
  424.     inx
  425.     bne !petla-
  426. !powrot:
  427.     rts
  428.  
  429.  
  430. wyswietl_text_7:
  431.     ldx #$00
  432. !petla:
  433.     lda tekst_17,x
  434.     sta PamiecEkranu+851,x
  435.     jsr opoznienie
  436.     cpx #22
  437.     beq !powrot+
  438.     inx
  439.     bne !petla-
  440. !powrot:
  441.     rts
  442.  
  443. opoznienie:
  444.       txa
  445.       ldx #$00  
  446. petla1:
  447.       ldy #$00
  448. petla2:
  449.       iny
  450.       cpy #$40
  451.       bne petla2
  452.       inx
  453.       cpx #$90
  454.       bne petla1
  455.       tax
  456.       rts
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.        
  467. colwash:   ldx #$27        //; load x-register with #$27 to work through 0-39 iterations
  468.           lda color+$28   //; init accumulator with the last color from first color table
  469.  
  470. cycle1:    ldy color-1,x   //; remember the current color in color table in this iteration
  471.           sta color-1,x   //; overwrite that location with color from accumulator
  472.           sta $d800,x     //; put it into Color Ram into column x
  473.           tya             //; transfer our remembered color back to accumulator
  474.           dex             //; decrement x-register to go to next iteration
  475.           bne cycle1      //; repeat if there are iterations left
  476.           sta color+$28   //; otherwise store te last color from accu into color table
  477.           sta $d800       //; ... and into Color Ram
  478.                            
  479. colwash2:  ldx #$00        //; load x-register with #$00
  480.           lda color2+$28  //; load the last color from the second color table
  481.  
  482. cycle2:    ldy color2,x    //; remember color at currently looked color2 table location
  483.           sta color2,x    //; overwrite location with color from accumulator
  484.           sta $d850,x     //; ... and write it to Color Ram
  485.           tya             //; transfer our remembered color back to accumulator
  486.           inx             //; increment x-register to go to next iteraton
  487.           cpx #$28        //; have we gone through 39 iterations yet?
  488.           bne cycle2      //; if no, repeat
  489.           sta color2+$28  //; if yes, store the final color from accu into color2 table
  490.           sta $d850+$27   //; and write it into Color Ram
  491.  
  492.           rts             //; return from subroutine
  493.  
  494.  
  495. color:       .byte $09,$09,$02,$02,$08
  496.              .byte $08,$0a,$0a,$0f,$0f
  497.              .byte $07,$07,$01,$01,$01
  498.              .byte $01,$01,$01,$01,$01
  499.              .byte $01,$01,$01,$01,$01
  500.              .byte $01,$01,$01,$07,$07
  501.              .byte $0f,$0f,$0a,$0a,$08
  502.              .byte $08,$02,$02,$09,$09
  503.  
  504. color2:       .byte $09,$09,$02,$02,$08
  505.              .byte $08,$0a,$0a,$0f,$0f
  506.              .byte $07,$07,$01,$01,$01
  507.              .byte $01,$01,$01,$01,$01
  508.              .byte $01,$01,$01,$01,$01
  509.              .byte $01,$01,$01,$07,$07
  510.              .byte $0f,$0f,$0a,$0a,$08
  511.              .byte $08,$02,$02,$09,$09
  512.  
  513.  
  514.  
  515. obrazek:
  516.  
  517.    ldx #$00
  518.    
  519. laduj_obrazek:
  520. //    lda $3f40+$4000,x
  521. //    sta PamiecEkranu,x
  522.     lda $3f40+$4000+256,x
  523.     sta PamiecEkranu+256,x
  524.     lda $3f40+$4000+300,x
  525.     sta PamiecEkranu+300,x
  526. //    lda $3f40+$4000+768,x
  527. //    sta PamiecEkranu+768,x
  528.     dex
  529.     bne laduj_obrazek
  530.     rts
  531.  
  532.  
  533. opoznienie2:
  534.         txa
  535.             ldx #$00   
  536.  
  537. petla1_2:
  538.             ldy #$00
  539.  
  540. petla2_2:
  541.             iny
  542.             cpy #$50
  543.             bne petla2_2
  544.             inx
  545.             cpx #$90
  546.             bne petla1_2
  547.             tax
  548.             rts
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556. opoznienie3:
  557.         txa
  558.             ldx #$00   
  559.  
  560. petla4_1:
  561.             ldy #$00
  562.  
  563. petla4_2:
  564.             iny
  565.             cpy #$ff
  566.             bne petla4_2
  567.             inx
  568.             cpx #$ff
  569.             bne petla4_1
  570.             tax
  571.             rts
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579. teksty:
  580.         .text "     yugorin of samar productions       "
  581.     .text "     prezentuje pierwsze wypociny       "
  582.     .text "    po  30 latach bycia w niebycie      "
  583.  
  584.  
  585.  
  586.  
  587.  
  588. tekst_2:
  589.         .text "nie umiem jeszcze zrobic scrolla, ale to"
  590.         .text "kwestia czasu. bardzo chcialem zrobic   "
  591.         .text "pierwsze 'cos', zeby moc powiedziec     "
  592.         .text "wszystkim, ze po 30 latach jestem tu,   "
  593.         .text "gdzie przerwalem jako dziecko.          "
  594.  
  595. tekst_8:
  596.         .text " nigdy nie zrobilem scrolla :-)     "
  597.  
  598. tekst_10:
  599.  
  600.   .text "dziekuje dkt, isildurowi i slajerkowi za"
  601.   .text "wiare we mnie. calemu samarowi za przy- "
  602.   .text "jecie, jammerowi za opierdol na start za"
  603.   .text "dropboxa. wielkie dzieki mlodszemu bratu"
  604.   .text "programiscie (fucking genius)!! za wiare"
  605.   .text "wsparcie i cierpliwosc do mnie.         "
  606.  
  607.  
  608.  
  609.   tekst_15:
  610.  
  611.   .text " to, ze skubany nie zna asm"
  612.   .text " a tlumaczy mi co robie zle"
  613.   .text " sprawia,ze jestem dumny"
  614.   .text " z niego jak nikt na swiecie."
  615.   .text "namawiam go na kodzenie w asm "
  616.   .text "na c64. zobaczymy co z tego wyjdzie."
  617.   .text "na koniec dziekuje asi i biance "
  618.   .text "za to, ze jeszcze nie zwariowaly "
  619.  
  620.   tekst_16:
  621.   .text "bo na kazde pytanie co robie "
  622.   .text "odpowiadam 'kodze' ;-p"
  623.  
  624. tekst_17:
  625.   .text " sceno - przybywam !!!!"
  626.  
  627.  
  628. niebieskie:
  629.     .byte $06,$06,$0e,$0e,$03,$03,$01,$01,$03,$03,$0e,$0e,$0e,$0e,$0e
  630.  
  631. brazowe:
  632.     .byte $02, $08,$0a,$01,$0a,$08,$02,$00,$00,$00,$00,$00
  633.     // .byte $02,$08,$0a,$01,$0a,$08,$02,$02,$00,$00,$00
  634. /// raster $33 bad line - potem 7 linii OK i 8 znów bad lines ($3b)
  635.  
  636. cykle:
  637. .byte $01, $08, $08, $08, $08, $08, $08
  638. .byte $01, $07, $08, $08, $08, $08, $0e
  639.  
  640. cykle2:
  641. .byte $01, $08, $08, $09, $08, $08
  642. .byte $08, $08, $08, $08, $08, $08
  643.  
  644.  
  645.  
  646.  
  647.  
  648. *=$1000 "Muzyka"
  649. .import binary "glover_Small_It.sid", $7c+2
  650.  
  651. .pc = $6000 "Logo Samar"
  652. .import c64 "logo.art"
  653.  
  654. .pc = $4800 "Font 1"
  655. .import c64 "mega_designer_3_c.64c"
  656.  
  657. .pc = $5000 "font 2"
  658. .import c64 "amigo_s.64c"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement