]> git.sur5r.net Git - cc65/blob - libsrc/geos-common/conio/cclear.s
Introduced internal gotoxy that pops both parameters.
[cc65] / libsrc / geos-common / conio / cclear.s
1 ;
2 ; Maciej 'YTM/Elysium' Witkowiak
3 ;
4 ; 06.03.2002
5
6 ; void cclearxy (unsigned char x, unsigned char y, unsigned char length);
7 ; void cclear (unsigned char length);
8
9             .export _cclearxy, _cclear
10             .import gotoxy, fixcursor
11             .importzp cursor_x, cursor_y, cursor_c
12
13             .include "jumptab.inc"
14             .include "geossym.inc"
15
16 _cclearxy:
17         pha                     ; Save the length
18         jsr gotoxy              ; Call this one, will pop params
19         pla                     ; Restore the length
20
21 _cclear:
22         cmp #0                  ; Is the length zero?
23         beq L9                  ; Jump if done
24         tax
25         lda cursor_x            ; left start
26         sta r3L
27         lda cursor_x+1
28         sta r3L+1
29         lda cursor_y            ; level
30         sta r2L
31         clc
32         adc #7
33         sta r2H
34         txa                     ; right end
35         clc
36         adc cursor_c
37         sta cursor_c
38         sta r4L
39         ldx #r4
40         ldy #3
41         jsr DShiftLeft
42         clc                     ; one pixel less
43         lda r4L
44         sbc #0
45         sta r4L
46         lda r4L+1
47         sbc #0
48         sta r4L+1
49         lda curPattern          ; store current pattern
50         pha
51         lda #0                  ; set pattern to clear
52         jsr SetPattern
53         jsr Rectangle
54         pla
55         jsr SetPattern          ; restore pattern
56         jsr fixcursor
57 L9:     rts