You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(models): cover the eight NMOS packages the data sheet lists
The 6500 data sheet names ten packages sharing one die. Two were
modelled. The other eight differ only in how far an address reaches and
which interrupt lines the package brings out, both of which the
per-model pages state exhaustively.
A line the package does not bring out is not a line a system can assert,
so pulling one now raises instead of quietly taking the interrupt. That
makes the 6507 having no interrupt pins a behaviour rather than a
sentence in its summary.
Three of those differences are the kind that produce a bug rather than a compile error.
198
206
199
207
The address bus is not cosmetic. The 65802 has sixteen address lines, so bank bits never leave the chip and a read of `$7E0012` lands on `$0012`. The 6507 has thirteen, so everything above eight kilobytes is a mirror of something below it.
200
208
209
+
Neither are the pins. The ten NMOS packages share one die and one instruction set, and what separates most of them is how far an address reaches and which interrupt lines the package brought out. A line that is not on the package is not a line a system can assert, so pulling one here raises rather than quietly taking the interrupt:
210
+
211
+
```python
212
+
cpu = Cpu(SparseMemory(), model="6507")
213
+
cpu.irq()
214
+
215
+
# NoSuchPin: the 6507 has no irq pin; it brings out rdy
216
+
```
217
+
201
218
Decimal mode is a property of the part. The Ricoh variant in the Famicom has the decimal adder left unwired, so the flag can be set and changes nothing. Code that sets it and expects decimal arithmetic is wrong, and the part will not say so.
202
219
203
220
And the undocumented instructions are not optional. A hundred and fifty one of the 6502's opcodes were never documented, programs used them anyway, and a core that treats them as undefined is wrong for the machines that shipped.
204
221
205
222
Revisions are separate models, including the ones that only fixed a bug, because a machine has whichever revision it was built with. The three CMOS parts differ in exactly two opcode columns and two opcodes: a bit-clear instruction on a part that does not have it is a no-operation, and nothing reports that the bit was never cleared.
206
223
207
224
> [!NOTE]
208
-
> A model is only listed once a conformance suite backs it. A model with no suite behind it would make its fidelity a claim rather than a measurement.
225
+
> A model is only listed once something measures it. Six are held to a suite of their own. The other ten name the part they narrow and are held to that part's suite plus a check that the narrowing, fewer address lines or fewer pins, is the only difference. Either way the fidelity is a measurement rather than a claim.
"covers": "The current revision. Its caveats table carries the same values as the 2004 one, renumbered from Table 8-1 to Table 7-1, which is what makes those claims safe to cite without pinning a revision.",
"covers": "Which parts the NMOS family has. A page per package giving its addressable range and the interrupt lines it brings out, which between them are the whole of what a program can tell apart.",
"section": "Table 7-1 Caveats, which the 2004 revision numbers Table 8-1",
286
295
"quote": "A.ABS,X,ASL,LSR,ROL with no Page Crossing: 7 cycles, 6 cycles, 6 cycles, 7 cycles.",
287
296
"note": "Every cell of the comparison table is the same in the 2004 and 2024 revisions, twenty years apart. Only the section number moved. A claim taken from that table therefore does not depend on which revision a reader happens to hold, which is worth knowing because three revisions of this data sheet are pinned here."
297
+
},
298
+
"nmosFamilyPackages": {
299
+
"document": "mos6500_datasheet",
300
+
"section": "Features of 6502 through Features of 6515",
301
+
"quote": "Features of 6504: 8K Addressable Bytes of Memory (A0-A12). On-the-chip Clock. IRQ Interrupt. 8 Bit Bidirectional Data Bus.",
302
+
"note": "Ten packages, one die. The list of features under each is exhaustive, so a line absent from it is a line the package does not bring out: the 6504 has no non-maskable pin and the 6507 has neither interrupt pin. Six of the ten have an on-chip oscillator and four take their clock on pins, which is the only difference between 6502 and 6512, between 6503 and 6513, and so on, and it is not something a program can see.",
303
+
"whatIsImplemented": {
304
+
"addressLines": "12 on the 6503, 6505, 6506, 6513 and 6515; 13 on the 6504, 6507 and 6514; 16 on the 6502 and 6512",
305
+
"interruptPins": "Both on the 6502, 6503, 6512 and 6513. The request line alone on the 6504, 6505, 6506, 6514 and 6515. Neither on the 6507.",
306
+
"whatHappensWhenOneIsMissing": "Pulling it raises, because a line the package does not bring out is not a line a system can assert"
0 commit comments