Skip to content

Commit ba9584b

Browse files
committed
Initial commit of dasm version 2.20.10. Sources were downloaded from the dasm-dillon release on SourceForge.
1 parent d9f3e4c commit ba9584b

32 files changed

+9866
-2
lines changed

Machines/ATARI2600/VCS.H

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
; VCS.H
2+
; Version 1.05, 13/November/2003
3+
4+
VERSION_VCS = 105
5+
6+
; THIS IS A PRELIMINARY RELEASE OF *THE* "STANDARD" VCS.H
7+
; THIS FILE IS EXPLICITLY SUPPORTED AS A DASM-PREFERRED COMPANION FILE
8+
; PLEASE DO *NOT* REDISTRIBUTE THIS FILE!
9+
;
10+
; This file defines hardware registers and memory mapping for the
11+
; Atari 2600. It is distributed as a companion machine-specific support package
12+
; for the DASM compiler. Updates to this file, DASM, and associated tools are
13+
; available at at http://www.atari2600.org/dasm
14+
;
15+
; Many thanks to the original author(s) of this file, and to everyone who has
16+
; contributed to understanding the Atari 2600. If you take issue with the
17+
; contents, or naming of registers, please write to me (atari2600@taswegian.com)
18+
; with your views. Please contribute, if you think you can improve this
19+
; file!
20+
;
21+
; Latest Revisions...
22+
; 1.05 13/NOV/2003 - Correction to 1.04 - now functions as requested by MR.
23+
; - Added VERSION_VCS equate (which will reflect 100x version #)
24+
; This will allow conditional code to verify VCS.H being
25+
; used for code assembly.
26+
; 1.04 12/NOV/2003 Added TIA_BASE_WRITE_ADDRESS and TIA_BASE_READ_ADDRESS for
27+
; convenient disassembly/reassembly compatibility for hardware
28+
; mirrored reading/writing differences. This is more a
29+
; readability issue, and binary compatibility with disassembled
30+
; and reassembled sources. Per Manuel Rotschkar's suggestion.
31+
; 1.03 12/MAY/2003 Added SEG segment at end of file to fix old-code compatibility
32+
; which was broken by the use of segments in this file, as
33+
; reported by Manuel Polik on [stella] 11/MAY/2003
34+
; 1.02 22/MAR/2003 Added TIMINT($285)
35+
; 1.01 Constant offset added to allow use for 3F-style bankswitching
36+
; - define TIA_BASE_ADDRESS as $40 for Tigervision carts, otherwise
37+
; it is safe to leave it undefined, and the base address will
38+
; be set to 0. Thanks to Eckhard Stolberg for the suggestion.
39+
; Note, may use -DLABEL=EXPRESSION to define TIA_BASE_ADDRESS
40+
; - register definitions are now generated through assignment
41+
; in uninitialised segments. This allows a changeable base
42+
; address architecture.
43+
; 1.0 22/MAR/2003 Initial release
44+
45+
46+
;-------------------------------------------------------------------------------
47+
48+
; TIA_BASE_ADDRESS
49+
; The TIA_BASE_ADDRESS defines the base address of access to TIA registers.
50+
; Normally 0, the base address should (externally, before including this file)
51+
; be set to $40 when creating 3F-bankswitched (and other?) cartridges.
52+
; The reason is that this bankswitching scheme treats any access to locations
53+
; < $40 as a bankswitch.
54+
55+
IFNCONST TIA_BASE_ADDRESS
56+
TIA_BASE_ADDRESS = 0
57+
ENDIF
58+
59+
; Note: The address may be defined on the command-line using the -D switch, eg:
60+
; dasm.exe code.asm -DTIA_BASE_ADDRESS=$40 -f3 -v5 -ocode.bin
61+
; *OR* by declaring the label before including this file, eg:
62+
; TIA_BASE_ADDRESS = $40
63+
; include "vcs.h"
64+
65+
; Alternate read/write address capability - allows for some disassembly compatibility
66+
; usage ; to allow reassembly to binary perfect copies). This is essentially catering
67+
; for the mirrored ROM hardware registers.
68+
69+
; Usage: As per above, define the TIA_BASE_READ_ADDRESS and/or TIA_BASE_WRITE_ADDRESS
70+
; using the -D command-line switch, as required. If the addresses are not defined,
71+
; they defaut to the TIA_BASE_ADDRESS.
72+
73+
IFNCONST TIA_BASE_READ_ADDRESS
74+
TIA_BASE_READ_ADDRESS = TIA_BASE_ADDRESS
75+
ENDIF
76+
77+
IFNCONST TIA_BASE_WRITE_ADDRESS
78+
TIA_BASE_WRITE_ADDRESS = TIA_BASE_ADDRESS
79+
ENDIF
80+
81+
;-------------------------------------------------------------------------------
82+
83+
SEG.U TIA_REGISTERS_WRITE
84+
ORG TIA_BASE_WRITE_ADDRESS
85+
86+
; DO NOT CHANGE THE RELATIVE ORDERING OF REGISTERS!
87+
88+
VSYNC ds 1 ; $00 0000 00x0 Vertical Sync Set-Clear
89+
VBLANK ds 1 ; $01 xx00 00x0 Vertical Blank Set-Clear
90+
WSYNC ds 1 ; $02 ---- ---- Wait for Horizontal Blank
91+
RSYNC ds 1 ; $03 ---- ---- Reset Horizontal Sync Counter
92+
NUSIZ0 ds 1 ; $04 00xx 0xxx Number-Size player/missle 0
93+
NUSIZ1 ds 1 ; $05 00xx 0xxx Number-Size player/missle 1
94+
COLUP0 ds 1 ; $06 xxxx xxx0 Color-Luminance Player 0
95+
COLUP1 ds 1 ; $07 xxxx xxx0 Color-Luminance Player 1
96+
COLUPF ds 1 ; $08 xxxx xxx0 Color-Luminance Playfield
97+
COLUBK ds 1 ; $09 xxxx xxx0 Color-Luminance Background
98+
CTRLPF ds 1 ; $0A 00xx 0xxx Control Playfield, Ball, Collisions
99+
REFP0 ds 1 ; $0B 0000 x000 Reflection Player 0
100+
REFP1 ds 1 ; $0C 0000 x000 Reflection Player 1
101+
PF0 ds 1 ; $0D xxxx 0000 Playfield Register Byte 0
102+
PF1 ds 1 ; $0E xxxx xxxx Playfield Register Byte 1
103+
PF2 ds 1 ; $0F xxxx xxxx Playfield Register Byte 2
104+
RESP0 ds 1 ; $10 ---- ---- Reset Player 0
105+
RESP1 ds 1 ; $11 ---- ---- Reset Player 1
106+
RESM0 ds 1 ; $12 ---- ---- Reset Missle 0
107+
RESM1 ds 1 ; $13 ---- ---- Reset Missle 1
108+
RESBL ds 1 ; $14 ---- ---- Reset Ball
109+
AUDC0 ds 1 ; $15 0000 xxxx Audio Control 0
110+
AUDC1 ds 1 ; $16 0000 xxxx Audio Control 1
111+
AUDF0 ds 1 ; $17 000x xxxx Audio Frequency 0
112+
AUDF1 ds 1 ; $18 000x xxxx Audio Frequency 1
113+
AUDV0 ds 1 ; $19 0000 xxxx Audio Volume 0
114+
AUDV1 ds 1 ; $1A 0000 xxxx Audio Volume 1
115+
GRP0 ds 1 ; $1B xxxx xxxx Graphics Register Player 0
116+
GRP1 ds 1 ; $1C xxxx xxxx Graphics Register Player 1
117+
ENAM0 ds 1 ; $1D 0000 00x0 Graphics Enable Missle 0
118+
ENAM1 ds 1 ; $1E 0000 00x0 Graphics Enable Missle 1
119+
ENABL ds 1 ; $1F 0000 00x0 Graphics Enable Ball
120+
HMP0 ds 1 ; $20 xxxx 0000 Horizontal Motion Player 0
121+
HMP1 ds 1 ; $21 xxxx 0000 Horizontal Motion Player 1
122+
HMM0 ds 1 ; $22 xxxx 0000 Horizontal Motion Missle 0
123+
HMM1 ds 1 ; $23 xxxx 0000 Horizontal Motion Missle 1
124+
HMBL ds 1 ; $24 xxxx 0000 Horizontal Motion Ball
125+
VDELP0 ds 1 ; $25 0000 000x Vertical Delay Player 0
126+
VDELP1 ds 1 ; $26 0000 000x Vertical Delay Player 1
127+
VDELBL ds 1 ; $27 0000 000x Vertical Delay Ball
128+
RESMP0 ds 1 ; $28 0000 00x0 Reset Missle 0 to Player 0
129+
RESMP1 ds 1 ; $29 0000 00x0 Reset Missle 1 to Player 1
130+
HMOVE ds 1 ; $2A ---- ---- Apply Horizontal Motion
131+
HMCLR ds 1 ; $2B ---- ---- Clear Horizontal Move Registers
132+
CXCLR ds 1 ; $2C ---- ---- Clear Collision Latches
133+
134+
;-------------------------------------------------------------------------------
135+
136+
SEG.U TIA_REGISTERS_READ
137+
ORG TIA_BASE_READ_ADDRESS
138+
139+
; bit 7 bit 6
140+
CXM0P ds 1 ; $00 xx00 0000 Read Collision M0-P1 M0-P0
141+
CXM1P ds 1 ; $01 xx00 0000 M1-P0 M1-P1
142+
CXP0FB ds 1 ; $02 xx00 0000 P0-PF P0-BL
143+
CXP1FB ds 1 ; $03 xx00 0000 P1-PF P1-BL
144+
CXM0FB ds 1 ; $04 xx00 0000 M0-PF M0-BL
145+
CXM1FB ds 1 ; $05 xx00 0000 M1-PF M1-BL
146+
CXBLPF ds 1 ; $06 x000 0000 BL-PF -----
147+
CXPPMM ds 1 ; $07 xx00 0000 P0-P1 M0-M1
148+
INPT0 ds 1 ; $08 x000 0000 Read Pot Port 0
149+
INPT1 ds 1 ; $09 x000 0000 Read Pot Port 1
150+
INPT2 ds 1 ; $0A x000 0000 Read Pot Port 2
151+
INPT3 ds 1 ; $0B x000 0000 Read Pot Port 3
152+
INPT4 ds 1 ; $0C x000 0000 Read Input (Trigger) 0
153+
INPT5 ds 1 ; $0D x000 0000 Read Input (Trigger) 1
154+
155+
;-------------------------------------------------------------------------------
156+
157+
SEG.U RIOT
158+
ORG $280
159+
160+
; RIOT MEMORY MAP
161+
162+
SWCHA ds 1 ; $280 Port A data register for joysticks:
163+
; Bits 4-7 for player 1. Bits 0-3 for player 2.
164+
165+
SWACNT ds 1 ; $281 Port A data direction register (DDR)
166+
SWCHB ds 1 ; $282 Port B data (console switches)
167+
SWBCNT ds 1 ; $283 Port B DDR
168+
INTIM ds 1 ; $284 Timer output
169+
170+
TIMINT ds 1 ; $285
171+
172+
; Unused/undefined registers ($285-$294)
173+
174+
ds 1 ; $286
175+
ds 1 ; $287
176+
ds 1 ; $288
177+
ds 1 ; $289
178+
ds 1 ; $28A
179+
ds 1 ; $28B
180+
ds 1 ; $28C
181+
ds 1 ; $28D
182+
ds 1 ; $28E
183+
ds 1 ; $28F
184+
ds 1 ; $290
185+
ds 1 ; $291
186+
ds 1 ; $292
187+
ds 1 ; $293
188+
189+
TIM1T ds 1 ; $294 set 1 clock interval
190+
TIM8T ds 1 ; $295 set 8 clock interval
191+
TIM64T ds 1 ; $296 set 64 clock interval
192+
T1024T ds 1 ; $297 set 1024 clock interval
193+
194+
;-------------------------------------------------------------------------------
195+
; The following required for back-compatibility with code which does not use
196+
; segments.
197+
198+
SEG
199+
200+
; EOF

Machines/ATARI2600/macro.h

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
; MACRO.H
2+
; Version 1.06, 3/SEPTEMBER/2004
3+
4+
VERSION_MACRO = 106
5+
6+
;
7+
; THIS FILE IS EXPLICITLY SUPPORTED AS A DASM-PREFERRED COMPANION FILE
8+
; PLEASE DO *NOT* REDISTRIBUTE MODIFIED VERSIONS OF THIS FILE!
9+
;
10+
; This file defines DASM macros useful for development for the Atari 2600.
11+
; It is distributed as a companion machine-specific support package
12+
; for the DASM compiler. Updates to this file, DASM, and associated tools are
13+
; available at at http://www.atari2600.org/dasm
14+
;
15+
; Many thanks to the people who have contributed. If you take issue with the
16+
; contents, or would like to add something, please write to me
17+
; (atari2600@taswegian.com) with your contribution.
18+
;
19+
; Latest Revisions...
20+
;
21+
; 1.06 03/SEP/2004 - nice revision of VERTICAL_BLANK (Edwin Blink)
22+
; 1.05 14/NOV/2003 - Added VERSION_MACRO equate (which will reflect 100x version #)
23+
; This will allow conditional code to verify MACRO.H being
24+
; used for code assembly.
25+
; 1.04 13/NOV/2003 - SET_POINTER macro added (16-bit address load)
26+
;
27+
; 1.03 23/JUN/2003 - CLEAN_START macro added - clears TIA, RAM, registers
28+
;
29+
; 1.02 14/JUN/2003 - VERTICAL_SYNC macro added
30+
; (standardised macro for vertical synch code)
31+
; 1.01 22/MAR/2003 - SLEEP macro added.
32+
; - NO_ILLEGAL_OPCODES switch implemented
33+
; 1.0 22/MAR/2003 Initial release
34+
35+
; Note: These macros use illegal opcodes. To disable illegal opcode usage,
36+
; define the symbol NO_ILLEGAL_OPCODES (-DNO_ILLEGAL_OPCODES=1 on command-line).
37+
; If you do not allow illegal opcode usage, you must include this file
38+
; *after* including VCS.H (as the non-illegal opcodes access hardware
39+
; registers and require them to be defined first).
40+
41+
; Available macros...
42+
; SLEEP n - sleep for n cycles
43+
; VERTICAL_SYNC - correct 3 scanline vertical synch code
44+
; CLEAN_START - set machine to known state on startup
45+
; SET_POINTER - load a 16-bit absolute to a 16-bit variable
46+
47+
;-------------------------------------------------------------------------------
48+
; SLEEP duration
49+
; Original author: Thomas Jentzsch
50+
; Inserts code which takes the specified number of cycles to execute. This is
51+
; useful for code where precise timing is required.
52+
; ILLEGAL-OPCODE VERSION DOES NOT AFFECT FLAGS OR REGISTERS.
53+
; LEGAL OPCODE VERSION MAY AFFECT FLAGS
54+
; Uses illegal opcode (DASM 2.20.01 onwards).
55+
56+
MAC SLEEP ;usage: SLEEP n (n>1)
57+
.CYCLES SET {1}
58+
59+
IF .CYCLES < 2
60+
ECHO "MACRO ERROR: 'SLEEP': Duration must be > 1"
61+
ERR
62+
ENDIF
63+
64+
IF .CYCLES & 1
65+
IFNCONST NO_ILLEGAL_OPCODES
66+
nop 0
67+
ELSE
68+
bit VSYNC
69+
ENDIF
70+
.CYCLES SET .CYCLES - 3
71+
ENDIF
72+
73+
REPEAT .CYCLES / 2
74+
nop
75+
REPEND
76+
ENDM
77+
78+
;-------------------------------------------------------------------------------
79+
; VERTICAL_SYNC
80+
; revised version by Edwin Blink -- saves bytes!
81+
; Inserts the code required for a proper 3 scanline vertical sync sequence
82+
; Note: Alters the accumulator
83+
84+
; OUT: A = 0
85+
86+
MAC VERTICAL_SYNC
87+
lda #%1110 ; each '1' bits generate a VSYNC ON line (bits 1..3)
88+
.VSLP1 sta WSYNC ; 1st '0' bit resets Vsync, 2nd '0' bit exit loop
89+
sta VSYNC
90+
lsr
91+
bne .VSLP1 ; branch until VYSNC has been reset
92+
ENDM
93+
94+
;-------------------------------------------------------------------------------
95+
; CLEAN_START
96+
; Original author: Andrew Davie
97+
; Standardised start-up code, clears stack, all TIA registers and RAM to 0
98+
; Sets stack pointer to $FF, and all registers to 0
99+
; Sets decimal mode off, sets interrupt flag (kind of un-necessary)
100+
; Use as very first section of code on boot (ie: at reset)
101+
; Code written to minimise total ROM usage - uses weird 6502 knowledge :)
102+
103+
MAC CLEAN_START
104+
sei
105+
cld
106+
107+
ldx #0
108+
txa
109+
tay
110+
.CLEAR_STACK dex
111+
txs
112+
pha
113+
bne .CLEAR_STACK ; SP=$FF, X = A = Y = 0
114+
115+
ENDM
116+
117+
;-------------------------------------------------------
118+
; SET_POINTER
119+
; Original author: Manuel Rotschkar
120+
;
121+
; Sets a 2 byte RAM pointer to an absolute address.
122+
;
123+
; Usage: SET_POINTER pointer, address
124+
; Example: SET_POINTER SpritePTR, SpriteData
125+
;
126+
; Note: Alters the accumulator, NZ flags
127+
; IN 1: 2 byte RAM location reserved for pointer
128+
; IN 2: absolute address
129+
130+
MAC SET_POINTER
131+
.POINTER SET {1}
132+
.ADDRESS SET {2}
133+
134+
LDA #<.ADDRESS ; Get Lowbyte of Address
135+
STA .POINTER ; Store in pointer
136+
LDA #>.ADDRESS ; Get Hibyte of Address
137+
STA .POINTER+1 ; Store in pointer+1
138+
139+
ENDM
140+
141+
;-------------------------------------------------------
142+
; BOUNDARY byte#
143+
; Original author: Denis Debro (borrowed from Bob Smith / Thomas)
144+
;
145+
; Push data to a certain position inside a page and keep count of how
146+
; many free bytes the programmer will have.
147+
;
148+
; eg: BOUNDARY 5 ; position at byte #5 in page
149+
150+
__DASM__TOTAL_FREE_MEMORY SET 0
151+
.FREE_BYTES SET 0
152+
MAC BOUNDARY
153+
REPEAT 256
154+
IF <. % {1} = 0
155+
MEXIT
156+
ELSE
157+
.FREE_BYTES SET .FREE_BYTES + 1
158+
.byte $00
159+
ENDIF
160+
REPEND
161+
__DASM__TOTAL_FREE_MEMORY SET __DASM__TOTAL_FREE_MEMORY + .FREE_BYTES
162+
ENDM
163+
164+
165+
; EOF

0 commit comments

Comments
 (0)