Advertisement
yugorin

raster gora i dol jedno irq

Jun 2nd, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :BasicUpstart2(main)
  2. //----------------------------------------------------------
  3. // Code for creating the breakpoint file sent to Vice/C64Debugger
  4. //----------------------------------------------------------
  5. .var _useBinFolderForBreakpoints = cmdLineVars.get("usebin") == "true"
  6. .var _createDebugFiles = cmdLineVars.get("afo") == "true"
  7. .print "File creation " + [_createDebugFiles
  8.     ? "enabled (creating breakpoint file)"
  9.     : "disabled (no breakpoint file created)"]
  10. .var brkFile
  11. .if(_createDebugFiles) {
  12.     .if(_useBinFolderForBreakpoints)
  13.         .eval brkFile = createFile("bin/breakpoints.txt")
  14.     else
  15.         .eval brkFile = createFile("breakpoints.txt")
  16. }
  17.  
  18. .macro break() {
  19. .if(_createDebugFiles) {
  20.     .eval brkFile.writeln("break " + toHexString(*))
  21.     }
  22. }
  23.  
  24. // For C64Debugger v0.54 (2016/09/03)
  25. .macro setbkg(color) {
  26. .if(_createDebugFiles) {
  27.     .eval brkFile.writeln("setbkg " + toHexString(*) + " " + color)
  28.     }
  29. }
  30.  
  31. //Because Kick Assembler has to be run with the -afo switch to be able to write breakpoints to a file, we can use this to enable "debugger" specific code when build with Shift-F7 or Shift-F5, ie:
  32.  
  33. .const debug = cmdLineVars.get("afo") == "true"
  34.  
  35. .if (debug) {
  36.   inc $d020
  37. }
  38. licznik:
  39. .byte $0
  40. goraczydol:
  41. .byte $0
  42.  
  43. main:
  44. :break()
  45.         sei       //disable maskable IRQs
  46.  
  47.         lda #$7f
  48.         sta $dc0d //disable timer interrupts which can be generated by the two CIA chips
  49.         sta $dd0d //the kernal uses such an interrupt to flash the cursor and scan the keyboard, so we better
  50.           //stop it.
  51.  
  52.         lda $dc0d//;by reading this two registers we negate any pending CIA irqs.
  53.         lda $dd0d //if we don't do this, a pending CIA irq might occur after we finish setting up our irq.
  54.          //;we don't want that to happen.
  55.  
  56.         lda #$01 //;this is how to tell the VICII to generate a raster interrupt
  57.         sta $d01a
  58.  
  59.         lda #$47 //;this is how to tell at which rasterline we want the irq to be triggered
  60.         sta $d012
  61.  
  62.         lda #$1b  //as there are more than 256 rasterlines, the topmost bit of $d011 serves as
  63.         sta $d011 //the 9th bit for the rasterline we want our irq to be triggered.
  64.          //;here we simply set up a character screen, leaving the topmost bit 0.
  65.  
  66. //      lda #$35  //we turn off the BASIC and KERNAL rom here
  67.     //  sta $01   //the cpu now sees RAM everywhere except at $d000-$e000, where still the registers of
  68.           //SID/VICII/etc are visible
  69.  
  70.     lda #<irq   // nastavit LO byte adresy
  71.     sta $0314   // na LO adresu IRQ - preruseni
  72.     lda #>irq   // nastavit HI byte adresy
  73.     sta $0315   // na HI adresu IRQ - preruseni
  74.     cli // vypnout preruseni
  75.     //rts   // skoncit program
  76.     //  cli      //;enable maskable interrupts again
  77.        
  78.         jmp *    //;we better don't RTS, the ROMS are now switched off, there's no way back to the system
  79.            
  80.            
  81.  irq:  
  82.          inc $d019          
  83. linia1:         lda #120
  84. !loop:     
  85.         cmp $d012
  86.         bne !loop-
  87. !kolor:        
  88.         ldx #BLACK
  89.         stx $d021
  90.        
  91. linia2:     lda #140
  92.         sta $d012
  93.  !loop:
  94.         cmp $d012
  95.         bne !loop-
  96.         lda #WHITE
  97.         sta $d021
  98.  
  99. linia3:         lda #160
  100. !loop:     
  101.         cmp $d012
  102.         bne !loop-
  103. !kolor:        
  104.         ldx #RED
  105.         stx $d021
  106.        
  107. linia4:     lda #180
  108.         sta $d012
  109.  !loop:
  110.         cmp $d012
  111.         bne !loop-
  112.         lda #BLUE
  113.         sta $d021
  114.  
  115.  
  116.         pla
  117.         tay
  118.         pla
  119.         tax
  120.         pla
  121.        // dec $d020
  122.         lda goraczydol
  123.         cmp #$00
  124.         beq !loop+
  125.    
  126.    
  127. !loop1:
  128.     dec linia1+1   
  129.     dec linia2+1   
  130.     dec linia3+1   
  131.     dec linia4+1   
  132.     dec licznik
  133.     lda licznik
  134.     cmp #00
  135.     beq dalej  
  136.    
  137.     rti
  138. !loop:    
  139.     inc linia1+1   
  140.     inc linia2+1   
  141.     inc linia3+1   
  142.     inc linia4+1   
  143.     inc licznik
  144.     lda licznik
  145.     cmp #$29
  146.     beq dalej2
  147.  
  148.    
  149.  rti
  150.        
  151.  dalej:
  152.     inc goraczydol
  153.     rti
  154.    
  155.  dalej2:
  156.     dec goraczydol
  157.     rti
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement