diff --git a/assembly/a.bin b/assembly/a.bin new file mode 100644 index 0000000..1914548 Binary files /dev/null and b/assembly/a.bin differ diff --git a/assembly/hd44780_lcd_test_procedure.asm b/assembly/hd44780_lcd_test_procedure.asm new file mode 100644 index 0000000..4ce25b7 --- /dev/null +++ b/assembly/hd44780_lcd_test_procedure.asm @@ -0,0 +1,40 @@ +;hd44780 lcd test procedure + +ld hl,$4000 ;address reg points to lcd instruction address + +;reset procedure +ld a,%00111000 +ld (hl),a +ld a,%00001000 +ld (hl),a +ld a,%00000001 +ld (hl),a + +;init procedure +ld a,%00111000 +ld (hl),a +ld a,%00001110 +ld (hl),a + +;write characters to display +ld hl,$4001 ;address reg points to lcd data address + +ld a,%01000100 +ld (hl),a +ld a,%01100001 +ld (hl),a +ld a,%01101110 +ld (hl),a +ld a,%01101001 +ld (hl),a +ld a,%01100101 +ld (hl),a +ld a,%01101100 +ld (hl),a +ld a,%01100101 +ld (hl),a +ld a,%00100001 +ld (hl),a + +halt + diff --git a/eeprom_programmer/eeprom_programmer/eeprom_programmer.ino b/eeprom_programmer/eeprom_programmer/eeprom_programmer.ino new file mode 100644 index 0000000..b33cd6e --- /dev/null +++ b/eeprom_programmer/eeprom_programmer/eeprom_programmer.ino @@ -0,0 +1,175 @@ +/* ************** EEPROM PROGRAMMER ****************** + +HARDWARE: + + CORRISPONDENZA PIN EEPROM Atmel AT28C64B -> ARDUINO MEGA 2560 + (Compatibile con eeprom fino a 16 bit di address bus. In caso di altre eeprom collegare secondo datasheet) + NB: Nel caso della eeprom da 8k, ci sono solo 12 address bus, quindi gli altri 4 pin provenienti dall'Arduino + vengono lasciati disconnessi + + Arduino VCC 11 38 40 44 10 42 12 9 8 7 6 5 + Eeprom 28 27 26 25 24 23 22 21 20 19 18 17 16 15 + ____________________________________________________________________ + | | + | | + |_ | + |_) Atmel AT28C64B | + | | + | | + |____________________________________________________________________| + + Eeprom 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + Arduino 46 36 34 32 30 28 26 24 22 2 3 4 GND + + + + + CORRISPONDENZA FUNZIONALE: + + Address bus (A0...A15): 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52 + + Data bus (D0...D7): 2, 3, 4, 5, 6, 7, 8, 9 + + Control bus: + /OE 10 + /WE 11 + /CE 12 + +*/ + +const byte ROM_DATA[] = {0x76, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00}; + + +const byte ADDR_BUS[] = {52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22}; +const byte DATA_BUS[] = {9, 8, 7, 6, 5, 4, 3, 2}; +const byte CTRL_BUS_OE = 10; +const byte CTRL_BUS_WE = 11; +const byte CTRL_BUS_CE = 12; + +void setup() { + Serial.begin(57600); + for(int pin=0; pin < 16; pin++) { + pinMode(ADDR_BUS[pin], OUTPUT); + } + setDataBusAs(INPUT); + pinMode(CTRL_BUS_OE, OUTPUT); + pinMode(CTRL_BUS_WE, OUTPUT); + pinMode(CTRL_BUS_CE, OUTPUT); + digitalWrite(CTRL_BUS_OE, HIGH); //Active low + digitalWrite(CTRL_BUS_WE, HIGH); //Active low + digitalWrite(CTRL_BUS_CE, HIGH); //Active low + + delay(1000); + + //readRom(8192); + writeRom(); + verifyRom(); +} + +void writeRom() { + digitalWrite(CTRL_BUS_OE, HIGH); + setDataBusAs(OUTPUT); + Serial.print("Starting to write ROM... "); + for (int i=0; i>=1; + } +} + + +void writeIntToAddressBus(int j) { + for (int n=0; n<16; n++) + { + if((0x01&j) < 0x01) + { + digitalWrite(ADDR_BUS[n],LOW); + } else { + digitalWrite(ADDR_BUS[n],HIGH); + } + j>>=1; + } +} + +void loop() {} diff --git a/z80_debugger/z80_debugger.ino b/z80_debugger/z80_debugger.ino index 0999b18..44039c8 100644 --- a/z80_debugger/z80_debugger.ino +++ b/z80_debugger/z80_debugger.ino @@ -55,8 +55,9 @@ const byte MODE_ROM_EMULATOR = 1; const byte MODE_ROM_RAM_EMULATOR = 2; const byte ADDR_BUS[] = {50, 52, A11, A9, A8, A12, A15, A14, 53, 51, 49, 47, 45, 43, 41, 39}; -const byte DATA_BUS[] = {34, 40, 42, 46, 44, 36, 30, 32}; -const byte CTRL_BUS_RD = 20; +const byte DATA_BUS[] = {34, 40, 42, 44, 46, 36, 30, 32}; +//const byte CTRL_BUS_RD = 20; +const byte CTRL_BUS_RD = 3; const byte CTRL_BUS_WR = 23; const byte CTRL_BUS_BUSACK = 25; const byte CTRL_BUS_WAIT = 27; @@ -68,7 +69,8 @@ const byte CTRL_BUS_IORQ = A13; const byte CTRL_BUS_MREQ = 22; const byte CTRL_BUS_HALT = 24; const byte CTRL_BUS_NMI = 26; -const byte CTRL_BUS_CLK= 21; +//const byte CTRL_BUS_CLK= 21; +const byte CTRL_BUS_CLK= 2; const byte CTRL_BUS_INT = 28; const byte PWR_GND = 37; const byte PWR_VCC = 38; @@ -88,8 +90,8 @@ const byte PWR_VCC = 38; */ const byte MODE = MODE_ROM_EMULATOR; -//const byte ROM_DATA[] = {0x00, 0x00, 0x00, 0x00, 0xC3, 0x00, 0x00}; -const byte ROM_DATA[] = {0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00}; +const byte ROM_DATA[] = {0x00, 0x00, 0x00, 0x00, 0xC3, 0x00, 0x00}; +//const byte ROM_DATA[] = {0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00}; @@ -97,6 +99,18 @@ const byte ROM_DATA[] = {0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00}; void setup() { Serial.begin(57600); + Serial.print("Started in mode "); + switch(MODE) { + case MODE_DEBUGGER: + Serial.println("debugger"); + break; + case MODE_ROM_EMULATOR: + Serial.println("rom emulator"); + break; + case MODE_ROM_RAM_EMULATOR: + Serial.println("rom/ram emulator"); + break; + } for(int pin=0; pin < 16; pin++) { pinMode(ADDR_BUS[pin], INPUT); } @@ -121,19 +135,6 @@ void setup() { pinMode(PWR_VCC, INPUT); attachInterrupt(digitalPinToInterrupt(CTRL_BUS_CLK), onClk, RISING); - - - - - - - - unsigned int data = ROM_DATA[4]; - writeByteToDataBus(data); - - char output[30] = {}; - sprintf(output, "%04x r- %02x Emu ROM read", 4, data); - Serial.println(output); } @@ -208,19 +209,16 @@ void setDataBusAs(byte mode){ } } -void writeByteToDataBus(byte toWrite) { +void writeByteToDataBus(byte j) { setDataBusAs(OUTPUT); - unsigned i; - for (i = 1 << 7; i > 0; i = i / 2){ - if (toWrite & i) { - digitalWrite(DATA_BUS[i], HIGH); - Serial.print(DATA_BUS[i]); - Serial.print("->1 "); - } else { - digitalWrite(DATA_BUS[i], LOW); - Serial.print(DATA_BUS[i]); - Serial.print("->0 "); - } + for (int n=0; n<8; n++) + { + if((0x01&j) < 0x01) + { + digitalWrite(DATA_BUS[n],LOW); + } else { + digitalWrite(DATA_BUS[n],HIGH); + } + j>>=1; } - Serial.println(" "); }