| home | |||
|
|||
| links |
|
||
|
developer's mag main page article part 1 part 2 part 3 part 4 part 5 part 6 part 7 part 8 part 9 |
5 - Onto the Code!Now with all the necessary opcodes under our belt, let's look at our assembly version of the Sieve:
void AssemblySieve(unsigned char *array,int limit)
{
asm("
ldc 3 ; init i/r7
mov t,r7
.i_loop ; label format for our jump
The top of our function shows how we place assembly code into a standard function. The function passes a bitflag array pointer, and a limit on the numbers tested. For simplicity, we pass the array already zeroed, and our code simply sets appropriate bits for the composite numbers. Notice several things:
Previous Section Next Section |
||
| Copyright © 2001-2006 ebmDevMag.com - Legal Notice | |||