
November 25th, 2012, 08:29 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 1
Time spent in forums: 32 m 14 sec
Reputation Power: 0
|
|
|
Piramid of chars - nasm
Hi all,
i have a problem with a program which is doing a pyramid of inputted chars.
for exampled input is 'abc' and output is:
...a
..bbb
ccccc
I'm absolutely new to assembler and everything i have managed to do is:
Code:
org 100h
mov ah,9
mov dx, hello
int 21h ; display on screen
mov ah, 0ah ;takes an char from keybord
mov dx, string ; take data
int 21h
; here should be some loop which i cant figure out
mov ah,9
mov dx, string+2 ; adress of imputted data
mov ax, 4c00h; end of program
int 21h
hello db "imput an word $"
string db 20 ;max amount of chars to be takend
db 0; here we are getting list of chars which were taken
times 22 db "$" ;space for data
I don't know how to make this spaces before chars in these strings. I know only that this pyramid's top line should have n-1 (where n is string length) spaces before an char and every next one is (-1). But i don't know assembler's magic loops and i don't even know how to dismember string to chars here.
of course i was googling for this but even if there were codes that could help me they are for fasm or other ide that i dont understand at all
thanks in advance
|