]> git.sur5r.net Git - cc65/blob - libsrc/atari/atari-10p2.s
f4b6a7450743727279c7aeec098dacd0fe10e50d
[cc65] / libsrc / atari / atari-10p2.s
1 ;
2 ; Graphics driver for the 80x192x9 (CIO mode 10, ANTIC mode F, GTIA mode $80) 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         .define grmode 10
26 ; X resolution
27         .define x_res 80
28 ; Y resolution
29         .define y_res 192
30 ; Number of colors
31         .define colors 9
32 ; Pixels per byte
33         .define ppb 2
34 ; Screen memory size in bytes
35         .define scrsize x_res * y_res / ppb
36 ; Pixel aspect ratio
37         .define aspect $0400                            ; 4:1
38 ; Free memory needed
39         .define mem_needed 15339
40 ; Number of screen pages
41         .define pages 2
42
43 .rodata
44         mask_table:                             ; Mask table to set pixels
45                 .byte   %11110000, %00001111
46         masks:                                  ; Color masks
47                 .byte   $00, $11, $22, $33, $44, $55, $66, $77, $88
48         bar_table:                              ; Mask table for BAR
49                 .byte   %11111111, %00001111, %00000000
50         default_palette:
51                 .byte   $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A
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         sta     PCOLR0,y
71         dey
72         bpl     loop
73
74         ; Done, reset the error code
75         lda     #TGI_ERR_OK
76         sta     error
77         rts
78 .endproc
79
80 .include "atari_tgi_common.inc"