flat assembler
Message board for the users of flat assembler.

Index > Main > Three Questions confused me, Could you help?

Author
Thread Post new topic Reply to topic
lilainst



Joined: 29 Jul 2004
Posts: 11
lilainst 13 Aug 2004, 01:06
1, How to control flow in assembly language?

It's said that assembly programmers (coders) always have pencil and paper handy when they programming, and draw all the "jump flows" on the paper to see which part is which. Is that true? Even the very expericenced coder dose that?


2, How to calculate Hex in brain?

In assembly language, we almost deal with Hex every day. How do you calculate simple things like 'A + F' or ' 13 - E' or 'A * D' , should I hard-code these simple values in brain just like what we do with Dec?

3, Do I need to learn some Electronics?

I found many university assembly books describe a lot of Electronics stuff. For me that's very hard to learn, because I have no Electronic Lab to do experiment. (I just have a computer at home). And it's hard to figure out which one is 8259 and which one is 8237 on the MotherBoard. Is there a good tutorial about this? or Do I really need Electronic knowledge when using assembly language?

Many thanks.
Best regards.
Post 13 Aug 2004, 01:06
View user's profile Send private message Reply with quote
fasm9



Joined: 19 Jun 2003
Posts: 439
fasm9 13 Aug 2004, 02:23
I don't know well computer due to my lazyness("Being happy for doing nothing")

But, you should check this!
http://www.homebrewcpu.com

Everything is his *own*. not their.

--
PS: if you seek some books, here is my recommendation.
http://board.flatassembler.net/topic.php?t=1422&p=10428
Post 13 Aug 2004, 02:23
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 13 Aug 2004, 08:13
1. When hard-coding ops you will definately need a pencil and a paper but
nowdays compilers are so advanced(FASM Smile) that you don't need much
brainwork to achieve something that macros can do for you. If you mean
the jump distance calculation, then it's very tedious job, because any change
in code changes the distance between the jump and the destination.

2.Short answer:You don't!
Long answer:You will eventually make up a loop-up table in your head and
you won't have to think if you stumble upon FF or A0 which are 255 and 160 respectively. Some hints though: Its hard to think of (A+F)h as a 10+15,
because 25 does not make sence: 10h=16,20h=32 so 25 is 10h+(25-16) or
19h, waste of time - think of F as 9 in base ten. 5+9=14 <= you subtract
1 from 5, don't you. (A+F)h=19h you subtract 1 from Ah which is 9, simple Very Happy
and (13-E)h=(13-10+2)h=5 due to fact that 10h-Eh=2h
(A*D)h is hard to do it in your head. 10*13=130 <=nearest 2^n=128 so
you would think what is 128 in HEX : 80h and 130-128=2 so you get 82h

3.Learning electronics is not obligatory but it helps A LOT. If you ever get
frustrated over why graphics take long or MUL more cycles that ADD then
it doesn't hurt to give the 'source' a look: dig into the very gates themselves
and try to walk through the gates in your head with all kinds of inputs and
soon you will wonder why isn't it the other way around, because ADD carries
should take 32 clocks Wink you will find some very interesting stuff.
For example for your brain it will take a long time to figure out the use of
EIP. You think YOU can deal without it, but for a computer its crucial Sad

Hope it helps, with any questions, please return.
Post 13 Aug 2004, 08:13
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 13 Aug 2004, 11:47
1. Method i use is having "blocks" of code, linear ordered, each block starts with comment, that says where this blocks continues (usually at following block, no comment then). If blocks jumps elsewhere (conditonaly or not), it is written in comment. Whis is main difference from HLLs like C or pascal. But you will learn it best by usage.

2. remember learning computing over 10 in first class, like 5+7? You have to learn same thing in hex. But in reality nobody does this, you can live without it, and when you will need it, you will learn it quickly by usage, again.

3. Absolutely not nescessary, but again, people who code assembly are usually interested how things work, so they will get to this point.
Post 13 Aug 2004, 11:47
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias 14 Aug 2004, 07:32
control of flow: it is easy to get lost with so many different methods of controlling program execution available to the Intel cpu architecture. For a debutant, at least, (and in my opinion, for Masters of Assembly as well,) it is EASIER for someone else to understand your program, if you will rely upon ONLY two or three methods of evaluating conditions to determine subsequent program execution. Intel's RICH instruction set permits many, many different routes, to accomplish similar goals, but the more of them you employ in your program, the more difficult it will be for another person to understand what you are trying to accomplish. SIMPLICITY of design, with concomitant program readability (at the cost of increased memory use and increased program execution time) trump ALL OTHER FACTORS.
learning electronics: not necessary, because you will not be measuring analogue currents, nor applying resistors, diodes, or capacitors. WHAT IS ESSENTIAL to learn, for Assembly language, or any other computer programming environment is Boolean Algebra. Hexadecimal notation is convenient to understand, because much of the original literature used it, but it is not essential. regards, tom Smile
Post 14 Aug 2004, 07:32
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 20 Aug 2004, 20:10
Quote:
It's said that assembly programmers (coders) always have pencil and paper handy when they programming, and draw all the "jump flows" on the paper to see which part is which.


don't believe everything you see. Many people can code without this, especially on smaller projects. Also on bigger projects with good coders, this is only needed for uppermost part of program in hierachy, when dividing work to people.
This is "mathematical" way to express algorithms, instead of using some programming languages, you are using symbols (boxes, diamonds, arrows etc.). But you can construct something like that easier in your mind, and if problem is hard and thus interesting, you will probably remember solution so you don't have to memorize it.
Post 20 Aug 2004, 20:10
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
lilainst



Joined: 29 Jul 2004
Posts: 11
lilainst 24 Aug 2004, 08:16
Thanks for ALL of your great advice. I'll try my best to become a coder... and I hope that's not too late. I shuffled a lot in HLLs and did waste a lot of time. I'm now adhere to Assembly and Fasm, and hope that I made a wise decision this time.

Thank you again.
Best Regards
Post 24 Aug 2004, 08:16
View user's profile Send private message Reply with quote
fasm9



Joined: 19 Jun 2003
Posts: 439
fasm9 24 Aug 2004, 09:04
Believe me, Learning assembly never let you down!

Assembly most close to "what is what".

--
Smile
Post 24 Aug 2004, 09:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.