Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. Screen =$0400
  2.  
  3. ; [BASIC LOADER] --------------------------------------------------------------
  4.  
  5. ; The following bytes generate the SYS call below to execute the Assembler.
  6. ; 10 SYS (2065) = $0811
  7.  
  8. *=$0801
  9. BYTE $0E, $08, $0A, $00, $9E, $20, $28, $32, $30, $36, $35, $29, $00, $00, $00
  10.  
  11.  
  12.  
  13. ; [CODE START] ----------------------------------------------------------------
  14.  
  15. *=$0811
  16. ldx #250 ; Clear screen
  17. lda #" "
  18. @clr sta Screen,x
  19. sta Screen+250,x
  20. sta Screen+500,x
  21. sta Screen+750,x
  22. dex
  23. bne @clr
  24. txa
  25.  
  26. jsr initRaster ; Init Raster IRQ
  27. @loop
  28. ; jsr waitRaster
  29. sta Screen+120,x ; Draw character to screen
  30. inx
  31. cpx #40
  32. bne @nzero
  33. ldx #0
  34. clc
  35. adc #1
  36. @nzero
  37. jmp @loop
  38. ;;; -----------------------------------------------------------------------------
  39. ;;; install raster interrupt handler
  40. ;;; -----------------------------------------------------------------------------
  41.  
  42. initRaster
  43. sei ; turn off interrupts
  44.  
  45. ldx #1 ; enable raster interrupts
  46. stx $d01a
  47.  
  48. lda #<intHandler ; set raster interrupt vector
  49. ldx #>intHandler
  50. sta $fffe
  51. stx $ffff
  52.  
  53. ldy #$50 ; set scanline on which to trigger interrupt
  54. sty $d012
  55. lda $d011 ; scanline hi bit
  56. and #%01111111
  57. sta $d011
  58.  
  59. lda #$35 ; disable kernal and BASIC memory ($e000 - $ffff)
  60. sta $01
  61.  
  62. asl $d019 ; acknowledge VIC interrupts
  63. cli
  64. rts
  65.  
  66. ;;; -----------------------------------------------------------------------------
  67. ;;; raster IRQ handler
  68. ;;; -----------------------------------------------------------------------------
  69.  
  70. intHandler
  71.  
  72. pha
  73. txa
  74. pha
  75. tya
  76. pha
  77.  
  78. lda #$ff
  79. sta $d019
  80.  
  81. ; inc $d020
  82. ; inc rasterCount
  83.  
  84. pla
  85. tay
  86. pla
  87. tax
  88. pla
  89.  
  90. rti
  91.  
  92. ;;; -----------------------------------------------------------------------------
  93.  
  94. waitRaster
  95. pha
  96. lda rasterCount
  97. @wait cmp rasterCount
  98. beq @wait
  99. pla
  100. rts
  101.  
  102.  
  103. rasterCount byte 00
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement