<sect1>4510 mode<p>
The 4510 is a microcontroller that is the core of the Commodore C65 aka C64DX.
-It contains among other functions a slightly modified 65CE02 CPU, to allow
+It contains among other functions a slightly modified 65CE02/4502 CPU, to allow
address mapping for 20 bits of address space (1 megabyte addressable area).
-As compared to the description of the CPU in the System Specification of the
-Commodore C65 aka C64DX prototypes ca65 uses these changes:
+As compared to the description of the CPU in the
+<url url="http://www.zimmers.net/anonftp/pub/cbm/c65/c65manualupdated.txt.gz"
+name="C65 System Specification">
+<url url="https://raw.githubusercontent.com/MEGA65/c65-specifications/master/c65manualupdated.txt"
+name="(updated version)"> uses these changes:
<itemize>
<item><tt>LDA (d,SP),Y</tt> may also be written as <tt>LDA (d,S),Y</tt>
(matching the 65816 notataion).
"<tt>BNE</tt>"). This might change at a later implementation of the assember.
</itemize>
For more information about the Commodore C65/C64DX and the 4510 CPU, see
-<url url="http://www.zimmers.net/anonftp/pub/cbm/c65/c65manualupdated.txt.gz">.
+<url url="http://www.zimmers.net/anonftp/pub/cbm/c65/"> and
+<url url="https://en.wikipedia.org/wiki/Commodore_65" name="Wikipedia">.
<sect1>sweet16 mode<label id="sweet16-mode"><p>
static void PutPCRel4510 (const InsDesc* Ins)
/* Handle branches with a 16 bit distance */
{
- /* 16 bit branch opcode is 8 bit branch opcode or 0x03 */
+ /* 16 bit branch opcode is 8 bit branch opcode or'ed with 0x03 */
EmitPCRel (Ins->BaseCode, GenBranchExpr (2), 2);
}
static void Put4510 (const InsDesc* Ins)
-/* Handle all other instructions */
+/* Handle all other instructions, with modifications for 4510 */
{
- /* The 4510 uses all 256 possible opcodes, so the last ones were cramped
- * in where an opcode was still undefined. As a result, some of those
- * don't follow any rules for encoding the addressmodes. So the EATab
- * approach does not work always. In this function, the wrongly calculated
- * opcode is replaced by the correct one "on the fly". Suggestions for a
- * better approach are welcome.
- *
- * These are:
- * $20 -> $22 : JSR ($1234) NEED TO CHECK FOR ADDRESSING
- * $30 -> $23 : JSR ($1234,X)
- * $47 -> $44 : ASR $12
- * $57 -> $54 : ASR $12,X
- * $93 -> $82 : STA ($12,SP),Y
- * $9c -> $8b : STY $1234,X
- * $9e -> $9b : STX $1234,Y
- * $af -> $ab : LDZ $1234
- * $bf -> $bb : LDZ $1234,X
- * $b3 -> $e2 : LDA ($12,SP),Y
- * $d0 -> $c2 : CPZ #$00
- */
+ /* The 4510 uses all 256 possible opcodes, so the last ones were crammed
+ ** in where an opcode was still undefined. As a result, some of those
+ ** don't follow any rules for encoding the addressmodes. So the EATab
+ ** approach does not work always. In this function, the wrongly calculated
+ ** opcode is replaced by the correct one "on the fly". Suggestions for a
+ ** better approach are welcome.
+ **
+ ** These are:
+ ** $20 -> $22 : JSR ($1234) NEED TO CHECK FOR ADDRESSING
+ ** $30 -> $23 : JSR ($1234,X)
+ ** $47 -> $44 : ASR $12
+ ** $57 -> $54 : ASR $12,X
+ ** $93 -> $82 : STA ($12,SP),Y
+ ** $9c -> $8b : STY $1234,X
+ ** $9e -> $9b : STX $1234,Y
+ ** $af -> $ab : LDZ $1234
+ ** $bf -> $bb : LDZ $1234,X
+ ** $b3 -> $e2 : LDA ($12,SP),Y
+ ** $d0 -> $c2 : CPZ #$00
+ */
EffAddr A;
/* Evaluate the addressing mode used */
if (EvalEA (Ins, &A)) {
- switch(A.Opcode) {
+ switch (A.Opcode) {
case 0x20: if(A.AddrModeBit == AM65_ABS_IND) A.Opcode = 0x22; break;
case 0x30: A.Opcode = 0x23; break;
case 0x47: A.Opcode = 0x44; break;