News for hackers. Stuff that matters.
Re:Compiling to Assembly from Scratch [free to read online] by kragen on Monday September 23, 2024 @09:35AM (#41625934)
this could be easy or hard depending on what you had to write in assembly on the test. like it wouldn't be that hard to write a subroutine to add up an array of integers or something

    addem:   xor eax, eax
        loop:
             test ecx, ecx
             jnz ok
             ret
        ok:  add eax, [ebx + ecx * 4]
             dec ecx
             jmp loop
(i haven't tested this, it'd be hilarious if i got it wrong)
Re:Compiling to Assembly from Scratch [free to read online] by gus_massa on Monday September 23, 2024 @10:13AM (#41626365)
Assuming ebx is the pointer to the array and ecx is the length, doesn't this sum the slots from 1 to ecx (incusive) instead of 0 to ecx-1 (inclusive)?
Re:Compiling to Assembly from Scratch [free to read online] by kragen on Monday September 23, 2024 @10:25AM (#41626477)
hahaha, yes! i guess it wasn't as trivial as i thought. that's what i get for trying to be clever — guess i wouldn't have done that well on that exam ;)
Re:Compiling to Assembly from Scratch [free to read online] by hirvi74 on Monday September 23, 2024 @12:52PM (#41628064)
The assembly on the test was much larger than the snippet you provided. I wish a kept a copy of the old test so I could just copy and example problem. Honestly though, that wasn't the worst part of the tests. It was the most dangerous though because many of the questions/instructions relied on previously completed questions/instruction to be correct.

So, like if you passed a wrong value to a certain register, then downstream, every problem that used that register would be off.

The tests were often 4 pages front and back with the handwritten assembly, definition matching, word problems, essay responses, etc.. We had like 75 minutes to take the test too. This was all at a public, no-name state university too. I was no MIT student or anything.

Anyway, I'll never forget the first day of class. Our professor said we were to have 4 tests and a final and some labs.

My friend in the class: "If we make a 100 on all 4 tests, do we have to take the final?"

The professor: "Hell, if you make 100 on 4 test, then I will let you write the final."

My friend: "Why? Has no one ever done that before?"

Professor: "No, in fact, in the 20 years I have taught this class, no one has ever scored a 100 on any test."

We all knew we were in for hell after that.

Re:Compiling to Assembly from Scratch [free to read online] by kragen on Monday September 23, 2024 @12:56PM (#41628113)
that's awesome! i wish you'd kept a copy too