Re: Question about jumps
- From: "randyhyde@xxxxxxxxxxxxx" <randyhyde@xxxxxxxxxxxxx>
- Date: 31 Aug 2006 11:54:46 -0700
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
.
- References:
- Question about jumps
- From: Markus Pitha
- Re: Question about jumps
- From: Evenbit
- Re: Question about jumps
- From: Markus Pitha
- Re: Question about jumps
- From: randyhyde@xxxxxxxxxxxxx
- Re: Question about jumps
- From: Markus Pitha
- Question about jumps
- Prev by Date: Re: Question about jumps
- Next by Date: Re: Question about jumps
- Previous by thread: Re: Question about jumps
- Next by thread: explanation of an assembly code
- Index(es):
Relevant Pages
|