mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-21 21:29:17 +00:00
atari5200: added atari5200.inc, display list test
This commit is contained in:
parent
be505566ee
commit
3e8436126b
387
presets/atari8-5200/atari5200.inc
Normal file
387
presets/atari8-5200/atari5200.inc
Normal file
@ -0,0 +1,387 @@
|
||||
;-------------------------------------------------------------------------
|
||||
; Atari 5200 System Equates
|
||||
; by Christian Groessler <chris@groessler.org>
|
||||
; taken from EQUATES.INC from Atari Inc.
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; ATASCII CHARACTER DEFS
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
ATEOL = $9B ; END-OF-LINE, used by CONIO
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; CONIO CHARACTER DEFS
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
CH_ULCORNER = $0B ; '+' sign
|
||||
CH_URCORNER = $0B
|
||||
CH_LLCORNER = $0B
|
||||
CH_LRCORNER = $0B
|
||||
CH_HLINE = $0D ; dash
|
||||
CH_VLINE = $01 ; exclamation mark
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; Zero Page
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
POKMSK = $00 ; Mask for Pokey IRQ enable
|
||||
RTCLOK = $01 ; 60 hz. clock
|
||||
JUMP = $01
|
||||
CRITIC = $03 ; Critical section
|
||||
ATRACT = $04 ; Attract Mode
|
||||
|
||||
SDLSTL = $05 ; DLISTL Shadow
|
||||
SDLSTH = $06 ; DLISTH "
|
||||
SDMCTL = $07 ; DMACTL "
|
||||
|
||||
PCOLR0 = $08 ; COLPM0 Shadow
|
||||
PCOLR1 = $09 ; COLPM1 "
|
||||
PCOLR2 = $0A ; COLPM2 "
|
||||
PCOLR3 = $0B ; COLPM3 "
|
||||
|
||||
COLOR0 = $0C ; COLPF0 Shadow
|
||||
COLOR1 = $0D ; COLPF1 "
|
||||
COLOR2 = $0E ; COLPF2 "
|
||||
COLOR3 = $0F ; COLPF3 "
|
||||
COLOR4 = $10 ; COLBK "
|
||||
|
||||
PADDL0 = $11 ; POT0 Shadow
|
||||
PADDL1 = $12 ; POT1 "
|
||||
PADDL2 = $13 ; POT2 "
|
||||
PADDL3 = $14 ; POT3 "
|
||||
PADDL4 = $15 ; POT4 "
|
||||
PADDL5 = $16 ; POT5 "
|
||||
PADDL6 = $17 ; POT6 "
|
||||
PADDL7 = $18 ; POT7 "
|
||||
|
||||
; cc65 runtime zero page variables
|
||||
|
||||
ROWCRS_5200 = $19
|
||||
COLCRS_5200 = $1A
|
||||
SAVMSC = $1B ; pointer to screen memory (conio)
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; Page #2
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
;Interrupt Vectors
|
||||
|
||||
VIMIRQ = $0200 ; Immediate IRQ
|
||||
; Preset $FC03 (SYSIRQ)
|
||||
VVBLKI = $0202 ; Vblank immediate
|
||||
; Preset $FCB8 (SYSVBL)
|
||||
VVBLKD = $0204 ; Vblank deferred
|
||||
; Preset $FCB2 (XITVBL)
|
||||
VDSLST = $0206 ; Display List
|
||||
; Preset $FEA1 (OSDLI)
|
||||
VKYBDI = $0208 ; Keyboard immediate
|
||||
; Preset $FD02 (SYSKBD)
|
||||
VKYBDF = $020A ; Deferred Keyboard
|
||||
; Preset $FCB2 (XITVBL)
|
||||
VTRIGR = $020C ; Soft Trigger
|
||||
VBRKOP = $020E ; BRK Opcode
|
||||
VSERIN = $0210 ; Serial in Ready
|
||||
VSEROR = $0212 ; Serial Out Ready
|
||||
VSEROC = $0214 ; Serial Output complete
|
||||
VTIMR1 = $0216 ; Pokey Timer 1
|
||||
VTIMR2 = $0218 ; Pokey Timer 2
|
||||
VTIMR4 = $021A ; Pokey Timer 4
|
||||
|
||||
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; CTIA/GTIA Address Equates
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
GTIA = $C000 ; CTIA/GTIA area
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; ANTIC Address Equates
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
ANTIC = $D400 ; ANTIC area
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; POKEY Address Equates
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
POKEY = $E800 ; POKEY area
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; conio color defines
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
COLOR_WHITE = 0
|
||||
COLOR_RED = 1
|
||||
COLOR_GREEN = 2
|
||||
COLOR_BLACK = 3
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; Cartridge Parameters
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
CARTNM = $BFE8 ; Cartridge Name Area
|
||||
COPYD = $BFFC ; Copyright Decade in Cart
|
||||
COPYR = $BFFD ; Copyright Year in Cart
|
||||
; $FF=Diagnostic Cart
|
||||
GOCART = $BFFE ; Cartridge Start Vector
|
||||
|
||||
CHRORG = $F800 ; Character Generator Base
|
||||
;-------------------------------------------------------------------------
|
||||
; ANTIC Address Equates
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
; Read Addresses
|
||||
|
||||
VCOUNT = ANTIC + $0B ;vertical line counter
|
||||
PENH = ANTIC + $0C ;light pen horizontal position
|
||||
PENV = ANTIC + $0D ;light pen vertical position
|
||||
NMIST = ANTIC + $0F ;NMI interrupt status
|
||||
|
||||
; Write Addresses
|
||||
|
||||
DMACTL = ANTIC + $00 ;DMA control
|
||||
CHACTL = ANTIC + $01 ;character control
|
||||
DLISTL = ANTIC + $02 ;low display list address
|
||||
DLISTH = ANTIC + $03 ;high display list address
|
||||
HSCROL = ANTIC + $04 ;horizontal scroll
|
||||
VSCROL = ANTIC + $05 ;vertical scroll
|
||||
PMBASE = ANTIC + $07 ;player-missile base address
|
||||
CHBASE = ANTIC + $09 ;character base address
|
||||
WSYNC = ANTIC + $0A ;wait for HBLANK synchronization
|
||||
NMIEN = ANTIC + $0E ;NMI enable
|
||||
NMIRES = ANTIC + $0F ;NMI interrupt reset
|
||||
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; Antic opcodes
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
; usage example:
|
||||
;
|
||||
; ScreenDL:
|
||||
; .byte DL_BLK8
|
||||
; .byte DL_BLK8
|
||||
; .byte DL_CHR40x8x1 | DL_LMS | DL_DLI
|
||||
; .word ScreenAlignment
|
||||
; .byte DL_BLK1 | DL_DLI
|
||||
; .byte DL_MAP320x1x1 | DL_LMS
|
||||
; .word Screen
|
||||
;
|
||||
; .repeat 99
|
||||
; .byte DL_MAP320x1x1
|
||||
; .endrepeat
|
||||
; .byte DL_MAP320x1x1 | DL_LMS
|
||||
; .word Screen + 40 * 100 ; 100 lines a 40 byte, 'Screen' has to be aligned correctly!
|
||||
; .repeat 92
|
||||
; .byte DL_MAP320x1x1
|
||||
; .endrepeat
|
||||
;
|
||||
; .byte DL_JVB
|
||||
|
||||
; absolute instructions (non mode lines)
|
||||
|
||||
DL_JMP = 1
|
||||
DL_JVB = 65
|
||||
|
||||
; DL_BLKn display n empty lines (just background)
|
||||
|
||||
DL_BLK1 = 0
|
||||
DL_BLK2 = 16
|
||||
DL_BLK3 = 32
|
||||
DL_BLK4 = 48
|
||||
DL_BLK5 = 64
|
||||
DL_BLK6 = 80
|
||||
DL_BLK7 = 96
|
||||
DL_BLK8 = 112
|
||||
|
||||
; absolute instructions (mode lines)
|
||||
|
||||
DL_CHR40x8x1 = 2 ; monochrome, 40 character & 8 scanlines per mode line (GR. 0)
|
||||
DL_CHR40x10x1 = 3 ; monochrome, 40 character & 10 scanlines per mode line
|
||||
DL_CHR40x8x4 = 4 ; colour, 40 character & 8 scanlines per mode line (GR. 12)
|
||||
DL_CHR40x16x4 = 5 ; colour, 40 character & 16 scanlines per mode line (GR. 13)
|
||||
DL_CHR20x8x2 = 6 ; colour (duochrome per character), 20 character & 8 scanlines per mode line (GR. 1)
|
||||
DL_CHR20x16x2 = 7 ; colour (duochrome per character), 20 character & 16 scanlines per mode line (GR. 2)
|
||||
|
||||
DL_MAP40x8x4 = 8 ; colour, 40 pixel & 8 scanlines per mode line (GR. 3)
|
||||
DL_MAP80x4x2 = 9 ; 'duochrome', 80 pixel & 4 scanlines per mode line (GR.4)
|
||||
DL_MAP80x4x4 = 10 ; colour, 80 pixel & 4 scanlines per mode line (GR.5)
|
||||
DL_MAP160x2x2 = 11 ; 'duochrome', 160 pixel & 2 scanlines per mode line (GR.6)
|
||||
DL_MAP160x1x2 = 12 ; 'duochrome', 160 pixel & 1 scanline per mode line (GR.14)
|
||||
DL_MAP160x2x4 = 13 ; 4 colours, 160 pixel & 2 scanlines per mode line (GR.7)
|
||||
DL_MAP160x1x4 = 14 ; 4 colours, 160 pixel & 1 scanline per mode line (GR.15)
|
||||
DL_MAP320x1x1 = 15 ; monochrome, 320 pixel & 1 scanline per mode line (GR.8)
|
||||
|
||||
; modifiers on mode lines...
|
||||
|
||||
DL_HSCROL = 16
|
||||
DL_VSCROL = 32
|
||||
DL_LMS = 64
|
||||
|
||||
; general modifier...
|
||||
|
||||
DL_DLI = 128
|
||||
;-------------------------------------------------------------------------
|
||||
; CTIA/GTIA Address Equates
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
; Read/Write Addresses
|
||||
|
||||
CONSOL = GTIA + $1F ;console switches and speaker control
|
||||
|
||||
; Read Addresses
|
||||
|
||||
M0PF = GTIA + $00 ;missile 0 and playfield collision
|
||||
M1PF = GTIA + $01 ;missile 1 and playfield collision
|
||||
M2PF = GTIA + $02 ;missile 2 and playfield collision
|
||||
M3PF = GTIA + $03 ;missile 3 and playfield collision
|
||||
|
||||
P0PF = GTIA + $04 ;player 0 and playfield collision
|
||||
P1PF = GTIA + $05 ;player 1 and playfield collision
|
||||
P2PF = GTIA + $06 ;player 2 and playfield collision
|
||||
P3PF = GTIA + $07 ;player 3 and playfield collision
|
||||
|
||||
M0PL = GTIA + $08 ;missile 0 and player collision
|
||||
M1PL = GTIA + $09 ;missile 1 and player collision
|
||||
M2PL = GTIA + $0A ;missile 2 and player collision
|
||||
M3PL = GTIA + $0B ;missile 3 and player collision
|
||||
|
||||
P0PL = GTIA + $0C ;player 0 and player collision
|
||||
P1PL = GTIA + $0D ;player 1 and player collision
|
||||
P2PL = GTIA + $0E ;player 2 and player collision
|
||||
P3PL = GTIA + $0F ;player 3 and player collision
|
||||
|
||||
TRIG0 = GTIA + $10 ;joystick trigger 0
|
||||
TRIG1 = GTIA + $11 ;joystick trigger 1
|
||||
|
||||
TRIG2 = GTIA + $12 ;cartridge interlock
|
||||
TRIG3 = GTIA + $13 ;ACMI module interlock
|
||||
|
||||
PAL = GTIA + $14 ;##rev2## PAL/NTSC indicator
|
||||
|
||||
; Write Addresses
|
||||
|
||||
HPOSP0 = GTIA + $00 ;player 0 horizontal position
|
||||
HPOSP1 = GTIA + $01 ;player 1 horizontal position
|
||||
HPOSP2 = GTIA + $02 ;player 2 horizontal position
|
||||
HPOSP3 = GTIA + $03 ;player 3 horizontal position
|
||||
|
||||
HPOSM0 = GTIA + $04 ;missile 0 horizontal position
|
||||
HPOSM1 = GTIA + $05 ;missile 1 horizontal position
|
||||
HPOSM2 = GTIA + $06 ;missile 2 horizontal position
|
||||
HPOSM3 = GTIA + $07 ;missile 3 horizontal position
|
||||
|
||||
SIZEP0 = GTIA + $08 ;player 0 size
|
||||
SIZEP1 = GTIA + $09 ;player 1 size
|
||||
SIZEP2 = GTIA + $0A ;player 2 size
|
||||
SIZEP3 = GTIA + $0B ;player 3 size
|
||||
|
||||
SIZEM = GTIA + $0C ;missile sizes
|
||||
|
||||
GRAFP0 = GTIA + $0D ;player 0 graphics
|
||||
GRAFP1 = GTIA + $0E ;player 1 graphics
|
||||
GRAFP2 = GTIA + $0F ;player 2 graphics
|
||||
GRAFP3 = GTIA + $10 ;player 3 graphics
|
||||
|
||||
GRAFM = GTIA + $11 ;missile graphics
|
||||
|
||||
COLPM0 = GTIA + $12 ;player-missile 0 color/luminance
|
||||
COLPM1 = GTIA + $13 ;player-missile 1 color/luminance
|
||||
COLPM2 = GTIA + $14 ;player-missile 2 color/luminance
|
||||
COLPM3 = GTIA + $15 ;player-missile 3 color/luminance
|
||||
|
||||
COLPF0 = GTIA + $16 ;playfield 0 color/luminance
|
||||
COLPF1 = GTIA + $17 ;playfield 1 color/luminance
|
||||
COLPF2 = GTIA + $18 ;playfield 2 color/luminance
|
||||
COLPF3 = GTIA + $19 ;playfield 3 color/luminance
|
||||
|
||||
COLBK = GTIA + $1A ;background color/luminance
|
||||
|
||||
PRIOR = GTIA + $1B ;priority select
|
||||
VDELAY = GTIA + $1C ;vertical delay
|
||||
GRACTL = GTIA + $1D ;graphic control
|
||||
HITCLR = GTIA + $1E ;collision clear
|
||||
|
||||
|
||||
; Hue values
|
||||
|
||||
HUE_GREY = 0
|
||||
HUE_GOLD = 1
|
||||
HUE_GOLDORANGE = 2
|
||||
HUE_REDORANGE = 3
|
||||
HUE_ORANGE = 4
|
||||
HUE_MAGENTA = 5
|
||||
HUE_PURPLE = 6
|
||||
HUE_BLUE = 7
|
||||
HUE_BLUE2 = 8
|
||||
HUE_CYAN = 9
|
||||
HUE_BLUEGREEN = 10
|
||||
HUE_BLUEGREEN2 = 11
|
||||
HUE_GREEN = 12
|
||||
HUE_YELLOWGREEN = 13
|
||||
HUE_YELLOW = 14
|
||||
HUE_YELLOWRED = 15
|
||||
|
||||
; Color defines, similar to c64 colors (untested)
|
||||
|
||||
GTIA_COLOR_BLACK = (HUE_GREY << 4)
|
||||
GTIA_COLOR_WHITE = (HUE_GREY << 4 | 7 << 1)
|
||||
GTIA_COLOR_RED = (HUE_REDORANGE << 4 | 1 << 1)
|
||||
GTIA_COLOR_CYAN = (HUE_CYAN << 4 | 3 << 1)
|
||||
GTIA_COLOR_VIOLET = (HUE_PURPLE << 4 | 4 << 1)
|
||||
GTIA_COLOR_GREEN = (HUE_GREEN << 4 | 2 << 1)
|
||||
GTIA_COLOR_BLUE = (HUE_BLUE << 4 | 2 << 1)
|
||||
GTIA_COLOR_YELLOW = (HUE_YELLOW << 4 | 7 << 1)
|
||||
GTIA_COLOR_ORANGE = (HUE_ORANGE << 4 | 5 << 1)
|
||||
GTIA_COLOR_BROWN = (HUE_YELLOW << 4 | 2 << 1)
|
||||
GTIA_COLOR_LIGHTRED = (HUE_REDORANGE << 4 | 6 << 1)
|
||||
GTIA_COLOR_GRAY1 = (HUE_GREY << 4 | 2 << 1)
|
||||
GTIA_COLOR_GRAY2 = (HUE_GREY << 4 | 3 << 1)
|
||||
GTIA_COLOR_LIGHTGREEN = (HUE_GREEN << 4 | 6 << 1)
|
||||
GTIA_COLOR_LIGHTBLUE = (HUE_BLUE << 4 | 6 << 1)
|
||||
GTIA_COLOR_GRAY3 = (HUE_GREY << 4 | 5 << 1)
|
||||
;-------------------------------------------------------------------------
|
||||
; POKEY Address Equates
|
||||
;-------------------------------------------------------------------------
|
||||
|
||||
; Read Addresses
|
||||
|
||||
POT0 = POKEY + $00 ;potentiometer 0
|
||||
POT1 = POKEY + $01 ;potentiometer 1
|
||||
POT2 = POKEY + $02 ;potentiometer 2
|
||||
POT3 = POKEY + $03 ;potentiometer 3
|
||||
POT4 = POKEY + $04 ;potentiometer 4
|
||||
POT5 = POKEY + $05 ;potentiometer 5
|
||||
POT6 = POKEY + $06 ;potentiometer 6
|
||||
POT7 = POKEY + $07 ;potentiometer 7
|
||||
|
||||
ALLPOT = POKEY + $08 ;potentiometer port status
|
||||
KBCODE = POKEY + $09 ;keyboard code
|
||||
RANDOM = POKEY + $0A ;random number generator
|
||||
SERIN = POKEY + $0D ;serial port input
|
||||
IRQST = POKEY + $0E ;IRQ interrupt status
|
||||
SKSTAT = POKEY + $0F ;serial port and keyboard status
|
||||
|
||||
; Write Addresses
|
||||
|
||||
AUDF1 = POKEY + $00 ;channel 1 audio frequency
|
||||
AUDC1 = POKEY + $01 ;channel 1 audio control
|
||||
|
||||
AUDF2 = POKEY + $02 ;channel 2 audio frequency
|
||||
AUDC2 = POKEY + $03 ;channel 2 audio control
|
||||
|
||||
AUDF3 = POKEY + $04 ;channel 3 audio frequency
|
||||
AUDC3 = POKEY + $05 ;channel 3 audio control
|
||||
|
||||
AUDF4 = POKEY + $06 ;channel 4 audio frequency
|
||||
AUDC4 = POKEY + $07 ;channel 4 audio control
|
||||
|
||||
AUDCTL = POKEY + $08 ;audio control
|
||||
STIMER = POKEY + $09 ;start timers
|
||||
SKRES = POKEY + $0A ;reset SKSTAT status
|
||||
POTGO = POKEY + $0B ;start potentiometer scan sequence
|
||||
SEROUT = POKEY + $0D ;serial port output
|
||||
IRQEN = POKEY + $0E ;IRQ interrupt enable
|
||||
SKCTL = POKEY + $0F ;serial port and keyboard control
|
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
; Atari 5200 "Hello World" sample code
|
||||
; Written by Daniel Boris (dboris@comcast.net)
|
||||
;
|
||||
@ -7,16 +7,7 @@
|
||||
|
||||
processor 6502
|
||||
|
||||
DMACTL equ $D400 ;DMA Control
|
||||
sDMACTL equ $07 ;DMA Control Shadow
|
||||
DLISTL equ $D402 ;Display list lo
|
||||
DLISTH equ $D403 ;Display list hi
|
||||
sDLISTL equ $05 ;Display list lo shadow
|
||||
sDLISTH equ $06 ;Display list hi shadow
|
||||
CHBASE equ $D409 ;Character set base
|
||||
CHACTL equ $D401 ;Character control
|
||||
NMIEN equ $D40E ;NMI Enable
|
||||
COLOR0 equ $0C ;Color 0 shadow
|
||||
include "atari5200.inc"
|
||||
|
||||
org $4000 ;Start of cartridge area
|
||||
sei ;Disable interrupts
|
||||
@ -78,15 +69,15 @@ dlloop ;Create Display List
|
||||
lda #$58
|
||||
sta COLOR0+3
|
||||
lda #$00 ;Set Display list pointer
|
||||
sta sDLISTL
|
||||
sta SDLSTL ;Shadow DLISTL
|
||||
sta DLISTL
|
||||
lda #$10
|
||||
sta sDLISTH
|
||||
sta SDLSTH ;Shadow DLISTH
|
||||
sta DLISTH
|
||||
lda #$f8 ;Set Charcter Set Base
|
||||
sta CHBASE
|
||||
lda #$22 ;Enable DMA
|
||||
sta sDMACTL
|
||||
sta SDMCTL ;Shadow DMACTL
|
||||
lda #$40 ;Enable NMI
|
||||
sta NMIEN
|
||||
|
||||
@ -108,17 +99,15 @@ wait
|
||||
nop
|
||||
jmp wait
|
||||
|
||||
;Display list data
|
||||
org $b000
|
||||
dlist .byte $70,$70,$70
|
||||
.byte $42,$00,$18,$02
|
||||
.byte $43,$00,$18,$02
|
||||
.byte $44,$00,$18,$02
|
||||
.byte $45,$00,$18,$02
|
||||
.byte $46,$00,$18,$06
|
||||
.byte $47,$00,$18,$06
|
||||
.byte $02,$02,$02,$02
|
||||
.byte $41,$00,$10
|
||||
;Display list data (starts at $1000)
|
||||
dlist .byte $70,$70,$70 ;24 blank scanlines
|
||||
.byte $42,$00,$18,$02 ;mode 2 @ $1800
|
||||
.byte $43,$00,$18,$02 ;mode 3 @ $1800
|
||||
.byte $44,$00,$18,$02 ;mode 4 @ $1800
|
||||
.byte $45,$00,$18,$02 ;mode 5 @ $1800
|
||||
.byte $46,$00,$18,$06 ;mode 6 @ $1800
|
||||
.byte $47,$00,$18,$06 ;mode 7 @ $1800
|
||||
.byte $41,$00,$10 ;JMP -> $1000
|
||||
|
||||
;Text data
|
||||
org $b100
|
||||
|
95
presets/atari8-5200/hellodlist.c
Normal file
95
presets/atari8-5200/hellodlist.c
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
This example demonstrates setting up a ANTIC display list in C.
|
||||
We have two lines of text on the top, two lines on the bottom,
|
||||
and a bitmap in the middle.
|
||||
*/
|
||||
#include <peekpoke.h>
|
||||
#include <atari5200.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
// shadow registers for the 5200
|
||||
#define POKMSK (*(unsigned char*)0x00) // Mask for Pokey IRQ enable
|
||||
#define RTCLOK (*(unsigned char*)0x01) // 60 hz. clock
|
||||
#define CRITIC (*(unsigned char*)0x03) // critical section
|
||||
#define ATRACT (*(unsigned char*)0x04) // attract mode
|
||||
#define SDLIST (*(unsigned int*) 0x05) // Display list start shadow
|
||||
#define SDMCTL (*(unsigned char*)0x07) // Antic DMA control shadow
|
||||
#define PCOLOR ((unsigned char[4])0x08) // COLPM[0-3] shadow
|
||||
#define COLORS ((unsigned char[5])0x0c) // COLOR[0-4] shadow
|
||||
#define PADDLS ((unsigned char[8])0x11) // POT[0-7] shadow
|
||||
|
||||
// screen RAM structure definition
|
||||
typedef struct ScreenMemoryDef {
|
||||
char topStatusLine[2][40];
|
||||
char bottomStatusLine[4][40];
|
||||
char bitmap[80][40];
|
||||
} ScreenMemoryDef;
|
||||
|
||||
// screen RAM variable
|
||||
ScreenMemoryDef screen;
|
||||
|
||||
// display list definition
|
||||
const void displayList = {
|
||||
DL_BLK8, // 8 blank scanlines
|
||||
DL_BLK8, // 8 blank scanlines
|
||||
// top status line (2 lines)
|
||||
DL_LMS(DL_CHR40x8x1), //Load Memory Scan (next two bytes must be the LSB/MSB of the data to load)
|
||||
screen.topStatusLine, // address of frame buffer
|
||||
DL_CHR40x10x1, // second line of text
|
||||
// 80x2 lines of 160x2x4 bitmap
|
||||
DL_LMS(DL_MAP160x2x4), // first line of bitmap
|
||||
screen.bitmap, // bitmap address
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
|
||||
// bottom status line (4 lines)
|
||||
DL_LMS(DL_CHR40x8x1), //Load Memory Scan (next two bytes must be the LSB/MSB of the data to load)
|
||||
screen.bottomStatusLine,
|
||||
DL_CHR40x8x1, DL_CHR40x8x1, DL_CHR40x8x1, // next 3 lines of text
|
||||
// wait for vertical blank
|
||||
DL_JVB,
|
||||
// restart display list
|
||||
DL_JMP,
|
||||
&displayList
|
||||
};
|
||||
|
||||
void main(void) {
|
||||
unsigned int i;
|
||||
|
||||
SDMCTL = 0; // turn off ANTIC
|
||||
SDLIST = (unsigned int) &displayList; // set display list
|
||||
SDMCTL = 0x22; // turn on ANTIC
|
||||
|
||||
// set screen memory
|
||||
for(i=0; i<40; ++i) {
|
||||
screen.topStatusLine[0][i] = i;
|
||||
screen.topStatusLine[1][i] = i>>1;
|
||||
screen.bottomStatusLine[0][i] = i;
|
||||
screen.bottomStatusLine[1][i] = i>>1;
|
||||
screen.bottomStatusLine[2][i] = i<<1;
|
||||
screen.bottomStatusLine[3][i] = i<<2;
|
||||
}
|
||||
memset(screen.bitmap, 0x13, sizeof(screen.bitmap));
|
||||
// infinite loop
|
||||
while(1) {
|
||||
}
|
||||
}
|
@ -7,31 +7,7 @@
|
||||
|
||||
processor 6502
|
||||
|
||||
; ************ Hardware Adresses ***************************
|
||||
|
||||
DMACTL equ $D400 ;DMA Control
|
||||
sDMACTL equ $07 ;DMA Control Shadow
|
||||
PMBASE equ $D407 ;PM base address
|
||||
CHBASE equ $D409 ;Character set base
|
||||
GRACTL equ $C01D ;Graphics control
|
||||
PRIOR equ $C01B ;PM priorities
|
||||
SIZEP0 equ $C001 ;Size of player 0
|
||||
HPOSP0 equ $C000 ;Horizontal position player 0
|
||||
COLPM0 equ $C012 ;Player 0 color
|
||||
DLISTL equ $D402 ;Display list lo
|
||||
DLISTH equ $D403 ;Display list hi
|
||||
sDLISTL equ $05 ;Display list lo shadow
|
||||
sDLISTH equ $06 ;Display list hi shadow
|
||||
CHACTL equ $D401 ;Character control
|
||||
NMIEN equ $D40E ;NMI Enable
|
||||
sCOLPM0 equ $08 ;Player/missile 0 color shadow
|
||||
sCOLPM1 equ $09 ;Player/missile 0 color shadow
|
||||
sCOLPM2 equ $0A ;Player/missile 0 color shadow
|
||||
sCOLPM3 equ $0B ;Player/missile 0 color shadow
|
||||
sCOLOR0 equ $0C ;Color 0 shadow
|
||||
sCOLOR1 equ $0D ;Color 1 shadow
|
||||
sCOLOR2 equ $0E ;Color 2 shadow
|
||||
sCOLOR3 equ $0F ;Color 3 shadow
|
||||
include "atari5200.inc"
|
||||
|
||||
;*************** Variable ***********************
|
||||
line equ $20 ;Current DLI line
|
||||
@ -107,21 +83,21 @@ dlloop ;Copy display list to RAM
|
||||
;************* Setup hardware registers *************
|
||||
|
||||
lda #$22 ;Set color PF0
|
||||
sta sCOLOR0
|
||||
sta COLOR0
|
||||
lda #$0F ;Set color PF1
|
||||
sta sCOLOR1
|
||||
sta COLOR1
|
||||
lda #$84 ;Set color PF2
|
||||
sta sCOLOR2
|
||||
sta COLOR2
|
||||
lda #$00 ;Set Display list pointer
|
||||
sta sDLISTL
|
||||
sta SDLSTL
|
||||
sta DLISTL
|
||||
lda #$10
|
||||
sta sDLISTH
|
||||
sta SDLSTH
|
||||
sta DLISTH
|
||||
lda #$f8 ;Set Charcter Set Base
|
||||
sta CHBASE
|
||||
lda #$22 ;Enable DMA
|
||||
sta sDMACTL
|
||||
sta SDMCTL
|
||||
lda #$C0 ;Enable NMI + DLI
|
||||
sta NMIEN
|
||||
|
||||
@ -154,15 +130,15 @@ crloop5
|
||||
;************* Setup Player/Missile registers ***************
|
||||
|
||||
lda #$3A ;Enable DMA (single line resolution/
|
||||
sta sDMACTL ;normal background)
|
||||
sta SDMCTL ;normal background)
|
||||
lda #$20 ;Set PM base address ($200)
|
||||
sta PMBASE
|
||||
lda #$03 ;Enable players and missiles
|
||||
sta GRACTL
|
||||
lda #$16 ;Color of player 0
|
||||
sta sCOLPM0
|
||||
sta PCOLR0
|
||||
ldy #$00
|
||||
lda #$03 ;Size of player 0
|
||||
lda #$02 ;Size of player 0
|
||||
sta SIZEP0
|
||||
lda #$01 ;Give players priority over playfield
|
||||
sta PRIOR
|
||||
@ -188,7 +164,7 @@ mvloop1
|
||||
stx HPOSP0 ;Set position of player
|
||||
stx pm0pos ;Save position for DLI
|
||||
inx
|
||||
cpx #$B0 ;Check for end of move
|
||||
cpx #$C0 ;Check for end of move
|
||||
bne mvloop1 ;If not keep moving right
|
||||
lda #$04 ;Give playfield priority player
|
||||
sta PRIOR
|
||||
@ -200,7 +176,7 @@ mvloop2
|
||||
stx HPOSP0 ;Set position of player
|
||||
stx pm0pos ;Save position for DLI
|
||||
dex
|
||||
cpx #$40 ;Check for end of move
|
||||
cpx #$30 ;Check for end of move
|
||||
bne mvloop2 ;If not keep moving left
|
||||
lda #$01 ;Give player priority over playfield
|
||||
sta PRIOR
|
||||
@ -236,8 +212,8 @@ done
|
||||
rti ;Done
|
||||
|
||||
;************* Display list data ****************************
|
||||
; starts at $1000
|
||||
|
||||
org $b000
|
||||
dlist .byte $70,$70,$70 ;24 blank scanlines
|
||||
.byte $48,$00,$18 ;Mode 8 and Load memory scan $1800
|
||||
.byte $88,$88,$88,$88,$88,$88,$88 ;23 more line of mode 8
|
||||
|
@ -6,7 +6,7 @@ echo Creating $PREFIX
|
||||
ln -fs . $PREFIX
|
||||
git-archive-all --prefix $PREFIX release/$PREFIX.zip
|
||||
zip -9r release/$PREFIX.zip $PREFIX/gen
|
||||
git archive --prefix 8bitworkshop- -o release/8bitworkshop-tools.zip HEAD tools
|
||||
#git archive --prefix 8bitworkshop- -o release/8bitworkshop-tools.zip HEAD tools
|
||||
|
||||
# copy to remote
|
||||
. ./scripts/env.sh
|
||||
|
@ -12,6 +12,7 @@ var Atari8_PRESETS = [
|
||||
{id:'hellopm.a', name:'Hello Sprites (ASM)'},
|
||||
{id:'helloconio.c', name:'Text Mode (C)'},
|
||||
{id:'siegegame.c', name:'Siege Game (C)'},
|
||||
{id:'hellodlist.c', name:'Display List (C)'},
|
||||
];
|
||||
|
||||
const ATARI8_KEYCODE_MAP = makeKeycodeMap([
|
||||
|
Loading…
Reference in New Issue
Block a user