mirror of
https://github.com/stid/APPLE-1-ReplicaDue.git
synced 2025-01-14 05:31:07 +00:00
Cleanup
This commit is contained in:
parent
a773d0dffa
commit
a1c56fb36f
@ -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/
|
- https://coronax.wordpress.com/projects/project65/
|
||||||
- http://archive.computerhistory.org/resources/text/Apple/Apple.AppleI.1976.102646518.pdf (apple 1 official manual)
|
- http://archive.computerhistory.org/resources/text/Apple/Apple.AppleI.1976.102646518.pdf (apple 1 official manual)
|
||||||
- https://en.wikipedia.org/wiki/WDC_65C02
|
- https://en.wikipedia.org/wiki/WDC_65C02
|
||||||
- http://www.westerndesigncenter.com/wdc/w65c21-chip.cfm
|
- 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 -
|
@ -32,7 +32,5 @@ Then in `src/main.c` you should use:
|
|||||||
PlatformIO will find your libraries automatically, configure preprocessor's
|
PlatformIO will find your libraries automatically, configure preprocessor's
|
||||||
include paths and build them.
|
include paths and build them.
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
More information about PlatformIO Library Dependency Finder
|
||||||
|
- http://docs.platformio.org/page/librarymanager/ldf.html
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
||||||
|
@ -1,23 +1,14 @@
|
|||||||
#
|
; PlatformIO Project Configuration File
|
||||||
# Project Configuration File
|
;
|
||||||
#
|
; Build options: build flags, source filter
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
; Upload options: custom upload port, speed and extra flags
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
; Library options: dependencies, extra library storages
|
||||||
#
|
; Advanced options: extra scripting
|
||||||
|
;
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
; Please visit documentation for the other options and examples
|
||||||
# Comment lines are ignored.
|
; http://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:due]
|
[env:due]
|
||||||
platform = atmelsam
|
platform = atmelsam
|
||||||
framework = arduino
|
|
||||||
board = due
|
board = due
|
||||||
|
framework = arduino
|
||||||
|
22
src/main.cpp
22
src/main.cpp
@ -1,4 +1,4 @@
|
|||||||
#include "Arduino.h"
|
#include <Arduino.h>
|
||||||
#include "rom.h"
|
#include "rom.h"
|
||||||
#include "programs.h"
|
#include "programs.h"
|
||||||
|
|
||||||
@ -147,6 +147,7 @@ void byteToDataBus(unsigned char data) {
|
|||||||
void PIAWrite() {
|
void PIAWrite() {
|
||||||
switch (address) {
|
switch (address) {
|
||||||
|
|
||||||
|
// Keyboard
|
||||||
case KBD_ADDR:
|
case KBD_ADDR:
|
||||||
KBD=bus_data;
|
KBD=bus_data;
|
||||||
break;
|
break;
|
||||||
@ -155,8 +156,9 @@ void PIAWrite() {
|
|||||||
KBDCR=bus_data;
|
KBDCR=bus_data;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Display
|
||||||
case DSP_ADDR:
|
case DSP_ADDR:
|
||||||
DSP = bus_data;
|
DSP=bus_data;
|
||||||
|
|
||||||
switch(DSP) {
|
switch(DSP) {
|
||||||
case CR:
|
case CR:
|
||||||
@ -219,6 +221,7 @@ unsigned char PIARead() {
|
|||||||
case DSPCR_ADDR:
|
case DSPCR_ADDR:
|
||||||
val=DSPCR;
|
val=DSPCR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
val=0;
|
val=0;
|
||||||
break;
|
break;
|
||||||
@ -231,22 +234,33 @@ void writeToDataBus() {
|
|||||||
unsigned char val=0;
|
unsigned char val=0;
|
||||||
|
|
||||||
switch (address >> 12) {
|
switch (address >> 12) {
|
||||||
|
|
||||||
|
// $0000-$0FFF 4KB Standard RAM
|
||||||
case 0x0:
|
case 0x0:
|
||||||
val=RAM_BANK_1[address-RAM_BANK1_ADDR];
|
val=RAM_BANK_1[address-RAM_BANK1_ADDR];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// $E000-$EFFF 4KB Extended RAM
|
||||||
case 0xE:
|
case 0xE:
|
||||||
val=RAM_BANK_2[address-RAM_BANK2_ADDR];
|
val=RAM_BANK_2[address-RAM_BANK2_ADDR];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// $FF00-$FFFF 256 Bytes ROM
|
||||||
case 0xF:
|
case 0xF:
|
||||||
val=ROM[address-ROM_ADDR];
|
val=ROM[address-ROM_ADDR];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// $D010-$D013 PIA (6821) [KBD & DSP]
|
||||||
case 0xD:
|
case 0xD:
|
||||||
val=PIARead();
|
val=PIARead();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Segmentation Fault. Just return 0
|
||||||
default:
|
default:
|
||||||
val=0;
|
val=0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
byteToDataBus(val);
|
byteToDataBus(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,8 +359,7 @@ void handleClock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handleBusRW() {
|
void handleBusRW() {
|
||||||
|
// If nothing changed from the last cycle, we don't need to update anything
|
||||||
// If nothing changed from the last cycle, we don't need to upadte anything
|
|
||||||
if (pre_address != address || pre_rw_state != rw_state) {
|
if (pre_address != address || pre_rw_state != rw_state) {
|
||||||
// READ OR WRITE TO BUS?
|
// READ OR WRITE TO BUS?
|
||||||
rw_state ? writeToDataBus() : readFromDataBus();
|
rw_state ? writeToDataBus() : readFromDataBus();
|
||||||
@ -356,7 +369,6 @@ void handleBusRW() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void step() {
|
void step() {
|
||||||
|
|
||||||
CLOCK_DELAY=analogRead(CLOCK_DELAY_PIN); // Can be removed, see setup()
|
CLOCK_DELAY=analogRead(CLOCK_DELAY_PIN); // Can be removed, see setup()
|
||||||
handleClock();
|
handleClock();
|
||||||
readAddress();
|
readAddress();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user