ソースを参照

All op-codes filled out in assmebler.

master
Bryan Miller 5年前
コミット
22a70bc711
1個のファイルの変更78行の追加15行の削除
  1. +78
    -15
      src/MOS6502.js

+ 78
- 15
src/MOS6502.js ファイルの表示

@@ -436,55 +436,118 @@ class Assembler{
procFailed = StoreSingleOp(0xC8); break;
// --- JMP
case 'jmp':
if (tokens.length === 2){
if (tokens[1].startsWith("$") && tokens[1].length === 5){
let v = parseInt(tokens[1].substr(1), 16);
if (!isNaN(v)){
op.push(0x4C);
op.push(v & 0x000000FF);
op.push((v & 0x0000FF00) >> 8);
this.__PC += 3;
} else {
throw new Error("Malformed op-code or value on program address " + toHexString(this.__PC));
}
} else if (tokens[1].startsWith("+$") && tokens[1].length === 6){
let v = parseInt(tokens[1].substr(2), 16);
if (!isNaN(v)){
op.push(0x6C);
op.push(v & 0x000000FF);
op.push((v & 0x0000FF00) >> 8);
this.__PC += 3;
} else {
throw new Error("Malformed op-code or value on program address " + toHexString(this.__PC));
}
} else { procFailed = true; }
} else { procFailed = true; }
break;
// --- JSR
case 'jsr':
if (tokens.length === 2){
if (tokens[1].startsWith("$") && tokens[1].length === 5){
let v = parseInt(tokens[1].substr(1), 16);
if (!isNaN(v)){
op.push(0x20);
op.push(v & 0x000000FF);
op.push((v & 0x0000FF00) >> 8);
this.__PC += 3;
} else {
throw new Error("Malformed op-code or value on program address " + toHexString(this.__PC));
}
} else { procFailed = true; }
} else {
procFailed = true;
}
break;
// --- LDA
case 'lda':
procFailed = StoreOp([0xA9, 0xA5, 0xB5, 0xAD, 0xBD, 0xB9, 0xA1, 0xB1], 2, 3); break;
break;
// --- LDX
case 'ldx':
procFailed = StoreOp([0xA2, 0xA6, 0xB6, 0xAE, 0xBE, null, null, null], 2, 3); break;
break;
// --- LDY
case 'ldy':
procFailed = StoreOp([0xA0, 0xA4, 0xB4, 0xAC, 0xBC, null, null, null], 2, 3); break;
break;
// --- LSR
case 'lsr':
break;
if (tokens.length === 2){
if (tokens[1].toUpperCase() === 'A'){
op.push(0x4A);
this.__PC += 1;
break;
}
}
procFailed = StoreOp([null, 0x46, 0x56, 0x4E, 0x5E, null, null, null], 2, 3); break;
// --- NOP
case 'nop':
procFailed = StoreSingleOp(0xEA); break;
// --- ORA
case 'ora':
break;
procFailed = StoreOp([0x09, 0x05, 0x15, 0x0D, 0x1D, 0x19, 0x01, 0x11], 2, 3); break;
// --- PHA
case 'pha':
break;
procFailed = StoreSingleOp(0x48); break;
// --- PHP
case 'php':
break;
procFailed = StoreSingleOp(0x08); break;
// --- PLA
case 'pla':
break;
procFailed = StoreSingleOp(0x68); break;
// --- PLP
case 'plp':
break;
procFailed = StoreSingleOp(0x28); break;
// --- ROL
case 'rol':
break;
if (tokens.length === 2){
if (tokens[1].toUpperCase() === 'A'){
op.push(0x2A);
this.__PC += 1;
break;
}
}
procFailed = StoreOp([null, 0x26, 0x36, 0x2E, 0x3E, null, null, null], 2, 3); break;
// --- ROR
case 'ror':
break;
if (tokens.length === 2){
if (tokens[1].toUpperCase() === 'A'){
op.push(0x6A);
this.__PC += 1;
break;
}
}
procFailed = StoreOp([null, 0x66, 0x76, 0x6E, 0x7E, null, null, null], 2, 3); break;
// --- RTI
case 'rti':
break;
procFailed = StoreSingleOp(0x40); break;
// --- RTS
case 'rts':
procFailed = StoreSingleOp(0x60); break;
break;
// --- SBC
case 'sbc':
break;
procFailed = StoreOp([0xE9, 0xE5, 0xF5, 0xED, 0xFD, 0xF9, 0xE1, 0xF1], 2, 3); break;
// --- SEC
case 'sec':
procFailed = StoreSingleOp(0x38); break;
@@ -497,13 +560,13 @@ class Assembler{
break;
// --- STA
case 'sta':
break;
procFailed = StoreOp([null, 0x85, 0x95, 0x8D, 0x9D, 0x99, 0x81, 0x91], 2, 3); break;
// --- STX
case 'stx':
break;
procFailed = StoreOp([null, 0x86, 0x96, 0x8E, null, null, null, null], 2, 3); break;
// --- STY
case 'sty':
break;
procFailed = StoreOp([null, 0x84, 0x94, 0x8C, null, null, null, null], 2, 3); break;
// --- TAX
case 'tax':
procFailed = StoreSingleOp(0xAA); break;
@@ -512,13 +575,13 @@ class Assembler{
procFailed = StoreSingleOp(0xA8); break;
// --- TSX
case 'tsx':
break;
procFailed = StoreSingleOp(0xBA); break;
// --- TXA
case 'txa':
procFailed = StoreSingleOp(0x8A); break;
// --- TXS
case 'txs':
break;
procFailed = StoreSingleOp(0x9A); break;
// --- TYA
case 'tya':
procFailed = StoreSingleOp(0x98); break;

読み込み中…
キャンセル
保存