-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiplication_table.asm
More file actions
105 lines (84 loc) · 1.87 KB
/
multiplication_table.asm
File metadata and controls
105 lines (84 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
;wap in 8086 microprocessor to display multiplication table of the number given by user in clear screen
.model small
.stack 64
.data
num db 0
sum db 0
prompt db 'Enter a number (0-9): $'
;upper and lower count
NEW_LINE MACRO
mov ah, 02h
mov dl, 0ah
int 21h
mov dl, 0dh
int 21h
NEW_LINE ENDM
.code
main proc far
mov ax, @data
mov ds, ax
; Prompt user
mov ah, 09h
lea dx, prompt
int 21h
;character input
mov ah, 01
int 21h ; stores input character in al
sub al, 48
mov num, al
;clear screen
MOV AX,0600H;REQ TO SCROLL
MOV BH,61H;BLUE ON BROWN FOR ATTRIBUT ON PIXEL
MOV CX,0000H
MOV DX,1950H
INT 10h
;Cursor Reset
MOV AH, 02h ; Function 02h: Set cursor position
MOV BH, 00h ; Video page 0
MOV DX, 0000h ; Row 0, column 0
INT 10h
;MOV AH, 02h
;MOV DX, 000Dh
;INT 21h
mov ch, 0
mov cl, 10
l1:
push CX
mov ah, 0
mov al, sum
add al, num
mov sum, al
call print_number
NEW_LINE
pop CX
loop l1
mov ah, 4Ch
int 21h
main endp
print_number proc ;prints multiple digit number whose hex value is stored in AX register
cmp ax, 0
jne not_zero
mov dl, '0'
mov ah, 02h
int 21h
ret
not_zero:
mov cx, 0; count no of digit (for print loop)
loop_push:
mov dx, 0 ; reset dl
mov bx, 10
div bx ;ax/bx, quotient ax, reminder dx
add dl, '0'
push dx
inc cx
cmp ax, 0
jne loop_push
; Print digits
loop_print:
pop dx
mov ah, 02h
int 21h
loop loop_print
ret
print_number endp
end