]> git.sur5r.net Git - cc65/blob - libsrc/atari5200/conioscreen.s
atari5200 update: simple conio "hello world" works now
[cc65] / libsrc / atari5200 / conioscreen.s
1
2                 .include "atari5200.inc"
3
4 SCREEN_BUF_SIZE =       20 * 24
5 SCREEN_BUF      =       $4000 - SCREEN_BUF_SIZE
6
7                 .code
8                 .export screen_setup_20x24
9
10 screen_setup_20x24:
11
12                 ; initialize SAVMSC
13                 lda     #<SCREEN_BUF
14                 sta     SAVMSC
15                 lda     #>SCREEN_BUF
16                 sta     SAVMSC+1
17
18                 ; initialize cursor position
19                 lda     #0
20                 sta     COLCRS_5200
21                 sta     ROWCRS_5200
22
23                 ; clear screen buffer
24                 ldy     #<(SCREEN_BUF_SIZE-1)
25                 ldx     #>(SCREEN_BUF_SIZE-1)
26 clrscr:         sta     (SAVMSC),y
27                 dey
28                 cpy     #$FF
29                 bne     clrscr
30                 dex
31                 cpx     #$FF
32                 bne     clrscr
33
34                 ; set display list
35
36                 lda     #<dlist
37                 sta     SDLSTL
38                 lda     #>dlist
39                 sta     SDLSTH
40
41                 rts
42
43
44                 .segment "RODATA"
45
46 ; display list for 20x24 text mode
47
48 dlist:          .repeat 3
49                 .byte   DL_BLK8
50                 .endrepeat
51                 
52                 .byte   DL_CHR20x8x2 | DL_LMS
53                 .word   SCREEN_BUF
54
55                 .repeat 23
56                 .byte   DL_CHR20x8x2
57                 .endrepeat
58
59                 .byte  DL_JVB
60                 .word   dlist
61
62 ; end of display list
63
64 .assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary"
65
66
67                 .end