Advertisement
yugorin

rysowanie hires

Apr 29th, 2017
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import "helpers.asm"
  2.  
  3. :BasicUpstart2(main)
  4.  
  5. //----------------------------------------------------------
  6. // Code for creating the breakpoint file sent to Vice/C64Debugger
  7. //----------------------------------------------------------
  8. .var _useBinFolderForBreakpoints = cmdLineVars.get("usebin") == "true"
  9. .var _createDebugFiles = cmdLineVars.get("afo") == "true"
  10. .print "File creation " + [_createDebugFiles
  11.     ? "enabled (creating breakpoint file)"
  12.     : "disabled (no breakpoint file created)"]
  13. .var brkFile
  14. .if(_createDebugFiles) {
  15.     .if(_useBinFolderForBreakpoints)
  16.         .eval brkFile = createFile("bin/breakpoints.txt")
  17.     else
  18.         .eval brkFile = createFile("breakpoints.txt")
  19. }
  20.  
  21. .macro break() {
  22. .if(_createDebugFiles) {
  23.     .eval brkFile.writeln("break " + toHexString(*))
  24.     }
  25. }
  26.  
  27. // For C64Debugger v0.54 (2016/09/03)
  28. .macro setbkg(color) {
  29. .if(_createDebugFiles) {
  30.     .eval brkFile.writeln("setbkg " + toHexString(*) + " " + color)
  31.     }
  32. }
  33.  
  34. //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:
  35.  
  36. .const debug = cmdLineVars.get("afo") == "true"
  37.  
  38. .if (debug) {
  39.   inc $d020
  40. }
  41.  
  42.  
  43. .label screen_control_register = $d011
  44. .label memory_setup_register = $d018
  45. .label border_color = $d020
  46.  
  47. main:
  48.   lda screen_control_register
  49.   ora #%00100000
  50.   sta screen_control_register
  51.  
  52.   lda #DARK_GRAY
  53.   sta border_color
  54.  
  55.   :choose_screen_memory(3)
  56.  
  57.   :choose_bitmap_memory(1)
  58.  
  59.   lda #$c0
  60.   ldx #$00
  61.   ldy #$ff
  62. liniastart:
  63.  
  64.   inx
  65.  
  66.    
  67. :delay(200,40)
  68. :break()
  69.  
  70.   sty $2000+364*8
  71.  
  72.   sta $2000+204*8-1,x
  73.   //sta $2000+204*8-1,x
  74.   //sta $2000+244*8-1,x
  75.   //sta $2000+284*8-1,x
  76.  // sta $2000+324*8-1,x
  77.  
  78.   cpx #$08
  79.  
  80.   bne linia
  81.  
  82.   beq tu2
  83.  
  84. linia:
  85.   jmp liniastart
  86.  
  87. tu2:  
  88.  
  89.  
  90.  
  91.   lda #$c0
  92.   ldx #$00
  93.   ldy #$ff
  94. liniastart3:
  95.  
  96.   inx
  97.  
  98.    
  99. :delay(200,40)
  100.  
  101.   sta $2000+244*8-1,x
  102.   //sta $2000+284*8-1,x
  103.  // sta $2000+324*8-1,x
  104.  
  105.   cpx #$08
  106.  
  107.   bne linia3
  108.  
  109.   beq tu3
  110.  
  111. linia3:
  112.   jmp liniastart3
  113.  
  114. tu3:  jmp *
  115.  
  116.  
  117.  
  118.  
  119.  
  120. * = screen_memory(3)
  121. .fill 1000, GRAY << 1 | LIGHT_GRAY
  122.  
  123. * = bitmap_memory(1)
  124. .fill 8192, 0
  125. /*.for (var y = 0; y < 25; y++) {
  126.   .for (var x = 0; x < 40; x++) {
  127.     .var number = 25*y + x
  128.     .for (var i = 7; i >= 0; i--) {
  129.       .byte number >> i
  130.     }
  131.   }
  132. }
  133. */
  134. .macro choose_bitmap_memory(index) {
  135.   lda memory_setup_register
  136.   and #%11110111
  137.   ora #[index << 3]
  138.   sta memory_setup_register
  139. }
  140.  
  141. .function bitmap_memory(index) {
  142.   .return 1024*8*index
  143. }
  144.  
  145. .macro choose_screen_memory(index) {
  146.   lda memory_setup_register
  147.   and #%00001111
  148.   ora #[index << 4]
  149.   sta memory_setup_register
  150. }
  151.  
  152. .function screen_memory(index) {
  153.   .return 1024*index
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement