Hellow,

I have got to make a .s file that can do the following stuff:

-image pixels are tored in memory (32bit/pixels: R-G-B alpha)
-write an image correcting algorithm
*copy a port of the image to another spot
*increase the amount of red in the picture
*Increase the brightness (simple of more complex)

I think i've got to use array but i don't know al lot of assembly
so can somebody help me?

tnx

Recommended Answers

All 3 Replies

What sort of help?

If you were doing this in C (or your other favourite language), could you express the algorithms you would need?

the post was wrong
I don't got to make the part with the image pixels
I just gotta make an MIPS assembly program that searches the minimum value in the array

here is my java code:

package array;

/**
 *
 * @author raphael vandaele
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int [] nummers = {20, 22, 25, 3, 28, 2};
        int min = nummers[0];

        for(int i = 0; i<nummers.length; i++)
        {
            if (nummers[i]<min)
            {
                min = nummers[i];
            }

    }
        System.out.println(min);
    }
}

tnx

I also did a try to code the java into assembly:

#searching the minimum of an array	
	
	.text
	.align 2
	.globl main    # declaration of main as a global variable

main:
	addu	$s7, $0, $ra		#save the return address in a global register

	lw 	$s1, Size 		# read the size of array
	li 	$s2, 0 			# index i
	li      $s3, 0			# constant 0
	add 	$t3, $s3, 0		# in een tempke steken
	lw	$s4, nummers($t3)	# s4 contains first element of array
	add 	$t2, $s2, 0
	lw	$s5, nummers($t2)	# s5 contains n-element of array
	

loop:
	add 	$t2, $s2, 0
	sub	$t6, $s4, $s5		# t6 krijgt het verschil van s4-s5 	
	bltz	$t6, loop		# als t6 kleiner is dan 0 (dus s5 is niet kleiner dan s4 en er is dus geen nieuw minimum) ga dan naar loop

	move 	$s4, $s5		#als s5 dus kleiner is dan s4 wordt s5 de nieuwe minimum


	addi 	$s2, $s2, 1 		# Decrement loop counter
	bne  	$s2, $s1, else 		# If ($s2 == $s1) Branch to else

else:
	move	$s0, $s4


	


	.data
	.globl	message	

message:	.asciiz "\nThe value of f is: "	#string to print
	.text
	li	$v0, 4			#print_str (system call 4)
	la	$a0, message 		# takes the address of string as an argument 
	syscall	

        li	$v0, 1			#print_int (system call 1)
        add	$a0, $0, $s0		#put value to print in $a0
        syscall

        
	#Usual stuff at the end of the main
	
	addu	$ra, $0, $s7		#restore the return address
	jr	$ra			#return to the main program
	add	$0, $0, $0		#nop
	


	.data
	.align 2

nummers: .word 20, 22, 25, 3, 28, 2
Size: .word 6
Result: .word 0

Is this good code?

Tnx again for the help

the post was wrong
I don't got to make the part with the image pixels
I just gotta make an MIPS assembly program that searches the minimum value in the array

my java code for the algorithm is already posted above

tnx

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.