2009-11-10 21:53:55 +00:00
|
|
|
;
|
|
|
|
; Graphics driver for the 80x48x4 (CIO mode 5, ANTIC mode A) on the Atari.
|
|
|
|
;
|
|
|
|
; Fatih Aygun (2009)
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "atari.inc"
|
|
|
|
.include "zeropage.inc"
|
2009-11-10 21:53:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "tgi-kernel.inc"
|
|
|
|
.include "tgi-error.inc"
|
2009-11-10 21:53:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.macpack generic
|
2009-11-10 21:53:55 +00:00
|
|
|
|
|
|
|
; ******************************************************************************
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
; ----------------------------------------------------------------------
|
|
|
|
;
|
|
|
|
; Constants and tables
|
|
|
|
;
|
|
|
|
; ----------------------------------------------------------------------
|
2009-11-10 21:53:55 +00:00
|
|
|
|
|
|
|
; Graphics mode
|
2013-05-09 11:56:54 +00:00
|
|
|
grmode = 5
|
2009-11-10 21:53:55 +00:00
|
|
|
; X resolution
|
2013-05-09 11:56:54 +00:00
|
|
|
x_res = 80
|
2009-11-10 21:53:55 +00:00
|
|
|
; Y resolution
|
2013-05-09 11:56:54 +00:00
|
|
|
y_res = 48
|
2009-11-10 21:53:55 +00:00
|
|
|
; Number of colors
|
2013-05-09 11:56:54 +00:00
|
|
|
colors = 4
|
2009-11-10 21:53:55 +00:00
|
|
|
; Pixels per byte
|
2013-05-09 11:56:54 +00:00
|
|
|
ppb = 4
|
2009-11-10 21:53:55 +00:00
|
|
|
; Screen memory size in bytes
|
2013-05-09 11:56:54 +00:00
|
|
|
scrsize = x_res * y_res / ppb
|
2009-11-10 21:53:55 +00:00
|
|
|
; Pixel aspect ratio
|
2013-05-09 11:56:54 +00:00
|
|
|
aspect = $00CC ; based on 4/3 display
|
2009-11-10 21:53:55 +00:00
|
|
|
; Free memory needed
|
2013-05-09 11:56:54 +00:00
|
|
|
mem_needed = 185
|
2009-11-10 21:53:55 +00:00
|
|
|
; Number of screen pages
|
2013-05-09 11:56:54 +00:00
|
|
|
pages = 1
|
2009-11-10 21:53:55 +00:00
|
|
|
|
|
|
|
.rodata
|
2013-05-09 11:56:54 +00:00
|
|
|
mask_table: ; Mask table to set pixels
|
|
|
|
.byte %11000000, %00110000, %00001100, %00000011
|
|
|
|
masks: ; Color masks
|
|
|
|
.byte %00000000, %01010101, %10101010, %11111111
|
|
|
|
bar_table: ; Mask table for BAR
|
|
|
|
.byte %11111111, %00111111, %00001111, %00000011, %00000000
|
|
|
|
default_palette:
|
|
|
|
.byte $00, $0E, $32, $96
|
2009-11-10 21:53:55 +00:00
|
|
|
|
|
|
|
.code
|
|
|
|
|
|
|
|
; ******************************************************************************
|
|
|
|
|
|
|
|
.proc SETPALETTE
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
; ----------------------------------------------------------------------
|
|
|
|
;
|
|
|
|
; SETPALETTE: Set the palette (in ptr1)
|
|
|
|
;
|
|
|
|
; ----------------------------------------------------------------------
|
2009-11-10 21:53:55 +00:00
|
|
|
|
|
|
|
.code
|
2013-05-09 11:56:54 +00:00
|
|
|
; Copy the palette
|
|
|
|
ldy #colors - 1
|
|
|
|
loop: lda (ptr1),y
|
|
|
|
sta palette,y
|
|
|
|
dey
|
|
|
|
bpl loop
|
2009-11-10 21:53:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
; Get the color entries from the palette
|
|
|
|
lda palette
|
|
|
|
sta COLOR4
|
|
|
|
lda palette + 1
|
|
|
|
sta COLOR0
|
|
|
|
lda palette + 2
|
|
|
|
sta COLOR1
|
|
|
|
lda palette + 3
|
|
|
|
sta COLOR2
|
2009-11-10 21:53:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
; Done, reset the error code
|
2009-11-10 21:53:55 +00:00
|
|
|
lda #TGI_ERR_OK
|
|
|
|
sta error
|
|
|
|
rts
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
.include "atari_tgi_common.inc"
|