I'm in CS320, Computer Design. We got handed a lab last Friday which is due this Wednesday.
What're we supposed to program? Oh, nothing really, we just have to write a program that will accept an array size, then accept that number of inputs, then turn around, examine all of those inputs, and output the largest of the batch.
Sounds easy, right? Everyone's now snickering at how the silly programmer is calling haitus to write a program that will take about ten seconds to write in C or Java or... well, any high level language.
Catch: High level language.
Catch: I'm writing this in Assembly.
For those of you who don't know what that is, this is a chunk of Assembly I wrote for homework.
What does that translate to in a high level language? Glad you asked.add $12, $11, $11
add $12, $12, $S12
add $13, $12, $10
lw $5, 16($13)
addi $5, $5, 10
sw $5, -12($13)
addi $11, $11, 5
add $12, $11, $11
add $12, $12, $12
add $13, $12, $10
lw $5, 0($13)
sw $5, 8($10)
A = A[i+4] +10;
i=i+5;
A[2] = A;
What does that translate in real-people language? Glad you asked.
There is an array called A.
There is a number, referenced earlier in the program, called i. "i" is usually a counting number.
What we want to do is access the number that's in cell "i + 4", add ten to it, then assign that to the cell "i - 3".
After that, we add 5 to i and reassign that new number back to i.
After that, we want to access the number that's in cell "i" and place that number into cell 2.
Now. I have to write an entire program... in assembly.
Excuse me while I go put my head into a vise. I think that'll be less painful.