]> git.sur5r.net Git - cc65/blob - libsrc/atari/tgi/atari8.s
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / libsrc / atari / tgi / atari8.s
1 ;
2 ; Graphics driver for the 320x192x2 (CIO mode 8, ANTIC mode F) 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 = 8
25 ; X resolution
26         x_res = 320
27 ; Y resolution
28         y_res = 192
29 ; Number of colors
30         colors = 2
31 ; Pixels per byte
32         ppb = 8
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 = 7147
39 ; Number of screen pages
40         pages = 1
41
42 .rodata
43         mask_table:                             ; Mask table to set pixels
44                 .byte   %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
45         masks:                                  ; Color masks
46                 .byte   %00000000, %11111111
47         bar_table:                              ; Mask table for BAR
48                 .byte   %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
49         default_palette:
50                 .byte   $00, $0E
51 .code
52
53 ; ******************************************************************************
54
55 .proc SETPALETTE
56
57         ; ----------------------------------------------------------------------
58         ;
59         ; SETPALETTE: Set the palette (in ptr1)
60         ;
61         ; ----------------------------------------------------------------------
62
63 .code
64         ; Copy the palette
65         ldy     #colors - 1
66 loop:   lda     (ptr1),y
67         sta     palette,y
68         dey
69         bpl     loop
70
71         ; Get the color entries from the palette
72         lda     palette
73         sta     COLOR2
74         lda     palette + 1
75         sta     COLOR1
76
77         ; Done, reset the error code
78         lda     #TGI_ERR_OK
79         sta     error
80         rts
81 .endproc
82
83 .include "atari_tgi_common.inc"