y86

Confused about memory locations of this Y86 assembly code

We had a piece of code in C in one class where we needed to convert it to Y86 and this was written on the board by some guy with the teacher's correction of course. However, I'm confusing the memory locations and .pos directives on the initial part of the code: int array[100], sum, i; int main() { sum = 0; for(i = 0; i < 100;...

Assembly: Y86 Stack and call, pushl/popl and ret instructions

Hi, Unless I copied it wrong, the code above was written in the blackboard in a class by a student with the help/corrections of the teacher: int array[100], sum, i; void ini() { for(i = 0; i < 100; i++) array[i] = i; } int main() { ini(); sum = 0; for(i = 0; i < 100; i++) sum += array[i]; } .pos 0 irmovl Stack, %...

Do I understand the stack properly in this Y86 Assembly code?

I've created this simple and pointless assembly (Y86) code to see if I understand everything that's happening in the stack when the instructions call, pushl, popl and ret are used. Like I said, this code is pointless, it's just for testing/learning purposes. Although, all memory addresses were correctly (hopeful) calculated and are not ...