//#include <TinyDebug.h>
// NOTE: Top 2 steppers are set to 1/4 microstepping.  Delete red wires to MS2 on each driver to restore full step

int latchPin = PB0;//Pin connected to ST_CP of each shift register
int clockPin = PB1;  //Pin connected to SH_CP of each shift register
int dataPin = PB2; //Pin connected to DS of first shift register

byte motStep[4] = {128,32,8,2};
byte motDir[4] = {64,16,4,1};

// Set motor reference to axis
byte x = motStep[0];
byte y = motStep[1];
byte z = motStep[2] + motStep[3]; // Linked motors, dual axis

// Direction byte mask
byte xd = motDir[0];
byte yd = motDir[1];
// Assumes linked motors rotate in the same direction, invert/xor (~) or not (!) the value to reverse it
// eg 'byte zd = motDir[2] + (motDir[3] ^ motDir[3]);'..or "~"...or "!"
byte zd = motDir[2] + !motDir[3]; 

void setup() {
  //Debug.begin();
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void motMove(int steps, int speed, byte mots, byte dir) { // stepcount, delay millis(low is faster)
  for(int i = 0; i < steps; i++){
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, mots);
    digitalWrite(latchPin, HIGH);
    delayMicroseconds(speed);
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, dir);
    digitalWrite(latchPin, HIGH);
    delayMicroseconds(speed);
    
  }
}

void loop() {
  // If not explictly set, dir will be clockwise (normal)
  byte mots = x + y + z;
  byte dir = xd + !yd + zd; // x clockwise, y counter clockwise, z..whatever direction for linked

  motMove(200,2000,mots,dir); // Steps to move, delay between steps, axis combo, direction combo
  delay(2000);
}

ATTINY8520PU
tiny:PB5
tiny:PB3
tiny:PB4
tiny:GND
tiny:PB0
tiny:PB1
tiny:PB2
tiny:VCC
A4988
drv1:ENABLE
drv1:MS1
drv1:MS2
drv1:MS3
drv1:RESET
drv1:SLEEP
drv1:STEP
drv1:DIR
drv1:GND.1
drv1:VDD
drv1:1B
drv1:1A
drv1:2A
drv1:2B
drv1:GND.2
drv1:VMOT
stepper1:A-
stepper1:A+
stepper1:B+
stepper1:B-
74HC595
sr2:Q1
sr2:Q2
sr2:Q3
sr2:Q4
sr2:Q5
sr2:Q6
sr2:Q7
sr2:GND
sr2:Q7S
sr2:MR
sr2:SHCP
sr2:STCP
sr2:OE
sr2:DS
sr2:Q0
sr2:VCC
stepper2:A-
stepper2:A+
stepper2:B+
stepper2:B-
A4988
drv2:ENABLE
drv2:MS1
drv2:MS2
drv2:MS3
drv2:RESET
drv2:SLEEP
drv2:STEP
drv2:DIR
drv2:GND.1
drv2:VDD
drv2:1B
drv2:1A
drv2:2A
drv2:2B
drv2:GND.2
drv2:VMOT
stepper3:A-
stepper3:A+
stepper3:B+
stepper3:B-
A4988
drv3:ENABLE
drv3:MS1
drv3:MS2
drv3:MS3
drv3:RESET
drv3:SLEEP
drv3:STEP
drv3:DIR
drv3:GND.1
drv3:VDD
drv3:1B
drv3:1A
drv3:2A
drv3:2B
drv3:GND.2
drv3:VMOT
stepper4:A-
stepper4:A+
stepper4:B+
stepper4:B-
A4988
drv4:ENABLE
drv4:MS1
drv4:MS2
drv4:MS3
drv4:RESET
drv4:SLEEP
drv4:STEP
drv4:DIR
drv4:GND.1
drv4:VDD
drv4:1B
drv4:1A
drv4:2A
drv4:2B
drv4:GND.2
drv4:VMOT