Question:
assembler programming?
bee-bee
2008-05-29 20:33:42 UTC
i'm very new in computer programing and i only have turbo assembler v.5
there is a sample like
.mode small
.code
.386
start: jmp process
word db 'assembler learn"
process:xor bx,bx
mov cx,15
rep: mov dl,words[bx]
mov ah,02
int 21h
inc bx
loop rep
int 20h
end start
its print word assembler learn, but how to print word learn assembler without changing word db 'asembler learn?

is there any tutorial that give a simple sample code to learn, step by step ?
thank's
Three answers:
sspade30
2008-05-29 23:12:12 UTC
ignore those people. ASM is great!



It took me a while to understand your question. I want to point out what this line is doing:



mov cx, 15



That sets a counter. 15 is the length to the string to be printed out. To print out "learn assembler" without changing the constant, well, first you'd have to print out "learn" then then space, and then "assembler".



You can print out learn by making the first loop start at 11 instead of 0 ("learn" starts at the 11th character):



process:

mov bx, 11

mov cx, 5

rep: mov dl,words[bx]

mov ah, 02

int 21h

inc bx

loop rep



; now, print our space

mov dl, ' '

mov ah, 02

int 21h



; now, the 2nd loop prints 'assembler'

xor bx, bx

mov cx, 9

rep: mov dl, words[bx]

mov ah, 02

int 21h

inc bx

loop rep



; calling int 20h ends the program

int 20h
2008-05-29 20:42:42 UTC
You do not want to learn an assembly language if you are first getting into programming. At the lowest level you would want to learn something like C/C++ or Java (a language commonly used which has lots of documentation and tutorials on the net). Also maybe look into a scripting language like Python... as the syntax is easier to understand and in some cases more intuitive (and again, the documentation thing).





Response to sspade30:



In general assembly language is not platform independent, whereas the above languages can be compiled for use on different architectures. It is also not easy to replicate the functionality of object-oriented languages using just assembly. Even accomplishing relatively simple tasks in C (a non-object oriented higher level language) requires much more involved code than if you were trying to do the same thing with C++/Java/Python.



However, direct calls to assembly code can in some cases be very useful, especially if you want to get the most speed out of certain low-level tasks. But it would be more useful for someone new to programming to start by learning a higher level language, as they can get more results with less code and learn the broader strokes of it all.
Aaron
2008-05-29 20:47:05 UTC
I wouldn't bother learning assembly language. Most people program in a easier to read language like C#, VB.NET or Java. You can get a free compiler and development enironment here: http://www.microsoft.com/express/. Microsoft development tools come with many tutorials and there are tons of free articles on the internet to help you solve any programing problem you encounter.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...