IV.
SATPLE PROGRA}{
This asaeobly language progran lllustrates the use of players, Flsstles, and dlsplay 1ists. I'he dlagran on the next page shows shat lhe display looks 1lke and whlch oblects are used. The conBents in the progran listtng describe how lt works.
rv.1
n
sl 3l? ------'
I I I
I I I
d ,r. a
I
l
E q E
;l i>:
IV.2
a
i
i2
'rd
.-
.t
. - . r-!r :
.?9
:q]
::3 -
-
I$:
.
\.-
J
{ro
.>;
:s'
i-.s
_:r
c:;:db
odw
" : - =
-:*' :;i ::F :'r:4 {-*5 i; _),, i..r :rn:--Et
,
r i g
i' ' :
P'zo':z :-t1P99 F:6rF;' ;d'C'g'H
: I s-
i:: ",.-= $*3[:- $ i:"H-::8 "ri0:?i:
;"
h,"",9,E:
;
L
a
): -; E. F: i- : ! : + de n Ece:,;s;; ) :?t;tl:;"",,.;
o
c 5 !
t : ": -! !: isi -: jl jE- ii: ! ! ' s 3 h 3 3 3 a r e ; s 3E ts .: E 3 : 3 3 3 $ 3 3 3 X S 3-: 3 + 9 3 ! : R : g g S P f \a:5--E'l[3 :;
*!
-LdIJ
.
:iY:i"i;*:
;o ". J- ," : "- ". t9a -: :9 S ; n , r , ' r
- r - o o o r r r d a F
:
{ l i Q E ::+r j:il:: ^ i E - !ftft:qiEf:ii $ r'E6tlUd6'&gFE
! il;i 3 ItJl;
o
!3
"iy2z2E;1
u d r i = o d o ; E d - t r . : . : ; d .i i < 6 6 6 6 6 o ,d 6
$ fEr " 9 : F C E : J , ; * ; , ; ; : i E ! ! i ! ! E $ $ i :i :f f; ;f ;q E : $ : $ E $E d j d j 6 i o d i ! b i r j o oo o b 6 d 6 , n d d d , n o
E$*EH;8$E}3$g EEEEEEgE$E$g$;
IV.3
a i
^
a-
d "
a
H 5
K
6
:E "9
H ic o
E
H
e
9p
s;
:3 i c;UF
-d E
, $
P
:d E d ' ' i>i d ci
g. e ciHb
" Y a Cd3,4 ! cr! q 5Q** E EJ .F :::;i
-; iE
;
.
L L -
o*U; ccco
r icgcF$H$
un -
L r
E -
L L L L L E L L -
b E b b b b 3 BE 6 b b b b 6 6 6
t E rraitrrrrrr?zr-zv.d
' I E . d: : ' g: s * s ' aj r P 5 [ o . " " " 9
a
t ' ad ' , L i
',,""
3
9Fq
"5ti.
ix l r " ' , , , ' " ' S >y
f
"
g E " - - - - - - , - - - - - : 6 ;H a f E E E4RE E r 6 ...Y.fididE.didi
EEEEEEEEEIEEEE$$EEBR8;gg IEgEEfi ;
EgEH B$H$H E$ E$B*H$$EHEH*$EH3$
U I So
t
9t dd
;
IV.5
f
d
n
=
.
3
:
e
6
j
-
!
3
+
1
{
;
q
=
V " d
"
; t , 2
-
e
o d u
n
o6$66o6
H d 3
9: ::::
E
F
t
n
*
'
-
4
t
3
:
S
'
:
i
i
d
u i
! i
b
! l
!
g
d
i
:
:
>
: """""
; 3 t St d S3 Sf f 3 3 SS,' SI Sf 3 f f H3 3 S3 SS3 $ S3 : f PfrSi S
IVi6
6
J +
-
&
, a
6
ao. t g
9": t +e
-FE
iH5 .r+
P
\E
FliJ
S Ct r C
: i_:
-.rEqc i
IV.7
g
i
n
6
; i
6
5
fr
o
€
E E
K
EA FCEEEi9
E
:
5 333.S
rv.8
p
6
3
3
[3hi=ts$Ets3 i;
SSRS$E$RA339 $e3s33E$3S$
g*sssssP IV.9
;
g
5
z
f
s
t
q
q
6
E
q
d
q .
.ii
o
rru66
vt I 6
9
-o
o
!P Et
i6
3
3" "
P
5
3 u
E
*
i
-
e$a*
r
BS3$
Pg
e " i :
:
S
gfrsfr=:irilEd E:EEE$rHH
og
9r
d
!
i I
5
. ' o
ts
r!!
t>L
EE
s*aer
.i.
.E d d
fifrfi $HHRHB$$B$$Bgi$939s$H$f fifififiR$fi P EgCS Lo rU 6$i'i
I 6rr.
c
x 3
$ FE HH H ! l H e e sse*s$JeHs $ e E : Na
vouei'ltF\
F F -P P P P P P K R T R RI S KX , :R R R R ^ " E ;i 6i6 i,nihniDhi i^i
IV. l0
I
o
g
di
nJ q
rv.11
HARDWARE REGISTERI,ISTS
ANDRESSORDER
CTIA ADDRESSES READ Address DOTF
tI
Descrt
REPEATAS BEI,OW
7 MORETIMES
i D020 01r D Ol E DO]D
9t3
Wrlte Co on Clear Vert. ?riori
Consol SW. Port
De
0lA
D01 D OI 6
D0l5 D0t4 D0l
Color-1um of 3 sile
2
laver-Ulss1le
I
RXAN PAJ-/NTSCb l t s Read Joystlck Trlgge! Buttons
D0l2 D011
GraDhlcs
A1l
aDhlcs Plaver 3
DOOT GraDhlcs Plaver
I
DOOD
Read PLayer to Player ColllsLoDs
Slze A11 lttsstle DOOB Slze
D009 D008 D00 D006 D004 D002 D000
Plaver
2
Plaver
I
llorz. rz, Itorz. Ilorz. Itorz. 1{orz.
Read Mlsslle To ?Iayer colllslons
Poslt. Mlsslle Posl!. Mlsslle 2 P Poslr, l41sslle 0 P Poslt. Plaver 2
orz. Poslt.
?laver 0
V.I
Read P]ayer To Playfield Colllslons Read Mlsstle To Playfteld CollisloIrs
ANTIC ADDRES
Address D4FF
tt
REPEAT (AS BELOW)
15 MORETIMES
Reset NUI Interrupt Status
D4OT
NMI Interrupt Status Reglster
D4OE Llght Pen Reglster VertlcaL Llght Pen Reglsrer Horlzontal Vertical Llne Counter
D4OD D40C D4OB Walt for
IIBLANK
D4OA Character Base Address Red
D409 D408
Player-Mlssile Address Re
D 4 07
Base
D406 Ve!tlca1
Scroll
Horizontal
D1-1ST11
Scro11
Dtsplay List olnrer (H Display Llst
D402 Character Control
D401 DMA Control
D400
!.2
POKEYA.DDRESSES READ Descri
DescrlDtlon
DzFI
t I
i
REPEAT (AS BE].OW)
15 MORETIMES
D2l0 Serlal Port 4 Key control IRQ lnterrupt lnable Serlal Port
Start
Port 4 Key
IRQ lnterrupt s Reeister Ser{al Porl Resister
Pot Scan 1ca1 ]-lne Rendon Numb
Reset Status
Sralt
Serlal
oard code Read
Tlmers
dio control Audlo Channel 4 Audlo Channel 4
D206 Audio channel
4
Audio channel
3
D205
D20
Audlo channel control Andlo chanRel 2
D202 Audto Channel Ardlo
channel
v.3
I
Read the value of each POT
ANDRESSES READ Add!ess D3TF
DescrlDtion Repeat as shown below rnany tlnes
Directlon Reglster If PBCTI, Bit 2-0
D301 Jack2&Jack3 If Dlrectlon Blts Dlrec!1oo Register If PACTLtlt 2=0
D300 Jack0&Jackl If Dlrectlon Bits
* NoTE:
Same as wrlce Jack2&Jack3 If Dlrectlon Bits e 0 * Same as wrlte J A C K U d J
If
Dlrectlor
Ortpur data is retained 1n Jack Output Registers. If dlrectlon blts are true, a read of the iacks !dlI read old dara from these reslsters.
C K I
Bits
AIPHABETICAL ORIER
Itard
lster Address Hex
AI,LPOT R e a d 8 1 i n e l o t P o r t S t a t e AttDc I Audto Channel I Colltrol AUDC2 Audlo Chafirel 2 CoDtrol ATIDC3 Audlo Channel 3 Control o Channel AUDCTL Audlo Control AI'DF I Audio Channel 1 Frequency AIJDF2 Audlo Channel 2 f'requency AIDT3 A[dto Channel 3 lrequency Audto Channel 4 lreouenc CHACTL Character control CITBASECharacter base addless C01,BK Color-l-umlnance of Background COLPFOColor Luninance of Playfteld 0
Add!ess Dec
53768 5376r 53763 53765 5316'l 5 37 6 8 53760 53762
'155 2F3 2F4 1 5 6 2C8 7 t 2 2C4 708 2C5 709 COL?F2Color Lunlnance of Playfield 2 5 3 2 7 2coLoR2 7t0 coI-PF3 5 3 2 7 3col-oR3 711 COLPMOColor Lunlnance of P1a;er-l.tlss1le 53266 PCOLRO O 704 COI,PMI Color Luninance of Player-l4isst1e I 53267 PCOLRI 705 olor Luolnance of Plaver-Misslle 2 70 COLPlI3 Color Lunlnance of Player-Mlsslle D 0 l 5 53269 PCOlR3 2C3| 707 coNsoLConsole Sldtch Port DOIF 53279 S e t t o 8 du r lng VBLANK DLISTII Display Ltst Potnter (hlgh byte) D403 S'LSTE 2 3 I | 5 6 I D],ISTL Display list Potnter (1ow byte) D402 5 4 2 74 SDLSTL 2 3 0t s 6 0 TL DIrect Menorv Access (DMA) Control TL 22F| 559 ERACTL DO1D 5 3 2 7 1 GRAI'M Graphics for all lllsslles D01I. 53265 GRAI?O Graphlcs for Player 0 DOOD 5326r GRAFP 1 Graphica for Player I DOOE 5 3 2 6 2 GraDhlcB for Plaver 2 DOOF GRATP3Graphics for Player 3 D 0 l 0 53264 I{1TC]-R Collsslon Clear DOlE 5327I ITPOSMO l{orizontal Posltlon of Mtssile 0 r004 53252 ITPOSMlllorlzontal Posltlon of Missile 1 s3253 rizontal IIPOSM3 Hor{zontal HPOSPOHorlzontal HPOSPInorlzontal HPOSP2lorlzortal
PoslEion Postlton ?ostrlon Posltlon Posltlotr
of of of of of of
Mlsslle 2 Mlsslle 3 Playet 0 Player I Player 2 Plaver
HSCROT IRQEN r n E e r r u p E K e q r e s r ( 1 K q ) E n a D r e IRqST KBCODEKeyboard Code MOPL MIPF MIPL M2?I IT2PL
Mlsslle l,ltsst1e Mlsslle Ulsslle
0 1 I 2
!o to to to
Player col1l6tons Playfteld Colltslons Player colllslons Playfleld colllslons
54273 54281 53274 53210
D007 D000 D001 D002 D003 D404 D2OE D2OE D209
53255 53248 53249 53250 53251 54276 53714 53714 53769 53256 53249 53257 53250
764
llardnare
ister
0S Shadow Address
Address },13PF Misstle 3 ro Playfleld co1l1slons M3PL }llss11e 3 to Player (NMI) Enabte NMIEN Non-Maskable Interrupt NMIRES NMl reset NMIST NMl Stahrs ?OPF Player 0 to Playfield Colllslons POPL Player 0 to ?layer Co1llslons PIPF Player l to Playfteld Collisions PIPL Player I to Player Colllslons P2PF Player 2 to Player Colllslons PzIL P 3 P F Player 3 to ?layfleld colllsions P3PL Player 3 to Player Colllslons PACTL Port A Cotltlol PAr,/NTsc tndtctor PA]PBCTL Port B Conlrol PENH Llght Pen Ilorlzontal Posilion PENV Ltght Pen Vertlcal Poslllon P}EASE Player Misslle Base Address ?ORTA P o r t A PORTB Port A POTO P o t 0 POTl Pot I POT2 P o L 2 POT3 POT4 P o t 4 POT5 POT6 POTT Pot 7 (rlght paddle controller) POTGO Star! POT Scan Sequence PRIOR D r ' l ^ i l r w C a l e . r RANDOMRaodon number generator SERIN Serial Port Input SEROUTserlal Port output stzes for all nisslles SIZE?O stze of Player 0 S I Z E P1 size of Player I S'ZEP2 slze ot Player 2 S I Z E P 3Slze of Player 3 SKCTI Serlal Port Control SXRESTReset Sertal Port Status (SKSTAT) SKSTAT Serial Port Status STlMER Slart Tiner Trigger 0 IRIGO Joysrick cortroller Joastick Controller Trisser I 2 TRIG2 Joysrtck Controller'Irigget TRIG3T Joystlck Conlroller T!1gger 3 VCOIJNTVertical Llne Counler VDELAY Vertcal Delay scrolf VSCROLvertical WSYNC Wait for Horizontal Sync
53251 53259 54246 set to $40 by IRQ code 5 4287 wrltten to by NMI code 54287 read bv NIlI code D 0 0 4 53252 D00c 53260 D 0 0 5 53253 DOOD 53261 D006 DOOE 5 3 2 6 2 D 0 0 7 53255 DOOF 53263 D302 5 4 0 1 8s e t t o $ iC by IR C o d e D 0 1 4 53268 D303 54 0 1 9 set to $ iC by IR Code 564 234 D40C 54284 LPENII 235 D4OD 54285 IPENV D407 54279 D300 sTlCK0 - l 2 78 . 2 7 9 D3 0 1 5 4 0 1 7s T r c K 2 , 32 7! , , 2 1 R 634,635 624 D 2 0 0 53760PADDI-O 2 7 0 , 625 PADDL I 2 7 1 D 20 1 5 3 7 6 1 626 2 7 2 D202 ?ADD]-2 53163?ADDI-3 2 7 3 624 DZ04 5 3 7 6 4PADDL4 2 7 4 629 2 7 5 D205 53765PADD],5 6 30 PADD]-6 2 7 6 DZO6 5 3 7 6 6 631 D20'I 53767 PAI}D].7 27'I ILANK D2OB 5 3 7 7 1WRITTEN 623 26r D O I B 53275 GPRIOR 53770 D2OA D2OE 5 3 7 7 4 D2OD 53773 D00c 53260 D 0 0 8 53256 D0 0 9 53257 DOOA 53258 DOOB 53259 562 SSKCTL 232 D2OF D2OA 53770 D2OF D209 53769 644 D 0 t 0 5 3 2 6 4STRIGO 284 285 53265 STRIGL D01l 646 286 D 0 1 2 5 3 2 6 6STRIG2 641 247 5 3 2 6 7STRIG3 D OI 3 D4OB 54283 5 4216 D0IC 54 2 1 7 D405 D4OA 54282 Used by keyboald D003 DOOB D4OE D4OF D4OF
cltck
v.6
routtne
vI.
FIGURES
MEMORYMAP RE
s
FFTF
Operatlng Systen And Math Routlnes
IOK
D800 DOOO-D7TF C}FF
Ilardware Addresses
2K
Reserved for Future O.S. exDanslon
4K
BFFF
Rol,l Cartrldge
8000
(Col1een left and right slot and Candy single slo! all address to
16K
7}FF
RAM Expanslon
2000 lFTF RAM tnltially supplled 1n rhe product
8K
RAM expansion can actually exten to BFEF. However, lhe ROMcartrldges will deselect the RAM. Deselectton occurs on 8K boundartes. Atari 400 unlts are RAM expandable onty at the factory. They can accepr RAlt up to 2FFF (16K) when fully exrended.
vI.l
--__lrO'an-,OS:o 3Nr-rZ -.l.Nnot^
i3
:3lNfral
l .
tu t 9 o ib
(!Nri r..\"s) 'tYf,.i.!:^
z
F < F
> J tNAsts
>JN\?'IEH ld 3Cl7\ N,|S
id
^/€r*Jwtl
aNnan€)>#
U
6 ---rI
I
c^rncEg>tx
A ON=
o
ON=+
(,
q -r
trj
(o JO
po
nu) :v
uu $(l qd
fi'fl.
{u 6 (l
-J i]
^u
-o
dY
id
7 -
< o Fla
?0
Ad
l(,
w
iUY
(qd
:
CNncljgtx'r€
;dU
d
ON
r
3 i t
.
J
<
O
0
<
LONneE9>r
()
t")
>N(9. rgir t:93d
F
z. II
3Nr€H IfS3I3S
I
d * / \ . .L9:rHflHftl l s > 1 L
-
. r r-r
.LejnE EcrcD €N=cN,|gH
=
-
6 N t r N R V
trud ,,,0q 606
I ]!VJs
-J
0 , <
3d r'r'OalltvN I:j\/IS
/\\7-1dS1C
-J
-
Qoo
,.9
z(\t
<
\_
, < s
J<. rr nl
o
lI
L t
t
h$ HYH>dAE
t
d l'z ul r iii
lY o
ET LU
sd$b
'i0S U rjt
_,lf =< LUn
>rn
--J .\
A{ -l at:1Nno, (3Ntr Nv?9
$ trl F =
tU
2;
(r!rtosl
(rrraos)
tt3)13o5)
il* E {JJ
F =
::r.!.'?!r:i::r
;
::r::r::r:!r
::::r*:llfEh!S:;f
rr::.:.:
r:ii:::i:.:3::r:E:!:::i.:
f!
t::iatr::r::?n;!3rtr!: ia
3e F
(D
'rLl.j
EiEi +
.:9E
;E.
E:
5R
*
:E
E
E:
t
l D @
I <
o <
G .
=
rl-oYr.!> s 3 Nr ' l
tno 0!0 rA
(Maos)
u! xaos)
3tvts-rt.L
>
;
r:r ;-
iitt
E r!i:i9!
3*,:r;i,
PJ
o (I c0 CC lrl = F
o
i-{H.:;F+# "FF+r
fFr
=1
tsrl rii
1
I
i'i ti l": :l llrl+t i 1 1 i-rH
llt l
rEi!! :9ci'!,:r!6!:::!.:
:l:!:ir:::::1!?!r.',"i
x:::r"r;q
:Illr:ic.;itr:?:r:
:rtrt!:;1
::::;ria::.::lrir::
P;ii111::r:::::!
!,?
-.
i:,3;
i
r1;::!
>i
,! i.r!
;9
.';a
,t
;!;!!
! !
:! I
3>1
;a:!
>3>;
3.t:
!,r
B!!:
r 3E
O
N
A F o * E. IJ
F
o
_8:-Ei
!i
3o-$nf
; E a
E !-*-e
ErEt'
:
;
:
:
: 6
(L
- !
o Lrl = F (L
:
:
i
;
G
;
o 9
r
6
;
F
- ; <
!
-
t! =
iE
tp
\r
,g*ils:i**iE
; 5 s . ! :
aao lrJ
G
= < O
F
o - <
9 ; E
: t i
4
g
;
<
;
- - E
5
-
tf
IJ =
i
o
iii EE: Eis ; ; 3 3
I
iie:iiiEl E:3i
iEiE:
lr,J g 6
<
F J
F
=
7
u) ). E lrl
F J
F
0 u v o 8 u 3 H L o l to i -
<
" " 1 = r " = ""1" ' . "-" " r" '=i .
"-"'r"" l'-' : ; : : E 3 E E
1
=rt_D
:.-:::
E
? r: : €- - ;. ; : a : -
i9
F
{
2 @
t=] ."i UB
G <
LIJ F
o-<
il
f'.
:i :t '
'id t
!"'
) :
-i"r.ii .i 3;:3133;::l
i : ;
3
;
o
o l - ( , . !
Y
o J
o !t
F
c , u J Q
z
YI
t,
d F
F
Hi 1A ; ut
F
9 t
h
9 E
a ) z z o -
0 u v o E u 3 H 1 0 r {O J .
Q = J g l
: :
:I
iii n
.3 e!
:::::
! l
iEs s
!
3:E
E i i i : r : : e, . s : " E E
l i !
E
E3E:83;
E*: 6. "
3 sB;;
ecE! lE
d ,a
5
! HE ; ; "
r5:::;
E:re
j
< t !
*
ar. o
z
F
z F
z
F
> 2
< o
- J E
> . :
83X31dtt1n,{30
ss3c00v
c, Ltl
2
o
rrl
F
- J F t D F
( r <
E | r l < J
r g z o t !
tt lrJ lr
O U V O E u 3 H 1 0 t ^ t0 I
1
:l
1 n, , , T , - rt l l E
I ?
ll:rr?!::l!
: !
!ri
:
!i: ll:::::::13
! ti
!;3!
P:lr....Bl!
!
!
! : : : : a
i : : : : : :
i t , 3 , i 9
: < : l-t;e@
:
o :
z z
*.^ kt-
F
F
> t < o
F
> t
u!x31dlttnFt3o
J E | r l -
ss3800v
F lEt!
< o
trJ lrl
0UVOg U3H10r'lOJ
J
O lrl @ l t
13::!.r::l:i
l!r:rr:::13
E:::Tr.:rli p::,1r.:Bli rf"
;:
lrr.rTr.rnli s ii i E;; !i e !t:
! ii s
I
!
:::::::.
! ' ! ' E J . r
tn
UJ (9
=
a tIY
F
OUVOSU3HION OJ-
lrl
o tr F
ty.
o
= LIJ T
U) !::?:l::::?:
s
9i ..."...-,.;
l3l3iE3338a;
lr
:i!?I?lll?q-
-l
F( ro(T ruoro| 'F-Rr +t-_,-_
I
I
J
6
r'trAU:e(r€e!rrr!
{?,t
ro-)
-l
I
"ti
'f:;*".
.i
II l
I
v, I
,r^n^.l.dm,L R..'rE.re.a€oJ . a u . ' I r , , a a R r , " , t n L \ j < ot u ^ . I
l'":l
/\
*:i*lx
o.--"--- -ATAR| *
;;,riLFt,q/ilJrAL
AtD,. a.vcaEntnl Po,?TI]LOI ( OiH6ii/r/')1
-a!-Fi:3f*i*5*
APPENDIX A U S E O F P L A Y E R / M I S S I L EG R A P H I C S I . ] ]T H B A S l C
r"rHardware The l f A . e lt 9 , t O O T e OlO l 4 a n u asl h o u l d b e r e a d f i r s t details of the PIayer/Missile craphics. To enable the P/M Graphics fron b e u s e d :*
to understand
BASIC the following
procealure
Generate the playfield, e i t h e r w i t h a c R A p H I C Sc a l t o r b u i l d a c u s t o n d i s p l a y l i s t ! r i t h a s e r i e s o f P O K Ds t a t e n e n t s , . 2.
E n a b l e P , / MD l l A c o n t r o l single Iine resolution resolution players.
3.
There are fou! players and four rnissiles (or five players if the four inissiles are combined into one player). Each of these has a horizontal position register Lhat controls its horizontal position on the screen. The registers and tnerr locat ions are as follows: ADDRESS 53248 53249 53254 5325I 53252 53253 53254 53255
by a POKE559 !,ith either a 62 for players or a 46 for double line
E O R I Z O N T A LP O S I T I O I I O F player P1ayer player player Miss ile Missile Miss i.le Missile
0 1 2 3 I 2 3 4
the horizontal positions can range on the playfield between 4t a n d 2 0 0 . S o P O K E5 3 2 4 9 , 1 2 0 w i l ] n o v e p l a y e r 1 t o t h e m i d d l e of the screen.
*NOTEi AlI
number references are decimal. A-1-
Use of PLayer/l4iss ile with BASIC, cont.
4.
Graphics
Each player (and its missile) has a color register which determines its color. These registers can be controlled by poking to the following locationsl ADDRESS
COLOROF
7 04 '745
P/M O
706 101 711
P/M 2 P/t4 3 f ifth player
T h u s a P O K E7 0 6 , 2 0 0 w i l l 5.
T h e P , / Mb i t Fha
eh.ha
^F
information thc
nlhvArl
(if
enabled)
color player 2 green. (those byres which actually n,ret
ha
qiorpd
jn
rn
iraa
describe where
it
will not interfere with BAsIc or the operating system. It must also start at a 2K nemory boundary if single line resolLltion players are used, or a IK boundary for double line players. resolution 6.
The page number (i.e. number of 256 byte sections of rnemory) for the starting address of the P/M information obtai.ned in step 5 is poked into location 54279.
7,
E n a b l e t h e P / M D M A b y a P O K E5 3 2 7 7 , 3 .
B.
The starting address of each player is obtaineC by mulLiplying the number obtained in step 6 by 256 and then adding the o f f s e t i n d i c a t e d i n P , / Mn e n o r y c o o f i g u r a t i o n t a b L e .
9.
The vertical posiLion of the player is deterrnined by its location in memory. After the initi.al offset is obtained in sCep 8, its height may be defined. Its range on the olayfield is frorn 32 Lo 223 in single line resoLution and from 16 to 111 in double line resofution. By adding the desired height to 'L5
found. Xo
^^Lan
:F,c^l,rf6
The a"propriate bit ihf^ lhic -> -; ?-l r, e s s .
:4/irac<
information
^F
for
ai-h
nl:var
ic
the player can now
Use of Player,/Missile i,rith BASIC, cont.
craphics
(9, cont. ) Exampfe to Generate a rectangular box player, eight color clocks wide and four Lines bigh irt irfi€diate rode. STEP
TYPE
RESULT
1
GRAPHICS B
SetuP l{cde B Playfield
2
POKE559, 62
Enable P/M DMAsingle line
3
POKE53248,L20
Set horizontal
4
POKE704,88
Set clIor
5
I = PEEK(106)-8
Get P/M base addless
6
F(]r'.dB 54279tI
Store in base register
PaRE 53277t3
Enable P/M Df'lA
8
J = I * 256 + 1024
Get player starting
9
PoKEJ POREJ POKEJ POKEJ
'7
+ + + +
125,255 126,129 127.129 128,255
position
to pink
address
Draw player on screen
Use of Player^issile with BASIC, cont. DI4ACTL bit D4=0
Graphics DMACTL bit D4=1
PIAYER-MISSILE Uefi1ory
+0
start at PTtsASE*L0:425t +- 8 bits
wide --+
384 bytes unused
start at PMBASE* +--8
;4xt5L
bits wide -+
+0
PMBASE. 768 b!'tes unused
Relative address shqum along sides of maps.
+384 +5I2
Absolute address
I
u: lr'rztt luo
+640
Player 0
+768
Plaver 1
+896
Player 2
+t-024
P]ayer 3
128 bytes
+768
[,13 t42 Mt MO +I424 .o Player 0
+1280
\-----rr------l double line resolution
+1536 PraYer z
Player 3 +2048
single line resolution
Eacn Player-$lsst1e sectj.on (128 bytes in single line, 256 bytes in double line) naps directly onto the totaf hei.ght of TV screen.
APPENDIXB } , I IX l N C G R A P E I C S M O D E S
I .
GENERAL
Thls procedure descrlbes hoa to ldix severat graphlc nodes on the TV screen ar rhe sare tlne using BASrc comnanes. Each g.aphlcs node has a dlfferenr n u n b e r o f s c a n l i n e s p e i , , M o d eL l n e r (one tine of a graphlcs lnode). The Tv screen must constst of 192 scan 1ines, so-when Elxlng modes, they must be conbined ln.such a way as ro get 192 scan 1tnes. Thls 1s accoDptished by nodifytng the Disptay Llst, When a graphics node is set on rhe corcputer, the O/S attocates R A M€ p a c e f o r t h e g r a p h i c s n o d e , r h e n b u 1 1 d s t h e , d i s p l a y l i s r adjacent to the graphics RAM, and sets a poinrer to irre tegrnnrng of the dlsplay 1isr. Each I'Eode1ine" is construc!eal fror a,,rnode byt€" in rhe dtsplay 1is! thar deternines hol' nany scan tlnes in each oode 11ne. The display list describes tt e screen dtsDrav frora EoP ro bottoE. A Dlsplay Lisr [lusr be builr for rhe "nax RAX node,, (rhe graphlcs node thar requlres the dost R-{M) then modified aith pOKES to lrix the othe! lxodes virh 1r. This "nax RAt{ llode', cannot be a ',nax split screen !1ode (text windo\r), rherefore R A l , ti n o d e , ' + 1 6 o u s t be used. Tf the 'nai RAMoode will be ar the rop of the screen, then rLMS_by!err (1oad menory scan byre) ut tir. iop of the Display -the Lls! r111 already be correcc. If nor, the "LMs bire. \ritI have !o be inodifted. The Dtsplay Lisr is nodlfted by pOKINc a nel' Dode byie fo! e a c h n o d e l i n e i h a t i s n o t a n a x R A t , tn o d e l i n e . Ar.rhe end of the display list i s a J U M Pf n s r r u c r r o n p o i n r l n e r o t h e r o D o f r h e D i s p l a - \ r1 1 s t . When rhe Display Lisr is Dodifled, rhe JUIIptnstruc_ tion nust be placed lnroediately after rhe last oode byre. Exanple ',JI vi11 i Ilu strat e each steD.
be used rhroughout
this
proceature ro
NORMAL
TV scRrEN
YhOO\FIED
-T6 t,S -- 43
MODE 1
I
I
LINE5
6
I
r9L
YnoDE7
112
?6
moDe
LINE5
LINE.5
6\a
SGTINEJ
1
Il/.ooE z
'i
2 LrNE5
TOTA L
ToTAL= lg2
f o o \ FI e D tnoUe ? DI5PLAV
moDE 7 O I5 I ' L A Y moog L r N e+
1
I
2
3 4
Mo
(d D) (6D,
13
;:-
q
t3
(r rns BYIE) ---->
m o o EI 6 L I DE 5
moDE7
7 NE5
- -I I L
66rrN95
I
/hoDE 2-
1
( i r E x l) D E c (qu)1 1d
:
)-
(d6)
G
3 q
(
L
@e) @L\
6
(
kc)
6
4A
1 8
(do) (6 D)
t3 13
5Z
\
(rD\
13
q6
(60) (7 O)
13 13
lgo rq2
ex Arnrru E tJ
2.q
c 5d
J
I
6l
(o o)
/3
@o)
t3
lbo
@7)
1
(d't,
7
r'16 tqz
(rrr)
6.5
T c .!1
to
qq
s
V
7
M i x l n g G r a p hi c s { o d e s ,
II.
cont.
P R O C E D U RTEO S E T U P S C R E E NI N M I X E D M O D E S : 1.
Select nodes destred, then RAMnode froo table #2. exabple:
modes selecEed
look
-
up qhich
eode
I,
node 1s the
oode
7,
nax
Eode 2
7 = max RAM node
node
2. Use table *L to calculate the nunber of roode lines !hat lhe toial n u m b e r o f sc a n l t n e s * 1 9 2 .
such
exaEplel
1lres Iioe
Itne
I
I
1
l
I 48 IT2
56 t6
t92
TOTAL
3 . lf
r h . c . r a r n lhe Dax RAM Dode ls at the top ^f f h thls step: CaIcuLate the LYS byte hw cprr'ln' nlbble to 4, then use table llI ro f tnd rhe rtghl rhe drarh i.c rn.te :. fhe FnD of rh e v r h ^ l a
l -
r o c r
r r h \ ' .
=
3,
LMS byte
-
46
Yode
l,efl Nibble
ntbb1e for
= 6
(HEX)
C a l c u l a t e t h e n o d e b y t e f o r e a c h I 0o d e . Sei !he !o 0, use tabLe lI ro find the !lg ht ntbble for a v , F n 1 o .
c L { n
l c f F
4
de I
4.
r F a n c
lefr ntbble each 0ode.
Uo de Nlbble
( l { E x) 06 OD
o7
B -3-
Mlxlng Graphlcs Xodes, cont.
11.
PRoCEDURE T 0 S E T U P S C R E E NI N M I i E D U O D E S . c o n l . : 5,
Conve!t
all
bytes
dectnal
to
06 0D
Mode I Mode 7 Mode 2
6. Execute a graphics llode (.r15) . exardple:
| I
o7 | call
on
G R A P E T C S7 +
ihe
codputer
tabelted
exanple: Tf
the
rhis
polnter "START".
e x a n p1 e :
to
S T A R T = P E E K( 5 5 0 ) + P r E K ( 5 6 1 ) t
max RAM mode 1s at
s+Fn:
P.kc
rhp
the
loax RAM
l6
7 . P E E Kt h e D l s p l a y L i s i varlab le
using
the
T,Ys hvte
r^n
^{
r1la
.
c a 1 c u1 a t e a
2i6 + 4
creen, then sklp slART-t.
POKESTART-1,70
Every node line requlres a mode byre 1n the DlspIay Lisl in The lhe saEe order as lhe node 1lnes appear on lhe screen. n o d e b y t e s b u s L b e D 0 K E DL n l o r h e D I s p l a y L l s c a t l o c a t i o n S T A R T+ o f f s e t . w h e r e o f f s e r = D o d e I L n e l . Exanple:
M O D EL I N E #
POKEINSTRUCTION P o K E S T A R T+ P O K E S T A R T+ P O K E S T A R T+ P O K E S T A R T+ P o K ! S T A R T+
2 3 MODE I
5 6 MODE 7
for
MODE 2
64
2,6 3,6 4,6 5,6 6,6
loode 7 (Dax RAM Eode) ? o K E S T A R T+ 6 3 , t P O K E S T A R T+ 6 4 , 7
N0TE: .The Disptay L tst wiII already be correct f o r t h e E a x RAX node, therefore lts mode bytes do not need to be POKEd. B
-4-
Craphics
Mlxlng
M o d e s'
cont.
11.
, I0.
f oI1oi.'ed by the LO byte, then the ?OKE the JUMP lnstructlor for rhe JUMP The offset HI byte loto the Dtsplay I-1st. ?OKE 1s the last Dode 11ne # + I, for L0 byte tt 1s + 2' for HI byte 1t 1s + 3. exaople:
1II.
conl.:
(Las!
llode line
# 1 . ' a s6 4 )
REMARK
?OKE INSTRUCTION
JUMP I,O BYTE IIl BYTE
P O K E S T A R T1 . 6 5 , 6 5 POKE START+ 66, PEEK(560) POKE START+ 67, PEEK(56I)
P R O C E D U R TT O P R I N T A N D P ] - O T I N M I X E D } I O D E S
l.
1f the node 11$e ll's ot a tnode on the sc!een fa11 withln the !ange of that node's nornal node flne #'s !hen use the f ollowtng procedure: a. ?OKE 87 n'ith the node # of node b. Delernlrte the Y coordinate by cou11!lng !he/l c u i r e n l o f r h e s c r e e n t o t h e l o p lines fron the posMon. 1n lhe norDal llanner for that c. Deternlne !he X posllion Eode. PLOT and DRAWT0'or d. Dependlng on the node, either POSITION and PRINT. e. These s!eps Dust be done for each node on the screen 1ri s!ep 1. that neets the condltion exanple:
}IODEI
PoKE 87,1 P O S I T I O N2 , I : P R I N T I 6 ; " T E X T "
M O D E7
P O K E8 7 , 7 C o L 0 R 1 : P L o T 2 0 , 2 0 : D R A W T o3 0 , 3 0
MoDE 2
See step
2
Ml v i
III.
n o
C i - nhl . e
M ^ . l oc
P R 0 C E D U RTEo P R I I T A N D P L 0 T I N M I X E D v o l P S . c o ' r r . 2.
S o x d eb o d e s E a y h a v e r 0 o d e l i r e range. e:.ampIe:
/l's
ou!slde
of
their
noroal
Xode 2 nor$a11y has node 11ne #'s I through 12 (fu1I screen). T h e s e a r e n o d l f l e d t o / 1 6 3a n d #64 1n exanple #1.
To prevenL the conputer from givlng ouc oi rarge" error nessageche Folloirlngprocedure can be used: a , S e t a v a r t a b l e I a b e l l e d " M E 1 4 S Tr "o b e t h e d i s p l a y
b.
l , l E M S T= P E E K ( S T A R T )+ P E E K ( S T A R T+ l ) * 2 5 6 S e t a v a r l a b l e l a b e l l e d C H R P 0 St o p o s l t l o n c h a r : a c t e r : s to be prlnted on the target Llne. C E R P O S = . ' . l E l r s T+
R = Yr = M
=
[(Mr -I)*R-U,
* ( R _ 2 0 ) - 1 , 1 3* ( R - 1 0 ) ] + X
line. che RAV per 11ne of the Yax RAM Yode the Uode Line + of Lhe target Line. flaa
n,tFhpr
llne
abovP
.f
-hF
' { r = t h e n L r m b e ro f l'-e
ch^vF
'hF
n^,ra
rtable
,/l),
l
-rrdpF
line.
m o d e 1i n e s o f r:roar
L0 bytes of RAY per
rine.
ExanpLe: calculate C H R P O Sf o r l . I o d e 1 - i n e # 6 4 ( t h e last tlne of rhe Mode 2 area) at horizootal posltton 5.
x
=
5
R = 40 Mr = 6a M, 7 (6 from Mode 1 area, I fron Mode 2 area.). M " = 0 ( 6 4 - l ) * 4 0 - 7 *( 4 0 - 2 0 ) - 0 * ( 4 0 - r 0I )+ s CHRPO S = l . l E M S T+ ( 6 3 ) ' , 4 0 - 7 * ( 2 0 ) _ 0 r ( 3I 0+ )5 c H R P oS = : , l E M S T + CERPO S = )IEMST+ 2 5 2 0 - 1 4 0 1+ 5 C E R P 0 S= M E M S T+ [ 2 3 8 0 ] + 5 CHRPoS=YEMST+2385
B -6-
Mixlng Craphlcs Uodes, cont. lII.
P R O C E D U RTEO P R I N T A N D P L o T I N M I X E D M O D E S , c o n r , c.
d.
Tf fe!r characters \r111be printed, then each charac!er,s internal value day be fooked up in the In!erna1 Characre! Ser Table (Tab1e 9.6) , tn rhe ne!, BASIC Reference Manual. This value is rhen p0KED lnto CIIRPOS . If srrlngs are to be outpu!, and 1f rhe ATASCII vatues of all rhe characters 11e irlthlo one of the tanges shown tn rhe rable belol,', rhen do rhe follor,ingl I ) 0btatn rhe appropriate ATASCII vatue range fo! the char act exs 2 ) D o t h e 0 P E R A T I O Nt h e ! a b l e t n d l c a r e s o n r h e ATASCII value of each characrer. 3 ) p 0 K E t h t s v a l u e i n t o c E R p o sA T A S CI I V A L U E RANGE
0-31 32-95 96-r27 t28-159 t60-223 224-255 lxaEple:
I)
2) l)
4)
] I
OPERATION Value
+
64
NONE Value
+
64
NONE
assuse we want to prlnr Ehe vord "TEXT'i In !he Eode 2 area of exac0ple #l us Lng previously. the CHRP0Scalculated rhese characters are 1n the ATASCII VALUE RANGE of "32 ' 95". t5e OPIRATI0N for c\is !aflge Is "VaIue-32", so 32 Eust be subtracted fro0 each ATASCII valu e. the progran statesents !7ould non look I ike this:
TS(I,4) = "TExT" C H R P o S = Y E M S T+ 2 3 8 5 I o R X = I TO L E N ( T $ ) P O K E C 1 I R PS O + x - r , A s NEXT X
c l T $( x ,x) l - 32
A t
(0PERATI0N: value
4 -
5 ) r h a F n c / \ " v _ l n n . P O < c <E h e f l r s c charac!er of T$, ASCIT$(X,X)l-32, into CHRPO S + 0, 6) the next lreration P0KEs the next cha!acter of T$ lnto the next CHRP0S, and s' 'n' B -7-
l
32)
ltlodes, cont.
G!aphlcs
Mixlng
TAB',E # I
R I GllT NIBBI-E (HEX)
1EFT REMARR N I B B L E (ItEX)
o
ClTAR
SC A N I.INES PER I,IODE LINE
PER PI X E L
1----Z----l-.i-
|
s
RA}1 MODE PER LlNE
',} c0L0Rs
|
7
I
-
I 40
MODES (;l
20 l0
^
l
(-1 ) l |
1
GRAPH IC MODES
40
40
0 81,ANK I
BLANK
0-7 SP
UMP
MP
IAL
at the toP of the When the llax R A t { m o d e 1 s ! ! 3 m usl be changed lo b y t e o f E h e L l { S n l b b l e lefl
Lef t
I
I[ode bytes
nlbb te
after
the LYS bY!e.
is conErolted by setcolor the field Col.or & Luro fo! o r g r a p hi c s f r o o s e t c o l o r l . Lun for charactors JUUP B 1 - A N K-
used !o end the beginnlng. lo
output
dlsPlaY
selected
lisl
nuober of
the
screen, a 4'
and return
!o
aod
2'
!he
b a c k g r o u n d 1 1 n es .
B -8-
Ytxing
Graphics Yodes, cont. TABLE #2 GRAPIlICS MODES RAMREQUIREMENTS
,',tode
+
I
8i38
16
8112
8 'l
By!es
4240
+ 16
7
4190
6 + I6
2t84
6
2 1 74
5 + I6
II76
5
It7 4 696
I6 4
6 94
3 + l6
432
3
L34
2 + I
424
2
t+24 6 72
16 I
614
0
992
these valu es tnclude u nu sed rnernory
!he
display
list
a n d any
tllbedded
e€l
e9'8
b
ag
e9'g 3
3';
Eg.;F
FgE
z
e F
uJ iI o
3
r
H9;E
5E€
cg.;F
Eg9
RB;E
3
z
=
o = l! =
d $
:
5E€
eaEc
FgE e.t
3
r
E:E E':
esEs = 3
'EE
E e' ; E
B- 10
I
I 3
E: . ; E a
: 3
€& ;F
3
*. A i :E
I ?
g 9 . 5F
+
F q
B;;E
z
Es
3
E O
E
10 :.4=
3 € . ;F g
o-
E B = gR
= =
T
t
',2
r I*
F$='
A P P E N D IX C :
PI NOUTS
Ye!]!9l-iesl-l!!-q-_eo ry L D.f.N
5 Jack Audio
OutDut
Coilposite
4
6
10
8
I 1. 2 . Clock
11
Output
4 . Ground 5 . Data Output 6 . cround '7. cor,mand
Controller
\ri rla^
i ra
2
6
(Joystick) (Joystick) (Joystick) (Joysiick) D^+oh+
12
13 8. 9. 10. 11. 12.
Motor Contro I Proceed +5/Ready . a . uido l n p u t +12 volts
l'l
rh+or.,1^+
Jack L
a
a^mn^c
f ,/O Jack 2
12. 3. 4.
Luninence
Chroma
Ground
Serial
Composite
3
7
4
8
Fo4eard Input Back TnPut Left rnput Right Input
i ^ma+or
T.^f+
5
9
b. 7. 8. 9.
l rrgger LnpuE +5 vofts cround A Potentiometer
Input