diff --git a/README.md b/README.md index 4d79bb4..e40b6c1 100644 --- a/README.md +++ b/README.md @@ -104,4 +104,9 @@ If you are under OSX - you can install MASM via HomeBrew and use it to compile a - https://coronax.wordpress.com/projects/project65/ - http://archive.computerhistory.org/resources/text/Apple/Apple.AppleI.1976.102646518.pdf (apple 1 official manual) - https://en.wikipedia.org/wiki/WDC_65C02 -- http://www.westerndesigncenter.com/wdc/w65c21-chip.cfm \ No newline at end of file +- http://www.westerndesigncenter.com/wdc/w65c21-chip.cfm + + +## TODO + - Hook to real keyboard - frame rate of 60.05 Hz, could support 40 characters per line at 24 lines, with automatic scrolling. + - Hook to real display - \ No newline at end of file diff --git a/lib/readme.txt b/lib/readme.txt index 607a92a..dbadc3d 100644 --- a/lib/readme.txt +++ b/lib/readme.txt @@ -32,7 +32,5 @@ Then in `src/main.c` you should use: PlatformIO will find your libraries automatically, configure preprocessor's include paths and build them. -See additional options for PlatformIO Library Dependency Finder `lib_*`: - -http://docs.platformio.org/en/latest/projectconf.html#lib-install - +More information about PlatformIO Library Dependency Finder +- http://docs.platformio.org/page/librarymanager/ldf.html diff --git a/platformio.ini b/platformio.ini index 4e33d61..3250fd4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,23 +1,14 @@ -# -# Project Configuration File -# -# A detailed documentation with the EXAMPLES is located here: -# http://docs.platformio.org/en/latest/projectconf.html -# - -# A sign `#` at the beginning of the line indicates a comment -# Comment lines are ignored. - -# Simple and base environment -# [env:mybaseenv] -# platform = %INSTALLED_PLATFORM_NAME_HERE% -# framework = -# board = -# -# Automatic targets - enable auto-uploading -# targets = upload +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; http://docs.platformio.org/page/projectconf.html [env:due] platform = atmelsam -framework = arduino board = due +framework = arduino diff --git a/src/main.cpp b/src/main.cpp index e3419a3..a76f492 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,4 @@ -#include "Arduino.h" +#include #include "rom.h" #include "programs.h" @@ -147,6 +147,7 @@ void byteToDataBus(unsigned char data) { void PIAWrite() { switch (address) { + // Keyboard case KBD_ADDR: KBD=bus_data; break; @@ -155,8 +156,9 @@ void PIAWrite() { KBDCR=bus_data; break; + // Display case DSP_ADDR: - DSP = bus_data; + DSP=bus_data; switch(DSP) { case CR: @@ -219,6 +221,7 @@ unsigned char PIARead() { case DSPCR_ADDR: val=DSPCR; break; + default: val=0; break; @@ -231,22 +234,33 @@ void writeToDataBus() { unsigned char val=0; switch (address >> 12) { + + // $0000-$0FFF 4KB Standard RAM case 0x0: val=RAM_BANK_1[address-RAM_BANK1_ADDR]; break; + + // $E000-$EFFF 4KB Extended RAM case 0xE: val=RAM_BANK_2[address-RAM_BANK2_ADDR]; break; + + // $FF00-$FFFF 256 Bytes ROM case 0xF: val=ROM[address-ROM_ADDR]; break; + + // $D010-$D013 PIA (6821) [KBD & DSP] case 0xD: val=PIARead(); break; + + // Segmentation Fault. Just return 0 default: val=0; break; } + byteToDataBus(val); } @@ -345,8 +359,7 @@ void handleClock() { } void handleBusRW() { - - // If nothing changed from the last cycle, we don't need to upadte anything + // If nothing changed from the last cycle, we don't need to update anything if (pre_address != address || pre_rw_state != rw_state) { // READ OR WRITE TO BUS? rw_state ? writeToDataBus() : readFromDataBus(); @@ -356,7 +369,6 @@ void handleBusRW() { } void step() { - CLOCK_DELAY=analogRead(CLOCK_DELAY_PIN); // Can be removed, see setup() handleClock(); readAddress();