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