【问题标题】:Loop and Incrementation in Alignment?对齐中的循环和增量?
【发布时间】:2013-12-05 06:08:04
【问题描述】:

有没有办法循环对齐代码?

因为我想显示这种输出。请点击here

如果我要使用循环,如何更改数字的对齐和递增设置?

这是我拥有的代码示例:

 mov cx, 5     ; counter

 try:          ; loop

 mov ah,2      
 mov bh,1      ;1st column number 1
 mov dl,12
 int 10h

 Mov ah, 2
 Mov dl, 49    ; display 1
 int 21h

 mov ah,2      
 mov bh,2      ;2nd column number 1
 mov dl,10
 int 10h

 Mov ah, 2
 Mov dl, 49    ; display 1
 int 21h


 mov ah,2      
 mov bh,2      ;2nd column number 2
 mov dl,14
 int 10h

 Mov ah, 2
 Mov dl, 50    ; display 2
 int 21h

 loop try

请帮帮我。

谢谢=}

【问题讨论】:

    标签: loops assembly x86 alignment increment


    【解决方案1】:

    算法非常简单。这里有一些 C-ish 代码,让您了解如何做(我将把程序集实现留给您,因为这是您的任务):

    #define ROWS 5
    
    for (int row = 0; row < ROWS; row++) {
        move_to_xy(ROWS - (row + 1), row);
        for (int column = 0; column < row + 1; column++) {
            printf("%d ", column + 1);
        }
    }
    

    【讨论】:

    • 这是问题,先生。我对Assembly 的语法不是很熟悉。我不知道该用什么。
    • 下载 x86 instruction set reference 并开始阅读。
    猜你喜欢
    • 1970-01-01
    • 2018-06-26
    • 1970-01-01
    • 1970-01-01
    • 2010-10-03
    相关资源
    最近更新 更多