Assembly 汇编语言中的增量循环
我想把照片打印出来Assembly 汇编语言中的增量循环,assembly,x86,dos,Assembly,X86,Dos,我想把照片打印出来 * ** *** **** ***** ****** 8086仿真器控制台上的模式,但我不知道如何在汇编中进行增量循环,请帮助我?? 我正在尝试下面的代码,但它不工作 ; You may customize this and other start-up templates; ; The location of this template is c:\emu8086\inc\0_com_template.txt org 100h .dat
*
**
***
****
*****
******
8086仿真器控制台上的模式,但我不知道如何在汇编中进行增量循环,请帮助我??
我正在尝试下面的代码,但它不工作
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
.data
size dw 5
iner dw 1
.code
mov cx,size
dec cx
outer:
mov dx,cx
mov ah,2
mov dl,' '
int 21h
mov cx,5
inner:
mov ah,2
mov dl,'*'
int 21h
loop inner
mov ah,2
mov cx,dx
loop outer
ret
不管怎样,下面的代码似乎都缺少这样的结构:
label:
//do something
dec register
jnz label
因此,您的任务应该如下所示:
place=1
line_length=5
space_count=line_length
print_spaces:
mov ah,2
mov dl,' '
int 21h
dec space_count
jnz print_spaces
dots_count=place
print_dots:
mov ah,2
mov dl,'*'
int 21h
dec dots_count
jnz print_dots
mov ah,2
mov dl,'\n'
int 21h
inc place
dec line_length
jnz print_spaces
ret
dl
是dx
的低位字节,因此您正在覆盖计数器。可能还有其他问题。学习使用调试器。尝试循环
指令。