Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can you please write an assembly program in 68k that allows the user to enter tw

ID: 665816 • Letter: C

Question

Can you please write an assembly program in 68k that allows the user to enter two integer numbers (X and Y) and calculate X^Y and outputs the answer to the screen. Thank you.

***Below is an example of the format being used in 68k***

ORG $1000
START: ; first instruction of program

* Put program code here
MOVE.B #14,D0 ;Getting ready to print hello word
LEA MESSAGE,A1   
  
MOVE I,D2 ;our starting index
FOR Trap #15 ;print hello world
ADD #1,D2 ;increment index
CMP J,D2 ;check if ready to terminate loop
BNE FOR ;terminate loop if J == D2
SIMHALT ; halt simulator

* Put variables and constants here
CR EQU $0D
LF EQU $0A
MESSAGE DC.B 'Hello World',CR,LF,0
I DC.W 2
J DC.W 6
END START ; last line of source

Explanation / Answer

.MODEL SMALL .DATA BASE DB ? POW DB ? NL1 DB 0AH,0DH,'ENTER BASE:','$' NL2 DB 0AH,0DH,'ENTER POWER:','$' .CODE MAIN PROC MOV AX,@DATA MOV DS,AX ENTER_BASE: LEA DX,NL1 MOV AH,09H INT 21H MOV AH,01H INT 21H SUB AL,30H MOV BL,AL MOV BASE,AL ENTER_POWER: LEA DX,NL2 MOV AH,09H INT 21H MOV AH,01H INT 21H SUB AL,30H MOV CL,AL DEC CL MOV AX,00 MOV AL,BASE LBL1: MUL BL LOOP LBL1 MOV CL,10 DIV CL ADD AX,3030H MOV DX,AX MOV AH,02H INT 21H MOV DL,DH INT 21H MOV AH,4CH INT 21H MAIN ENDP END MAIN