]> git.sur5r.net Git - cc65/blob - libsrc/atari/atari-8.s
DIO functions always set _oserror.
[cc65] / libsrc / atari / atari-8.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-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 = 8
26 ; X resolution
27         x_res = 320
28 ; Y resolution
29         y_res = 192
30 ; Number of colors
31         colors = 2
32 ; Pixels per byte
33         ppb = 8
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 = 7147
40 ; Number of screen pages
41         pages = 1
42
43 .rodata
44         mask_table:                             ; Mask table to set pixels
45                 .byte   %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
46         masks:                                  ; Color masks
47                 .byte   %00000000, %11111111
48         bar_table:                              ; Mask table for BAR
49                 .byte   %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
50         default_palette:
51                 .byte   $00, $0E
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     COLOR2
75         lda     palette + 1
76         sta     COLOR1
77
78         ; Done, reset the error code
79         lda     #TGI_ERR_OK
80         sta     error
81         rts
82 .endproc
83
84 .include "atari_tgi_common.inc"