]> git.sur5r.net Git - cc65/blob - libsrc/atari/atari-3.s
changes from Fatih
[cc65] / libsrc / atari / atari-3.s
1 ;
2 ; Graphics driver for the 40x24x4 (CIO mode 3, ANTIC mode 8) on the Atari.
3 ;
4 ; Fatih Aygun (2009)
5 ;
6
7         .include        "atari.inc"
8         .include        "zeropage.inc"
9
10         .include        "tgi-kernel.inc"
11         .include        "tgi-mode.inc"
12         .include        "tgi-error.inc"
13
14         .macpack        generic
15
16 ; ******************************************************************************
17
18         ; ----------------------------------------------------------------------
19         ;
20         ; Constants and tables
21         ;
22         ; ----------------------------------------------------------------------
23
24 ; Graphics mode
25         grmode = 3
26 ; X resolution
27         x_res = 40
28 ; Y resolution
29         y_res = 24
30 ; Number of colors
31         colors = 4
32 ; Pixels per byte
33         ppb = 4
34 ; Screen memory size in bytes
35         scrsize = x_res * y_res / ppb
36 ; Pixel aspect ratio
37         aspect = $0100                          ; 1:1
38 ; Free memory needed
39         mem_needed = 1
40 ; Number of screen pages
41         pages = 1
42
43 .rodata
44         mask_table:                             ; Mask table to set pixels
45                 .byte   %11000000, %00110000, %00001100, %00000011
46         masks:                                  ; Color masks
47                 .byte   %00000000, %01010101, %10101010, %11111111
48         bar_table:                              ; Mask table for BAR
49                 .byte   %11111111, %00111111, %00001111, %00000011, %00000000
50         default_palette:
51                 .byte   $00, $0E, $32, $96
52
53 .code
54
55 ; ******************************************************************************
56
57 .proc SETPALETTE
58
59         ; ----------------------------------------------------------------------
60         ;
61         ; SETPALETTE: Set the palette (in ptr1)
62         ;
63         ; ----------------------------------------------------------------------
64
65 .code
66         ; Copy the palette
67         ldy     #colors - 1
68 loop:   lda     (ptr1),y
69         sta     palette,y
70         dey
71         bpl     loop
72
73         ; Get the color entries from the palette
74         lda     palette
75         sta     COLOR4
76         lda     palette + 1
77         sta     COLOR0
78         lda     palette + 2
79         sta     COLOR1
80         lda     palette + 3
81         sta     COLOR2
82
83         ; Done, reset the error code
84         lda     #TGI_ERR_OK
85         sta     error
86         rts
87 .endproc
88
89 .include "atari_tgi_common.inc"