You are on page 1of 57

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
I
d ,r.
a l

E
q E

;l
i>:

IV.2
a i

i2

.- 'rd .t
. - .
r-!r

: .?9 :q]
::3 \.- .>;
- J

- I$: :s' i-.s


odw
. {ro _:r c:;:db
" : - =
i'
, r i g
:;i -:*'
' ::F :'r:4 P'zo':z
i; {-*5 :-t1P99
: _),, i..r F:6rF;'
:rn:--Et ;d'C'g'H

: i:: ",.-= o
): -; E. F: i- : ! : +
de n
I $*3[:- $ c Ece:,;s;; )
s- i:"H-::8 5 :?t;tl:;"",,.;
"ri0:?i:
;" h,"",9,E: ; !
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
L a
*! -LdIJ .
; :iY:i"i;*:
;o ". J- ," : "- ". t9a -: :9 S ; n , r , ' r
- r - o o o r r r d a F : o
{ l i Q E ::+r j:il:: ^ i E - !ftft:qiEf:ii $
r'E6tlUd6'&gFE
!3 "iy2z2E;1
! il;i u d r i = o d o ; E d - t r . : . : ; d .i i < 6 6 6 6 6 o ,d 6
3 ItJl;
J , ; * ; , ; ; : i E ! ! i ! ! E $ $ i :i :f f; ;f ;q E : $ : $ E
$E$ fEr " 9 : F C 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- a
d :E
" a "9
6 H ic
H o 9p
5 K
E H s;
e :3 i c;UF
-d ,
E $ g. e ciHb
-; " Y a Cd3,4
! cr! q 5Q**
iE E EJ .F :::;i
E d :d o*U;
' ' i>i ccco
P d ci

un r icgcF$H$
; L L - - 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 9Fq
3
- '
I E . d: : ' g: s * s ' aj r P 5 [ o . " " " "5ti.
9
t ' ad ' , ',,"" ix l r " ' , , , ' " '
L i S >y f "
g E " - - - - - - , - - - - - : 6 ;H
6 a f E E E4RE E r
...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
:

j - ! n ' - :

3 + 1 * 4 S :
{ ; q t 3 ' i i
= V " d d u i ! i b

; t o
" , 2 d ! l ! g d
- e u t >

n o6$66o6
H 9: :::: : i : :
d
3 """""

E F ; 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

+ -
& 6
, a ao.

t
g

9":

t
+e P

-FE
\E FliJ
iH5 S Ct r C
.r+
: i_:

-.rEqc g

IV.7
i

;
i

5 E
E
o
fr

€ EA FCEEEi9 K
E

5
333.S

rv.8
p

6 ; g

[3hi=ts$Ets3
i;

SSRS$E$RA339

$e3s33E$3S$ g*sssssP

IV.9
5

z f t s
q q . ' o 5
6 E
ts

q !
d
*
i i -

I q !P
. .ii o Et i6
e$a* r e " i
BS3$ Pg : : S

d o rru66 og
gfrsfr=:irilEd
E:EEE$rHH
vt
6
I 3" " 3
9 -o 9r P 5 .E d d
u r!!
3
fifififiR$fi
P EgCS
fifrfi
$HHRHB$$B$$Bgi$939s$H$f
I
t>L
Lo rU 6$i'i 6rr. c x 3
$ FE HH H ! l H e e sse*s$JeHs $ e E :
E s*aer EE F F -P
Na
P P P P P K R T R RI S
vouei'ltF\
KX, :R R R R ^ " E
;i 6i6 i,nihniDhi i^i

IV. l0
.i.
I

di

nJ

rv.11
HARDWARE
REGISTERI,ISTS

ANDRESSORDER

CTIA ADDRESSES

READ
Address Descrt
DOTF
tI REPEATAS BEI,OW 7 MORETIMES
i
D020
01r Wrlte Co Consol SW. Port
D Ol E on Clear
DO]D
Vert. De
9t3 ?riori
0lA
D01

D OI 6
D0l5 Color-1um of 3
D0t4 sile 2 RXAN PAJ-/NTSCb l t s
D0l laver-Ulss1le I Read Joystlck
D0l2 Trlgge!
D011 GraDhlcs A1l Buttons
aDhlcs Plaver 3
DOOT Read PLayer
GraDhlcs Plaver I to Player
DOOD ColllsLoDs
Slze A11 lttsstle
DOOB Read Mlsslle
Slze Plaver 2 To ?Iayer
D009 Plaver I colllslons
D008
D00 llorz. Poslt. Mlsslle Read P]ayer
D006 rz, Posl!. Mlsslle 2 To Playfield
Itorz. P Colllslons
D004 Ilorz. Poslr, l41sslle 0
Itorz. P Read Mlsstle
D002 1{orz. Poslt. Plaver 2 To Playfteld
CollisloIrs
D000 orz. Poslt. ?laver 0

V.I
ANTIC ADDRES

Address
D4FF

tt REPEAT (AS BELOW) 15 MORETIMES

Reset NUI NMI Interrupt


D4OT Interrupt Status Status Reglster

D4OE
Llght Pen Reglster
D4OD VertlcaL
Llght Pen Reglsrer
D40C Horlzontal
Vertical Llne
D4OB Counter
Walt for IIBLANK
D4OA
Character Base
D409 Address Red

D408
Player-Mlssile Base
D 4 07 Address Re

D406
Ve!tlca1 Scroll

Horizontal Scro11

Dtsplay List
D1-1ST11 olnrer (H
Display Llst
D402
Character Control
D401
DMA Control
D400

!.2
POKEYA.DDRESSES

READ
DescrlDtlon Descri
DzFI
t
I REPEAT (AS BE].OW) 15 MORETIMES
i
D2l0
Serlal Port 4 Key Serlal Port 4 Key
control
IRQ lnterrupt IRQ lnterrupt
lnable s Reeister
Serlal Port Ser{al Porl
Resister

Start Pot Scan


1ca1 ]-lne
Reset Status Rendon Numb

Sralt Tlmers oard code


Read
dio control
Audlo Channel 4

Audlo Channel 4
D206
Audio channel 4
D205 Read the
Audio channel 3 value of
each POT
Audlo channel
D20 control
Andlo chanRel 2
D202
Audto Channel

Ardlo channel I

v.3
ANDRESSES

READ

Add!ess DescrlDtion
D3TF
Repeat as shown below rnany tlnes

Directlon Reglster
If PBCTI, Bit 2-0 Same as wrlce
D301
Jack2&Jack3 Jack2&Jack3
If Dlrectlon Blts If Dlrectlon Bits
e 0 *
Dlrec!1oo Register
If PACTLtlt 2=0 Same as wrlte
D300
Jack0&Jackl J A C K U d J C K I
If Dlrectlon Bits If Dlrectlor Bits

* NoTE: 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.
AIPHABETICAL ORIER

Itard lster
Address Add!ess
Hex Dec
AI,LPOT R e a d 8 1 i n e l o t P o r t S t a t e 53768
AttDc I Audto Channel I Colltrol 5376r
AUDC2 Audlo Chafirel 2 CoDtrol 53763
ATIDC3 Audlo Channel 3 Control 53765
o Channel 5316'l
AUDCTL Audlo Control 5 37 6 8
AI'DF I Audio Channel 1 Frequency 53760
AIJDF2 Audlo Channel 2 f'requency 53762
AIDT3 A[dto Channel 3 lrequency
Audto Channel 4 lreouenc
CHACTL Character control '155
54273
2F3
CITBASECharacter base addless 54281
2F4 1 5 6
C01,BK Color-l-umlnance of Background 53274
2C8 7 t 2
COLPFOColor Luninance of Playfteld 0 53210
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 O 53266 PCOLRO 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 PoslEion of Mlsslle 2
IIPOSM3 Hor{zontal Postlton of Mlsslle 3 D007 53255
HPOSPOHorlzontal ?ostrlon of Playet 0 D000 53248
HPOSPInorlzontal Posltlon of Player I D001 53249
HPOSP2lorlzortal Posltlotr of Player 2 D002 53250
of Plaver D003 53251
HSCROT D404 54276
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 D2OE 53714
IRqST D2OE 53714
KBCODEKeyboard Code D209 53769 764

MOPL Mlsslle 0 !o Player col1l6tons 53256


MIPF l,ltsst1e 1 to Playfteld Colltslons 53249
MIPL Mlsslle I to Player colllslons 53257
M2?I Ulsslle 2 to Playfleld colllslons 53250
IT2PL
llardnare ister 0S Shadow
Address Address

},13PF Misstle 3 ro Playfleld co1l1slons D003 53251


M3PL }llss11e 3 to Player DOOB 53259
NMIEN Non-Maskable Interrupt (NMI) Enabte D4OE 54246 set to $40 by IRQ code
NMIRES NMl reset D4OF 5 4287 wrltten to by NMI code
NMIST NMl Stahrs D4OF 54287 read bv NIlI code
?OPF Player 0 to Playfield Colllslons D 0 0 4 53252
POPL Player 0 to ?layer Co1llslons D00c 53260
PIPF Player l to Playfteld Collisions D 0 0 5 53253
PIPL Player I to Player Colllslons DOOD 53261
P2PF D006
PzIL Player 2 to Player Colllslons DOOE 5 3 2 6 2
P 3 P F Player 3 to ?layfleld colllsions D 0 0 7 53255
P3PL Player 3 to Player Colllslons DOOF 53263
PACTL Port A Cotltlol D302 5 4 0 1 8s e t t o $ iC by IR C o d e
PA]- PAr,/NTsc tndtctor D 0 1 4 53268
PBCTL Port B Conlrol D303 54 0 1 9 set to $ iC by IR Code
PENH Llght Pen Ilorlzontal Posilion D40C 54284 LPENII 234 564
PENV Ltght Pen Vertlcal Poslllon D4OD 54285 IPENV 235
P}EASE Player Misslle Base Address D407 54279
?ORTA P o r t A D300 sTlCK0 - l 2 78 . 2 7 9
PORTB Port A D3 0 1 5 4 0 1 7s T r c K 2 , 32 7! , , 2 1 R 634,635
POTO P o t 0 D 2 0 0 53760PADDI-O 2 7 0 , 624
POTl Pot I D 20 1 5 3 7 6 1 PADDL I 2 7 1 625
POT2 P o L 2 D202 ?ADD]-2 2 7 2 626
POT3 53163?ADDI-3 2 7 3
POT4 P o t 4 DZ04 5 3 7 6 4PADDL4 2 7 4 624
POT5 D205 53765PADD],5 2 7 5 629
POT6 DZO6 5 3 7 6 6 PADD]-6 2 7 6 6 30
POTT Pot 7 (rlght paddle controller) D20'I 53767 PAI}D].7 27'I 631
POTGO Star! POT Scan Sequence D2OB 5 3 7 7 1WRITTEN ILANK
PRIOR D r ' l ^ i l r w C a l e . r D O I B 53275 GPRIOR 26r 623
RANDOMRaodon number generator D2OA 53770
SERIN Serial Port Input D2OE 5 3 7 7 4
SEROUTserlal Port output D2OD 53773
stzes for all nisslles D00c 53260
SIZE?O stze of Player 0 D 0 0 8 53256
S I Z E P1 size of Player I D0 0 9 53257
S'ZEP2 slze ot Player 2 DOOA 53258
S I Z E P 3Slze of Player 3 DOOB 53259
SKCTI Serlal Port Control D2OF SSKCTL 232 562
SXRESTReset Sertal Port Status (SKSTAT) D2OA 53770
SKSTAT Serial Port Status D2OF
STlMER Slart Tiner D209 53769
IRIGO Joysrick cortroller Trigger 0 D 0 t 0 5 3 2 6 4STRIGO 284 644
Joastick Controller Trisser I D01l 53265 STRIGL 285
TRIG2 Joysrtck Controller'Irigget 2 D 0 1 2 5 3 2 6 6STRIG2 286 646
TRIG3T Joystlck Conlroller T!1gger 3 D OI 3 5 3 2 6 7STRIG3 247 641
VCOIJNTVertical Llne Counler D4OB 54283
VDELAY Vertcal Delay D0IC 5 4216
VSCROLvertical scrolf D405 54 2 1 7
WSYNC Wait for Horizontal Sync D4OA 54282 Used by keyboald
cltck routtne

v.6
vI. FIGURES

MEMORYMAP

RE s
FFTF
Operatlng Systen
And IOK
Math Routlnes

D800
DOOO-D7TF Ilardware Addresses 2K
C}FF
Reserved for Future 4K
O.S. exDanslon
BFFF
Rol,l Cartrldge

(Col1een left and right


slot and Candy single 16K
slo! all address to
8000
7}FF

RAM

Expanslon

2000
lFTF
RAM tnltially
supplled 1n rhe 8K
product

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
--__l-
i3 rO'an-,OS:o 3Nr-rZ -.l.Nnot^ l .

tu
t 9 o ib
:3lNfral (!Nri r..\"s) 'tYf,.i.!:^

z
F < F
U

tNAsts
>JN\?'IEH
> J 6 ---r-
ld 3Cl7\
aNnan€)>#
I
N,|S A ON=
c^rncEg>tx I
lI
id ^/€r*Jwtl ON=+ o (,
trj q
-r
\_
<
(o -J

o
JO
J<.
rr nl
Ad
, < s -
nu) po Qoo l-
:v <q (, -J
uu 0 , <
$(l
qd
-J i]
^u
iUY
(qd w
: -
=
dY
-o
fi'fl.
{u 6
trud 6 N
(l ,,,0q t r N
id 7 - 606
< o ;dU
R V
Fla d - .
ON r J
?0
z(\t
,.9 3
i t . r
<
3d r'r'OalltvN I:j\/IS
O r-r

0 <
I
CNncljgtx'r€ LONneE9>r ()
/\\7-1dS1C ]!VJs t")
>N(9. rgir t:93d
.LejnE EcrcD €N=- F
z.
3Nr€H IfS3- II
cN,|gH I3S
I

d * / \ . .-
l s > 1 L L t t d l'z
t
lY o
_,l-
f
L9:rHflHftl ul r iii
ET LU

h$ HYH>dAE 'i0S
U rjt
sd$b =<
LUn
>rn
--J .\
A{
-l
at:1Nno, (3Ntr Nv?9
$

trl

tU 2;

(r!rtosl

(rrraos)

tt3)13o5)
il*
E
{JJ

F
=

<f

::r.!.'?!r:i::r ::::r*:llfEh!S:;f

; ::r::r::r:!r rr::.:.:

r:ii:::i:.:3::r:E:!:::i.: f!

t::iatr::r::?n;!3rtr!: ia
3e
F

(D

'rLl.j

EiEi

+ .:-
9E

;E.

5R E:
*

:E

E
E:
t
l D @

I <

G .
o <
=

rl-oYr.!>

s 3 Nr ' l

tno 0!0 rA

(Maos)

> ;
u! xaos)

3tvts-rt.L
r:r E
;- r!i:i9! PJ 3*,:r;i,
iitt

o
(I

c0
CC
lrl
= i-{H.:;F+#
F
o fFr "FF+r 1
=1 tsrl rii 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:: i:,3; -. r1;::! :! I

>i ,! i.r! 3>1 ;a:!

;9 .';a ! ! >3>; 3.t:

P;ii111::r:::::! i ,t ;!;!! !,r B!!:


r 3E

O N

A F
o *
E.
IJ
F

o _8:-Ei !i
3o-$nf
;
E
a

E
!-*-e
ErEt'

: ; : :
(L
: 6
- ! !
o

Lrl
=
F
(L

: ; G
; o 9

: r
i 6

; F

- ; <
-

t!
=

iE
tp
\r

,g*ils:i**iE
; 5 s
a-
. ! :
ao

lrJ G
= <
O F
o - <

9 ; E

: t
i 4

g ;

< 5

;
- - E
-

tf
IJ i
=

o iii
EE:

Eis

; ; 3 3

iie:iiiElE:3i
iEiE:
lr,J

g F
6 J
< = F

u) ).
E <
lrl

0 u v o 8 u 3 H L o l to i -
" " 1 = r " = ""1"
' . "-"
" r" '=i
.

"-"'r""
l'-'
: ; : : E 3 E E

=rt_D 1

:.-::: E

r: : €- - ;. ; : a ?
: -
i9

{
2 @

G <
LIJ F
o-< ."i
UB
t=]
f'.
:i

il :t '

'id
t
!"'

) :

-i"r.ii .i
3;:3133;::l i : ; 3

;
o

o
l - ( , . !
Y

o
J

o
!t

c , u J
Q =
Q J g l

YI
t,
d F F

Hi
1A ;

ut

F
a ) z
9
t h
9
E
z o -

0 u v o E u 3 H 1 0 r {O J .
: :

: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

! 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
( r < E | r l
F r g z < J
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

F
*.^ kt-
F
> t
< o

F
u!x31dlttnFt3o > t
J E
ss3800v | r l -

lEt!
< J
O lrl
o @ l t
trJ

lrl

0UVOg U3H10r'lOJ
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
t-
IY

OUVOSU3HION OJ-
lrl
o
tr
F
ty.

=
LIJ
T

U)

!::?:l::::?:
s 9i lr
..."...-,.;

l3l3iE3338a; :i!?I?lll?q-
-l

ruoro| 'F-Rr
F( ro(T
I +t-_,-_
I

6
r'trAU:e(r€e!rrr! ro-)

-l
{?,t
I
"ti

'f:;*".
II
l
.i I

v,
I ,r^n^.l.dm,L R..'rE.re.a€oJ
l'":l . a u . ' I r , , a a R r , " , t n L \ j < ot u ^ . I

/\ *:i*lx
o.--"--- --
ATAR|
*
;;,riLFt,q/ilJrAL
AtD,. a.vcaEntnl Po,?T-
I]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

The l f A . e lt 9 , t O O T e OlO
r"rHardware
l 4 a n u asl h o u l d b e r e a d f i r s t to understand
details of the PIayer/Missile craphics.

To enable the P/M Graphics fron BASIC the following procealure


b e u s e d :*

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 by a POKE559 !,ith either a 62 for


single Iine resolution players or a 46 for double line
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 E O R I Z O N T A LP O S I T I O I I O F

53248 player 0
53249 P1ayer 1
53254 player 2
5325I player 3
53252 Miss ile I
53253 Missile 2
53254 Miss i.le 3
53255 Missile 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 Graphics
with BASIC, cont.

4. 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 P/M O
'745
706 P/M 2
101 P/t4 3
711 f ifth player (if enabled)

T h u s a P O K E7 0 6 , 2 0 0 w i l l color player 2 green.

5. T h e P , / Mb i t information (those byres which actually describe


Fha eh.ha ^F thc nlhvArl n,ret ha qiorpd jn rn iraa 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
resolution players.

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 :F,c^l,rf6 :4/irac< ^F ai-h nl:var ic
found. The a"propriate bit information for the player can now
Xo ^^Lan ihf^ lhic -> -; ?-l r, e s s .
Use of Player,/Missile craphics
i,rith BASIC, cont.

(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 position

4 POKE704,88 Set clIor to pink

5 I = PEEK(106)-8 Get P/M base addless

6 F(]r'.dB
54279tI Store in base register
'7 Enable P/M Df'lA
PaRE 53277t3

8 J = I * 256 + 1024 Get player starting address

9 PoKEJ + 125,255 Draw player on screen


POREJ + 126,129
POKEJ + 127.129
POKEJ + 128,255
Use of Player^issile Graphics
with BASIC, cont.

DI4ACTL DMACTL PIAYER-MISSILE


bit D4=0 bit D4=1
Uefi1ory

start at start at
PTtsASE*L0:425t PMBASE* ;4xt5L
+0 +0 Absolute address
+- 8 bits wide --+ +--8 bits wide -+
PMBASE.
384 bytes 768 b!'tes
unused unused Relative address
shqum along sides
+384 of maps.
I
+5I2 u: lr'rztt luo Eacn Player-$lsst1e
sectj.on (128 bytes
+640 Player 0 in single line, 256
bytes in double line)
+768 Plaver 1 +768 naps directly onto
the totaf hei.ght of
+896 Player 2 [,13 t42 Mt MO TV screen.
+t-024 P]ayer 3 +I424 .o
128 bytes Player 0

\-----rr------l +1280
double line
resolution
+1536

PraYer z

Player 3

+2048

single line
resolution
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
split screen !1ode (text windo\r), rherefore ',nax
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
-the menory scan byre) ut tir. iop of the Display
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 be used rhroughout this proceature ro


i Ilu strat e each steD.
NORMAL TV scRrEN YhOO\FIED
-T-
I MODE 1 6 t,S -- 43
I 6 LINE5

I
r9L
112 YnoDE7 - -I I L
LINE5 moDe 6\a
?6 LINE.5 SGTINEJ

'i
Il/.ooE z
2 LrNE5 1
ToTAL= lg2 TOTA L 7

f o o \ FI e D
moDE 7 tnoUe ?
O I5 I ' L A Y DI5PLAV
moog s<Ah
L r N e+ ( i r E x l) D E c
;:- (r rns BYIE) ----> (qu)1 1d
I
1 1 :

2 (d D) 13 q m o o EI )- (d6) G
3 (6D, t3 6 L I DE 5 3 ( \ L 2.q
4 q @e) c
@L\ 6
( kc) 6 4A
1 (do) t3 5d
8 (6 D) 13 5Z
Mo 7 moDE7 J I
NE5 66rrN95
T
I 6l (o o)
@o)
/3
t3
V
lbo
/hoDE 2- @7) 1 r'16
c .!1 (d't, 7 tqz
(rrr) 6.5
to

qq (rD\ 13
(60) 13 lgo
q6 (7 O) 13 rq2

E tJ
ex Arnrru
M i x l n g G r a p hi c s { o d e s , cont.

II. 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 look up qhich node 1s the nax


RAMnode froo table #2.

exabple: modes selecEed - eode I, oode 7, Eode 2

node 7 = max RAM node

2. Use table *L to calculate the nunber of roode lines such


!hat lhe toial n u m b e r o f sc a n l t n e s * 1 9 2 .

exaEplel
1lres

Iioe
Itne I
I I 48
1 l 56 IT2
t6
t92 TOTAL

3 . lf lhe Dax RAM Dode ls at the top ^f r h . c . r a r n r F a n c L { n


thls step: CaIcuLate the LYS byte hw cprr'ln' f h c l c f F
nlbble to 4, then use table llI ro f tnd rhe rtghl ntbb1e for
rhe drarh i.c rn.te :. fhe FnD of rh

e v r h ^ l a l - r o c r r r h \ ' . = 4
de I = 6
3, LMS byte - 46 (HEX)

4. 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 lefr ntbble


!o 0, use tabLe lI ro find the !lg ht ntbble for each 0ode.

a v , F n 1 o . l,efl Uo de
Yode Nibble Nlbble
( l { E x)

06
OD
o7

B -3-
Mlxlng Graphlcs Xodes, cont.

11. 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 . :
PRoCEDURE

5, Conve!t all bytes to dectnal

Mode I 06 |
Mode 7 0D I
Mode 2 o7 |
6. Execute a graphics call on ihe codputer using the loax RAM
llode (.r15) .

exardple: G R A P E T C S7 + l6

7 . P E E Kt h e D l s p l a y L i s i polnter to c a 1 c u1 a t e a
varlab le tabelted "START".

exanple: S T A R T = P E E K( 5 5 0 ) + P r E K ( 5 6 1 ) t 2i6 + 4

Tf the max RAM mode 1s at the r^n ^{ r1la . creen, then sklp
rhis s+Fn: P.kc rhp T,Ys hvte slART-t.

e x a n p1 e : POKESTART-1,70

Every node line requlres a mode byre 1n the DlspIay Lisl in


lhe saEe order as lhe node 1lnes appear on lhe screen. The
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

2 P o K E S T A R T+ 2,6
3 P O K E S T A R T+ 3,6
MODE I P O K E S T A R T+ 4,6
5 P O K E S T A R T+ 5,6
6 P o K ! S T A R T+ 6,6

MODE 7 for loode 7 (Dax RAM Eode)

MODE 2 ? o K E S T A R T+ 6 3 , t
64 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-
Mlxlng Craphics M o d e s' cont.

11. , conl.:

I0. ?OKE the JUMP lnstructlor f oI1oi.'ed by the LO byte, then the
HI byte loto the Dtsplay I-1st. The offset for rhe JUMP
?OKE 1s the last Dode 11ne # + I, for L0 byte tt 1s + 2'
for HI byte 1t 1s + 3.

exaople: (Las! llode line # 1 . ' a s6 4 )

REMARK ?OKE INSTRUCTION

JUMP P O K E S T A R T1 . 6 5 , 6 5
I,O BYTE POKE START+ 66, PEEK(560)
IIl BYTE POKE START+ 67, PEEK(56I)

1II. 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 #
b. Delernlrte the Y coordinate by cou11!lng !he/l of node
lines fron the l o p o f r h e s c r e e n t o t h e c u i r e n l
posMon.
c. Deternlne !he X posllion 1n lhe norDal llanner for that
Eode.
d. Dependlng on the node, either PLOT and DRAWT0'or
POSITION and PRINT.
e. These s!eps Dust be done for each node on the screen
that neets the condltion 1ri s!ep 1.

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 n o C i - nhl . e M ^ . l oc

III. 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 /l's ou!slde of their noroal


range.

e:.ampIe: 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

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
b. 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+ [(Mr -I)*R-U, * ( R _ 2 0 ) - 1 , 1 3* ( R - 1 0 ) ] + X

line.
R = che RAV per 11ne of the Yax RAM Yode rtable ,/l),
Yr = the Uode Line + of Lhe target Line.
M = flaa n,tFhpr .f n^,ra l

llne abovP -hF -rrdpF line.


' { r = t h e n L r m b e ro f m o d e 1i n e s o f L0 bytes of RAY per
l'-e ch^vF 'hF r:roar 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

CHRPO S = l . l E M S T+ ( 6 4 - l ) * 4 0 - 7 *( 4 0 - 2 0 ) - 0 * ( 4 0 - r 0I )+ s
c H R P oS = : , l E M S T + ( 6 3 ) ' , 4 0 - 7 * ( 2 0 ) _ 0 r ( 3I 0+ )5
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. 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 .
d. 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 s-

A T A S CI I V A L U E ]
RANGE I OPERATION

0-31 Value + 64
32-95
96-r27 NONE
t28-159 Value + 64
t60-223
224-255 NONE

lxaEple: I) assuse we want to prlnr Ehe vord "TEXT'i


In !he Eode 2 area of exac0ple #l us Lng
the CHRP0Scalculated previously.
2) rhese characters are 1n the ATASCII
VALUE RANGE of "32 ' 95".
l) t5e OPIRATI0N for c\is !aflge Is "VaIue-32",
so 32 Eust be subtracted fro0 each
ATASCII valu e.
4) 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 $ )
O + x - r , A s
P O K E C 1 I R PS c l T $( x ,x) l - 32
A 4
NEXT X t l
(0PERATI0N: value - 32)

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-
Mixlng G!aphlcs ltlodes, cont.

TAB',E # I

SC A N
1EFT R I GllT I.INES RA}1
PER ',} MODE PER
REMARR N I B B L E NIBBI-E PER
(ItEX) (HEX) PI X E L I,IODE c0L0Rs LlNE
LINE

o ClTAR
1----Z----l-.i- | s | 7 I - I 40
MODES
(;l
20
l0
^ l
(-1 ) l | 1 GRAPH
IC

MODES
40
0 40

81,ANK I 0-7 BLANK


UMP SP IAL MP

When the llax R A t { m o d e 1 s ! ! 3 at the toP of the screen, the


lefl n l b b l e o f E h e L l { S b y t e m usl be changed lo a 4'

Lef t nlbb te I[ode bytes after the LYS bY!e.

Col.or & Luro fo! the field is conErolted by setcolor 2' aod
I Lun for charactors o r g r a p hi c s f r o o s e t c o l o r l .

JUUP - used !o end the dlsPlaY lisl and return !o !he


beginnlng.

B 1 - A N K- lo output selected nuober of 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 + 16 8i38 By!es

8 8112
'l
+ 16 4240

7 4190

6 + I6 2t84

6 2 1 74

5 + I6 II76

5 It7 4

I6 696

4 6 94

3 + l6 432

3 L34

2 + I 424

2 t+24

16 6 72

I 614

0 992

these valu es tnclude !he display list a n d any tllbedded


u nu sed rnernory
b e9'8 e€l

e9'g ag
3';

3
Eg.;F FgE
z
e 3 r
F H9;E 5E€
uJ
iI o
z
=
o
cg.;F Eg9
=
l!
=

3 :
RB;E 5E€

$
eaEc FgE

3 r
e.t E:E
E':

esEs
= 3
'EE
E e' ; E

B- 10
I
I
E: . ; E 3

€& ;F *. A
i :E I
?
a :
3

3 g 9 . 5F +

F q
z B;;E
Es
3
E O 3 € . ;F
10 E
:.4=

o- g
= E B = gR
=

F$='
',2
r I*
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 Composite Luninence


Coilposite Chroma
a^mn^c i ra \ri rla^
Ground

Serial f ,/O Jack

2 4 6 8 10 12

I 11 13
1. 8. Motor Contro I
2 . Clock Output 9. Proceed
10. +5/Ready
4 . Ground 11. . a . uido l n p u t
5 . Data Output 12. +12 volts
6 . cround l'l rh+or.,1^+
'7.
cor,mand

Controller Jack

L 2 3 4 5

6 7 8 9

1- (Joystick) Fo4eard Input b. l rrgger LnpuE


2. (Joystick) Back TnPut 7. +5 vofts
3. (Joystick) Left rnput 8. cround
4. (Joysiick) Right Input 9. A Potentiometer Input
a D^+oh+ i ^ma+or T.^f+

You might also like