Advertisement
yugorin

bar 6502

Apr 3rd, 2016
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //making simple rasterbars
  2. //by Knoeki of Digital Sounds System
  3. //
  4. //was coded and proven to work in Turbo Assembler 5.2 (Cyberpunx RR)
  5. //
  6. //should be compatible with most assemblers out there..
  7. //
  8. //                                                          enjoy //)
  9.  
  10. .pc = $0801 "Basic Program"
  11.  
  12. :BasicUpstart($0810)
  13.  
  14. .pc =$0810 "Program"
  15.  
  16.  
  17.          sei              //disable interrupts
  18.  
  19.          lda #$00         //load $00 into A
  20.          sta $d011        //turn off screen. (now you have only borders!)
  21.          sta $d020        //make border black.
  22.  
  23. main:    ldy #56   //load $7a into Y. this is the line where our rasterbar will start. od linii 56 z góry
  24.          ldx #$00         //load $00 into X
  25. loop:    lda colors,x     //load value at label 'colors' plus x into a. if we don't add x, only the first
  26.                           //value from our color-table will be read.
  27.  
  28.          cpy $d012        //ComPare current value in Y with the current rasterposition.
  29.          bne *-3          //is the value of Y not equal to current rasterposition? then jump back 3 bytes (to cpy).
  30.  
  31.          sta $d020        //if it IS equal, store the current value of A (a color of our rasterbar)
  32.                           //into the bordercolour
  33.  
  34.          cpx #1          //compare X to #51 (decimal). have we had all lines of our bar yet?
  35.          beq main         //Branch if EQual. if yes, jump to main.
  36.  
  37.          inx              //increase X. so now we're gonna read the next color out of the table.
  38.          iny              //increase Y. go to the next rasterline.
  39.  
  40.          jmp loop         //jump to loop.
  41.  
  42.  
  43. colors:
  44.          .byte %00000001,%00001111,%00001111,%00001111,%00001111,%00001111
  45.          .byte %00001111,%00001111,%00001111,%00001111,%00001111,%00001111
  46.          .byte %00001111,%00001111,%00001111,%00001111,%00001111,%00001111
  47.          .byte %00001111,%00001111,%00001111,%00001111,%00001111,%00001111
  48.          .byte %00001111,%00001111,%00001111,%00001111,%00001111,%00001111
  49.          .byte %00001111,%00001111,%00001111,%00001111,%00001111,%00001111
  50.          .byte %00001111,%00001111,%00001111,%00001111,%00001111,%00001111
  51.          .byte %00001111,%00001111,%00001111,%00001111,%00001111,%00001111
  52.          .byte %00001111,%00001111,%00001111,%00001111,%00001111,%00001111
  53.  
  54.          .byte $ff
  55.  
  56.  
  57.  
  58.  
  59. //-----------------------------------------------------------------
  60. //
  61. //if everything goes correctly, you should have a blue rasterbar on
  62. //the middle of your screen. play with the values a bit, and see
  63. //what you can do with it... =)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement