#include #define JINX 0x1FF000 #define PAUSE 0xfffFFF #define size 1 .section/dm dm_data; .section/pm pm_code; start: bit set MODE1 IRPTEN | CBUFEN; // set circular buffer enable // and allow global interrupts r0=0x00000000; // initially clear SPI control register dm(SPICTL)=r0; nop; // wait one instruction //get ready bits in ustat1 for start SPI bit set ustat1 SPIEN | DF | WL32 | BAUDR5 | SGN | GM ; nop; // wait one instruction dm(SPICTL) = ustat1; // enable SPI nop; // wait one instruction // test receive buffer status to determine when it is ok to read from SPIRX test: ustat1=dm(SPISTAT); // get status SPI bit tst USTAT1 RXS0; // test bit RXS0 if Not TF jump test; // if SPIRX not full jump to test // if full go to receive receive: r0=dm(SPIRX); // read from RX buffer nop; // wait one instruction dm(IOFLAG)=r0; // send data from buffer to IOFLAG nop; // wait thre instruction nop; nop; r0=r0+1; // increase r0 nop; // wait thre instruction nop; nop; dm(SPITX)=r0; // set data from ro to TX buffer nop; // wait thre instruction nop; nop; jump test; // go to test start.end: // end program