//
// FREE RUN, CLOCK IS TOGGLED AS CODE EXECUTES SEQUENTIALLY
// This version sets clock LOW then high again
// Then gets address via addr_high/addr_low tri-state buffers
// and reads data buffer. Then cycle repeats
// This fits better with the 65C02 timing diagram that shows
// address is stable on PHI2 rise, and data stable 25ns later
// Based on Pico_6502_v4_ehbasic.ino
//
// Pins are monitored in Wokwi Logic Analyzer and resulting VCD file viewed in PulseView (downsample factor = 50)
//
#include <stdio.h>
#include <string.h>
#include "pico/stdlib.h"
#include "hardware/gpio.h"
#include "cpu6502.h"
//
// INIT
//
void init() {
stdio_init_all();
printf("Pi Pico TEST : clock free run V2\n\n");
cpu6502_init();
cpu6502_reset();
}
//
// MAIN
//
int main() {
init();
while (true) {
cpu6502_tick();
}
}