Skip to content

Commit

Permalink
cleanup everything
Browse files Browse the repository at this point in the history
  • Loading branch information
udo-munk committed May 14, 2024
1 parent 7dacb01 commit f302fe2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 2 additions & 4 deletions arduino_8080.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// 04-MAY-2024 Release 1.0 implements a very basic 8080 system
// 06-MAY-2024 Release 1.1 add support for a ROM in flash
// 07-MAY-2024 Release 1.2 move 8080 memory into a FRAM
// 13-MAY-2024 Release 1.2.1 can run MITS Alatir BASIC
// 13-MAY-2024 Release 1.2.1 can run MITS Altair BASIC
//

//#define DEBUG // enables some debug messages
Expand All @@ -19,8 +19,6 @@
#define UAP 7
// chip select pin for FRAM (default)
#define FRAM_CS 10
// FRAM address size, this is for the 512 KB module
#define FRAM_ADDR_SIZE 3

// data types for the 8080 CPU
typedef unsigned char BYTE;
Expand Down Expand Up @@ -2796,7 +2794,7 @@ void setup()
; // Wait for serial port to connect. Needed for native USB
randomSeed(analogRead(UAP));
SPI.setClockDivider(SPI_CLOCK_DIV2);
if (!fram.begin(FRAM_ADDR_SIZE)) {
if (!fram.begin()) {
Serial.println(F("No FRAM found"));
exit(1);
}
Expand Down
9 changes: 5 additions & 4 deletions iosim.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//

static BYTE sio_last; // last byte read from the UART
BYTE fp_value; // the value for port 255 read

// I/O function port 0 read:
// read status of the Arduino UART and return:
Expand All @@ -31,10 +32,10 @@ static BYTE p000_in(void)
static BYTE p001_in(void)
{
if (!Serial.available()) // someone reading without checking first
return sio_last;
return (sio_last);
else {
sio_last = Serial.read();
return sio_last;
return (sio_last);
}
}

Expand All @@ -55,7 +56,7 @@ BYTE io_in(BYTE addrl, BYTE addrh)
if ((addrl <= 4) && (*port_in[addrl] != 0)) // for now we use 0-4
return ((*port_in[addrl]) ());
else if (addrl == 255) // and 255, frontpanel port
return 0;
return (fp_value);
else
return (0xff); // all other return 0xff
}
Expand Down Expand Up @@ -88,7 +89,7 @@ const static void (*port_out[5]) (BYTE) = {
0 // port 4
};

// write a byte to 8080 CPU I/O
// Write a byte to 8080 CPU I/O
void io_out(BYTE addrl, BYTE addrh, BYTE data)
{
if ((addrl <= 4) && (*port_out[addrl] != 0)) // for now we use 0-4
Expand Down
6 changes: 3 additions & 3 deletions memsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Adafruit_FRAM_SPI fram = Adafruit_FRAM_SPI(FRAM_CS, 40000000);
// setup FRAM
void init_memory(void)
{
long i;
uint32_t i;

// copy our 8080 code from flash into FRAM
for (i = 0; i < code_length; i++)
Expand All @@ -35,12 +35,12 @@ void init_memory(void)
// read a byte from 8080 CPU memory address addr
static inline BYTE memrdr(WORD addr)
{
return fram.read8(addr);
return fram.read8((uint32_t) addr);
}

// write a byte data into 8080 CPU RAM at address addr
static inline void memwrt(WORD addr, BYTE data)
{
if (addr < 0xff00) // top memory page write protected for MITS BASIC
fram.write8(addr, data);
fram.write8((uint32_t) addr, data);
}

0 comments on commit f302fe2

Please sign in to comment.