Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Source for 68k bin:
- M68000
- DL 0
- DL 8
- MOVE.B #$FF, D1
- LOOP:
- MOVE.L #$FF, D0
- LOOPW1:
- SUBQ #1, D0
- BNE LOOPW1
- MOVE.B D1, $010000
- NOT D1
- BRA LOOP
- */
- #include <stdint.h>
- uint8_t data[0x20] = {
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08,
- 0x12, 0x3c, 0x00, 0xff,
- 0x20, 0x3c, 0x00, 0x00,
- 0x00, 0xff, 0x53, 0x40,
- 0x66, 0xfc, 0x13, 0xc1,
- 0x00, 0x01, 0x00, 0x00,
- 0x46, 0x41, 0x60, 0xec
- };
- void bus_highz()
- {
- int _c;
- for (_c = 2; _c <= 9; _c++)
- pinMode(_c, INPUT);
- }
- void bus_out(uint8_t data)
- {
- int _c;
- for (_c = 2; _c <= 9; _c++)
- pinMode(_c, OUTPUT);
- for (_c = 0; _c < 8; _c++)
- digitalWrite(2 + _c, data & (1 << _c));
- }
- uint8_t get_addr()
- {
- uint8_t _c;
- uint8_t _b = 0;
- for (_c = 0; _c < 5; _c++)
- _b |= (digitalRead(A0 + _c) ? 1 : 0) << _c;
- _b |= (digitalRead(10) ? 1 : 0) ;
- return _b;
- }
- void do_read(){
- uint8_t addr = get_addr();
- Serial.println(addr);
- bus_out(data[addr]);
- digitalWrite(12, LOW);
- }
- void setup() {
- int _c;
- Serial.begin(115200);
- bus_highz();
- for (_c = 0; _c < 5; _c++)
- pinMode(A0 + _c, INPUT);
- pinMode(A5, INPUT);
- pinMode(10, INPUT);
- pinMode(11, INPUT);
- pinMode(12, OUTPUT);
- pinMode(13, OUTPUT);
- digitalWrite(13, LOW);
- digitalWrite(12, LOW);
- digitalWrite(13, LOW);
- }
- void loop() {
- if (digitalRead(A5) || !digitalRead(11)) {//IF READ & NOT *RAMCS
- bus_highz();
- digitalWrite(12, LOW);
- } else {
- digitalWrite(12, LOW);//Deassert SETARDUDTACK
- do_read();
- digitalWrite(12, HIGH);//Assert SETARDUDTACK
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement