mirror of
https://github.com/cmosher01/v6502cpp.git
synced 2024-05-31 20:41:32 +00:00
git-svn-id: https://subversion.assembla.com/svn/cmosher/apple2/emu/v6502@10092 884d43a4-ffbe-47e9-90ca-fd8c37d7eb32
This commit is contained in:
parent
27ec3d4d32
commit
86e4a75ef2
2
segsonly
2
segsonly
|
@ -1154,7 +1154,7 @@
|
||||||
1153 1
|
1153 1
|
||||||
1154 1
|
1154 1
|
||||||
1155 1
|
1155 1
|
||||||
1156 0
|
1156 1
|
||||||
1157 1
|
1157 1
|
||||||
1158 0
|
1158 0
|
||||||
1159 1
|
1159 1
|
||||||
|
|
25
v6502.cpp
25
v6502.cpp
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "nodes.h"
|
#include "nodes.h"
|
||||||
|
|
||||||
//#define TRACE 1
|
#define TRACE 1
|
||||||
|
|
||||||
class seg {
|
class seg {
|
||||||
public:
|
public:
|
||||||
|
@ -212,6 +212,7 @@ void addToGroup(int n, std::set<int>& s) {
|
||||||
if (n==VCC || n==VSS) {
|
if (n==VCC || n==VSS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//std::cout << "a: " << n << std::endl;
|
||||||
const seg& sg = segs[n];
|
const seg& sg = segs[n];
|
||||||
for (std::vector<int>::const_iterator itrn = sg.c1c2s.begin(); itrn != sg.c1c2s.end(); ++itrn) {
|
for (std::vector<int>::const_iterator itrn = sg.c1c2s.begin(); itrn != sg.c1c2s.end(); ++itrn) {
|
||||||
const trn& t = trns[*itrn];
|
const trn& t = trns[*itrn];
|
||||||
|
@ -230,9 +231,12 @@ void recalcNode(int n, std::set<int>& rcl) {
|
||||||
std::set<int> g;
|
std::set<int> g;
|
||||||
addToGroup(n,g);
|
addToGroup(n,g);
|
||||||
const bool gval = getGroupValue(g);
|
const bool gval = getGroupValue(g);
|
||||||
|
//std::cout << "gval: " << gval << " grp size: " << g.size() << std::endl;
|
||||||
for (std::set<int>::iterator ig = g.begin(); ig != g.end(); ++ig) {
|
for (std::set<int>::iterator ig = g.begin(); ig != g.end(); ++ig) {
|
||||||
|
//std::cout << "ig: " << *ig << std::endl;
|
||||||
seg& seg = segs[*ig];
|
seg& seg = segs[*ig];
|
||||||
if (seg.state != gval) {
|
if (seg.state != gval) {
|
||||||
|
//std::cout << "change seg state " << std::endl;
|
||||||
seg.state = gval;
|
seg.state = gval;
|
||||||
for (std::vector<int>::iterator igate = seg.gates.begin(); igate != seg.gates.end(); ++igate) {
|
for (std::vector<int>::iterator igate = seg.gates.begin(); igate != seg.gates.end(); ++igate) {
|
||||||
trn& t = trns[*igate];
|
trn& t = trns[*igate];
|
||||||
|
@ -249,7 +253,7 @@ void recalcNode(int n, std::set<int>& rcl) {
|
||||||
|
|
||||||
void recalc(const std::set<int>& s) {
|
void recalc(const std::set<int>& s) {
|
||||||
std::set<int> list(s);
|
std::set<int> list(s);
|
||||||
std::set<int> done;
|
// std::set<int> done;
|
||||||
for (int sane = 0; sane < 100; ++sane) {
|
for (int sane = 0; sane < 100; ++sane) {
|
||||||
//std::cout << "rc: " << list.size() << std::endl;
|
//std::cout << "rc: " << list.size() << std::endl;
|
||||||
if (!list.size()) {
|
if (!list.size()) {
|
||||||
|
@ -258,11 +262,12 @@ void recalc(const std::set<int>& s) {
|
||||||
std::set<int> rcl;
|
std::set<int> rcl;
|
||||||
for (std::set<int>::const_iterator ilist = list.begin(); ilist != list.end(); ++ilist) {
|
for (std::set<int>::const_iterator ilist = list.begin(); ilist != list.end(); ++ilist) {
|
||||||
recalcNode(*ilist,rcl);
|
recalcNode(*ilist,rcl);
|
||||||
|
//std::cout << "done recalcNode" << std::endl;
|
||||||
}
|
}
|
||||||
//done.insert(rcl.begin(),rcl.end());
|
// done.insert(rcl.begin(),rcl.end());
|
||||||
//std::set<int> v;
|
// std::set<int> v;
|
||||||
//std::set_difference(rcl.begin(),rcl.end(),done.begin(),done.end(),std::inserter(v,v.end()));
|
// std::set_difference(rcl.begin(),rcl.end(),done.begin(),done.end(),std::inserter(v,v.end()));
|
||||||
//list = v;
|
// list = v;
|
||||||
// if (std::equal(list.begin(),list.end(),rcl.begin())) {
|
// if (std::equal(list.begin(),list.end(),rcl.begin())) {
|
||||||
//std::cout << "hit stasis" << std::endl;
|
//std::cout << "hit stasis" << std::endl;
|
||||||
// return;
|
// return;
|
||||||
|
@ -417,14 +422,16 @@ void step() {
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
std::cout << "initializing CPU..." << std::endl;
|
std::cout << "initializing CPU..." << std::endl;
|
||||||
|
//dumpRegs();
|
||||||
//dumpSegs();
|
//dumpSegs();
|
||||||
recalcAll();
|
recalcAll();
|
||||||
//dumpSegs();
|
//dumpSegs();
|
||||||
|
dumpRegs();
|
||||||
|
|
||||||
setHigh(VCC);
|
setHigh(VCC);
|
||||||
setLow(VSS);
|
setLow(VSS);
|
||||||
|
|
||||||
setLow(CLK0);
|
setHigh(CLK0);
|
||||||
setHigh(IRQ);
|
setHigh(IRQ);
|
||||||
setLow(RES);
|
setLow(RES);
|
||||||
setHigh(NMI);
|
setHigh(NMI);
|
||||||
|
@ -444,7 +451,7 @@ recalc(s);
|
||||||
//dumpSegs();
|
//dumpSegs();
|
||||||
// std::cout << "recalc all" << std::endl;
|
// std::cout << "recalc all" << std::endl;
|
||||||
// recalcAll();
|
// recalcAll();
|
||||||
|
dumpRegs();
|
||||||
std::cout << " [50 cycles]" << std::endl;
|
std::cout << " [50 cycles]" << std::endl;
|
||||||
for (int i(0); i < 50; ++i) {
|
for (int i(0); i < 50; ++i) {
|
||||||
step();
|
step();
|
||||||
|
@ -534,7 +541,7 @@ int main(int argc, char *argv[])
|
||||||
init();
|
init();
|
||||||
|
|
||||||
std::cout << "running some..." << std::endl;
|
std::cout << "running some..." << std::endl;
|
||||||
for (int i(0); i < 10000; ++i) {
|
for (int i(0); i < 100; ++i) {
|
||||||
step();
|
step();
|
||||||
}
|
}
|
||||||
std::cout << "end" << std::endl;
|
std::cout << "end" << std::endl;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user