smartest way ?

I need a piece of code that toggles a clock bin at 4MHz, a Line Pulse pin that sends out one pulse every 180 clock pulses, then a First Line Marker pin that pulses once every 400 Line Pulse pin pulses.

Currently i've tried doing it in one big giant digitalWrite delayMicroseconds loop, but i figure there has to be a better way, also the digitalWrite loop only allows my clock pin to reach 80kHz which is a bit low.

Look at Port Manipulation. It is much faster than digitalWrite() but the code is not portable across different types of Arduino.

Without seeing your code it is not possible to say any more.

...R

A simple 555chip and a couple of ripple counters would be a better option.

KenF: A simple 555chip and a couple of ripple counters would be a better option.

Not when everything has to be synchronized to each other, ie there has to be exactly 180 clock pulses between every Hsync pulse, anfd exactly 400 Hsync pulses between every Vsync pulse to match the 720x400 pixel resolution of my panel.

For a 320x240 panel, but u get teh idea:

As u can see, ripple counters for freq division is out since the H and V sync are pulses and not 50%DTC pulse trains.

Not when everything has to be synchronized to each other, ie there has to be exactly 180 clock pulses between every Hsync pulse, anfd exactly 400 Hsync pulses between every Vsync pulse to match the 720x400 pixel resolution of my panel.

Do you have the impression that ripple counters can't count?

No, but they only give me 50% duty cycle pulse trains, which means i have to make careful pulse shoteners with R's and C's and carefully adjust them to output a pulse the same lenght as one clock pulse.

Besides, to divide 4MHz down to 24kHz and 60Hz using ripple counter, that'd take more or less a whole board full of just ripple counters all cascaded one after another, not really practical.