KEMBAR78
Lab Task | PDF
0% found this document useful (0 votes)
4 views2 pages

Lab Task

Uploaded by

sarteyx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Lab Task

Uploaded by

sarteyx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

.

model small
.stack 100h
.data
prompt db "Enter a number to print its Table: $"
newline db 0Dh,0Ah,'$'

.code
main proc
mov ax, @data
mov ds, ax

mov ah, 09h


lea dx, prompt
int 21h

mov ah, 01h


int 21h
sub al, '0'
mov bl, al

mov cl, 1

print_loop:
mov ah, 09h
lea dx, newline
int 21h

mov dl, bl
add dl, '0'
mov ah, 02h
int 21h

mov dl, '*'


mov ah, 02h
int 21h

mov dl, cl
add dl, '0'
mov ah, 02h
int 21h

mov dl, '='


mov ah, 02h
int 21h

mov al, bl
mul cl
call print_num

inc cl
cmp cl, 11
jne print_loop

mov ah, 4Ch


int 21h
main endp

print_num proc
cmp al, 10
jl one_digit

mov ah, 0
mov bl, 10
div bl
xchg ah, dl

add al, '0'


mov ah, 02h
int 21h

add dl, '0'


mov ah, 02h
int 21h
ret

one_digit:
add al, '0'
mov dl, al
mov ah, 02h
int 21h
ret
print_num endp

end main

You might also like