]> git.sur5r.net Git - cc65/blob - libsrc/geos-common/conio/cclear.s
9857f70e81277b15a5b25c94b9179b968a12fba0
[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 popa, _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 popa                ; Get y
19         jsr _gotoxy             ; Call this one, will pop params
20         pla                     ; Restore the length
21
22 _cclear:
23         cmp #0                  ; Is the length zero?
24         beq L9                  ; Jump if done
25         tax
26         lda cursor_x            ; left start
27         sta r3L
28         lda cursor_x+1
29         sta r3L+1
30         lda cursor_y            ; level
31         sta r2L
32         clc
33         adc #7
34         sta r2H
35         txa                     ; right end
36         clc
37         adc cursor_c
38         sta cursor_c
39         sta r4L
40         ldx #r4
41         ldy #3
42         jsr DShiftLeft
43         clc                     ; one pixel less
44         lda r4L
45         sbc #0
46         sta r4L
47         lda r4L+1
48         sbc #0
49         sta r4L+1
50         lda curPattern          ; store current pattern
51         pha
52         lda #0                  ; set pattern to clear
53         jsr SetPattern
54         jsr Rectangle
55         pla
56         jsr SetPattern          ; restore pattern
57         jsr fixcursor
58 L9:     rts