home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1995 January
/
1995-01b.d64
/
scroll.src
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
2KB
|
83 lines
200 ptr1 = $26
210 ptr2 = $28
220 scr1 = $8000
230 scr2 = $8400
235 *=$033c
240 lda #<scr1+40 ; from line2 of scrn
250 sta ptr1
260 lda #<scr1+0 ; of other screen
270 sta ptr2
280 ldx #>scr1 ; from screen 1
290 ldy #>scr2 ; to screen 2
300 stx ptr1+1
310 sty ptr2+1
320 lda #$10
330 bit $d018
340 beq flip
350 stx ptr2+1 ; from screen 2
360 sty ptr1+1 ; to screen 1
370 flip ldx #$00
380 ;
390 nxlin ldy #$00 ; start of line
400 nxchar lda (ptr1),y ; char..
410 sta (ptr2),y ; to other screen
420 iny ; next character
430 cpy #$28 ; copied 40 chars..
440 bcc nxchar ; no, do more
450 clc
460 lda ptr1 ; 'from' (NULL)
470 adc #$28 ; .. to next line
480 sta ptr1
490 bcc inc2
500 inc ptr1+1
510 inc2 clc
520 lda ptr2 ; 'to' (NULL)
530 adc #$28 ; .. to next line
540 sta ptr2
550 bcc sampg
560 inc ptr2+1
570 sampg inx
580 cpx #$18 ; copied 24 lines..
590 bcc nxlin ; no, (NULL) more
600 ;
610 lda #$20 ; spaces...
620 ldy #$00
630 movchr sta (ptr2),y ; bottom line
640 iny
650 cpy #$28 ; (NULL)ne 40 spaces..
660 bcc movchr ; no, (NULL) more
670 ; step old screen thru (NULL)& scroll
680 ldx #$17 ; bottom pixel position
690 scrol ldy #$05
700 wait lda $d012 ; wait retrace
710 cmp $03d0
720 sta $03d0
730 bcs wait
740 bit $d011 ; check hi raster
750 bmi wait
760 dey ; wait six retrace cycles
770 bpl wait
780 stx $d011 ; scroll it!
790 dex ; set one pixel higher
800 cpx #$10 ; check last px position
810 bcs scrol ; no, move another pixel
820 ; we have (NULL)ne a full pixel scroll;
825 ; ... switch screens!
830 ldx #$17 ; bottom pixel position
840 lda $d018 ; screen addrs register
850 eor #$10 ; flip to other screen
860 sta $d018
870 stx $d011
880 lda $0288 ; supply screen addrs
890 eor #$04
900 sta $0288
910 ; printing <cursor-up> then return
920 ; gives the effect of
925 ; restoring cursor to left margin
930 lda #$91 ; cursor-up (NULL)acter
940 jsr $ffd2
950 lda #$0d ; return (NULL)acter
960 jmp $ffd2