Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Stats + Instructions #284

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
6 changes: 3 additions & 3 deletions cpu/65c02.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ static void stz() {
// *******************************************************************************************

static void bra() {
oldpc = pc;
uint16_t oldpc = pc;
pc += reladdr;
if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
else clockticks6502++;
clockticks6502 += 1;
clockticks6502 += ((oldpc & 0xFF00) != (pc & 0xFF00)); //check if jump crossed a page boundary
}

// *******************************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion cpu/fake6502.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ uint8_t sp, a, x, y, status;
//helper variables
uint32_t instructions = 0; //keep track of total instructions executed
uint32_t clockticks6502 = 0, clockgoal6502 = 0;
uint16_t oldpc, ea, reladdr, value, result;
uint16_t ea, reladdr, value, result;
uint8_t opcode, oldstatus;

uint8_t penaltyop, penaltyaddr;
Expand Down
48 changes: 24 additions & 24 deletions cpu/instructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,28 @@ static void asl() {

static void bcc() {
if ((status & FLAG_CARRY) == 0) {
oldpc = pc;
uint16_t oldpc = pc;
pc += reladdr;
if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
else clockticks6502++;
clockticks6502 += 1;
clockticks6502 += ((oldpc & 0xFF00) != (pc & 0xFF00)); //check if jump crossed a page boundary
}
}

static void bcs() {
if ((status & FLAG_CARRY) == FLAG_CARRY) {
oldpc = pc;
uint16_t oldpc = pc;
pc += reladdr;
if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
else clockticks6502++;
clockticks6502 += 1;
clockticks6502 += ((oldpc & 0xFF00) != (pc & 0xFF00)); //check if jump crossed a page boundary
}
}

static void beq() {
if ((status & FLAG_ZERO) == FLAG_ZERO) {
oldpc = pc;
uint16_t oldpc = pc;
pc += reladdr;
if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
else clockticks6502++;
clockticks6502 += 1;
clockticks6502 += ((oldpc & 0xFF00) != (pc & 0xFF00)); //check if jump crossed a page boundary
}
}

Expand All @@ -115,28 +115,28 @@ static void bit() {

static void bmi() {
if ((status & FLAG_SIGN) == FLAG_SIGN) {
oldpc = pc;
uint16_t oldpc = pc;
pc += reladdr;
if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
else clockticks6502++;
clockticks6502 += 1;
clockticks6502 += ((oldpc & 0xFF00) != (pc & 0xFF00)); //check if jump crossed a page boundary
}
}

static void bne() {
if ((status & FLAG_ZERO) == 0) {
oldpc = pc;
uint16_t oldpc = pc;
pc += reladdr;
if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
else clockticks6502++;
clockticks6502 += 1;
clockticks6502 += ((oldpc & 0xFF00) != (pc & 0xFF00)); //check if jump crossed a page boundary
}
}

static void bpl() {
if ((status & FLAG_SIGN) == 0) {
oldpc = pc;
uint16_t oldpc = pc;
pc += reladdr;
if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
else clockticks6502++;
clockticks6502 += 1;
clockticks6502 += ((oldpc & 0xFF00) != (pc & 0xFF00)); //check if jump crossed a page boundary
}
}

Expand All @@ -153,19 +153,19 @@ static void brk() {

static void bvc() {
if ((status & FLAG_OVERFLOW) == 0) {
oldpc = pc;
uint16_t oldpc = pc;
pc += reladdr;
if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
else clockticks6502++;
clockticks6502 += 1;
clockticks6502 += ((oldpc & 0xFF00) != (pc & 0xFF00)); //check if jump crossed a page boundary
}
}

static void bvs() {
if ((status & FLAG_OVERFLOW) == FLAG_OVERFLOW) {
oldpc = pc;
uint16_t oldpc = pc;
pc += reladdr;
if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
else clockticks6502++;
clockticks6502 += 1;
clockticks6502 += ((oldpc & 0xFF00) != (pc & 0xFF00)); //check if jump crossed a page boundary
}
}

Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ emulator_loop(void *param)
spi_step();
joystick_step();
vera_spi_step();
new_frame |= video_step(MHZ);
new_frame |= video_step();
}
audio_render(clocks);

Expand Down
2 changes: 1 addition & 1 deletion video.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

bool video_init(int window_scale, char *quality);
void video_reset(void);
bool video_step(float mhz);
bool video_step();
bool video_update(void);
void video_end(void);
bool video_get_irq_out(void);
Expand Down