aboutsummaryrefslogtreecommitdiff
path: root/cart.txt
blob: a7783da207424cabd50a306e04dc038d4d20bfca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

What's needed to get taipan onto a cart:

joey_z is willing to manufacture carts like this:

+---------------------------------------------------------------------------+
| Type 13: XEGS 64 KB cartridge (banks 0-7)                                 |
+---------------------------------------------------------------------------+

 One of the two variants of the 64 KB XEGS cartridge, that's built on either
 a C100649 board with the W1 solder point not connected, or a C026449 board
 with pin 9 of the 74LS374 chip unconnected.
 This bank-switched cartridge occupies 16 KB of address space between $8000
 and $BFFF. The cartridge memory is divided into 8 banks, 8 KB each.
 Bank 7 (the last one) is always mapped to $A000-$BFFF. Three lowest bits of
 a byte written to $D500-$D5FF select the bank mapped to $8000-$9FFF.
 The initially selected bank is random, although it seems that 0 gets chosen
 the most often. Atari800 always selects bank 0 initially.

 Reference:
 http://www.atarimax.com/jindroush.atari.org/acarts.html#xegs

"For bank-switched cartridges banks are numbered in the order they appear
in the image file, starting with 0."

...so:

Bank 7 will have the startup code, uncompressed title screen, title
code, and code to copy from the other banks to RAM.

That gives me banks 0-6 to store code in. The code is 27174 bytes, so I
have plenty of space: it'll occupy 4 banks, leaving 2 empty ones. The
last code bank will only be 1/3 full of code... but 1K of it will be
used for the font, so 4.5K free there.

Code in bank 7 will copy all the chunks to correct place in RAM... and
I don't need to leave room for DOS or anything else, so the code can be
ORGed at $0400 (romable_taimain.raw target in the Makefile does this).

$0400 + 27174 means the code ends at $6e26, and the BSS is less than a
page. The OS will place the GR.0 display list at $7c20, and the stack
will grow down from there to $7a40 (except it never grows that much).

Copying the code to RAM will take some time, but not too much. Should be
around 1/4 second, don't need a progress bar or anything. Not sure when to do
the copying:

1. At boot, before displaying title screen?
2. After the title screen is displayed, before the menu is active?
3. After the player presses space/enter to start the game?

Options 1 and 3 will allow turning off ANTIC DMA during the copy, making
it a bit faster. Option 2 gives the player something to look at while
the copy is happening, but I think it'll be so quick as to not matter.

Amusingly, the Taipan cart will work on a 32K 800. Not a 16K Atari though.

bank 7: fixed bank
$a000-$b9xx - title screen data, dl, menu code
$ba00-$bff9 - memory checker plus code to copy romable_taimain to RAM
$bffa-$bfff - cart trailer

banks 0, 1, 2: full banks of romable_taimain code
$8000-$9dff - 30 pages (7680 bytes) of code
$9f00-$9fff - unused

bank 3: last (partial) bank of romable_taimain, plus the font
$8000-$9bff - up to 7K of code (28 pages)
$9c00-$9fff - font (1K)

Unused areas are filled with $ff. For the banks that map at $8000, this
includes the cart trailer area. A non-zero byte (our $ff) at $9ffc tells
the OS that a cart isn't inserted in the right slot, so it won't try to
initialize/run our cart as a right cart. Only bank 7 (that maps as a
left cart) needs a valid cart trailer... according to cart.txt, every
once in a while, bank 7 might come up selected at power on. This shouldn't
matter: it'll be in both bank areas, and if the OS tries to init it as
a right cart, the init/run addresses will point to the left cart area.

banks 4, 5, 6 are unused (24K total). Possibly the manual goes here,
if I write one.

--

Changes the game will need for a cart version: Not many.

checkmem.s won't be needed any longer... though there will need to be
a new memory checker (in bank 7) that says "32K required" if someone
tries it on a 16K machine.

"Play again?" should probably be "Press any key to play again" since
there's no place to exit() to. Unless I do a manual! Then it'll exit
to the title screen, from whence the user can choose the manual or else
start the game again.

The title decompression will be gone: it'll just display the title screen
DL and data straight from ROM. The menu help text might be in RAM though,
as at least 2 bytes need to be modified (sound on/off).

The font will be located in ROM, on a 1K boundary, so CHBAS can point
to it (no need to copy to RAM).

num_buf and firm will be located in the BSS rather than page 6 as they
are in the .xex version.

Since I have 3 empty banks... Why not include a manual on the cart,
with pseudo-hypertext UI?

--

Cart header (trailer, actually). Can I get away with using the same one
for all banks? IIRC, the low one ("right cartridge") gets looked at first,
does that mean the high bank doesn't even need a header?

atari800 can load a .xex that's built with --start-addr 0x400. This will
make testing the cart stuff slightly easier.

--

What would be *really* slick: figure out a way to split the code up
across banks and include bankswitching in the logic, so it runs from
the cart and switches banks as needed. This would allow Taipan to run
on a 16K or even an 8K 400/800!

Can it be done? Surely. Can it be done without rewriting everything
in asm? Probably. Do I want to? Not really.

--

The cartridge label should look like a classic brown 1st-gen 400/800 cart.
Yellow text:

TAIPAN!
Computer Game

and a bogus serial number.. CXU000001 or such (U for Urchlay).

The top should say LEFT CARTRIDGE.

If there's going to be a printed manual, it should be based on the Apple II
version's manual. If there was one. If I can find a copy.