mirror of
https://github.com/mist64/perfect6502.git
synced 2024-06-07 06:29:28 +00:00
fixed "broken transistors" test
This commit is contained in:
parent
217ba8f681
commit
44f7f48a9c
7
Makefile
7
Makefile
|
@ -1,7 +1,8 @@
|
||||||
OBJS=perfect6502.o
|
OBJS=perfect6502.o
|
||||||
#OBJS+=runtime.o runtime_init.o plugin.o console.o emu.o
|
#OBJS+=cbmbasic.o runtime.o runtime_init.o plugin.o console.o emu.o
|
||||||
OBJS+=measure.o
|
#OBJS+=measure.o
|
||||||
CFLAGS=-Wall -O3
|
OBJS+=broken_transistors.o runtime.o runtime_init.o plugin.o console.o emu.o
|
||||||
|
CFLAGS=-Wall -O3 -DBROKEN_TRANSISTORS
|
||||||
CC=clang
|
CC=clang
|
||||||
|
|
||||||
all: cbmbasic
|
all: cbmbasic
|
||||||
|
|
|
@ -1,3 +1,15 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include "perfect6502.h"
|
||||||
|
|
||||||
|
extern void init_monitor();
|
||||||
|
|
||||||
|
typedef unsigned char uint8_t;
|
||||||
|
typedef unsigned short uint16_t;
|
||||||
|
typedef unsigned int BOOL;
|
||||||
|
|
||||||
|
#define YES 1
|
||||||
|
#define NO 0
|
||||||
|
|
||||||
#define MAX_CYCLES 33000
|
#define MAX_CYCLES 33000
|
||||||
BOOL log_rw[MAX_CYCLES];
|
BOOL log_rw[MAX_CYCLES];
|
||||||
|
@ -6,8 +18,10 @@ uint8_t log_db[MAX_CYCLES];
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
setupNodesAndTransistors();
|
initAndResetChip();
|
||||||
for (int run = -1; run < transistors; run ++) {
|
printf("%d\n", transistors);
|
||||||
|
int stransistors = transistors;
|
||||||
|
for (int run = -1; run < stransistors; run ++) {
|
||||||
#if 0
|
#if 0
|
||||||
/* skip a few runs! */
|
/* skip a few runs! */
|
||||||
if (run == 0)
|
if (run == 0)
|
||||||
|
@ -26,12 +40,12 @@ main()
|
||||||
for (int c = 0; c < MAX_CYCLES; c++) {
|
for (int c = 0; c < MAX_CYCLES; c++) {
|
||||||
step();
|
step();
|
||||||
if (run == -1) {
|
if (run == -1) {
|
||||||
log_rw[c] = isNodeHigh(rw);
|
log_rw[c] = cycle & 1;
|
||||||
log_ab[c] = readAddressBus();
|
log_ab[c] = readAddressBus();
|
||||||
log_db[c] = readDataBus();
|
log_db[c] = readDataBus();
|
||||||
} else {
|
} else {
|
||||||
if (log_rw[c] != isNodeHigh(rw)) {
|
if (log_rw[c] != (cycle & 1)) {
|
||||||
printf("FAIL, RW %d instead of %d @ %d\n", isNodeHigh(rw), log_rw[c], c);
|
printf("FAIL, RW %d instead of %d @ %d\n", cycle & 1, log_rw[c], c);
|
||||||
fail = YES;
|
fail = YES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
23
cbmbasic.c
Normal file
23
cbmbasic.c
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#include "perfect6502.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
int clk = 0;
|
||||||
|
|
||||||
|
initAndResetChip();
|
||||||
|
|
||||||
|
/* set up memory for user program */
|
||||||
|
init_monitor();
|
||||||
|
|
||||||
|
/* emulate the 6502! */
|
||||||
|
for (;;) {
|
||||||
|
step();
|
||||||
|
clk = !clk;
|
||||||
|
if (clk)
|
||||||
|
handle_monitor();
|
||||||
|
|
||||||
|
//chipStatus();
|
||||||
|
//if (!(cycle % 1000)) printf("%d\n", cycle);
|
||||||
|
};
|
||||||
|
}
|
|
@ -34,6 +34,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "perfect6502.h"
|
||||||
|
|
||||||
typedef unsigned char uint8_t;
|
typedef unsigned char uint8_t;
|
||||||
typedef unsigned short uint16_t;
|
typedef unsigned short uint16_t;
|
||||||
typedef unsigned int BOOL;
|
typedef unsigned int BOOL;
|
||||||
|
@ -428,7 +430,7 @@ getGroupValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BROKEN_TRANSISTORS
|
#ifdef BROKEN_TRANSISTORS
|
||||||
transnum_t broken_transistor = (transnum_t)-1;
|
unsigned int broken_transistor = (unsigned int)-1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -719,7 +721,7 @@ step()
|
||||||
*
|
*
|
||||||
************************************************************/
|
************************************************************/
|
||||||
|
|
||||||
count_t transistors;
|
unsigned int transistors;
|
||||||
|
|
||||||
void
|
void
|
||||||
setupNodesAndTransistors()
|
setupNodesAndTransistors()
|
||||||
|
@ -820,7 +822,6 @@ void handle_monitor();
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
#elif defined(BROKEN_TRANSISTORS)
|
#elif defined(BROKEN_TRANSISTORS)
|
||||||
#include "broken_transistors.c"
|
|
||||||
#elif defined(COMPARE)
|
#elif defined(COMPARE)
|
||||||
#include "compare.c"
|
#include "compare.c"
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -15,4 +15,8 @@ extern unsigned char readIR();
|
||||||
|
|
||||||
extern unsigned char memory[65536];
|
extern unsigned char memory[65536];
|
||||||
extern unsigned int cycle;
|
extern unsigned int cycle;
|
||||||
|
extern unsigned int transistors;
|
||||||
|
|
||||||
|
#ifdef BROKEN_TRANSISTORS
|
||||||
|
extern unsigned int broken_transistor;
|
||||||
|
#endif
|
||||||
|
|
|
@ -96,24 +96,3 @@ handle_monitor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
int clk = 0;
|
|
||||||
|
|
||||||
initAndResetChip();
|
|
||||||
|
|
||||||
/* set up memory for user program */
|
|
||||||
init_monitor();
|
|
||||||
|
|
||||||
/* emulate the 6502! */
|
|
||||||
for (;;) {
|
|
||||||
step();
|
|
||||||
clk = !clk;
|
|
||||||
if (clk)
|
|
||||||
handle_monitor();
|
|
||||||
|
|
||||||
//chipStatus();
|
|
||||||
//if (!(cycle % 1000)) printf("%d\n", cycle);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user