init files
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.bin
|
||||
44
6502-reader/6502-reader.ino
Normal file
44
6502-reader/6502-reader.ino
Normal file
@@ -0,0 +1,44 @@
|
||||
const char ADDR[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
// { A15, A14, A13, A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, A0 }
|
||||
|
||||
const char DATA[] = { 16, 17, 18, 19, 20, 21, 22, 26 };
|
||||
// { D7, D6, D5, D4, D3, D2, D1, D0 }
|
||||
|
||||
#define CLOCK 28
|
||||
#define RW 27
|
||||
|
||||
void setup() {
|
||||
for (int n = 0; n < 16; n += 1){
|
||||
pinMode(ADDR[n], INPUT);
|
||||
}
|
||||
for (int n = 0; n < 8; n += 1){
|
||||
pinMode(DATA[n], INPUT);
|
||||
}
|
||||
pinMode(CLOCK, INPUT);
|
||||
pinMode(RW, INPUT);
|
||||
attachInterrupt(digitalPinToInterrupt(CLOCK), onClock, RISING);
|
||||
Serial.begin(57600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
}
|
||||
|
||||
void onClock() {
|
||||
char output[15];
|
||||
unsigned int address = 0;
|
||||
for (int n = 0; n < 16; n += 1){
|
||||
int bit = digitalRead(ADDR[n]) ? 1 : 0;
|
||||
Serial.print(bit);
|
||||
address = (address << 1) + bit;
|
||||
}
|
||||
Serial.print(" ");
|
||||
unsigned int data = 0;
|
||||
for (int n = 0; n < 8; n += 1){
|
||||
int bit = digitalRead(DATA[n]) ? 1 : 0;
|
||||
Serial.print(bit);
|
||||
data = (data << 1) + bit;
|
||||
}
|
||||
sprintf(output, " %04x %c %02x", address, digitalRead(RW) ? 'r' : 'W', data);
|
||||
Serial.println(output);
|
||||
}
|
||||
18
makerom.py
Normal file
18
makerom.py
Normal file
@@ -0,0 +1,18 @@
|
||||
rom_size = 32768
|
||||
rom = bytearray([0xea] * rom_size)
|
||||
|
||||
rom[0] = 0xa9 # load to a Register
|
||||
rom[1] = 0x42
|
||||
|
||||
rom[2] = 0x8d # write a register to memory
|
||||
|
||||
# address 6000
|
||||
rom[3] = 0x00
|
||||
rom[4] = 0x60
|
||||
|
||||
# address 8000 - little endien
|
||||
rom[0x7ffc] = 0x00
|
||||
rom[0x7ffd] = 0x80
|
||||
|
||||
with open("rom.bin", "wb") as file:
|
||||
file.write(rom)
|
||||
Reference in New Issue
Block a user