]> git.sur5r.net Git - cc65/blob - libsrc/atari5200/conioscreen.s
cleanups and add comments
[cc65] / libsrc / atari5200 / conioscreen.s
1 ; setup default CONIO screen (20x24, Antic mode 6, BASIC mode 1)
2 ;
3 ; 28-May-2014, Christian Groessler <chris@groessler.org>
4
5                 .include "atari5200.inc"
6
7 SCREEN_BUF_SIZE =       20 * 24
8 SCREEN_BUF      =       $4000 - SCREEN_BUF_SIZE
9
10                 .code
11                 .export screen_setup_20x24
12
13 screen_setup_20x24:
14
15                 ; initialize SAVMSC
16                 lda     #<SCREEN_BUF
17                 sta     SAVMSC
18                 lda     #>SCREEN_BUF
19                 sta     SAVMSC+1
20
21                 ; initialize cursor position
22                 lda     #0
23                 sta     COLCRS_5200
24                 sta     ROWCRS_5200
25
26                 ; clear screen buffer
27                 ldy     #<(SCREEN_BUF_SIZE-1)
28                 ldx     #>(SCREEN_BUF_SIZE-1)
29 clrscr:         sta     (SAVMSC),y
30                 dey
31                 cpy     #$FF
32                 bne     clrscr
33                 dex
34                 cpx     #$FF
35                 bne     clrscr
36
37                 ; set default colors
38
39                 lda     #40
40                 sta     COLOR0
41                 lda     #202
42                 sta     COLOR1
43                 lda     #148
44                 sta     COLOR2
45                 lda     #70
46                 sta     COLOR3
47                 lda     #0
48                 sta     COLOR4
49
50                 ; set display list
51
52                 lda     #<dlist
53                 sta     SDLSTL
54                 lda     #>dlist
55                 sta     SDLSTH
56
57                 rts
58
59
60                 .segment "RODATA"
61
62 ; display list for 20x24 text mode
63
64 dlist:          .repeat 3
65                 .byte   DL_BLK8
66                 .endrepeat
67                 
68                 .byte   DL_CHR20x8x2 | DL_LMS
69                 .word   SCREEN_BUF
70
71                 .repeat 23
72                 .byte   DL_CHR20x8x2
73                 .endrepeat
74
75                 .byte  DL_JVB
76                 .word   dlist
77
78 ; end of display list
79
80 .assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary"
81
82
83                 .end