News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

How to print an array vertically in a certain coordinates ?

Started by UntilCXZ, December 22, 2016, 06:10:03 PM

Previous topic - Next topic

UntilCXZ

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

Neil

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.
       

UntilCXZ

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.