Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/BizHawk.Emulation.Cores/Consoles/Atari/docs/Atari_Mappers.txt
2 views
1
Copied from:
2
http://blog.kevtris.org/blogfiles/Atari%202600%20Mappers.txt
3
4
Mostly Inclusive Atari 2600 Mapper / Selected Hardware Document
5
---------------------------------------------------------------
6
7
03/04/12
8
Kevin Horton aka kevtris
9
---
10
11
Version 1.00
12
13
14
Things covered in this document:
15
--------------------------------
16
17
"original" mappers from when the system was in production:
18
19
2K
20
4K
21
CV (Commavid)
22
F8 (Atari 8K)
23
F6 (Atari 16K)
24
F4 (Atari 32K)
25
FE (Activision 8K)
26
E0 (Parker bros. 8K)
27
3F (Tigervision 8K)
28
FA (CBS RAM Plus 12K)
29
E7 (M-network 16K)
30
F0 (Megaboy 64K)
31
UA (UA Ltd 8K)
32
33
"homebrew" mappers which are more recent:
34
35
3F (Enhanced Tigervision style, up to 512K)
36
3E (up to 512K of ROM, 256K of RAM)
37
0840 (Econobanking)
38
MC (Megacart)
39
EF (16K)
40
X07 (Atariage)
41
4A50 (no name)
42
43
Atari 2600 peripherals:
44
45
Spectravideo Compumate
46
Pitfall 2 DPC
47
Supercharger
48
Supercharger tape format
49
Supercharger demo unit
50
51
52
---
53
54
55
"original" 2600 Mappers
56
-----------------------
57
58
2K (no name)
59
-----
60
61
2K of ROM. no bankswitching.
62
63
4K (no name)
64
-----
65
66
4K of ROM. no bankswitching.
67
68
CV Commavid
69
-----
70
71
This was used by Commavid. It allowed for both ROM and RAM on the cartridge,
72
without using bankswitching. There's 2K of ROM and 1K of RAM.
73
74
2K of ROM is mapped at 1800-1FFF.
75
1K of RAM is mapped in at 1000-17FF.
76
77
The read port is at 1000-13FF.
78
The write port is at 1400-17FF.
79
80
F8 (Atari style 8K)
81
-----
82
83
This is the fairly standard way 8K of cartridge ROM was implemented. There are two
84
4K ROM banks, which get mapped into the 4K of cartridge space. Accessing 1FF8 or
85
1FF9 selects one of the two 4K banks. When one of these two addresses are accessed,
86
the banks switch spontaniously.
87
88
ANY kind of access will trigger the switching- reading or writing. Usually games use
89
LDA or BIT on 1FF8/1FF9 to perform the switch.
90
91
When the switch occurs, the entire 4K ROM bank switches, including the code that is
92
reading the 1FF8/1FF9 location. Usually, games put a small stub of code in BOTH banks
93
so when the switch occurs, the code won't crash.
94
95
F6 (Atari style 16K)
96
-----
97
98
This is a fairly standard 16K bankswitching method. It works like F8, except there's
99
four 4K banks of ROM, selected by accessing 1FF6 through 1FF9. These sequentially
100
select one of the 4 banks. i.e. 1FF6 selects bank 0, 1FF7 selects bank 1, etc.
101
102
F4 (Atari style 32K)
103
-----
104
105
Again, this works like F8 and F6 except now there's 8 4K banks. Selection is performed
106
by accessing 1FF4 through 1FFB.
107
108
FE (Activision special)
109
-----
110
111
Activision used this method on only three games: Decathlon, Robot Tank, and the
112
prototype Thwocker. This mapper is one of the more interesting ones in that it uses
113
stack access to select banks. It is composed of two 4K banks, similar to F8.
114
Unlike F8, however, switching occurs when the stack is accessed.
115
116
This mapper allows for "automatic" bankswitching to occur, using JSR and RTS. The
117
addresses for all JSRs and RTS' are either Fxxx or Dxxx, and the mapper uses this to
118
figure out which bank it should be going to.
119
120
The cycles of a JSR are as such:
121
122
1: opcode fetch
123
2: fetch low byte of address
124
3: read 100,s : garbage fetch
125
4: write 100,s : PCH, decrement S
126
5: write 100,s : PCL, decrement S
127
6: fetch high byte of address
128
129
The cycles of an RTS are as such:
130
131
1: opcode fetch
132
2: fetch next opcode (and throw it away)
133
3: read 100,S : increment S
134
4: read 100,S : pull PCL from stack, increment S
135
5: read 100,S : pull PCH from stack
136
137
The chip can determine what instruction is being executed by watching the data and
138
address bus.
139
140
It watches for 20 (JSR) and 60 (RTS), and accesses to 100-1ff:
141
142
(opcode cycles)
143
144
20 (opcode)
145
add low (new add low)
146
stack (garbage read)
147
stack (push PCH)
148
stack (push PCL)
149
add high (new add hi) : latch D5. This is the NEW bank we need to be in.
150
151
60 (opcode)
152
xx (garbage fetch)
153
stack
154
stack (pull PCL)
155
stack (pull PCH) : latch D5. This is the NEW bank we need to be in.
156
157
158
Using emulators or similar there is a large cheat that can be used. A13 can be used
159
to simply select which 8K bank to be in.
160
161
E0 (Parker Bros)
162
-----
163
164
Parker Brothers used this, and it was used on one other game (Tooth Protectors). It
165
uses 8K of ROM and can map 1K sections of it.
166
167
This mapper has 4 1K banks of ROM in the address space. The address space is broken up
168
into the following locations:
169
170
1000-13FF : To select a 1K ROM bank here, access 1FE0-1FE7 (1FE0 = select first 1K, etc)
171
1400-17FF : To select a 1K ROM bank, access 1FE8-1FEF
172
1800-1BFF : To select a 1K ROM bank, access 1FF0-1FF7
173
1C00-1FFF : This is fixed to the last 1K ROM bank of the 8K
174
175
Like F8, F6, etc. accessing one of the locations indicated will perform the switch.
176
177
3F (Tigervision)
178
-----
179
180
Traditionally, this method was used on the Tigervision games. The ROMs were all 8K, and
181
there's two 2K pages in the 4K of address space. The upper bank is fixed to the last 2K
182
of the ROM.
183
184
The first 2K is selectable by writing to any location between 0000 and 003F. Yes, this
185
overlaps the TIA, but this is not a big deal. You simply use the mirrors of the TIA at
186
40-7F instead! To select a bank, the games write to 3Fh, because it's not implemented
187
on the TIA.
188
189
The homebrew community has decided that if 8K is good, more ROM is better! This mapper
190
can support up to 512K bytes of ROM just by implementing all 8 bits on the mapper
191
register, and this has been done... however I do not think 512K ROMs have been made just
192
yet.
193
194
FA (RAM Plus)
195
-----
196
197
CBS Thought they'd throw a few tricks of their own at the 2600 with this. It's got
198
12K of ROM and 256 bytes of RAM.
199
200
This works similar to F8, except there's only 3 4K ROM banks. The banks are selected by
201
accessing 1FF8, 1FF9, and 1FFA. There's also 256 bytes of RAM mapped into 1000-11FF.
202
The write port is at 1000-10FF, and the read port is 1100-11FF.
203
204
E7 (M-Network)
205
-----
206
207
M-network wanted something of their own too, so they came up with what they called
208
"Big Game" (this was printed on the prototype ASICs on the prototype carts). It
209
can handle up to 16K of ROM and 2K of RAM.
210
211
1000-17FF is selectable
212
1800-19FF is RAM
213
1A00-1FFF is fixed to the last 1.5K of ROM
214
215
Accessing 1FE0 through 1FE6 selects bank 0 through bank 6 of the ROM into 1000-17FF.
216
Accessing 1FE7 enables 1K of the 2K RAM, instead.
217
218
When the RAM is enabled, this 1K appears at 1000-17FF. 1000-13FF is the write port, 1400-17FF
219
is the read port.
220
221
1800-19FF also holds RAM. 1800-18FF is the write port, 1900-19FF is the read port.
222
Only 256 bytes of RAM is accessable at time, but there are four different 256 byte
223
banks making a total of 1K accessable here.
224
225
Accessing 1FE8 through 1FEB select which 256 byte bank shows up.
226
227
F0 (Megaboy)
228
-----
229
230
This was used on one game, "megaboy".. Some kind of educational cartridge. It supports
231
64K of ROM making it the biggest single production game made during the original run
232
of the 2600.
233
234
Bankswitching is very simple. There's 16 4K banks, and accessing 1FF0 causes the bank
235
number to increment.
236
237
This means that you must keep accessing 1FF0 until the bank you want is selected. Each
238
bank is numbered by means of one of the ROM locations, and the code simply keeps accessing
239
1FF0 until the bank it is looking for comes up.
240
241
242
UA (UA Ltd)
243
-----
244
245
This one was found out later on, lurking on a proto of Pleaides. It works with 8K of ROM
246
and banks it in 4K at a time.
247
248
Accessing 0220 will select the first bank, and accessing 0240 will select the second.
249
250
251
That's about it for the "Traditional" mappers that were used on commercial releases.
252
253
-----------------------------------
254
255
The 2600 programming community's been pretty busy with adding new mappers. Here's the list
256
of known (to me) mappers used on homebrew games.
257
258
3E (Boulderdash
259
-----
260
261
This works similar to 3F (Tigervision) above, except RAM has been added. The range of
262
addresses has been restricted, too. Only 3E and 3F can be written to now.
263
264
1000-17FF - this bank is selectable
265
1800-1FFF - this bank is the last 2K of the ROM
266
267
To select a particular 2K ROM bank, its number is poked into address 3F. Because there's
268
8 bits, there's enough for 256 2K banks, or a maximum of 512K of ROM.
269
270
Writing to 3E, however, is what's new. Writing here selects a 1K RAM bank into
271
1000-17FF. The example (Boulderdash) uses 16K of RAM, however there's theoretically
272
enough space for 256K of RAM. When RAM is selected, 1000-13FF is the read port while
273
1400-17FF is the write port.
274
275
0840 (Econobanking)
276
-----
277
278
This is another 8K bankswitching method with two 4K banks. The rationale is that it's
279
cheap and easy to implement with only a single 74HC153 or 253 dual 4:1 multiplexer.
280
281
This multiplexer can act as a 1 bit latch AND the inverter for A12.
282
283
To bankswitch, the following mask it used:
284
285
A13 A0
286
----------------
287
0 1xxx xBxx xxxx
288
289
Each bit corresponds to one of the 13 address lines. a 0 or 1 means that bit must be
290
0 or 1 to trigger the bankswitch. x is a bit that is not concidered (it can be either
291
0 or 1 and is thus a "don't care" bit).
292
293
B is the bank we will select. sooo, accessing 0800 will select bank 0, and 0840
294
will select bank 1.
295
296
SB (Superbanking)
297
-----
298
299
This is the same as 0840, except A0-A6 are used instead of just A6, as so:
300
301
A13 A0
302
----------------
303
0 1xxx xBBB BBBB
304
305
By using 6 bits, the maximum ROM size has been increased from 8K to 256K.
306
307
308
MC (Megacart)
309
-----
310
311
This is the mapper for the "Chris Wilkson's Megacart".
312
313
Only four addresses are used to bankswitch on this one.
314
315
Up to 128K of ROM and 64K of RAM can be accessed.
316
317
1000-13FF is selected by address 3C
318
1400-17FF is selected by address 3D
319
1800-1BFF is selected by address 3E
320
1C00-1FFF is selected by address 3F
321
322
The value written determines what will be selected:
323
324
00-7F written will select one of the 128 1K ROM banks
325
80-FF written will select one of the 128 512 byte RAM banks
326
327
When a RAM bank is selected, the lower 512 bytes is the write port, while
328
the upper 512 bytes is the read port.
329
330
On accessing address FFFC or FFFD, the last 1K bank points to the last bank in ROM,
331
to allow for system initialization. Jumping out of the last bank disables this.
332
It's debatable how easy this system would be to implement on a real system.
333
334
Detecting when to disable the last bank fixing is difficult. The documentation
335
says:
336
337
"
338
Megacart Specification, Rev1.1
339
(c) 1997 Chris Wilkson
340
[email protected]
341
342
Because the console's memory is randomized at powerup, there is no way to
343
predict the data initially contained in the "hot addresses". Therefore,
344
hardware will force slot 3 to always point to ROM block $FF immediately
345
after any read or write to the RESET vector at $FFFC-$FFFD. Block $FF
346
must contain code to initialize the 4 memory slots to point to the desired
347
physical memory blocks before any other code can be executed. After program
348
execution jumps out of the boot code, the hardware will release slot 3 and
349
it will function just like any other slot.
350
"
351
352
Unfortunately, there's not an easy way to detect this. Just watching the address
353
bus won't work easily: Writing anywhere outside the bank 1C00-1FFF (i.e. bank
354
registers, RAM, TIA registers) will cause the switching to revert bank 3, crashing
355
the system.
356
357
The only way I can see it working is to disregard any access to addresses 3C-3F.
358
359
Emulators have it easier: they can simply watch the program counter, vs. the
360
address bus. An actual system doesn't have that luxury, unfortunately, so it must
361
disregard accesses to 3C-3F instead.
362
363
EF (no name?)
364
-----
365
366
This is a fairly simple method that allows for up to 64K of ROM, using 16 4K banks.
367
It works similar to F8, F6, etc. Only the addresses to perform the switch is
368
1FE0-1FEF. Accessing one of these will select the desired bank. 1FE0 = bank 0,
369
1FE1 = bank 1, etc.
370
371
X07 (Atariage)
372
-----
373
374
Apparently, this was only used on one cart: Stella's Stocking.
375
Similar to EF, there are 16 4K banks, for a total of up to 64K of ROM.
376
377
The addresses to select banks is below the ROM area, however.
378
379
The following TWO masks are used:
380
381
A13 A0
382
----------------
383
0 1xxx nnnn 1101
384
385
This means the address 80B selects bank 0, 81B selects bank 1, etc.
386
387
In addition to this, there is another way:
388
389
A13 A0
390
----------------
391
0 0xxx 0nxx xxxx
392
393
This is somewhat special purpose: Accessing here does nothing, unless one of the
394
last two banks are selected (banks 14 or 15). In that case, the new bank is:
395
396
111n i.e. accessing 0000 will select bank 14 (Eh, 1110b) while accessing 0040
397
will select bank 15 (Fh, 1111b). This allows for bankswitching by accessing
398
TIA registers at 00-3F or 40-7F without incurring any overhead.
399
400
401
402
4A50 (no name)
403
-----
404
405
Upon review, I don't think this method is terribly workable on real
406
hardware. There's so many problems that I kinda gave up trying to
407
count them all. Seems that this is more of a "pony" method than something
408
actually usable. ("pony" referring to "I want this, and that, and that, and
409
a pony too!")
410
411
One major problem is that it specifies that memory can be read and written
412
to at the same address, but this is nearly impossible to detect on a 2600
413
cartridge. You'd almost have to try and figure out what opcodes are being
414
run, and what cycle it's on somehow, all just by watching address and
415
data bus state. Not very practical.
416
417
The other problem is just the sheer volume of things it is supposed to do.
418
There's just tons and tons of unnecessary things like attempting to detect
419
BIT instructions, handling page wraps and other silly things.
420
421
This all supposidly fit into a Xilinx XC9536XL but I am not sure how the
422
chip could handle the RAM issue above at all. It almost needs to see R/W
423
and M2 (clock) to be able to properly do most of the things it's doing.
424
425
426
----------------------------------------------
427
428
Peripherals
429
-----------
430
431
432
Spectravideo Compumate Add-on
433
-----
434
435
This is more than just a cartridge mapper- it's also a "computer" add-on.
436
There's two 8K EPROMs soldered on top of each other. There's two short
437
wires with DB-9's on them which you plug into the two controller ports.
438
A 42 or so key membrane keyboard with audio in and audio out, and 1K of RAM.
439
440
Port A on the RIOT is used to run most of the functions on the Compumate:
441
442
7 0
443
---------
444
ACRE 31BB
445
446
A - Audio input from tape player
447
C - Audio out to tape player and 4017 CLK
448
R - 4017 RST, and RAM direction. (high = write, low = read)
449
E - RAM enable. 1 = disable RAM, 0 = enable RAM
450
3 - Row 3 of keyboard
451
1 - Row 1 of keyboard
452
B - 2 bit ROM bank number
453
454
All bits are outputs except for the 2 row inputs from the keyboard.
455
456
Unlike most things, the Compumate uses all three of the TIA inputs on each
457
joystick port (paddles and fire).
458
459
TIA inputs:
460
461
0 - function key
462
1 - pulled high thru 20K resistor
463
2 - pulled high thru 20K resistor
464
3 - shift key
465
4 - Row 0
466
5 - Row 2
467
468
469
Memory Map:
470
-----------
471
472
1000-1FFF : selectable 4K ROM bank (selected by D0, D1 on portA)
473
474
On powerup, the port is all 1's, so the last bank of ROM is enabled, RAM is
475
disabled.
476
477
when RAM is enabled:
478
479
1000-17FF : 2K of RAM. It's mapped into 1000-17FF. Unlike most 2600 carts,
480
bit 5 of portA controls if the RAM is readable or writable. When it's high,
481
the RAM is write only. When it's low, it is read only. There's no separate
482
read and write ports.
483
484
485
Keyboard:
486
---------
487
488
The keyboard's composed of a 4017 1 of 10 counter, driving the 10 columns of
489
the keyboard. It has 4 rows. The 4 row outputs are buffered by inverters.
490
491
Bit 5 of portA controls the reset line on the 4017. Pulling it high will reset
492
scanning to column 0. Pulling it low will allow the counter to be clocked.
493
494
Bit 6 of portA clocks the 4017. Each rising edge advances the column one
495
count.
496
497
There's 10 columns labelled 0-9, and 4 rows, labelled 0-3.
498
499
Column
500
501
0 1 2 3 4 5 6 7 8 9
502
+---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+
503
| 7 | | 6 | | 8 | | 2 | | 3 | | 0 | | 9 | | 5 | | 1 | | 4 | 0
504
+---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+
505
+---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+
506
| U | | Y | | I | | W | | E | | P | | O | | T | | Q | | R | 1
507
+---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ Row
508
+---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+
509
| J | | H | | K | | S | | D | |ent| | L | | G | | A | | F | 2
510
+---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+
511
+---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+
512
| M | | N | | < | | X | | C | |spc| | > | | B | | Z | | V | 3
513
+---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+
514
515
Function and Shift are separate keys that are read by 2 of the paddle inputs.
516
These two buttons pull the specific paddle input low when pressed.
517
518
Because the inputs are inverted, a low indicates a pressed button, and a high
519
is an unpressed one.
520
521
The audio input/output are designed to drive a tape player. The audio output is
522
buffered through an inverter and 2 resistors and a capacitor to reduce the level
523
to feed it into the tape player.
524
525
The audio input is passed through a .1uf capacitor and is pulled to 1/2 supply
526
by two 20K resistors, then it goes through a hex inverting schmitt trigger to
527
square it up. This then runs into bit 7 of portA.
528
529
530
DPC (Pitfall 2)
531
-----
532
533
Back in the day, this game was da shizzle (and IMO still is). It did its trick via
534
a custom chip in the cartridge. Fortunately for us, there's a patent that describes
535
lots of the internal workings of the chip (number 4644495, "video memory system").
536
537
Interestingly, the patent shows the DPC as a *separate* device. You plug a
538
passthrough cartridge into your 2600, then plug the game cartridge into the
539
passthrough. Apparently, Activision thought that people wouldn't like this, or
540
there was some other reasoning behind it and they ditched that idea and went with
541
the DPC inside the cartridge.
542
543
Unfortunately for Activision, it was filed in January of 1984, during the height of
544
the crash. The inventor is listed as David Crane.
545
546
OK, enough background. Now onto the meat:
547
548
The DPC chip is just 24 pins, and needs to pass through the chip enable to the
549
game ROM on the cartridge, so it can only address 2K of memory. This means the
550
DPC shows up twice in the address space, once at 1000-107F and again at 1800-18FF.
551
552
There's been some discussion about the pitch of the music generated by this chip,
553
and how different carts will play the music at different pitches. Turns out, on the
554
cart, the frequency is determined by a resistor (560K ohms) and a capacitor integrated
555
onto the die of the DPC chip itself. The resistor is a 5% tolerance part, and the
556
process variations of the DPC itself will control the frequency of the music produced
557
by it.
558
559
If you touch the resistor on the cartridge board, the music pitch will drastically
560
change, almost like you were playing it on a theremin! Lowering the resistance makes
561
the music pitch increase, increasing the resistance makes the pitch lower.
562
563
It's extremely high impedance so body effects of you touching the pin makes it
564
vary wildly.
565
566
Thus, I say there's really no "one true" pitch for the music. The patent, however,
567
says that the frequency of this oscillator is 42KHz in the "preferred embodiment".
568
The patent says that it can range from 15KHz to 80KHz depending on the application
569
and the particular design of the sound generator. I chose 21KHz (half their preferred
570
value) and it sounds fairly close to my actual cartridge.
571
572
Address map:
573
574
Read Only:
575
1000-1003 : random number generator
576
1004-1005 : sound value (and MOVAMT value ANDed with draw line carry, with draw line add)
577
1006-1007 : sound value (and MOVAMT value ANDed with draw line carry, no draw line add)
578
1008-100F : returned data value for fetcher 0-7
579
1010-1017 : returned data value for fetcher 0-7, masked
580
1018-101F : returned data value for fetcher 0-7, nybble swapped, masked
581
1020-1027 : returned data value for fetcher 0-7, byte reversed, masked
582
1028-102F : returned data value for fetcher 0-7, rotated right one bit, masked
583
1030-1037 : returned data value for fetcher 0-7, rotated left one bit, masked
584
1038-103F : fetcher 0-7 mask
585
586
Write Only:
587
1040-1047 : fetcher 0-7 start count
588
1048-104F : fetcher 0-7 end count
589
1050-1057 : fetcher 0-7 pointer low
590
1058-105B : fetcher 0-3 pointer high
591
105C : fetcher 4 pointer high and draw line enable
592
105D-105F : fetcher 5-7 pointer high and music enable
593
1060-1067 : draw line movement value (MOVAMT)
594
1068-106F : not used
595
1070-1077 : random number generator reset
596
1078-107F : not used
597
598
random number generator
599
-----------------------
600
601
The random number generator is used on Pitfall 2 to make the eel flash between white and
602
black, and nothing else. Failure to emulate this will result in the eel not flashing.
603
604
It's an 8 bit LFSR which can be reset to the all 0's condition by accessing 1070-1077.
605
Unlike a regular LFSR, this one uses three XOR gates and an inverter, so the illegal
606
condition is the all 1's condition.
607
608
There's 255 states and the following code emulates it:
609
610
LFSR = ((LFSR << 1) | (~(((LFSR >> 7) ^ (LFSR >> 5)) ^ ((LFSR >> 4) ^ (LFSR >> 3))) & 1)) & 0xff;
611
612
Bits 3, 4, 5, and 7 are XOR'd together and inverted and fed back into bit 0 each time the
613
LFSR is clocked.
614
615
The LFSR is clocked each time it is read. It wraps after it is read 255 times. (The
616
256th read returns the same value as the 1st).
617
618
data fetchers
619
-------------
620
621
Internal to the DPC is a 2K ROM containing the graphics and a few other bits and pieces
622
(playfield values I think) of data that can be read via the auto-incrementing data
623
fetchers.
624
625
Each set of 8 addresses (1008-100F for example) return the data from one of the 8
626
data fetcher pointers, returning the data in a slightly different format for each.
627
The format for the 6 possible register ranges is as follows:
628
629
For the byte "ABCDEFGH" (bit 7 to bit 0) it is returned:
630
631
1008-100F: ABCDEFGH (never masked)
632
1010-1017: ABCDEFGH
633
1018-101F: EFGHABCD (nybble swap)
634
1020-1027: HGFEDCBA (bit reversed)
635
1028-102F: 0ABCDEFG (shifted right)
636
1030-1037: BCDEFGH0 (shifted left)
637
638
Reading from each set of locations above returns the byte of data from the DPC's
639
internal ROM. Reading from 1008 accesses data at DF (data fetcher) 0's pointer,
640
then decrements the pointer. Reading from 1009 accesses data at DF1, and so on.
641
642
There is no difference except how the data is returned when reading from 1008,
643
1010, 1018, 1020, etc. All of them return data pointed to by DF0's pointer. Only
644
the order of the bits returned changes.
645
646
I am not sure what purpose returning the data shifted left or right 1 bit serves,
647
and it was not used on Pitfall 2, but that's what it does. I guess you could
648
use it to make a sprite appear to "wiggle" left and right a bit, if it were 6 pixels
649
wide.
650
651
All of these read ports returns the data masked by an enable signal, except for
652
1008-100F. The data here is never masked. (more about this in a minute)
653
654
To read data out of the chip, first you program in its start address into the
655
pointer registers. These are at 1050-1057 for the lower 8 bits of the pointer
656
value, and 1058-105F for the upper 4 bits of the pointer value. This forms the
657
12 bit address which can then be used to index the DPC's ROM.
658
659
A few of the upper bits on 105C-105F are used for a few other purposes, which will be
660
described later.
661
662
Masking the data:
663
-----------------
664
665
1038-103F is the readback for the mask value
666
1040-1047 is the start count
667
1048-104F is the end count
668
669
670
The mask value can be read via 1038-103F. It returns 0 when graphics are masked, and
671
FFh when they are not masked. (0 = reset, 1 = set)
672
673
The basic synopsis is thus:
674
675
When the lower 8 bits of the pointer equals the start count, the mask register is set.
676
When the lower 8 bits of the pointer equals the end count, the mask register is reset.
677
Writing to the start count register also sets the register.
678
679
This allows one to have the sprites only show up on specific scanlines, by programming
680
the proper start and end counts, and the proper starting value into the pointer. This
681
way, the sprite can be drawn from top to bottom of the screen, and have it only appear
682
where it is desired without having to do anything else in the 2600 code.
683
684
Making Music:
685
-------------
686
687
The music is generated by repurposing three of the fetchers, the last three.
688
Each fetcher can be individually selected for music or fetching.
689
690
7 0
691
---------
692
105D-105F: xxSM PPPP
693
694
S: Select clock input to fetching counter. 0 = read pulse when the proper returned
695
data register is read (i.e. for fetcher 5, 1015 is being read) 1 = music oscillator.
696
697
M: Music mode. 1 = enable music mode, 0 = disable music mode.
698
699
P: upper 4 bits of the 12 bit data fetcher pointer.
700
701
702
I am not sure why you can separately select the clock source and the music mode,
703
but you can. Maybe they had some plans for externally clocking the chip via some
704
logic to bump the pointers.
705
706
Normally you set both the M and P bits to make music.
707
708
When in music mode, the lower 8 bits of the fetcher pointer is used as an 8 bit down
709
counter. Each time the lower 8 bits equals FFh, it is reloaded from the start count
710
register.
711
712
To turn the data fetcher into a square wave generator takes very little hardware. The
713
start/end count registers are used as-is to toggle the flag register.
714
715
This means that the duty cycle of the square waves produced can be varied by adjusting
716
the end count register relative to the start count register. I suspect the game simply
717
right shifts the start count by one and stuffs it into the end count to produce a
718
50% duty cycle waveform.
719
720
The three flag outputs for fetchers 5 to 7 are fed into a cool little circuit composed
721
of a 3 to 8 decoder and four 4 input NAND gates to produce the 4 bit audio output.
722
723
The output is as follows:
724
725
fetcher result
726
567
727
---------------------
728
000 0h
729
001 4h
730
010 5h
731
011 9h
732
100 6h
733
101 Ah
734
110 Bh
735
111 Fh
736
737
738
This is a somewhat nonlinear mixing of the three channels, so the apparent volume of them
739
is different relative to each other.
740
741
The final 4 bit output value from the above table is then available to read at address
742
1004-1007, in bits 0 to 3.
743
744
Pitfall 2 just reads this location and stuffs it into the audio register every scanline or
745
so. The value read at 1004-1007 is the instantanious value generated by the fetchers and
746
mixing hardware.
747
748
749
HMOVE adjustment stuff:
750
-----------------------
751
752
I have not done much research on how this works, and P2 doesn't use it. It appears to
753
let you draw curved lines using a missile or two, probably to make swinging vines.
754
755
The patent explains how it works, but it just appears to be an adder that adds the start
756
count value to itself via a multiplexer and stuff. It appears to let you input an
757
offset and it calculates a new hmove value. Not sure how useful this really is.
758
759
760
AR (Starpath Supercharger)
761
--------------------------
762
763
Aaah the good ol' Supercharger. This is the large "cartridge" that you could plug into
764
your 2600 that had 6K of RAM which you could download games into off of cassette tape.
765
766
The idea being you plug your cassette player into the cable coming off of the cartridge,
767
and then you can download games into RAM from it.
768
769
When first turned on, it says "rewind tape" and "press play". When this is done, it will
770
start loading the game off tape and fill the screen in with blue bars from the sides
771
to the inside while a rising tone plays. When the screen is fully blue, it then clears
772
the screen and says "stop tape", and then the game starts.
773
774
If there is an error (corrupt tape, etc) it will continously flash "rewind tape" on
775
the screen until the audio input stops toggling.
776
777
Games can re-enable the BIOS ROM and load more data off tape at any time.
778
779
So, that's what it is... but how does it work?
780
781
I didn't find a whole huge amount of information on how the Supercharger actually
782
WORKS. There was some info about how to program it, but nothing on how the
783
ASIC in the Supercharger does its thing.
784
785
Well, turns out it's pretty cool and as far as I know, unique.
786
787
First off, there are two registers on the Supercharger. The first is the audio
788
input register. It's at FFF9:
789
790
7 0
791
---------
792
FFF9: 0000 000A
793
794
A: Supercharger audio data. 0 = low input, 1 = high input.
795
796
The audio input's just a filtered and schmitt triggered version of the audio data
797
coming into the Supercharger. The upper 7 bits must all be 0's, or else it
798
will not properly read the data. For testing, I fed my FPGA 2600's Supercharger
799
with data from Bankzilla's tape emulator. This is simply a digital output that
800
is fed into the Supercharger's audio pin (and to my FPGA board).
801
802
The next register is the control register.
803
804
7 0
805
---------
806
FFF8: DDDB BBWE
807
808
D: write delay (see below)
809
B: bankswitching mode (see below)
810
W: RAM write enable (1 = enabled, 0 = disabled)
811
E: ROM power enable (0 = enabled, 1 = turn off ROM)
812
813
To write to RAM or the control register on the Supercharger requires a somewhat
814
round-about method. First, you read a location at F000-F0FF, then you read
815
either FFF8 to write to the control register, or somewhere else in RAM.
816
Sooo, to write to the control register, the following type of code is
817
used:
818
819
;A = value we will write to the banking register
820
TAX
821
LDA F000,X
822
LDA FFF8
823
824
The TAX moves the value we wish to write into F000,X (i.e. if we wish to write 16h
825
to the control register, the location F016 is read).
826
827
Next, we read FFF8 which performs the write. *any* instruction that reads FFF8
828
will suffice. The BIOS uses BIT FFF8 and LDX FFF8 sometimes, depending on
829
what's convenient, and what flags or registers need to be saved. The
830
instruction really does not matter, so long as it simply READS.
831
832
Note: THERE IS NO UPPER LIMIT on the number of cycles that can elapse between
833
reading F0xx and reading FFF8 to write to the control register. Usually,
834
it is written to immediately after reading F0xx, but not always. The very
835
last write to FFF8 which sets the RAM banking before launching the game
836
after loading waits a very long time before reading FFF8 to set the banking
837
mode.
838
839
The basic method it does the final write is as such:
840
841
LDA F000,X
842
<thousands of cycles>
843
844
FA0B : 9A TXS ;X entered at ffh
845
FA0C : A2 3 LDX #$3
846
FA0E : BC AB FD LDY $FDAB,X
847
FA11 : 94 FA STY $FA,X ;load cmp fff8h, jmp opcode only
848
FA13 : CA DEX
849
FA14 : 10 F8 BPL $FA0E ;jmp target was at fe/ff
850
FA16 : A0 0 LDY #$0
851
FA18 : 84 81 STY $81
852
FA1A : 4C FA 0 JMP $FA ;run the code we loaded in RAM
853
854
00FA : CD F8 FF CMP $FFF8 ;sets up control register for the game
855
00FD : 4C xx xx JMP xxxx ;we now jump to the start of our code
856
857
858
FDAB : CD F8 FF 4C ;this is the code loaded into RAM
859
860
861
The control register contains a few different things.
862
863
The ROM power can be turned on and off (which IMO is dumb. The ROM doesn't
864
draw appriciable power, but they have a PNP transistor that can turn it on
865
and off anyways. Most games turn it off when they are done loading, and
866
then turn it back on if they need to load again from tape. I guess they
867
were worried it was going to vampire too much current from the system, so
868
running it only as long as necessary was their solution.
869
870
The next bit is the write enable. If set, the RAM can be written to.
871
If clear, it is read-only. This is useful for loading 2K and 4K games into
872
the Supercharger to play them. Not much use otherwise. The Supercharger
873
will never attempt to write to ROM, and it will not write to RAM if this
874
bit is clear.
875
876
Banking mode. The Supercharger allows for 8 different memory maps, depending
877
on how these three bits are set. The following are supported:
878
879
BBB 1000-17FF, 1800-1FFF
880
--- ---------------------
881
000 - RAM bank 3 ROM
882
001 - RAM bank 1 ROM
883
010 - RAM bank 3 RAM bank 1
884
011 - RAM bank 1 RAM bank 3
885
100 - RAM bank 3 ROM
886
101 - RAM bank 2 ROM
887
110 - RAM bank 3 RAM bank 2
888
111 - RAM bank 2 RAM bank 3
889
890
ROM can never be mapped into 1000-17FF but this makes sense, since the code is
891
written to only run from 1800-1FFF. Also, a few combinations are not possible
892
such as RAM bank 1, RAM bank 2, and RAM bank 2, RAM bank 1. All others are
893
possible.
894
895
The last part of the control register is the write pulse delay. I don't think
896
anything uses this and just keeps it at 0. Heck, it may not even be implemented.
897
898
So that takes care of how to read audio and how to access the control register.
899
That leaves writing to RAM.
900
901
The Supercharger watches all 13 address lines to determine when RAM should be
902
written. It first watches for a write to F0xx, just like when writing to the
903
control register, then it waits 5 address bus transitions, then it attempts to
904
write data to the RAM chip by pushing the value onto the data bus, while the CPU
905
is reading.
906
907
The usual way this is done in the BIOS is like so:
908
909
;X = byte to write
910
LDA F000,X ;tell the supercharger what to write
911
LDA (8B),Y ;write it!
912
913
If we look at bus transitions, it looks like this:
914
915
Assume that the code is sitting at 1800, and 8B/8C holds the address 1100h.
916
Also assume X = 66h
917
918
c# address, data
919
1: 1800 BD ;LDA,X opcode
920
2: 1801 00 ;low byte of add
921
3: 1802 10 ;hi byte of add
922
4: 1066 ?? ;read address 1066 (this is the RAM byte, could hold anything).
923
5: 1803 B1 ;LDA (),y opcode
924
6: 1804 8B ;zeropage address of pointer
925
7: 008B 00 ;low byte of destination
926
8: 008C 11 ;hi byte of destination
927
9: 1100 66 ;Supercharger writes data now to RAM by forcing value on bus
928
929
As we can see, cycle 9 is exactly 5 cycles after cycle 4, where we read from F0xx.
930
The supercharger will only attempt to write if writes are enabled, and the area
931
we're attempting to write to is set up for RAM. It will not attempt to write to
932
ROM, or outside the range of 1000-1FFF.
933
934
This method of operation has an interesting side effect. Because the Supercharger
935
forces a value onto the bus while the CPU is reading, the CPU will actually
936
READ this value! This makes sense- the CPU doesn't know if it's reading RAM, ROM,
937
or the Supercharger's write value.
938
939
In fact, this is REQUIRED for it to even work. It does some pretty extensive
940
RAM tests on powerup, and if it cannot write to RAM it will flash the screen
941
yellowish/black as it attempts to test RAM over and over. If RAM fails to test
942
properly, it will reset and start again.
943
944
The RAM testing code looks like this:
945
946
FF58 : A9 F1 LDA #$F1
947
FF5A : 85 8C STA $8C
948
FF5C : A0 0 LDY #$0 ;start address = F100
949
FF5E : 84 8B STY $8B
950
FF60 : AD 0 F0 LDA $F000 ;write 00h
951
FF63 : B1 8B LDA ($8B),Y ;write !
952
FF65 : D1 8B CMP ($8B),Y ;is it 00h?
953
FF67 : D0 14 BNE $FF7D ;no
954
FF69 : AD FF F0 LDA $F0FF ;write ffh
955
FF6C : B1 8B LDA ($8B),Y ;write !
956
FF6E : D1 8B CMP ($8B),Y ;is if ffh?
957
FF70 : D0 B BNE $FF7D ;nope
958
FF72 : C8 INY
959
FF73 : D0 EB BNE $FF60 ;last byte of page?
960
FF75 : E6 8C INC $8C
961
FF77 : A5 8C LDA $8C
962
FF79 : C9 F8 CMP #$F8
963
FF7B : D0 E3 BNE $FF60 ;last page?
964
FF7D : 60 RTS ;return zero set if passed
965
966
Basically what happens is this: It first sets up the address F100 (aka 1100) into
967
8B/8C, then it steps through the entire RAM area up to 17FF, and returns with
968
Z flag set, if it passed, or NZ if it fails.
969
970
The code at FF60-FF66 is very interesting: It first reads from F000 so that
971
we will write 00 to memory. Then it writes it and immediately compares it.
972
Remember that the CPU will READ what the Supercharger writes, so the accumulator
973
will hold 00 after executing that LDA (),y!
974
975
The same test is repeated, this time by writing FF. If it can step through all
976
locations without erroring out, it passes the test. This code only tests one
977
2K bank (minus the first 256 locations, more on that in a minute). The code is
978
then called three times, testing each bank of RAM in turn.
979
980
This testing brings up an interesting note about the Supercharger's RAM.
981
982
When writes are enabled to RAM, you CANNOT READ FROM 10xx WITHOUT CORRUPTING RAM.
983
This means, you cannot read data here, and you cannot excute code here! Doing
984
so will trigger writes, which will overwrite whatever happens to be 5 cycles later
985
if it's in RAM! You *CAN* write to 1000-10FF, however just fine... you just
986
cannot read it or execute from it without first disabling writes. In fact, the
987
BIOS starts writing at 1000 when it's loading the game from tape. Since it never
988
attempts to execute code from there or read back the data, this is legal.
989
990
The BIOS' RAM testing routine must therefore skip testing the first 256 bytes
991
of each bank. It *could* test it, but I guess they figured running the code from
992
RAM to do it would've been too much of a hassle, concidering space was at
993
a premium.
994
995
Remember how I said the Supercharger counted *BUS TRANSITIONS* to know when to
996
write to RAM? Well, this is very very important. You cannot just count CPU cycles.
997
That won't work (because the Supercharger cannot see the CPU's clock line for one).
998
999
Here's the other way that you can write to RAM:
1000
1001
FFC7 : A0 8 LDY #$8
1002
FFC9 : D9 0 F0 CMP $F000,Y
1003
FFCC : EA NOP
1004
FFCD : CD E3 F7 CMP $F7E3
1005
1006
This writes 8 to location 17E3. Notice the NOP to "fill up" the cycles. If we
1007
look at what the address/data bus is doing, we will see how this can work, even
1008
though the write occurs 6 cycles after the CMP, instead of 5.
1009
1010
1011
c# address, data
1012
1: FFC9 D9 ;CMP,Y opcode
1013
2: FFCA 00 ;low byte of add
1014
3: FFCB F0 ;hi byte of add
1015
4: F008 xx ;read RAM here, contents unimportant
1016
5: FFCC EA ;NOP opcode
1017
6: FFCD CD ;CMP opcode, but throw it away (NOP is 2 cycles)
1018
7: FFCD CD ;CMP opcode
1019
8: FFCE E3 ;low byte of add
1020
9: FFCF F7 ;hi byte of add
1021
10:F7E3 08 ;write to F7E3
1022
1023
Yes, it does indeed take 6 cycles to get to the write... however, look at the address
1024
bus. There's only FIVE transitions! The byte at FFCD gets read twice. This is
1025
because NOP is a 2 cycle instruction. NOP's second cycle reads the next opcode
1026
and throws it away, and does NOT increment the program counter. So, the next
1027
cycle reads it too and fetches CD for the CMP opcode. Pretty tricky stuff!
1028
1029
Note that when I say "transition", I am talking about when one or more of the 13
1030
address lines changes. The Supercharger can only count cycles by watching these
1031
address lines. That's why it only counts up 5 transitions on the above code snippet.
1032
The double access to FFCD counts as 1 transition as far as the Supercharger is
1033
concerned.
1034
1035
That about wraps up the Supercharger's hardware.
1036
1037
1038
Supercharger Tape Format
1039
------------------------
1040
1041
The tape format on the Supercharger is fairly straight forward. It's a form of
1042
pulse width modulation. Interestingly, the length of the pulses is not fixed, and
1043
the software on the Supercharger can adapt to a pretty wide range.
1044
1045
According to the "tapedocs.txt" file:
1046
1047
1048
"0" pulse "1" pulse
1049
-------------------------------
1050
minimum 158uS 317uS
1051
optimal* 227uS 340uS
1052
maximum 317uS 2450uS
1053
1054
* According to the tapedocs.txt file, the filters on the Supercharger are tuned
1055
specifically for 227uS and 340uS pulse lengths.
1056
1057
1058
NOTE: these times are for the entire pulse, i.e. the low and high portions of it.
1059
The low and high portions would thus be half these values.
1060
1061
1062
i.e. if the pulse is 300uS long...
1063
1064
low high
1065
1066
____________------------
1067
1068
\--150uS--/ \--150uS--/
1069
1070
1071
Here is a generic representation of what a typical signal looks like:
1072
1073
____----____----____----________--------________--------____----________--------
1074
1075
\--0--/ \--0--/ \--0--/ \------1------/ \------1------/ \--0--/ \------1------/
1076
1077
1078
The "one" pulses only have to be approximately 90uS wider than the "zero" pulses,
1079
but it's a good idea to have them at least 25% wider so the Supercharger can
1080
adapt to tape speed fluctuations during the load.
1081
1082
1083
A Supercharger tape load is composed of 6 separate parts:
1084
1085
---------------------------------
1086
1. Preamble
1087
1088
The preamble is a 50% duty cycle low frequency waveform that causes all the
1089
elements in the tape chain (amplifiers, the filter in the Supercharger proper,
1090
etc) to stabilize. Without this preamble, the volume level into the 'charger
1091
can change while the capacitors in the signal chain charge.
1092
1093
A frequency of around 750Hz (666uS low, 666uS high) is pretty decent.
1094
1095
The preamble needs to be at least 800 pulses long (i.e. around 1 second or more).
1096
1097
---------------------------------
1098
2. Synchronization
1099
1100
After the preamble, at least 256 or more bytes of 55h (0/1/0/1) bits need to be
1101
sent at the chosen bit rate. The Supercharger software uses this to synchronize
1102
its decoder software.
1103
1104
---------------------------------
1105
3. Start pulse
1106
1107
To tell the Supercharger our data is coming, a final 0 pulse is sent. After this
1108
point, the Supercharger header follows.
1109
1110
---------------------------------
1111
4. Header data
1112
1113
0: WORD Start address
1114
2: BYTE Control word
1115
3: BYTE Block count
1116
4: BYTE Header checksum
1117
5: BYTE Multiload number
1118
6: WORD Progress bar speed
1119
1120
All values are little endian. Bytes are sent out, MSB first (i.e. left shift
1121
the data byte).
1122
1123
Start address: The start address specifies where the 6502 will
1124
jump to after all the data is loaded from the tape.
1125
1126
Control word: Specifies the value to load into the Supercharger's control register.
1127
Usually the upper 3 bits should be clear. (See above for more info on the control
1128
register in the Supercharger section).
1129
1130
Block count: How many 256 byte blocks will be sent in this transfer.
1131
1132
Header checksum: As the name indicates, a checksum of the header. The checksum
1133
is computed by starting out with 55h and subtracting every byte in the header
1134
(not including the sumcheck byte itself).
1135
1136
The result is that when the Supercharger adds up ALL bytes of the header (including
1137
the sumcheck byte) it will be 55h. All carries/borrows are ignored when calculating
1138
the sumchecks.
1139
1140
This is what the demo unit's header contains:
1141
1142
.dw 0ffc0h ;start address of code
1143
.db 01bh ;control word: 1000-17ff= b.3, 1800-1fff= b.2 ROM=off WR=on
1144
.db 001h ;# of 256 byte blocks
1145
.db 06dh ;header checksum
1146
.db 000h ;this is not a multiload
1147
.dw 0010ch ;speed for progress bars
1148
1149
when all these bytes (c0, ff, 1b, 01, 6d, 00, 0c, 01) are added together, the result
1150
is 255h... dropping carries (AND with ffh) results in 55h... meaning that the
1151
sumcheck passes and the data was properly received.
1152
1153
Multiload number: If the game has no multiload, this byte is simply kept at 0. If
1154
this game IS a multiload game, then the sequence number is stored here. This lets
1155
Supercharger BIOS know if the proper game load is being received or not.
1156
1157
The first load of a multiload game is always 0. When the first load wishes to
1158
load the second (or subsequent) part(s), the current load tells the Supercharger
1159
BIOS which load it is looking for and runs the BIOS' receive routine again.
1160
1161
If the data received is not the proper load #, it will do a "false load" and load
1162
the data, but then throw the results away and wait for the next load to come around.
1163
This is repeated until the correct load number is reached and loaded.
1164
1165
On Escape from the Mindmaster this can be seen if you lose all your lives in the first
1166
load. It will instruct you to press "play" on your tape player, and will load part 2.
1167
But the ending is not in part 2, so it throws the data away after loading it and
1168
proceeds to load part 3, which is thrown away, and then the final part is loaded.
1169
1170
To prevent someone from getting cute, the multiload sequence numbers were never
1171
recycled. They were allocated like so:
1172
1173
Escape from the mindmaster uses 1, 2, and 3
1174
Dragonstomper uses 4 and 5
1175
Survival Island uses 6 and 7
1176
1177
Progress bar speed: The value here specifies how fast the progress bars.. well..
1178
progress as the game is loaded. If the value is wrong the bars will proceed to the
1179
middle before the game is fully loaded.
1180
1181
The value is calculated by taking the block count and multiplying it by
1182
approximately 22.8 i.e. for a game that's 6K in size (each block being 256 bytes)
1183
is 24 blocks * 22.8, which is 547 (223h).
1184
1185
This works for most bank sizes, however when only 1 bank is loaded, the value
1186
has to be 10ch for some reason I have not researched.
1187
1188
---------------------------------
1189
5. Data blocks
1190
1191
Once the header is finished sending, the data is sent in 256 byte blocks. Each
1192
block has a 2 byte header, followed by the 256 bytes of data.
1193
1194
Block header:
1195
1196
0: BYTE Block location
1197
1: BYTE Checksum
1198
1199
1200
Block location: This is the block location in RAM where the data will be loaded.
1201
Blocks are specified in the following format:
1202
1203
7 0
1204
---------
1205
000B BBRR
1206
1207
B: block number, from 0 to 7
1208
R: RAM chip #
1209
1210
Ram chip number is specified like so (reffing the bank numbers in the Supercharger
1211
documentation above)
1212
1213
00 - RAM bank 1
1214
01 - RAM bank 2
1215
10 - RAM bank 3
1216
11 - invalid (would select ROM)
1217
1218
The block number is the particular 256 byte block in the specified RAM bank.
1219
1220
So, to load data sequentially, from RAM bank 1's first block, to RAM bank 3's
1221
last block, the following block locations would be used:
1222
1223
RAM 1: 00, 04, 08, 0C, 10, 14, 18, 1C
1224
RAM 2: 01, 05, 09, 0D, 11, 15, 19, 1D
1225
RAM 3: 02, 06, 0A, 0E, 12, 16, 1A, 1E
1226
1227
Checksum: The checksum for the block is calculated exactly like the header's
1228
checksum is. All 258 bytes (256 data bytes, block location byte, and sumcheck)
1229
are added together, and the result must be 55h. If the sumcheck fails, the
1230
"rewind tape" message flashes as long as audio data is coming in, then when the
1231
audio data stops coming in, it reverts to the "press play" message.
1232
1233
---------------------------------
1234
6. Postamble
1235
1236
After all the blocks of data are sent, the Supercharger will play the "Press stop"
1237
message until audio data stops coming in, and then it starts running the game.
1238
1239
The postamble is used to detect when stop is pressed. The postamble is simply
1240
a string of "0" bits. The length of the postamble should be at least 256 bits,
1241
but it can be as long as desired. The Supercharger will not run the game
1242
until the postamble stops, however.
1243
1244
---
1245
1246
1247
Supercharger Demo Unit
1248
----------------------
1249
1250
This doodad is pretty cool. First, you plug a Supercharger into your 2600. Then
1251
you plug the audio cable from it into this black box. Then the black box plugs
1252
into the joystick port.
1253
1254
You can optionally plug a regular joystick into the other joystick port.
1255
1256
The demo unit itself is a nondescript black box with a label on it. Inside the box is
1257
quite a bit of hardware.
1258
1259
* 8 2764 EPROMs
1260
* 1 2732 EPROM
1261
* 1 6805E CPU
1262
* various discrete logic
1263
1264
The basics of operation are as such:
1265
1266
When powered up, a small bootloader is loaded into the Supercharger through its
1267
audio cable. Once this initial bootloader is loaded, the audio cable is never used
1268
again until the system is reset or power cycled.
1269
1270
After the bootloader is sent, the rest of the data to the Supercharger's RAM is loaded
1271
through the joystick port 4 bits at a time.
1272
1273
The net result is incredibly high loading speeds. A complete 6K of RAM data can be
1274
sent in around 250ms.
1275
1276
Internally, there is a 6805E CPU made by Motorola. This is similar to the 68705 and other
1277
microcontrollers Motorola made, except it's the external ROM version. There is no
1278
ROM on the chip.
1279
1280
The two IO ports are connected as such:
1281
1282
PortA: This port is used to send data out 8 bits at a time to the 2600 through the joystick
1283
port. The byte of data is simply written here, and the 2600 picks it off when it's good
1284
and ready (there's an explaination later on of how this works exactly).
1285
1286
PortB:
1287
1288
7 0
1289
---------
1290
AExB BBBB
1291
1292
A: Audio output. This port pin connects to the Supercharger's audio cable through a resistor
1293
divider that cuts the audio level down to a level of a few hundred millivolts to prevent
1294
overloading the audio input.
1295
1296
E: EPROM enable. Must be low to enable the 8 2764 EPROMs.
1297
B: EPROM bank. Selects a 2K EPROM bank from the 2764's (more about this later)
1298
1299
1300
PortA's data is passed through a quad 2:1 multiplexer (a 74LS157). The select line connects
1301
to bit 3 of the joystick port. When it's low, the multiplexer outputs the lower nybble of
1302
the byte on PortA. When it's high, it outputs the upper nybble.
1303
1304
The data bits from the muxer connect like so:
1305
1306
bit 3: this is acting as an output- it runs the select line of the 74LS157, and also
1307
connects to /IRQ on the CPU.
1308
bits 2 to 0 connect to the multiplexer's upper 3 bits.
1309
1310
The fire button input connects to the multiplexer's lowest bit.
1311
1312
So, to read a byte of data in through the controller port, the select line is pulled low
1313
via the RIOT register at 280h. Bit 3 must be set as an output, while bits 0-2 are inputs.
1314
1315
bits 3,2, and 1 of the data byte are read on 280 bits 2 to 0. bit 0 of the data byte is
1316
read via 3Dh bit 7.
1317
1318
the select line is thin pulled high via 280.3
1319
1320
bits 7,6, and 5 are then read from 280 bits 2 to 0 . bit 4 of the data byte is read via
1321
3Dh bit 7.
1322
1323
There's a very elegant piece of code that does this on the bootloader, which gets loaded
1324
into RAM:
1325
1326
;enters with Y = 3fh
1327
0081 : CD 0 F0 CMP $F000 ;select proper RAM bank (note: self modifying)
1328
0084 : CD F8 FF CMP $FFF8
1329
0087 : A9 7F LDA #$7F
1330
0089 : C5 3D CMP $3D ;puts fire button data into carry and invert it
1331
008B : 4D 80 2 EOR $280 ;get data, and invert it (data is sent inverted)
1332
008E : 8D 80 2 STA $280 ;write inverted data back (toggles bit 3 to demo unit)
1333
0091 : 2A ROL
1334
0092 : A ASL
1335
0093 : A ASL
1336
0094 : A ASL ;put lower 3 bits into bits 6 to 4, carry into 3
1337
0095 : 85 B7 STA $B7 ;save for now
1338
0097 : A9 7F LDA #$7F
1339
0099 : C5 3D CMP $3D ;put fire button into carry and invert it
1340
009B : 4D 80 2 EOR $280 ;get data, and invert it
1341
009E : 8D 80 2 STA $280 ;write inverted data back
1342
00A1 : 29 7 AND #$7 ;strip off upper bits
1343
00A3 : 5 B7 ORA $B7 ;or it on to add into bits 2 to 0
1344
00A5 : 2A ROL ;finish up by putting carry into 0 and shifting the mess left
1345
00A6 : AA TAX
1346
00A7 : DD 0 F0 CMP $F000,X ;write it to supercharger RAM
1347
00AA : D1 B9 CMP ($B9),Y
1348
00AC : 88 DEY
1349
00AD : 10 D8 BPL $FF8A ;do all bytes
1350
00AF : CD 19 F0 CMP $F019 ;bankswitch
1351
00B2 : CD F8 FF CMP $FFF8
1352
00B5 : 60 RTS
1353
1354
1355
This core routine is used to load data. It lives in the FF00-FFBF range and is loaded
1356
into RIOT RAM when data needs to be transferred.
1357
1358
Since bit 3 of 280h is also connected to the /IRQ line on the CPU, this is used to
1359
tell the 6805 when a byte of data has been read, and it should get the next one ready
1360
to go.
1361
1362
That's about it for the 2600 to demo unit interface.
1363
1364
The memory map of the demo unit is extremely simple:
1365
1366
0000-0FFF : on-chip resources (ports, the timer, RAM)
1367
1000-17FF : 2K bank of data from the 64K worth of 2764's
1368
1800-1FFF : 2K of BIOS code from the 2732 EPROM.
1369
1370
The 2K bank of data at 1000-17FF comes from the 64K of EPROMs. PortB bits 0-4 select
1371
a desired 2K bank.
1372
1373
That's about it for the details. There are a few other amusing (to me) details of the
1374
hardware, however.
1375
1376
When the unit starts, there's a 10 second countdown. This is there for a reason.
1377
Those 8 2764's can draw a lot of power if they were all turned on at once, so to
1378
enable the EPROMs there are 8 PNP transistors connected to a decoder, which connect
1379
to the VCC lines of each EPROM. So, when you wish to read from the EPROMs, you must
1380
actually enable the power line to it via a decoder chip (74LS42).
1381
1382
To prevent a huge power suck from the 2600, there's a large capacitor that supplies
1383
power to the EPROMs. I can't remember how big it was, but I think it was 4700uF.
1384
This is connected through a resistor to 5V. So, that 10 second countdown at the
1385
start is so this capacitor can charge. The countdown code and bootstraps are stored
1386
in the 2K EPROM.
1387
1388
Only one of the 8K EPROMs may be enabled at any time, and they can all be disabled
1389
to prevent them drawing any power by clearing bit 6 of portB. The desired EPROM is
1390
selected via bits 2,3,4 of portB. (bits 0 and 1 of portB connect to A11 and A12
1391
of the 8 EPROMs.)
1392
1393
The 74LS42 is a 1 of 10 decoder, and the inputs are connected as such:
1394
1395
7 0
1396
---------
1397
xDxC BAxx
1398
1399
ABCD: the 4 selector inputs (A = LSB, D = MSB). x = not used.
1400
1401
Thus, to enable an EPROM, bit 6 must be clear. When this bit is set, no outputs
1402
connected to EPROM power enable transistors will be turned on.
1403
1404
I am not 100% sure of the speed the demo unit's CPU runs at. It was 12 years ago,
1405
but I think it was 4.1952MHz. I am using this on my demo unit FPGA emulation and
1406
it works good.
1407
1408
That about wraps up this mysterious piece of hardware.
1409
1410
1411