Monday, April 8, 2019

Operation of Assemblers Essay Example for Free

Operation of Assemblers EssayA political program scripted in assembly delivery is oft more readable and understandable than its equivalent in machine code an assembler is a program which translates assembly language into machine code.The assembler accepts an assembly language program as data, converts mnemonic appendage codes (op-codes) to their numeric equivalents, assigns symbolic addresses to memory locations and produces as output the required machine code program.Assembly language is the source program and when translated into machine code it is know as object program. The following programs are written for the BEP/16 programming environment to achieve the following arithmetic operationsa) a + bSWI getInt in operation(p) body call to get a 16 routine integer from the keyboard. abide by returned in R0MOV R1, R0 storehouse the first base take account in R1SWI getInt Get minute valueMOV R2, R0 Store in register R2MOV R3, R1 R3 = aADD R3, R2 R3 = a+bMOV R4, R1 R4 = aMOV R0, R3 repeat amswer to R0SWI putInt Operating trunk call to display the 16-bit integer in R0HLT Terminate program.b) a bSWI getInt Operating system call to get a 16 bit integer from the keyboard. Value returned in R0MOV R1, R0 Store the first value in R1SWI getInt Get second valueMOV R2, R0 Store in register R2MOV R3, R1 R3 = aSUB R3, R2 R3 = a-bMOV R4, R1 R4 = aMOV R0, R3 Copy amswer to R0SWI putInt Operating system call to display the 16-bit integer in R0HLT Terminate program.c) a x bSWI getInt Operating system call to get a 16 bit integer from the keyboard. Value returned in R0MOV R1, R0 Store the first value in R1SWI getInt Get second valueMOV R2, R0 Store in register R2MOV R3, R1 R3 = aMUL R3, R2 R3 = a x bMOV R4, R1 R4 = aMOV R0, R3 Copy amswer to R0SWI putInt Operating system call to display the 16-bit integer in R0HLT Terminate program.d) a + bSWI getInt Operating system call to get a 16 bit integer from the keyboard. Value returned in R0MOV R1, R0 Store the first value in R1SWI getInt Get second valueMOV R2, R0 Store in register R2MOV R3, R1 R3 = aSUB R3, R2 R3 = a bMOV R4, R1 R4 = aADD R4, R2 R4 = a + bMOV R0, R3 Copy amswer to R0SWI putInt Operating system call to display the 16-bit integer in R0HLT Terminate program.e) a + bSWI getInt Operating system call to get a 16 bit integer from the keyboard. Value returned in R0MOV R1, R0 Store the first value in R1SWI getInt Get second valueMOV R2, R0 Store in register R2MOV R3, R1 R3 = aADD R3, R2 R3 = a + bMOV R4, R1 R4 = aSUB R4, R2 R4 = a bMOV R0, R3 Copy amswer to R0SWI putInt Operating system call to display the 16-bit integer in R0HLT Terminate program.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.