How to test equality in IAS Machine programming

  Kiến thức lập trình

I’ve got to write a program in IAS Machine assembly language that sums every item of an array, except the array[i] item.

Although, i’ve not yet found a way to test equality of two values to determine whether the item of the array is the one i won’t sum in the iteration, as i can’t just subtract one from another, as the only conditional operator tests for values >= 0, having no way of knowing if it’s just zero.

I’ve created two variables, one to point to the item i will not sum in the iteration, and one ‘j’ variable.

021 00 00 00 00 05 # variable j 022 00 00 00 00 01 # constant 1 024 00 00 00 00 30 # pointer array[i]

My plan was to compare the variable j with the position of array[i] to see if they are the same, then not adding it to the sum.

New contributor

Chloe Scaramal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT