Arduinolyzer: Arduino Logic Analyzer

am I correct that on an 16mhz avr, this unrolled code
takes an st (2 clockcycli) and in (1 clockcycle) instruction, meaning a sample rate of 16/(2+1) Mhz ?
and therefore covering less than a millisecond in a 1024 byte buffer ?

I haven't looked at it in-depth (that is, I haven't looked at how long each instruction takes, etc) - but if your numbers are correct, then yes, the sample period is going to be very short. Note that I believe it was done with a 168, with a 328 you could "double" the length (I think). Still, not a lot of time.

Potentially, you could dump the samples to an SD card, but I am not sure how you would glue the assembler together with the SD library (or if you would have to write your own assembler version?). Another alternative would be a serial EEPROM.

Udo's code is really a sampler, and not a strict analyzer; that is, it doesn't store timing information between transistions, it just stores whatever it grabs. But the same kind of system (an unrolled assembler loop) could potentially be used, only store the data on the transistion of any pin in the port (via an interrupt handler), and keep track of the time between interrupts (not sure if this can be done in an interrupt handler, though)...