mardi 2 avril 2019

How to write multiple if else branches in pep 8 assembly?

How can i write multiple if else statement in pep/8 assembly language?Lets say i need to compare a number to a set of ranges such as 0< X >10, 10<= x >20, and 20<= X >30.

This is similar to what i have now, how would i implement another else statement?

if:   LDBYTEA num,s   ;load num into accumulater 
      CPA 0,i      ;compare accumulator with 0
      BRGT else     ;end if accumulator > 0
      CPA 'z',i     ;compare accumulator with 'z'  
      BRLT else    ;end if accumulator < 10 
      STRO msg1,d  ;output message msg1:"X is in between 0 and 10"
      BR endIf     ; br around msg2
else: STRO msg2,d


Aucun commentaire:

Enregistrer un commentaire