home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1995 January / 1995-01b.d64 / scroll.src (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  2KB  |  83 lines

  1. 200 ptr1 = $26
  2. 210 ptr2 = $28
  3. 220 scr1 = $8000
  4. 230 scr2 = $8400
  5. 235 *=$033c
  6. 240  lda #<scr1+40 ; from line2 of scrn
  7. 250  sta ptr1
  8. 260  lda #<scr1+0  ;   of other screen
  9. 270  sta ptr2
  10. 280  ldx #>scr1     ; from screen 1
  11. 290  ldy #>scr2     ; to screen 2
  12. 300  stx ptr1+1
  13. 310  sty ptr2+1
  14. 320  lda #$10
  15. 330  bit $d018
  16. 340  beq flip
  17. 350  stx ptr2+1     ; from screen 2
  18. 360  sty ptr1+1     ; to screen 1
  19. 370 flip ldx #$00
  20. 380 ;
  21. 390 nxlin ldy #$00    ; start of line
  22. 400 nxchar lda (ptr1),y   ; char..
  23. 410  sta (ptr2),y   ; to other screen
  24. 420  iny            ; next character
  25. 430  cpy #$28       ; copied 40 chars..
  26. 440  bcc  nxchar    ; no, do more
  27. 450  clc
  28. 460  lda ptr1       ; 'from' (NULL)
  29.  
  30. 470  adc #$28       ;  .. to next line
  31. 480  sta ptr1
  32. 490  bcc inc2
  33. 500  inc ptr1+1
  34. 510 inc2 clc
  35. 520  lda ptr2        ; 'to' (NULL)
  36.  
  37. 530  adc #$28        ;  .. to next line
  38. 540  sta ptr2
  39. 550  bcc sampg
  40. 560  inc ptr2+1
  41. 570 sampg inx
  42. 580  cpx #$18      ; copied 24 lines..
  43. 590  bcc nxlin       ;  no, (NULL) more
  44. 600 ;
  45. 610  lda #$20        ; spaces...
  46. 620  ldy #$00
  47. 630 movchr sta (ptr2),y ; bottom line
  48. 640  iny
  49. 650  cpy #$28        ; (NULL)ne 40 spaces..
  50. 660  bcc movchr      ;  no, (NULL) more
  51. 670 ; step old screen thru (NULL)& scroll
  52. 680  ldx #$17  ;  bottom pixel position
  53. 690 scrol ldy #$05
  54. 700 wait lda $d012   ; wait retrace
  55. 710  cmp $03d0
  56. 720  sta $03d0
  57. 730  bcs wait
  58. 740  bit $d011  ; check hi raster
  59. 750  bmi wait
  60. 760  dey      ; wait six retrace cycles
  61. 770  bpl wait
  62. 780  stx $d011         ; scroll it!
  63. 790  dex       ; set one pixel higher
  64. 800  cpx #$10  ; check last px position
  65. 810  bcs scrol ; no, move another pixel
  66. 820 ; we have (NULL)ne a full pixel scroll;
  67. 825 ; ... switch screens!
  68. 830  ldx #$17   ; bottom pixel position
  69. 840  lda $d018  ; screen addrs register
  70. 850  eor #$10   ; flip to other screen
  71. 860  sta $d018
  72. 870  stx $d011
  73. 880  lda $0288  ; supply screen addrs
  74. 890  eor #$04
  75. 900  sta $0288
  76. 910 ; printing <cursor-up> then return
  77. 920 ; gives the effect of
  78. 925 ; restoring cursor to left margin
  79. 930  lda #$91     ; cursor-up (NULL)acter
  80. 940  jsr $ffd2
  81. 950  lda #$0d     ; return (NULL)acter
  82. 960  jmp $ffd2
  83.