heres my C code this was easy:
-Chris g

#include <stdlib.h>
#include <stdio.h>

extern int numodd( int array[], int size ) ;

int main( int argc, char * argv[] )
	int numarray[] = { 2, 3, 1025, 3024, 4057, -3, -1025, -3578 } ;
	int size = sizeof(numarray) / sizeof( int ) ;
	int result ;
	result = numodd( numarray, size ) ;
	printf( "Number of odd numbers: %d\n", result ) ;
	exit( 0 ) ;


.global numodd  

stmfd sp!, {v1-v6, lr} @load from memory

mov v1, #0
mov v1, a2 @store
mov v2, #0 
mov v5, #0
mov v3, #0      @register set
mov v4, #0	@register set
ldr v3, [a1,v2]   @load 
add v2, v2, #4	 @inc by 4 in v2
sub v1, v1, #1	@ rotate method to v3
ror v4, v3, #1  @changes signs of numbers
cmp v4, #0

bgt circulate
cmp v1, #-1
addgt v5, v5, #1
bgt circulate

mov a1, v5  @move to a1
ldmfd sp!, {v1-v6, pc}

this works but he said its not acceptable? i dont get any other way to do it.

The stmfd and ldmfd instructions are sort of like curly braces in C. They delimit the function. Copy them, and everything outside them from the add2 program.

The two parameters, array and size, are passed in registers a1 and a2, respectively. Remember that an array variable in C is a pointer to (memory address of) the first element.

You can access the first element with the load command. we can auto-increment the pointer (a1) by the size of an integer (4 bytes) at the same time, so it points to the next element next time.

Once you get the first element, you can check whether the last bit is 1 or not. I tried (and failed) to use the barrel shifter to do a logical shift right and then do an adc to increment my count of odd numbers. i guess we can use a bitwise and to "and" it with 00000001. Either way we need to use some form of the add instruction to increment your "variable" holding the number of odd integers so far.

i guess we need to use size, and a conditional branch (with a label of course), to loop through the array. Remember that size is in a2.

At the end, we can put the result, the number of odd integers you've counted, in a1. That way it will be returned to the C program.

if any one could help that would be awesomeee !!!
i typed as much as i could to help !! - Chris G

THANKS to any one that can help its much appreciated

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.