Skip to content

Instantly share code, notes, and snippets.

@sophacles
Created March 20, 2011 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sophacles/878422 to your computer and use it in GitHub Desktop.
Save sophacles/878422 to your computer and use it in GitHub Desktop.
void blockwrite(struct SR *sr, unsigned long long data, int bits) {
if (!SR_WRITEABLE(sr, bits)) {
wait = (bits + sr->pos) - 32;
LED_OUT &= ~LED1;
}
while (wait) {
//loop till something else makes wait go to 0
}
if (1) LED_OUT |= LED1;
SR_write(sr, data, bits);
return;
}
produces:
blockwrite:
0fb14: 1d 41 0a 00 MOV 0xa(SP), R13
0fb18: 6e 4f MOV.B @R15, R14
0fb1a: 0e 5d ADD R13, R14
0fb1c: 3e 90 21 00 CMP #0x21, R14
0fb20: 07 38 JL 0xfb30
0fb22: 3e 50 e0 ff ADD #InterruptVectors, R14
0fb26: 82 4e 24 02 MOV R14, &wait
0fb2a: f2 f0 bf ff 21 00 AND.B #0xbf, &0x0021
0fb30: 82 93 24 02 TST &wait
0fb34: 11 20 JNZ 0xfb58
0fb36: f2 d0 40 00 21 00 BIS.B #0x40, &0x0021
0fb3c: 0d 12 PUSH R13
0fb3e: 11 12 0c 00 PUSH 0xc(SP)
0fb42: 11 12 0c 00 PUSH 0xc(SP)
0fb46: 11 12 0c 00 PUSH 0xc(SP)
0fb4a: 11 12 0c 00 PUSH 0xc(SP)
0fb4e: b0 12 34 f8 CALL #SR_write
0fb52: 31 50 0a 00 ADD #0xa, SP
0fb56: 30 41 RET
0fb58: ff 3f JMP 0xfb58
0fb5a: 68 65 ADDC.B @R5, R8
0fb5c: 6c 6c ADDC.B @R12, R12
0fb5e: 6f 20 JNZ 0xfc3e
0fb60: 77 6f ADDC.B @R15+, R7
0fb62: 72 6c ADDC.B @R12+, SR
0fb64: 64 00 00 00 MOVA PC, &0x0000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment