汇编语言编程设计输出九九乘法表,从键盘输入选项,查找对应结果并标记输出,数据的
时间: 2024-04-23 17:25:31 浏览: 187
汇编语言编程九九乘法表的代码如下:
```
.model small
.stack 100h
.data
row db 9
col db 9
msg1 db "Please enter a number between 1 and 9: $"
msg2 db "Table of %d x %d: $"
msg3 db "%d x %d = %d$"
msg4 db "The result is marked with *"
.code
main proc
mov ax, @data
mov ds, ax
; Input row and column
mov ah, 9
lea dx, msg1
int 21h
mov ah, 1
int 21h
sub al, '0'
mov bl, al
mov ah, 1
int 21h
sub al, '0'
mov cl, al
; Output table
lea dx, msg2
mov ah, 9
mov al, bl
push ax
mov al, cl
push ax
int 21h
mov cx, col
mov bx, 1
mov dl, '*'
outer_loop:
mov ah, 9
mov al, bl
push ax
mov al, bh
push ax
mov al, '*'
cmp bh, cl
jge exit_loop
int 21h
mov ah, 9
inner_loop:
mov al, bl
push ax
mov al, bh
push ax
mul bh
mov si, ax
mov al, si
mov ah, 0
div cl
mov ah, 9
push dx
mov al, si
mov ah, 0
div cl
push ax
lea dx, msg3
int 21h
cmp bh, cl
jge exit_inner_loop
inc bh
jmp inner_loop
exit_inner_loop:
mov ah, 9
mov al, 0dh
int 21h
mov al, 0ah
int 21h
cmp bx, row
jge exit_loop
inc bx
mov bh, bx
jmp outer_loop
exit_loop:
lea dx, msg4
mov ah, 9
int 21h
mov ah, 4ch
int 21h
main endp
end main
```
这段代码实现了从键盘输入一个数字,输出该数字对应的九九乘法表,并标记出结果。在输出结果时,将符合要求的结果标记为 *。
阅读全文
相关推荐









