Advertisement
yugorin

zamiana znakow

Oct 1st, 2016
57
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. .label screen_memory = $0400
  25. .label memory_setup_register = $d018
  26.  
  27. .label character_rom = $d000
  28.  
  29. main:
  30. :break()
  31.   :clear_screen()
  32.   :print_all_characters()
  33.  
  34.   :choose_character_set(4)
  35.  
  36.   sei
  37.   lda $01
  38.   pha
  39.   and #%11111011
  40.   sta $01
  41.    
  42. .for (var char = 0; char < 64; char++) {
  43.   ldx #0
  44.   ldy #7
  45. loopx:
  46.   lda character_rom + char*8, X
  47.   sta custom_charset + char*8, X
  48.   sta custom_charset + [64+char]*8, Y
  49.  
  50.   dey
  51.   inx
  52.   cpx #8
  53.   bne loopx
  54. }
  55.  
  56.   pla
  57.   sta $01
  58.   cli
  59.  
  60.   rts
  61.  
  62. .pc = 4*2048 "Custom Charset"
  63. custom_charset:
  64. .for (var char = 0; char < 256; char++) {
  65.   .if (char == ' ') {
  66.     .byte %00000000
  67.     .byte %00000000
  68.     .byte %00000000
  69.     .byte %00000000
  70.     .byte %00000000
  71.     .byte %00000000
  72.     .byte %00000000
  73.     .byte %00000000
  74.   } else {
  75.     .for (var i = 0; i < 8; i++) {
  76.       .byte char & 1<<i
  77.     }
  78.   }
  79. }
  80.  
  81. .macro choose_character_set(index) {
  82.   lda memory_setup_register
  83.   and #%11110001
  84.   ora #[index << 1]
  85.   sta memory_setup_register
  86. }
  87.  
  88. .macro clear_screen() {
  89.   ldx #250
  90.   lda #' '
  91. loopx:
  92.   .for (var i = 0; i < 4; i++) {
  93.     sta screen_memory + 250*i - 1, X
  94.   }
  95.   dex
  96.   bne loopx
  97. }
  98.  
  99. .macro print_all_characters() {
  100.   .for (var i = 0;i < 256; i++) {
  101.     .var column = mod(i,32) + 4
  102.     .var row = floor(i / 32) + 4
  103.  
  104.     lda #i
  105.     sta screen_memory + row*40 + column
  106.   }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement