Re: Question about jumps




Markus Pitha wrote:
randyhyde@xxxxxxxxxxxxx wrote:
Your problem, as others have pointed out, is that you're not to the
point yet where you understand the difference between the string
representation of an integer and the integer itself.

I understand it, but obviously it's in assembler language more complicated
than I thought, but it's my target to learn exactly these basic things.

Forgive me for stating the obvious, but if it's "more complicated than
you thought" you probably don't understand it yet :-)

And yes, *eventually* you need to learn these types of things (not just
for assembly, this is basic computer organization knowledge you should
have). The point I'm making, however, is that you don't need to
understand the difference between a character representation of an
integer and how to convert between internal and external representation
in order to verify that shifting to the left multiplies a value by two.
All you need are some pre-written library routines that will do this
job for you. Eventually, you should probably take a look at how such
routines are written. Again, this has nothing to do with assembly
language -- the same would be true no matter *what* language you're
learning. In the meantime, however, such knowledge should *not* serve
as a barrier that prevents you verifying things like "a shift left
multiplies a value by two." You would be well-advised to drop the
elitism and snobbery you seem to have with respect to things like
library routines. Such an attitude may be cool once you already know
this stuff, but right now it's just getting in the way of your
education.



stdout.put( "Enter an integer:" );
stdin.geti32(); // Read integer from stdin into EAX.
shl( 1, eax ); // Multiply EAX by two
stdout.put( "eax = " );
stdout.puti32( eax );

So why should I deal with assembler, when I could solve it with C-like
methods? That's not what I want to learn.

What are you trying to learn? Seems to me that you're trying to verify
that shifting a value to the left multiplies it by two. Everything else
is peripheral. You really need to drop the attitude. It's getting in
the way of your education. As I said already, there will be *plenty*
of time to be an "assembly snob" once you actually understand the
stuff.


Now you get to see the effect of the shl instruction without having to
learn all the stuff needed to write your own integer input and output
routines. Sure, at some point you ought to be able to write your own
input and output routines, but for right now the integer I/O routines
in the HLA stdlib are *perfect* for the job.

It's not my target to see what's happened when I type in a number and see
the result on stdout.

Uh, in the NASM code you posted you seemed to be trying to read from
stdin and trying to write to stdout. What does it matter whether you
call "library code" that is part of the OS (written in C, btw) versus
library code that is included with the assembler? You're just arguing
to be arguing now.


That's what computer newbies are probably interested
in but I want to understand what the little gremlins in the background are
doing while this happens.

Learning what all the gremlins are doing in the background is a
laudible goal. However, this has little or nothing to do with learning
assembly language. It sure helps if you already *know* assembly
language when you set out on your journey to find out what's going on
in the background, but your impatience and desire for "instant
gratification" is getting in the way of the task at hand -- learning
assembly language. Feel free to learn at your own pace using the
methods you are happy with. Bottom line, however, is that the approach
you're taking will take quite a bit longer and leave a lot of holes in
your educaiton. But it's your choice. I've given you my advice and a
class-room tested method for efficiently learning assembly language. If
that's not your bally-wick, no sweat. I've done what I can. I can't
force you to learn more efficiently if you don't want to.
Cheers,
Randy Hyde

.



Relevant Pages

  • Re: Rene cant handle AoAs Success
    ... vehicles for learning assembly language ... learning assembly language with an in-line assembler, ... language using an in-line assembler is probably a bit more work than ... learn inline Assembly. ...
    (alt.lang.asm)
  • Re: Learning Assembly with an HLL
    ... Art of Assembly Language)? ... time with no programming taking place. ... Those types of tools are fantastic for learning how individual ... every other assembler out there, ...
    (comp.lang.asm.x86)
  • Re: FORTH as a high-level assembler (was: Intro to Programming w/ Machine Language)
    ... > There is a case to be made for using FORTH to learn assembly language. ... > using Forth than any traditional assembler, ... Interactiveness of the environment. ... I'm not sure that FORTH is any better a tool for learning architecture ...
    (alt.lang.asm)
  • Re: GAS struc
    ... Those who use HLA to learn assembly language benefit from learning how to write programs, not just how to whack out assembly language instructions, you see? ... Don't forget that using a non-HLA assembler is just text representing the machine code, a different way of expressing it; ...
    (alt.lang.asm)
  • comp.lang.asm.x86 - Frequently Asked Questions - general 2
    ... x86 Assembly Language FAQ - General Part 2 of 3 ... Accessing 4 Gigs of Memory in Real Mode ... Changing the value of a segment register results in that segment's entry ... This tutorial is designed specifically for the cheap assembler ...
    (comp.lang.asm.x86)