/*
See https://blog.jochumzen.com/ entry 30
Testing the 256x16 ROM.
Set the address to 00000001 on the address DIPs
Observe the LEDs: 0000 001 1000 0000 or 0180 in hex (remember that the two left-most LEDs on each bar is unused)
Check "uint16_t data[256]", confirm that data is 0180 at address 1
Set any address on the address DIPs and observe data on the LEDs
ROM is programmed so that D0-D7 displays the the address, A7-A0
D8-D15 displays the addres "in reverse", A0-A7.
Stop the simulation and change "data".
Start the simulation to confirm new data.
Note that the 8 bit address reprents a number between 0 and 255. This is why they are ordered A7-A0
with the most significant bit to the left.
The 16 data bits do not together represent a number, they are 16 individual bits. Therefore, we can order them however we like
and I have ordered them from bit 0 (D0) to bit 15 (D15).
*/
//Library with basic gates
#include <ACEL.h>
uint16_t data[256] = {0x0000,0x0180,0x0240,0x03C0,0x0420,0x05A0,0x0660,0x07E0,0x0810,0x0990,0x0A50,0x0BD0,0x0C30,0x0DB0,0x0E70,0x0FF0,0x1008,0x1188,0x1248,0x13C8,0x1428,0x15A8,0x1668,0x17E8,0x1818,0x1998,0x1A58,0x1BD8,0x1C38,0x1DB8,0x1E78,0x1FF8,0x2004,0x2184,0x2244,0x23C4,0x2424,0x25A4,0x2664,0x27E4,0x2814,0x2994,0x2A54,0x2BD4,0x2C34,0x2DB4,0x2E74,0x2FF4,0x300C,0x318C,0x324C,0x33CC,0x342C,0x35AC,0x366C,0x37EC,0x381C,0x399C,0x3A5C,0x3BDC,0x3C3C,0x3DBC,0x3E7C,0x3FFC,0x4002,0x4182,0x4242,0x43C2,0x4422,0x45A2,0x4662,0x47E2,0x4812,0x4992,0x4A52,0x4BD2,0x4C32,0x4DB2,0x4E72,0x4FF2,0x500A,0x518A,0x524A,0x53CA,0x542A,0x55AA,0x566A,0x57EA,0x581A,0x599A,0x5A5A,0x5BDA,0x5C3A,0x5DBA,0x5E7A,0x5FFA,0x6006,0x6186,0x6246,0x63C6,0x6426,0x65A6,0x6666,0x67E6,0x6816,0x6996,0x6A56,0x6BD6,0x6C36,0x6DB6,0x6E76,0x6FF6,0x700E,0x718E,0x724E,0x73CE,0x742E,0x75AE,0x766E,0x77EE,0x781E,0x799E,0x7A5E,0x7BDE,0x7C3E,0x7DBE,0x7E7E,0x7FFE,0x8001,0x8181,0x8241,0x83C1,0x8421,0x85A1,0x8661,0x87E1,0x8811,0x8991,0x8A51,0x8BD1,0x8C31,0x8DB1,0x8E71,0x8FF1,0x9009,0x9189,0x9249,0x93C9,0x9429,0x95A9,0x9669,0x97E9,0x9819,0x9999,0x9A59,0x9BD9,0x9C39,0x9DB9,0x9E79,0x9FF9,0xA005,0xA185,0xA245,0xA3C5,0xA425,0xA5A5,0xA665,0xA7E5,0xA815,0xA995,0xAA55,0xABD5,0xAC35,0xADB5,0xAE75,0xAFF5,0xB00D,0xB18D,0xB24D,0xB3CD,0xB42D,0xB5AD,0xB66D,0xB7ED,0xB81D,0xB99D,0xBA5D,0xBBDD,0xBC3D,0xBDBD,0xBE7D,0xBFFD,0xC003,0xC183,0xC243,0xC3C3,0xC423,0xC5A3,0xC663,0xC7E3,0xC813,0xC993,0xCA53,0xCBD3,0xCC33,0xCDB3,0xCE73,0xCFF3,0xD00B,0xD18B,0xD24B,0xD3CB,0xD42B,0xD5AB,0xD66B,0xD7EB,0xD81B,0xD99B,0xDA5B,0xDBDB,0xDC3B,0xDDBB,0xDE7B,0xDFFB,0xE007,0xE187,0xE247,0xE3C7,0xE427,0xE5A7,0xE667,0xE7E7,0xE817,0xE997,0xEA57,0xEBD7,0xEC37,0xEDB7,0xEE77,0xEFF7,0xF00F,0xF18F,0xF24F,0xF3CF,0xF42F,0xF5AF,0xF66F,0xF7EF,0xF81F,0xF99F,0xFA5F,0xFBDF,0xFC3F,0xFDBF,0xFE7F,0xFFFF};
//Create an Arduino board
auto* ard = new ArduinoBoard();
//Define chips
auto* rom = new ROM256x16(data);
//Add all chips to be emulated here
Chip* chips[] = {
rom
};
//Add all connections here
ConnectionBase* connections[] = {
new ConnectionEight(ard, 2, rom->A, 1),
new ConnectionSixteen(rom->Q, ard, 22, 0),
};
//Setting up the emulation. No need to change
Emulation emulation = Emulation(ard, chips, sizeof(chips)/2,
connections, sizeof(connections)/2);
void setup() {
Serial.begin(9600); Serial.println(); Serial.println("START");
Serial.println();
emulation.makePrintPin(13, 1);
//emulation.printOnArdEvent(1);
}
void loop() {
emulation.emulate();
}
Print
Address
A7-A0
Data
D0-D7
Data
D8-D15