Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 25th, 2012, 08:29 AM
kicjow kicjow is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 kicjow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old November 25th, 2012, 06:42 PM
OmegaZero OmegaZero is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2007
Posts: 738 OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 6 h 52 sec
Reputation Power: 928
Code examples aren't going to help you much at the moment. You will need a firmer understanding of assembler and memory first. If you have a text book, it would be helpful to work through the earlier problems and examples.

You could also look at the various subproblems in your current assignment. For instance: Can you write out a string from memory? Can you write out a string from memory one character at a time? Can you write out a character N times? can you create a triangle of characters like:
Code:
X
XX
XXX
?

When you need help with your code, it is useful to know what it is that you don't understand. Is the question how to construct a loop in assembler? Or is the problem with how to construct the condition?

BTW, to get better search results, try including the keywords "x86" and "intel". There are different flavors of assembler for different chips and x86 assembler is often written in two distinct styles called Intel and AT&T syntax.
__________________
sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Piramid of chars - nasm

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap