Parcourir la source

IO moved from common to root. Adjusted modules to use the new IO path.

master
Bryan Miller il y a 5 ans
Parent
révision
35333360c1
4 fichiers modifiés avec 2 ajouts et 64 suppressions
  1. +0
    -62
      dummy.js
  2. +1
    -1
      src/MOSCIA.js
  3. +0
    -0
      src/io.js
  4. +1
    -1
      src/memory/memory.js

+ 0
- 62
dummy.js Voir le fichier

@@ -1,62 +0,0 @@
const mos6502 = require("./src/chip/MOS6502");
const Bank = require("./src/common/bank.js");

function toHex(v){
let r = v.toString(16);
return (r.length < 2) ? "0" + r : r;
}

function printBytes(b, acc){
var out = "";
for (let i=0; i < b.length; i++){
if (i % acc === 0 && out !== ""){
console.log(out);
out = ""
} else {
out += toHex(b[i]) + " ";
}
}
console.log(out);
}

var asm = new mos6502.Assembler();
var cpu = new mos6502.CPU();
cpu.memory = new Bank(65536);
cpu.memory.clear();
var tick = cpu.clk();

var src = "SEC\n";
src += "CLV\n";
src += "CLD\n";
src += "CLI\n";
src += "LDA #$00\n";
src += "SBC #$01\n";
src += "CLC\n";
src += "ADC #$01";


var res = asm.compile(src).result();
printBytes(res, 16);

cpu.memory.load(0, res);
var page = [];
for (let i = 0; i < 256; i++){
cpu.memory.address = i;
page.push(cpu.memory.byte);
}
printBytes(page, 16);
cpu.reset();

//console.log(cpu.PC);
//return;
tick(); tick();
tick(); tick();
tick(); tick();
tick(); tick();
tick(); tick();
console.log("A: " + cpu.A);
tick(); tick();
console.log("A: " + cpu.A);
tick(); tick();
tick(); tick();
console.log("A: " + cpu.A);

+ 1
- 1
src/MOSCIA.js Voir le fichier

@@ -1,4 +1,4 @@
const IO = require('./common/io.js');
const IO = require('./io.js');
const BCD = require('./utils/bcd.js');
const BITM = require('./utils/bitman.js');


src/common/io.js → src/io.js Voir le fichier


+ 1
- 1
src/memory/memory.js Voir le fichier

@@ -1,5 +1,5 @@

const IO = require('../common/io.js');
const IO = require('../io.js');
const IMem = require('./imem');



Chargement…
Annuler
Enregistrer