Nearly C example: void SPI_WriteBytes(uint32 flags, uint32 * source, uint32 length) { uint32 * target = source + ((r2_in + (r2_in < 0 ? 3 : 0)) >> 2); while (SERIAL_CR32 & 0x80) ; while (r6 < target) { data = *src++; bit = 1; for (byteIndex = 0; byteIndex < 4; byteIndex++) { if ((src >= target) && (byteIndex == 3)) bit = 0; SPI_WriteByte(flags, data, bit); data = data >> 8; } } } For a simple function: @ WaitForCardIRQ - does: @ IntrWait(0, 1<<19); @ AfterTransfer(); etc...