The MASM Forum

General => The Campus => Topic started by: UntilCXZ on December 22, 2016, 06:10:03 PM

Title: How to print an array vertically in a certain coordinates ?
Post by: UntilCXZ on December 22, 2016, 06:10:03 PM
Hello, I am new to asm and i just wanted to learn how to print a certain array in a specific location vertically?

I tried to make it through this code:

.386
.model flat, stdcall
option casemap :none
include masm32rt.inc


.data
SameList byte 3 Dup("ITEM",13,10)

.data?

OutHandle HANDLE ?

.code

Main Proc

LOCAL XY:COORD

mov XY.x,10
mov XY.y,10

invoke GetStdHandle,STD_OUTPUT_HANDLE
mov  OutHandle, eax
mov edx,XY
invoke SetConsoleCursorPosition,eax,edx

lea esi,SameList

print esi
mov eax,input()

ret
Main Endp
start:
call Main
END start


the output was:

          ITEM
ITEM
ITEM


The first ITEM only was printed in the specific location , but others are not.

Also I wanted to ask if there any other way to print text vertically other than that "13,10" ?

So Any Help?

Thanks
Title: Re: How to print an array vertically in a certain coordinates ?
Post by: Neil on December 22, 2016, 09:00:50 PM
An easy way is to use the loc macro. An example is loc 2,5, this puts the cursor at column 2, row 5. now if you want to print something 10 times vertically set up a loop :-

    mov count,10          ;use a byte instead of ecx
    mov esi,5               ;Row pointer

@@: loc 2,esi
       print "Your text here"
       jnc esi
       dec count
       jne @B

That will do want you want.
       
Title: Re: How to print an array vertically in a certain coordinates ?
Post by: UntilCXZ on December 24, 2016, 01:27:46 AM
Quote from: Neil on December 22, 2016, 09:00:50 PM
An easy way is to use the loc macro. An example is loc 2,5, this puts the cursor at column 2, row 5. now if you want to print something 10 times vertically set up a loop :-

    mov count,10          ;use a byte instead of ecx
    mov esi,5               ;Row pointer

@@: loc 2,esi
       print "Your text here"
       jnc esi
       dec count
       jne @B

That will do want you want.
       

Thanks , Solved.