mercredi 1 juillet 2015

I need to Implement the following code segment in the ARC assembly language

if  x <= y:
    y = y + 1
else if x != z
    y = y-1
else
    z = z + 1

This is what i have for my Arc assembly code. Im fairly new at this so im not too sure how to make the if/else statement into assembly code.

! This program executes an If/else statement
    .begin
    .org 2048
prog1:  ld  [X], %r1    ! this loads memory X into register 1 
        ld  [Y], %r2    ! this loads memory y into register 2


X:  0
Y:  0
Z:  0
    .end

Aucun commentaire:

Enregistrer un commentaire