Write and run an 8086 assembly language program to print a multiplication table by asking number from user.
TITLE task.asm
; Description: The program to print a
; multiplication table by asking number from user
INCLUDE Irvine32.inc
.data
msgN BYTE "Enter n: ", 0
msg_01 BYTE " * ", 0
msg_02 BYTE " = ", 0
.code
main PROC
mov edx, OFFSET msgN
call WriteString ; "Enter n: "
call readDec
call CrLf
mov ecx,10
mov ebx, 1
l1:
push eax
mov eax, ebx
call writeDec ; first factor
mov edx, OFFSET msg_01 ;" * "
call WriteString
pop eax
call writeDec ; second factor
mov edx, OFFSET msg_02 ;" = "
call WriteString
push eax
mul ebx
inc ebx
call writeDec ; multiplication result
call CrLf
pop eax
loop l1
quit:
call CrLf
call CrLf
Invoke ExitProcess, 0 ; exit
main ENDP
END main
Comments
Leave a comment