Lab Description:
In this lab#3, we had to write a program that would compile a multiplication operation. But the option of using the ” mul” command and the loops were restricted. we could only used the “label” and “jump” option. It was quite a challenge since i had never use these command and the exclusion of the loops made it more difficult. but reading the book and asking questions about it, i was able to finish it.
CODE
Program perfect; #include("stdlib.hhf"); Static i: int16; u: int16; y: int16; z: int16; j: int16; begin perfect; part1: stdout.put( "enter i",nl); stdin.get(i); stdout.put( "enter u",nl); stdin.get(u); mov(i,ax); mov(u,bx); add(ax,bx); mov(bx,z); stdout.put(z, nl); jmp part2; part2: mov(i,ax); mov(z,bx); add(ax,bx); mov(bx,j); stdout.put("the total is ", j, nl); end perfect;
SCREENSHOT