Question: Show me the steps to solve the error ; * * Error * * T 2 . asm ( 6 5 ) Relative jump out

Show me the steps to solve the error ; **Error** T2.asm(65) Relative jump out of range by 0028h bytes
Single Digit Calculator .MODEL SMALL .STACK 100H .DATA menu_msg db "**********************************",0Dh,0Ah db "** Single Digit Calculator **",0Dh,0Ah db "**********************************",0Dh,0Ah db "**1. Addition **",0Dh,0Ah db "**2. Multiplication **",0Dh,0Ah db "**3. Subtraction **",0Dh,0Ah db "**4. Exit **",0Dh,0Ah db "**********************************",0Dh,0Ah,"$" select_op_msg db "Please enter the operation (1 for addition, etc.): $" num_prompt db 0Dh,0Ah, "Enter a single digit number (0-9): $" result_msg db 0Dh,0Ah, "The result is: $" error_msg db 0Dh,0Ah, "INVALID INPUT! Enter a number between 0 and 9.$" exit_msg db 0Dh,0Ah, "Exiting the program. Goodbye!", 0Dh,0Ah,"$" num1 db ? ; Variable for the first number num2 db ? ; Variable for the second number result db ? ; Variable for the result operation db ? ; Variable to store operation choice ten db 10 ; Constant for division by 10.CODE START: MOV AX, @data MOV DS, AX ; Call the main menu procedure CALL MAIN_MENU JMP EXIT_PROGRAM ; Ensure we exit after returning from MAIN_MENU MAIN_MENU: ; Display the menu MOV DX, OFFSET menu_msg MOV AH,09h INT 21h ; Prompt user for operation choice MOV DX, OFFSET select_op_msg MOV AH,09h INT 21h ; Read operation choice MOV AH,1 INT 21H SUB AL,'0' CMP AL,1 JB INVALID_OPERATION CMP AL,4 JA INVALID_OPERATION MOV operation, AL ; Check if user selected to exit CMP AL,4 JE EXIT_PROGRAM ; Call the function to get the first digit CALL GET_SINGLE_DIGIT MOV num1, AL ; Call the function to get the second digit CALL GET_SINGLE_DIGIT MOV num2, AL ; Perform the chosen operation CALL PERFORM_OPERATION ; Display the result MOV DX, OFFSET result_msg MOV AH,09h INT 21h CALL DISPLAY_RESULT ; Return to main menu after calculation JMP MAIN_MENU ; Return to the menu INVALID_OPERATION: MOV DX, OFFSET error_msg MOV AH,09h INT 21h JMP MAIN_MENU ; Return to the menu GET_SINGLE_DIGIT PROC ; Prompt for a single digit MOV DX, OFFSET num_prompt MOV AH,09h INT 21h ; Read digit MOV AH,1 INT 21H SUB AL,'0' CMP AL,0 JL INVALID_INPUT CMP AL,9 JG INVALID_INPUT RET INVALID_INPUT: MOV DX, OFFSET error_msg MOV AH,09h INT 21h CALL GET_SINGLE_DIGIT ; Call again if input is invalid RET GET_SINGLE_DIGIT ENDP PERFORM_OPERATION PROC ; Perform calculation based on operation MOV AL, num1 MOV BL, num2 CMP operation, 1 JE ADDITION CMP operation, 2 JE MULTIPLICATION CMP operation, 3 JE SUBTRACTION RET ADDITION: ADD AL, BL MOV result, AL RET MULTIPLICATION: MUL BL MOV result, AL RET SUBTRACTION: SUB AL, BL MOV result, AL RET PERFORM_OPERATION ENDP DISPLAY_RESULT PROC ; Check if result is a two-digit number MOV AL, result CMP AL,10 JL DISPLAY_SINGLE_DIGIT ; Handle two-digit result MOV BL, AL ; Store result in BL MOV AH,0 DIV ten ADD AL,'0' ; Convert tens place to ASCII MOV DL, AL MOV AH,02h INT 21h ; Print tens digit MOV AL, BL ; Restore result in AL MOV AH,0 DIV ten ; Get remainder in AH MOV AL, AH ; Move remainder to AL ADD AL,'0' ; Convert ones place to ASCII MOV DL, AL MOV AH,02h INT 21h ; Print ones digit RET DISPLAY_SINGLE_DIGIT: ADD AL,'0' ; Convert to ASCII MOV DL, AL MOV AH,02h INT 21h ; Print single digit result RET DISPLAY_RESULT ENDP EXIT_PROGRAM: MOV DX, OFFSET exit_msg MOV AH,09h INT 21h MOV AH,4Ch INT 21h END START

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!