LAB DESCRIPTION:
The lab was basically designed to convert decimal numbers to roman numerals. If then, while do, elseif then,sub(number,eax) functions were used to accomplish the results. The program basically asks the user to input an integer and, converts the integer into a roman numeral.
dectorom
CODE:
program dectorom; #include( “stdlib.hhf” ) static x:int32; begin dectorom stdout.put( “enter an integer value: “); stdin.get(x); mov(x,eax); while (eax>0) do if (eax>=100) then stdout.put(“C”); sub(100,eax); elseif (eax>99) then stdout.put(“IC”); sub(99,eax); elseif (eax>=90) then stdout.put(“XC”); sub(90,eax); elseif (eax>=50) then stdout.put(“L”); sub(50,eax); elseif (eax>=49) then stdout.put(“IL”); sub(49,eax); elseif (eax>=40) then stdout.put(“XL”); sub(40,eax); elseif (eax>=10) then stdout.put(“X”); sub(10,eax); elseif (eax>=9) then stdout.put(“IX”); sub(9,eax); elseif (eax>=6) then stdout.put(“VI”); sub(6,eax); elseif (eax>=5) then stdout.put(“V”); sub(5,eax); elseif (eax>=4) then stdout.put(“VI”); sub(4,eax); elseif (eax>=1) then stdout.put(“I”); sub(1,eax); endif; endwhile; stdout.put(nl);
end dectorom;