I tried calling this project done... but I had yet to finish the vision of expanding the registers along with the address bus. Diving into that over the last few days resulted in
https://github.com/lunarmobiscuit/verilog-65C2424-fsm, the mythical 65C2424.
This CPU builds upon the 65C2402. While that design grew the address bus from 16-bits to 24-bits, this design grows the registers from 8-bit to both 16-bit and 24-bit. All of this with 99.9% backward compatibility, no new flags, no modes, with a path to expand the design to a full 32-bit address+data design.
The key change is the use of the $nF opcodes as prefix codes. $0F is the new CPU opcode, which just loads the A register with the capabilities of the chip. The bottom-most nibble is $0 in this version, as I used that to describe the number of threads in the 65C24T8, and this version has no threads. The next nibble is split again into two bit pairs. The bottom pair is 00 for 16-bit addresses, 01 for 24-bit addresses. The top pair is 00 for 8-bit registers, 01 for 16-bit registers, and 10 for 24-bit registers. The 65C2424 has capabilities of $90, i.e. 24-bit registers and 24-bit addresses.
That all sounds complicated, but it matches the prefix codes. $1F is 8-bit registers, 24-bit address. $4F is 16-bit registers, 16-bit address. $8F is 24-bit registers, 16-bit address. For every opcode you pick the widths. E.g. $4F $A9 $34 $12 = LDA #1234. E.g. $8F $A9 $56 $34 $12 = LDA #123456. $9F $AD $00 $00 $F0 = LDA $F00000 (loading 24-bits from memory location $F00000/1/2).
You do the same for opcodes like INC, DEX, TAY, with the prefix (or lack thereof) telling the CPU whether to treat the register as 8-bits, 16-bits, or 24-bits. LDA #1234, R16 DEA results in $1233 in the A register whereas LDA #1234, DEA results in $33 in the A register, with the top two bytes not just ignored, but zeroed.
Note that I keep saying registers, not data, as this CPU keeps the 8-bit data bus. It thus fits into a 48-pin DIP. This project was originally a thought experiment about what might have been in 1978/79, and back then a 40-pin DIP was considered as big as a DIP should be. Just as today's ARMs have 64-bit addresses but a 40-odd address bus, an 1979 NMOS 652424 could be squeezed into that 40-pin DIP if the address bus is extended to just 17, 18, or 19 bits using the 3 NC pins.
And speaking of 1978/79, one question I asked in the first post on this thread is why Apple didn't ask for a larger address space way back then. I thought I found that answer in an interview with the Motorola 68000 team, who said Jobs negotiated a $15/chip price for their chip. Well... a few days ago I happened across another interview, this one by Bob Schreiner of Synertek in a footnote on the
https://en.wikipedia.org/wiki/Synertek Wikipedia page. Turns out Jobs did ask. The trouble is that he asked Synertek, who had a license to manufacture 6502s, and thus copies of the masks, but copies of the designs nor any of the team members from MOS. Bob said he told Steve that Synertek couldn't afford to do the design, but if Apple wanted to pay, he'd be happy to to it. Steve passed on that offer. If only...
In terms of complexity, this variation is 1176 lines of code (including commented debug code) vs. 912 in Arlet's original 65C02. A better measure of transistors is the netlist. This version is 1953 lines vs. 1591 in Arlet's original. 362/1591 = 23% larger. The 24-bit address upgrade was 11% of this growth, so basically the same with the register scale up. Both are small enough that MOS could have very likely made these changes back in the late 1970s if they had the resources, or if Jobs had offered to pay them.
A simulated test run showing 8-bit, 16-bit, and 24-bit loads and stores on the zero page. a: is the width of the address bus. r: is the width of the registers. rb: is the number of bytes to load. DR: remembers the last three bytes from DI (data in). The ALU and the registers always show their full widths in this debug code, as it's too much trouble to not do that.
Code:
$0000: 01 12 23 34 45 56 67 78 89 9a ab bc cd de ef f0 // zero page
$8100: 18 A5 01 A6 02 B4 03 ea 4F A5 01 8F B4 03 ea ea // CLC; LDA $01; LDX $02; LDY $03,X; LDA $01/2; LDY $03,X/3; NOP
$8110: 4F B2 00 8F B2 00 85 00 4F 85 01 8F 85 03 ea ea // LDA $00/2; LDA $00/3; STA $00; STA $01/2; STA $03/3; NOP
$8120: db ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff // STP
0 R PC:xxxxxx AB:xxxxxx a:04 r:00 rb:x DI:xx DR:xx:xx:xx DO:xx IR:ea WE:x ALU:xxxxxx S:ffff A:000000 X:000001 Y:000002 P:------
1 - BRK4 PC:fffffa AB:fffffa a:24 r:08 rb:0 DI:xx DR:xx:xx:xx DO:xx IR:xx WE:0 ALU:xxxxxx S:ffff A:000000 X:000001 Y:000002 P:------
2 - BRK3 PC:fffffb AB:fffffb a:24 r:08 rb:0 DI:00 DR:xx:xx:xx DO:xx IR:00 WE:0 ALU:xxxxxx S:ffff A:000000 X:000001 Y:000002 P:---I--
3 - JMP0 PC:fffffc AB:fffffc a:24 r:08 rb:0 DI:81 DR:00:00:xx DO:xx IR:81 WE:0 ALU:xxxxxx S:ffff A:000000 X:000001 Y:000002 P:---I--
4 - JMP1 PC:fffffd AB:008100 a:24 r:08 rb:0 DI:00 DR:81:00:xx DO:xx IR:00 WE:0 ALU:xxxxxx S:ffff A:000000 X:000001 Y:000002 P:---I--
5 - SYNC PC:008101 AB:008101 a:24 r:08 rb:0 DI:18 DR:81:00:xx DO:xx IR:18 WE:0 ALU:xxxxxx S:ffff A:000000 X:000001 Y:000002 P:---I--
6 - CLC SYNC PC:008102 AB:008102 a:24 r:08 rb:0 DI:a5 DR:81:00:xx DO:xx IR:a5 WE:0 ALU:xxxxxx S:ffff A:000000 X:000001 Y:000002 P:---I--
7 - LDA ZPG0 PC:008103 AB:000001 a:16 r:08 rb:0 DI:01 DR:81:00:xx DO:81 IR:01 WE:0 ALU:000081 S:ffff A:000000 X:000001 Y:000002 P:---I--
8 - LDA DATA PC:008103 AB:008103 a:16 r:08 rb:0 DI:12 DR:81:00:xx DO:81 IR:12 WE:0 ALU:000081 S:ffff A:000000 X:000001 Y:000002 P:---I--
9 - LDA SYNC PC:008104 AB:008104 a:16 r:08 rb:0 DI:a6 DR:12:81:00 DO:81 IR:a6 WE:0 ALU:000012 S:ffff A:000000 X:000001 Y:000002 P:---I--
10 - LDX ZPG0 PC:008105 AB:000002 a:16 r:08 rb:0 DI:02 DR:12:81:00 DO:12 IR:02 WE:0 ALU:000012 S:ffff A:000012 X:000001 Y:000002 P:---I--
11 - LDX DATA PC:008105 AB:008105 a:16 r:08 rb:0 DI:23 DR:12:12:81 DO:12 IR:23 WE:0 ALU:000012 S:ffff A:000012 X:000001 Y:000002 P:---I--
12 - LDX SYNC PC:008106 AB:008106 a:16 r:08 rb:0 DI:b4 DR:23:12:81 DO:12 IR:b4 WE:0 ALU:000023 S:ffff A:000012 X:000001 Y:000002 P:---I--
13 - LDY ZPG0 PC:008107 AB:000026 a:16 r:08 rb:0 DI:03 DR:23:12:81 DO:23 IR:03 WE:0 ALU:000023 S:ffff A:000012 X:000023 Y:000002 P:---I--
14 - LDY DATA PC:008107 AB:008107 a:16 r:08 rb:0 DI:26 DR:23:12:81 DO:23 IR:26 WE:0 ALU:000023 S:ffff A:000012 X:000023 Y:000002 P:---I--
15 - LDY SYNC PC:008108 AB:008108 a:16 r:08 rb:0 DI:ea DR:26:23:12 DO:23 IR:ea WE:0 ALU:000026 S:ffff A:000012 X:000023 Y:000002 P:---I--
16 - NOP SYNC PC:008109 AB:008109 a:16 r:08 rb:0 DI:4f DR:26:23:12 DO:23 IR:4f WE:0 ALU:000026 S:ffff A:000012 X:000023 Y:000026 P:---I--
17 - R16 SYNC PC:00810a AB:00810a a:16 r:08 rb:1 DI:a5 DR:26:23:12 DO:23 IR:a5 WE:0 ALU:000026 S:ffff A:000012 X:000023 Y:000026 P:---I--
18 - LDA ZPG0 PC:00810b AB:000001 a:16 r:16 rb:1 DI:01 DR:26:23:12 DO:23 IR:01 WE:0 ALU:002623 S:ffff A:000012 X:000023 Y:000026 P:---I--
19 - LDA ZPGR PC:00810b AB:000002 a:16 r:16 rb:0 DI:12 DR:26:26:23 DO:23 IR:12 WE:0 ALU:002623 S:ffff A:000012 X:000023 Y:000026 P:---I--
20 - LDA DATA PC:00810b AB:00810b a:16 r:16 rb:0 DI:23 DR:12:26:23 DO:26 IR:23 WE:0 ALU:001226 S:ffff A:000012 X:000023 Y:000026 P:---I--
21 - LDA SYNC PC:00810c AB:00810c a:16 r:16 rb:0 DI:8f DR:23:12:26 DO:26 IR:8f WE:0 ALU:002312 S:ffff A:000012 X:000023 Y:000026 P:---I--
22 - R24 SYNC PC:00810d AB:00810d a:16 r:08 rb:0 DI:b4 DR:23:12:26 DO:26 IR:b4 WE:0 ALU:000023 S:ffff A:002312 X:000023 Y:000026 P:---I--
23 - LDY ZPG0 PC:00810e AB:000026 a:16 r:24 rb:1 DI:03 DR:23:12:26 DO:26 IR:03 WE:0 ALU:231226 S:ffff A:002312 X:000023 Y:000026 P:---I--
24 - LDY ZPGR PC:00810e AB:000027 a:16 r:24 rb:1 DI:26 DR:23:12:26 DO:26 IR:26 WE:0 ALU:231226 S:ffff A:002312 X:000023 Y:000026 P:---I--
25 - LDY ZPGR PC:00810e AB:000028 a:16 r:24 rb:0 DI:27 DR:26:26:23 DO:12 IR:27 WE:0 ALU:262312 S:ffff A:002312 X:000023 Y:000026 P:---I--
26 - LDY DATA PC:00810e AB:00810e a:16 r:24 rb:0 DI:28 DR:27:26:23 DO:23 IR:28 WE:0 ALU:272623 S:ffff A:002312 X:000023 Y:000026 P:---I--
27 - LDY SYNC PC:00810f AB:00810f a:16 r:24 rb:0 DI:ea DR:28:27:26 DO:23 IR:ea WE:0 ALU:282726 S:ffff A:002312 X:000023 Y:000026 P:---I--
28 - NOP SYNC PC:008110 AB:008110 a:16 r:08 rb:0 DI:ea DR:28:27:26 DO:23 IR:ea WE:0 ALU:000028 S:ffff A:002312 X:000023 Y:282726 P:---I--
29 - NOP SYNC PC:008111 AB:008111 a:16 r:08 rb:0 DI:4f DR:28:27:26 DO:23 IR:4f WE:0 ALU:000028 S:ffff A:002312 X:000023 Y:282726 P:---I--
30 - R16 SYNC PC:008112 AB:008112 a:16 r:08 rb:0 DI:b2 DR:28:27:26 DO:23 IR:b2 WE:0 ALU:000028 S:ffff A:002312 X:000023 Y:282726 P:---I--
31 - LDA IDX0 PC:008113 AB:000000 a:16 r:16 rb:1 DI:00 DR:28:28:27 DO:23 IR:00 WE:0 ALU:002827 S:ffff A:002312 X:000023 Y:282726 P:---I--
32 - LDA IDX1 PC:008113 AB:000001 a:16 r:16 rb:1 DI:01 DR:00:28:27 DO:23 IR:01 WE:0 ALU:000028 S:ffff A:002312 X:000023 Y:282726 P:---I--
33 - LDA IDX2 PC:008113 AB:001201 a:16 r:16 rb:0 DI:12 DR:01:00:28 DO:00 IR:12 WE:0 ALU:000100 S:ffff A:002312 X:000023 Y:282726 P:---I--
34 - LDA IDXR PC:008113 AB:001202 a:16 r:16 rb:0 DI:02 DR:01:00:28 DO:00 IR:02 WE:0 ALU:000100 S:ffff A:002312 X:000023 Y:282726 P:---I--
35 - LDA DATA PC:008113 AB:008113 a:16 r:16 rb:0 DI:f0 DR:02:02:01 DO:01 IR:f0 WE:0 ALU:000201 S:ffff A:002312 X:000023 Y:282726 P:---I--
36 - LDA SYNC PC:008114 AB:008114 a:16 r:16 rb:0 DI:8f DR:f0:02:01 DO:01 IR:8f WE:0 ALU:00f002 S:ffff A:002312 X:000023 Y:282726 P:---I--
37 - R24 SYNC PC:008115 AB:008115 a:16 r:08 rb:2 DI:b2 DR:f0:02:01 DO:01 IR:b2 WE:0 ALU:0000f0 S:ffff A:00f002 X:000023 Y:282726 P:N--I--
38 - LDA IDX0 PC:008116 AB:000000 a:16 r:24 rb:2 DI:00 DR:f0:02:01 DO:01 IR:00 WE:0 ALU:f00201 S:ffff A:00f002 X:000023 Y:282726 P:N--I--
39 - LDA IDX1 PC:008116 AB:000001 a:16 r:24 rb:2 DI:01 DR:00:00:f0 DO:01 IR:01 WE:0 ALU:00f002 S:ffff A:00f002 X:000023 Y:282726 P:N--I--
40 - LDA IDX2 PC:008116 AB:001201 a:16 r:24 rb:2 DI:12 DR:01:00:f0 DO:f0 IR:12 WE:0 ALU:0100f0 S:ffff A:00f002 X:000023 Y:282726 P:N--I--
41 - LDA IDXR PC:008116 AB:001202 a:16 r:24 rb:0 DI:02 DR:01:01:00 DO:f0 IR:02 WE:0 ALU:0100f0 S:ffff A:00f002 X:000023 Y:282726 P:N--I--
42 - LDA IDXR PC:008116 AB:001203 a:16 r:24 rb:0 DI:f0 DR:02:01:00 DO:00 IR:f0 WE:0 ALU:020100 S:ffff A:00f002 X:000023 Y:282726 P:N--I--
43 - LDA DATA PC:008116 AB:008116 a:16 r:24 rb:0 DI:01 DR:f0:f0:02 DO:01 IR:01 WE:0 ALU:f00201 S:ffff A:00f002 X:000023 Y:282726 P:N--I--
44 - LDA SYNC PC:008117 AB:008117 a:16 r:24 rb:0 DI:85 DR:01:f0:02 DO:01 IR:85 WE:0 ALU:01f002 S:ffff A:00f002 X:000023 Y:282726 P:N--I--
45 - STA ZPG0 PC:008118 AB:000000 a:16 r:08 rb:0 DI:00 DR:01:f0:02 DO:02 IR:00 WE:1 ALU:000002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
46 - STA DATA PC:008118 AB:008118 a:16 r:08 rb:0 DI:01 DR:01:f0:02 DO:02 IR:01 WE:0 ALU:000002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
47 - STA SYNC PC:008119 AB:008119 a:16 r:08 rb:0 DI:4f DR:01:01:f0 DO:02 IR:4f WE:0 ALU:000002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
48 - R16 SYNC PC:00811a AB:00811a a:16 r:08 rb:0 DI:85 DR:01:01:f0 DO:02 IR:85 WE:0 ALU:000002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
49 - STA ZPG0 PC:00811b AB:000001 a:16 r:16 rb:0 DI:01 DR:01:01:f0 DO:02 IR:01 WE:1 ALU:00f002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
50 - STA ZPGR PC:00811b AB:000002 a:16 r:16 rb:0 DI:12 DR:01:01:f0 DO:f0 IR:12 WE:1 ALU:00f002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
51 - STA DATA PC:00811b AB:00811b a:16 r:16 rb:0 DI:23 DR:12:12:01 DO:f0 IR:23 WE:0 ALU:00f002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
52 - STA SYNC PC:00811c AB:00811c a:16 r:16 rb:0 DI:8f DR:23:12:01 DO:f0 IR:8f WE:0 ALU:00f002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
53 - R24 SYNC PC:00811d AB:00811d a:16 r:08 rb:2 DI:85 DR:23:12:01 DO:f0 IR:85 WE:0 ALU:000002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
54 - STA ZPG0 PC:00811e AB:000003 a:16 r:24 rb:2 DI:03 DR:23:12:01 DO:02 IR:03 WE:1 ALU:01f002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
55 - STA ZPGR PC:00811e AB:000004 a:16 r:24 rb:0 DI:34 DR:23:23:12 DO:f0 IR:34 WE:1 ALU:01f002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
56 - STA ZPGR PC:00811e AB:000005 a:16 r:24 rb:0 DI:45 DR:34:23:12 DO:01 IR:45 WE:1 ALU:01f002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
57 - STA DATA PC:00811e AB:00811e a:16 r:24 rb:0 DI:56 DR:45:45:34 DO:01 IR:56 WE:0 ALU:01f002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
58 - STA SYNC PC:00811f AB:00811f a:16 r:24 rb:0 DI:ea DR:56:45:34 DO:01 IR:ea WE:0 ALU:01f002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
59 - NOP SYNC PC:008120 AB:008120 a:16 r:08 rb:0 DI:ea DR:56:45:34 DO:01 IR:ea WE:0 ALU:000002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
60 - NOP SYNC PC:008121 AB:008121 a:16 r:08 rb:0 DI:db DR:56:45:34 DO:01 IR:db WE:0 ALU:000002 S:ffff A:01f002 X:000023 Y:282726 P:---I--
61 - STP SYNC PC:008122 AB:008122 a:16 r:08 rb:0 DI:ff DR:56:45:34 DO:01 IR:ff WE:0 ALU:000002 S:ffff A:01f002 X:000023 Y:282726 P:---I--