//
// EMULATION FOR MICROTAN 65 ON NEO6502 SBC
//
// Neo6502 SBC @ https://www.olimex.com/Products/Retro-Computers/Neo6502/open-source-hardware
//
// Neo6502 has "real" 65C02 with Pi Pico providing all RAM, "ROM", clocking and peripheral interfaces
// Includes USB keyboard and DVI/HDMI video
//
// This program is intended to load and run original Microtan 65 code (e.g. Tanbug monitor) unchanged.
// Memory accesses are "captured" and simulated by the Pi Pico, including memory mapped I/O
// Display is emulated by Pi Pico from Microtan 65 video memory
//
// In addition to the actual emulation, this code provides a basic "monitor"-like interface to load
// program data, activate the 6502, etc
//
// Microtan 65 memory map:
// $0000 Zero page
// $0100 Stack
// $0200 / $300 Screen RAM
// $8000 I/O page ???
// $F800 - $FFFF Tanbug Monitor
//
//
// TODO LIST
// - Create custom chip for 74VC245 tri-state bus transceiver
// - Borrow Wokwi 65C02 custom chip (e.g. mega6502 @ https://wokwi.com/projects/357113701134775297)
// - Simulate Neo6502 hardware in Wokwi
// - Develop additional code here
//
#include <stdio.h>
#include <string.h>
#include "pico/stdlib.h"
#include "hardware/gpio.h"
#include "cpu6502.h"
#include "cpu6502_mem.h"
#include "mon_parse.h"
#include "mon_cmds.h"
//
// INIT
//
void init() {
stdio_init_all();
printf("Neo6502\nEmulating the Microtan 65 (v0.1)\n\n");
}
//
// LOOK AT COMMAND LINE ENTERED
//
// TODO : make this non-blocking : check character available on input, if not return ?
void parse_line() {
printf(">"); // Output prompt
if (get_line_uppercase()) {
int parameter;
int item_type = get_item_from_line(¶meter);
switch (item_type) {
case IT_COMMAND:
mon_cmds_do(parameter); // Parameter = keyword ID
break;
case IT_NUMBER:
mon_cmds_wozmon(parameter); // Parameter = number value
break;
default:
printf("Unknown command\n");
break;
}
}
}
//
// MAIN
//
int main() {
init();
while (true) {
parse_line();
}
}