Assembly-Sprache If und else-Anweisungen

Wie kann ich umwandeln dieser Montage?

gegeben, ich habe dieses Menü

LEA SI, MSG1   
call PRINT_STRING    
gotoxy 0,1

LEA SI, MSG2  
call PRINT_STRING  
gotoxy 0,2

LEA SI, MSG3   
call PRINT_STRING  
gotoxy 0,3

LEA SI, MSG4  
call PRINT_STRING  
gotoxy 0,4    

LEA SI, MSG5  
call PRINT_STRING  
gotoxy 0,5

definieren und

MSG1 DB 'Choose Arithmetic Operation ' , 0  
MSG2 DB '(1) Addition ',0  
MSG3 DB '(2) Subtraction', 0  
MSG4 DB '(3) Multiplication',0  
MSG5 DB '(4) Division',0    

DEFINE_SCAN_NUM

DEFINE_PRINT_STRING

DEFINE_PRINT_NUM_UNS

und ich möchte einfügen das ifs'

if( x == 1)

fügen Sie dann

else if(x==2)

dann subtrahieren

else if(x==3)

dann multiplizieren

else if(x == 4)

dann teilen Sie

gegeben, ich habe die Funktionen für jede arithmetische operation.

jemand ? ich bin neu auf Montage und ich finde if und else komisch, zumindest wenn ich den trick kennst, wäre es perfekt. haha danke übrigens.

  • Die einfache Lösung: cmp x, 1; je add; cmp x, 2; je subtract und so weiter. Wo hast du stecken ...
InformationsquelleAutor CodeCracker | 2014-12-15
Schreibe einen Kommentar