]> git.sur5r.net Git - cc65/blob - libsrc/atari/setcursor.s
cf596d4fea238a3e928e2140975de3372bf833e9
[cc65] / libsrc / atari / setcursor.s
1 ;
2 ; Christian Groessler, November-2002
3 ;
4 ; cursor handling, internal function
5
6         .include "atari.inc"
7         .import cursor,mul40
8         .export setcursor
9
10 .proc   setcursor
11
12         ldy     #0
13         lda     OLDCHR
14         sta     (OLDADR),y
15
16         lda     ROWCRS
17         jsr     mul40
18         clc
19         adc     SAVMSC          ; add start of screen memory
20         sta     OLDADR
21         txa
22         adc     SAVMSC+1
23         sta     OLDADR+1
24         lda     COLCRS
25         adc     OLDADR
26         sta     OLDADR
27         bcc     nc
28         inc     OLDADR+1
29 nc:     lda     (OLDADR),y
30         sta     OLDCHR
31
32         ldx     cursor          ; current cursor setting as requested by the user
33         beq     off
34         ldx     #0
35         beq     cont
36
37 off:    inx
38 cont:   stx     CRSINH          ; update system variable
39
40         beq     turnon
41         and     #$7f            ; clear high bit / inverse flag
42 finish: sta     (OLDADR),y      ; update on-screen display
43         rts
44
45 turnon: ora     #$80            ; set high bit / inverse flag
46         bne     finish
47
48 .endproc