4510 support: fixed some cosmetical stuff and documentation

This commit is contained in:
Sven Oliver Moll
2016-08-29 23:29:31 +02:00
parent 0538184699
commit 91f8e09bcc
4 changed files with 36 additions and 33 deletions

View File

@@ -145,12 +145,11 @@ void GetEA (EffAddr* A)
if (CurTok.Tok == TOK_COMMA) {
/* (adr),y */
NextTok ();
switch(CurTok.Tok) {
switch (CurTok.Tok) {
case TOK_Z:
if (CPU == CPU_4510) {
NextTok ();
A->AddrModeSet = AM65_DIR_IND;
}
/* only set by scanner.c if in 4510-mode */
NextTok ();
A->AddrModeSet = AM65_DIR_IND;
break;
default:
Consume (TOK_Y, "`Y' expected");

View File

@@ -1290,7 +1290,7 @@ static void PutPCRel16 (const InsDesc* Ins)
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);
}
@@ -1543,33 +1543,33 @@ static void PutAll (const InsDesc* Ins)
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;

View File

@@ -1170,7 +1170,7 @@ Again:
CurTok.Tok = TOK_S;
return;
}
/* fall through */
/* FALL THROUGH */
default:
if (CPU == CPU_SWEET16 &&
(CurTok.IVal = Sweet16Reg (&CurTok.SVal)) >= 0) {