Advertisement
yugorin

scroll simple

May 20th, 2017
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :BasicUpstart2(main)
  2.  
  3. //----------------------------------------------------------
  4. // Code for creating the breakpoint file sent to Vice.
  5. //----------------------------------------------------------
  6. .var _useBinFolderForBreakpoints = cmdLineVars.get("usebin") == "true"
  7. .var _createDebugFiles = cmdLineVars.get("afo") == "true"
  8. .print "File creation " + [_createDebugFiles
  9.     ? "enabled (creating breakpoint file)"
  10.     : "disabled (no breakpoint file created)"]
  11. .var brkFile
  12. .if(_createDebugFiles) {
  13.     .if(_useBinFolderForBreakpoints)
  14.         .eval brkFile = createFile("bin/breakpoints.txt")
  15.     else
  16.         .eval brkFile = createFile("breakpoints.txt")
  17. }
  18. .macro break() {
  19. .if(_createDebugFiles) {
  20.     .eval brkFile.writeln("break " + toHexString(*))
  21.     }
  22. }
  23. //------------------------------------------------------
  24. main:
  25. :ClearScreen($0400,32)
  26.  
  27.  
  28.    sei
  29.  
  30. start:
  31.      lda #$3b  //; wait for line #59, making sure we
  32. !jump:
  33.     cmp $d012 //; don't catch it twice in one frame
  34.     beq !jump-
  35.  !jump:
  36.         cmp $d012
  37.         bne !jump-
  38.  
  39.  lda $d016 //; decrease scroll register
  40.  sbc #$01  //; (carry was set by cmp above)
  41.  and #$07
  42.  sta $d016
  43.  cmp #$07  //; go back if there's no need
  44.  bne start //; to shift screen memory
  45.  
  46.  ldx #$00  //; move columns 1..38 one byte left
  47. screen: lda $0401,x
  48.  sta $0400,x
  49.  inx
  50.  cpx #$26
  51.  bne screen
  52.  
  53.  lda $c000 //; some dummy data to column 38
  54.  sta $0426
  55.  inc *-5
  56.  
  57.  jmp start
  58.  
  59. * = $c000 "Tekst"
  60. .text "arek arek arek"
  61. raster_color:
  62.     .byte $00,$00,$07,$0a,$08,$0a,$08,$02
  63.     .byte $08,$02,$09,$02,$09,$0b,$09,$0b
  64.     .byte $00,$0b,$00,$07,$0a,$08,$0a,$08
  65.     .byte $02,$08,$02,$09,$02,$09,$0b,$09
  66.     .byte $0b,$00,$0b,$00,$08,$0a,$08,$02
  67.     .byte $08,$02,$09,$02,$09,$0b,$09,$0b
  68.     .byte $00,$0b,$00,$08,$02,$08,$02,$09
  69.     .byte $02,$09,$0b,$09,$0b,$00,$0b,$00
  70.     .byte $08,$02,$09,$02,$09,$0b,$09,$0b
  71.     .byte $00,$0b,$00,$09,$02,$09,$0b,$09
  72.     .byte $0b,$00,$0b,$00,$09,$0b,$09,$0b
  73.     .byte $00,$0b,$00,$09,$0b,$00,$0b,$00
  74.     .byte $00,$0b,$00,$00,$0b,$00,$00,$0b
  75.     .byte $00,$0b,$06,$00,$0b,$00,$0b,$06
  76.     .byte $0b,$06,$00,$0b,$00,$0b,$06,$0b
  77.     .byte $06,$0c,$06,$00,$0b,$00,$0b,$06
  78.     .byte $0b,$06,$0c,$06,$0c,$0e,$00,$0b
  79.     .byte $00,$0b,$06,$0b,$06,$0c,$06,$0c
  80.     .byte $0e,$0c,$0e,$00,$0b,$00,$0b,$06
  81.     .byte $0b,$06,$0c,$06,$0c,$0e,$0c,$0e
  82.     .byte $0f,$0e,$00,$0b,$00,$0b,$06,$0b
  83.     .byte $06,$0c,$06,$0c,$0e,$0c,$0e,$0f
  84.     .byte $0e,$0f,$03,$00,$0b,$00,$0b,$06
  85.     .byte $0b,$06,$0c,$06,$0c,$0e,$0c,$0e
  86.     .byte $0f,$0e,$0f,$03,$0f,$03,$00,$0b
  87.     .byte $00,$0b,$06,$0b,$06,$0c,$06,$0c
  88.     .byte $0e,$0c,$0e,$0f,$0e,$0f,$03,$0f
  89.     .byte $03,$01,$00,$00,$00,$00,$00,$00
  90.     .byte $00,$00,$00,$00,$00,$00,$00,$00
  91.     .byte $00,$00,$00,$00,$00,$00,$00,$00
  92.  
  93.  
  94. .macro ClearScreen(screen, clearByte) {
  95.     lda #clearByte
  96.     ldx #0
  97. !loop:
  98.     sta screen, x
  99.     sta screen + $100, x
  100.     sta screen + $200, x
  101.     sta screen + $300, x
  102.     inx
  103.     bne !loop-
  104. }
  105.  
  106. .pseudocommand pause cycles {
  107.     :ensureImmediateArgument(cycles)
  108.     .var x = floor(cycles.getValue())
  109.     .if (x<2) .error "Cant make a pause on " + x + " cycles"
  110.  
  111.     // Take care of odd cyclecount 
  112.     .if ([x&1]==1) {
  113.         bit $00
  114.         .eval x=x-3
  115.     }  
  116.    
  117.     // Take care of the rest
  118.     .if (x>0)
  119.         :nop #x/2
  120. }
  121.  
  122.  
  123. //---------------------------------
  124. // repetition commands
  125. //---------------------------------
  126. .macro ensureImmediateArgument(arg) {
  127.     .if (arg.getType()!=AT_IMMEDIATE)   .error "The argument must be immediate!"
  128. }
  129. .pseudocommand asl x {
  130.     :ensureImmediateArgument(x)
  131.     .for (var i=0; i<x.getValue(); i++) asl
  132. }
  133. .pseudocommand lsr x {
  134.     :ensureImmediateArgument(x)
  135.     .for (var i=0; i<x.getValue(); i++) lsr
  136. }
  137. .pseudocommand rol x {
  138.     :ensureImmediateArgument(x)
  139.     .for (var i=0; i<x.getValue(); i++) rol
  140. }
  141. .pseudocommand ror x {
  142.     :ensureImmediateArgument(x)
  143.     .for (var i=0; i<x.getValue(); i++) ror
  144. }
  145.  
  146. .pseudocommand pla x {
  147.     :ensureImmediateArgument(x)
  148.     .for (var i=0; i<x.getValue(); i++) pla
  149. }
  150.  
  151. .pseudocommand nop x {
  152.     :ensureImmediateArgument(x)
  153.     .for (var i=0; i<x.getValue(); i++) nop
  154. }
  155.  
  156. teskt:
  157.     .byte $04
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement