]> git.sur5r.net Git - cc65/blob - libsrc/cbm510/clrscr.s
Add a goto indirect jump from pointer
[cc65] / libsrc / cbm510 / clrscr.s
1 ;
2 ; Ullrich von Bassewitz, 14.09.2001
3 ;
4
5         .export         _clrscr
6         .import         plot
7
8         .include        "cbm510.inc"
9         .include        "extzp.inc"
10
11 ; ------------------------------------------------------------------------
12 ; void clrscr (void);
13
14 .proc   _clrscr
15
16         lda     #0
17         sta     CURS_X
18         sta     CURS_Y
19         jsr     plot            ; Set cursor to top left corner
20
21         ldx     #$00            ; Count
22         jsr     clearpage
23         jsr     clearpage
24         jsr     clearpage
25         ldx     #<(40*25)       ; Count
26         jsr     clearpage       ; Clear remainder of last page
27         jmp     plot            ; Set screen pointer again
28
29 .endproc
30
31
32 .proc   clearpage
33
34         txa
35         pha                     ; Save count
36
37         lda     #$20            ; Screencode for blank
38         ldy     #$00
39 @L1:    sta     (SCREEN_PTR),y
40         iny
41         dex
42         bne     @L1
43         inc     SCREEN_PTR+1
44
45         pla
46         tax                     ; Reload count
47         lda     IndReg
48         pha
49         lda     #$0F
50         sta     IndReg          ; Switch to the system bank
51         lda     CHARCOLOR       ; Load color
52         ldy     #$00
53 @L2:    sta     (CRAM_PTR),y
54         iny
55         dex
56         bne     @L2
57         inc     CRAM_PTR+1
58         pla
59         sta     IndReg          ; Restore the old indirect bank
60         rts
61
62 .endproc