-1

Is there a way to loop the alignment code?

Because I want to display this kind of output. Please click here

How can I change settings of alignment and incrementation of numbers if I'm going to use loop?

This is a sample of the codes I have:

 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

Please help me.

Thanks =}

1 Answer 1

0

The algorithm is farily simple. Here's some C-ish code to give you an idea of how to do it (I'll leave the assembly implementation to you since it's your assignment):

#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);
    }
}
2
  • That's the problem Sir. I am not that familiar with Assembly's syntax. I do not know what to used. Dec 5, 2013 at 12:25
  • Download the x86 instruction set reference and start reading.
    – Michael
    Dec 5, 2013 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.