I am working on a homework assignment where we have to write comments to describe what some assembly code is doing. I am new to assembly so I can't really tell if the following code has a mistake.
I am using i686 architecture (not entirely sure what that means TBH)
This program determineGrade.s is being called by another program cs3843p3Driver.o
############################## determineGrade #####################
# Purpose:
# determineGrade determines the grade of a student based on a
# 1000 pt scale.
# Parameters:
# i 8(%ebp) int iG1 Grade 1
# i 12(%ebp) int iG2 Grade 2
# i 16(%ebp) int iG3 Grade 3
# i 20(%ebp) int iG4 Grade 4
# i 24(%ebp) int iG5 Grade 5
# i 28(%ebp) int iG6 Grade 6
# i 32(%ebp) int iG7 Grade 7
# i 36(%ebp) int iG8 Grade 8
# i 40(%ebp) int iG9 Grade 9
# i 44(%ebp) int iG10 Grade 10
# Locals:
# -4(%ebp) int iqTot
# -8(%ebp) int iTot
# Notes:
# Grade is determined by
# ??
# Return Value:
# total grade on a 1000 pt scale
# Register Usage
# %eax - mostly working register until after .L7 then ??
.file "determineGrade.s"
.text
.globl determineGrade
.type determineGrade, @function
determineGrade:
pushl %ebp
movl %esp, %ebp
pushl %ebx # Save the caller's %ebx since we are using %ebx
subl $20, %esp
movl $0, -4(%ebp) # Overrides the caller's %ebx?
It looks as if the caller's %ebx value is stored in the same place as iqTot, which is defined as -4(%ebp). Was the caller's %ebx value overwritten by accident?