Advertisement
yugorin

drugi zajebisty scroll dziala

May 20th, 2017
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .pc =$0801 "Basic Upstart Program"
  2. :BasicUpstart($0810)
  3.  
  4. //---------------------------------------------------------
  5. //---------------------------------------------------------
  6. //          2x2 Scroll
  7. //---------------------------------------------------------
  8. //---------------------------------------------------------
  9. .var music = LoadSid("C:\\Users\\xxx\\Dysk Google\\C64\\CDU_Suxx.sid")
  10. .pc = $0810 "Main Program"
  11.             ldx #0
  12. !loop:
  13.             .for(var i=0; i<4; i++) {
  14.                 lda #$20
  15.                 sta $0400+i*$100,x
  16.                 lda #$0f
  17.                 sta $d800+i*$100,x
  18.             }
  19.             inx
  20.             bne !loop-
  21.  
  22.             lda #$00
  23.             sta $d020
  24.             sta $d021
  25.             ldx #0
  26.             ldy #0
  27.             lda #music.startSong-1
  28.             jsr music.init 
  29.             sei
  30.             lda #<irq1
  31.             sta $0314
  32.             lda #>irq1
  33.             sta $0315
  34.             asl $d019
  35.             lda #$7b
  36.             sta $dc0d
  37.             lda #$81
  38.             sta $d01a
  39.             lda #$1b
  40.             sta $d011
  41.             lda #$80
  42.             sta $d012
  43.             cli
  44. this:   jmp this
  45. //---------------------------------------------------------
  46. irq1:  
  47.             asl $d019
  48.             inc $d020
  49.             jsr music.play
  50.             inc $d020
  51.             jsr scroll
  52.            
  53.             lda #$c0
  54.             ora scroll_xpos
  55.             sta $d016
  56.             lda #$1e
  57.             sta $d018
  58.  
  59.             lda #0         
  60.             sta $d020
  61.             pla
  62.             tay
  63.             pla
  64.             tax
  65.             pla
  66.             rti
  67.  
  68. //---------------------------------------------------------
  69. .var scroll_screen = $0400
  70.  
  71. scroll:
  72.     lda scroll_xpos
  73.     sec
  74.     sbc scroll_speed
  75.     and #$07
  76.     sta scroll_xpos
  77.     bcc !moveChars+
  78.     rts
  79. !moveChars:
  80.     // Move the chars
  81.     ldx #0
  82. !loop:
  83.  
  84.     lda scroll_screen+1,x
  85.     sta scroll_screen,x
  86.     lda scroll_screen+1+40,x
  87.     sta scroll_screen+40,x
  88.     inx
  89.     cpx #40
  90.     bne !loop-
  91.    
  92.     // print the new chars
  93. !txtPtr: lda scroll_text
  94.     cmp #$ff
  95.     bne !noWrap+
  96.     lda #<scroll_text
  97.     sta !txtPtr-+1
  98.     lda #>scroll_text
  99.     sta !txtPtr-+2
  100.     jmp !txtPtr-
  101. !noWrap:
  102.     ora scroll_charNo
  103.     sta scroll_screen+39
  104.     clc
  105.     adc #$40   
  106.     sta scroll_screen+39+40
  107.    
  108.     // Advance textpointer
  109.     lda scroll_charNo
  110.     eor #$80
  111.     sta scroll_charNo
  112.     bne !over+
  113. !incr:
  114.     inc !txtPtr-+1
  115.     bne !over+
  116.     inc !txtPtr-+2
  117. !over:
  118.        
  119.     rts
  120. scroll_xpos: .byte 0
  121. scroll_speed: .byte 4
  122. scroll_charNo: .byte 0
  123.  
  124.  
  125. scroll_text:
  126.     .text "hello world.. here is a scroll with a converted charset. the charset was "
  127.     .text "drawn by trifox who asked how to convert it on csdb. this is a quick example of "
  128.     .text "how it can be done in kick assembler... .. .. .   .  . "
  129.     .byte $ff
  130. //---------------------------------------------------------
  131. .pc=music.location "Music"
  132. .fill music.size, music.getData(i)
  133. //---------------------------------------------------------
  134. .pc = $3800
  135. .var charsetPic = LoadPicture("2x2char.gif", List().add($000000, $ffffff))
  136. .function picToCharset(byteNo, picture) {
  137.     .var ypos = [byteNo&7] + 8*[[byteNo>>9]&1]
  138.     .var xpos = 2*[[byteNo>>3]&$3f] + [[byteNo>>10]&1]
  139.     .return picture.getSinglecolorByte(xpos,ypos)      
  140. }
  141. .fill $800, picToCharset(i,charsetPic)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement