]> git.sur5r.net Git - cc65/blob - libsrc/atmos/clrscr.s
Added library reference ser_libref to SER interface.
[cc65] / libsrc / atmos / clrscr.s
1 ;
2 ; Ullrich von Bassewitz, 2003-04-13
3 ;
4
5         .export         _clrscr
6         .importzp       ptr2
7
8         .include        "atmos.inc"
9
10 ; ------------------------------------------------------------------------
11 ; void clrscr (void);
12
13 .proc   _clrscr
14
15 ; Set the cursor to top left cursor position
16
17         ldy     #$00
18         sty     CURS_X
19         sty     CURS_Y
20
21 ; Set ptr2 to the screen position (left upper border)
22
23         lda     #<SCREEN
24         sta     ptr2
25         lda     #>SCREEN
26         sta     ptr2+1
27
28 ; Clear full pages. Y is still zero
29
30         ldx     #>(28*40)
31         lda     #' '
32 @L1:    sta     (ptr2),y
33         iny                     ; Bump low byte of address
34         bne     @L1
35         inc     ptr2+1          ; Bump high byte of address
36         dex
37         bne     @L1
38
39 ; Clear the remaining page
40
41 @L2:    sta     (ptr2),y
42         iny
43         cpy     #<(28*40)
44         bne     @L2
45         rts
46
47 .endproc