PCSpim/Assembly HELP

Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Dec 2008
Posts: 3
Reputation: raphkeu is an unknown quantity at this point 
Solved Threads: 0
raphkeu raphkeu is offline Offline
Newbie Poster

PCSpim/Assembly HELP

 
0
  #1
Dec 9th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: PCSpim/Assembly HELP

 
0
  #2
Dec 9th, 2008
What sort of help?

If you were doing this in C (or your other favourite language), could you express the algorithms you would need?
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 3
Reputation: raphkeu is an unknown quantity at this point 
Solved Threads: 0
raphkeu raphkeu is offline Offline
Newbie Poster

Re: PCSpim/Assembly HELP

 
0
  #3
Dec 9th, 2008
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:
  1. package array;
  2.  
  3. /**
  4.  *
  5.  * @author raphael vandaele
  6.  */
  7. public class Main {
  8.  
  9. /**
  10.   * @param args the command line arguments
  11.   */
  12. public static void main(String[] args) {
  13. int [] nummers = {20, 22, 25, 3, 28, 2};
  14. int min = nummers[0];
  15.  
  16. for(int i = 0; i<nummers.length; i++)
  17. {
  18. if (nummers[i]<min)
  19. {
  20. min = nummers[i];
  21. }
  22.  
  23. }
  24. System.out.println(min);
  25. }
  26. }
tnx

I also did a try to code the java into assembly:
  1. #searching the minimum of an array
  2.  
  3. .text
  4. .align 2
  5. .globl main # declaration of main as a global variable
  6.  
  7. main:
  8. addu $s7, $0, $ra #save the return address in a global register
  9.  
  10. lw $s1, Size # read the size of array
  11. li $s2, 0 # index i
  12. li $s3, 0 # constant 0
  13. add $t3, $s3, 0 # in een tempke steken
  14. lw $s4, nummers($t3) # s4 contains first element of array
  15. add $t2, $s2, 0
  16. lw $s5, nummers($t2) # s5 contains n-element of array
  17.  
  18.  
  19. loop:
  20. add $t2, $s2, 0
  21. sub $t6, $s4, $s5 # t6 krijgt het verschil van s4-s5
  22. 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
  23.  
  24. move $s4, $s5 #als s5 dus kleiner is dan s4 wordt s5 de nieuwe minimum
  25.  
  26.  
  27. addi $s2, $s2, 1 # Decrement loop counter
  28. bne $s2, $s1, else # If ($s2 == $s1) Branch to else
  29.  
  30. else:
  31. move $s0, $s4
  32.  
  33.  
  34.  
  35.  
  36.  
  37. .data
  38. .globl message
  39.  
  40. message: .asciiz "\nThe value of f is: " #string to print
  41. .text
  42. li $v0, 4 #print_str (system call 4)
  43. la $a0, message # takes the address of string as an argument
  44. syscall
  45.  
  46. li $v0, 1 #print_int (system call 1)
  47. add $a0, $0, $s0 #put value to print in $a0
  48. syscall
  49.  
  50.  
  51. #Usual stuff at the end of the main
  52.  
  53. addu $ra, $0, $s7 #restore the return address
  54. jr $ra #return to the main program
  55. add $0, $0, $0 #nop
  56.  
  57.  
  58.  
  59. .data
  60. .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
Last edited by Narue; Dec 9th, 2008 at 3:15 pm. Reason: added code tags
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 3
Reputation: raphkeu is an unknown quantity at this point 
Solved Threads: 0
raphkeu raphkeu is offline Offline
Newbie Poster

Re: PCSpim/Assembly HELP

 
0
  #4
Dec 9th, 2008
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Assembly Forum


Views: 1302 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Assembly
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC