Re: LF: For newbies... I


[Prev][Next][Index][Thread]

Re: LF: For newbies... I



Hmm... This looks like a pretty good start for an ASM tutorial ;)  Bryan
(Rabaler), why don't you put it up at the fargo archive?


Daniel Plaisted
-dsplaisted@juno.com
If you're getting burn-in in your eyes you're spending too much time on
the computer!


On Mon, 7 Jul 1997 16:18:43 -0400 (EDT) Hmlacage@aol.com writes:
>I will try to make U understand the basic knwoledge for asm: less than a
>month ago, i knew nothing on asm... Thus, i feel i am well placed to
explain
>what i did not understood... I hope you will excuse spelling errors ,
and
>will find this usefull ( for french readers, i recommend "assembleur
facile"
>in the " les best-sellers de l' informatique" by philippe mercier chez
les
>editions "Marabout": ~70 FF: ecrit pour PC mais tres, tres bien fait  !)

>
>I ) PRESENTATION
>
>  1) generalities
>
>First, as assembly is a langage Xtremly similar to the structure of the
>machine, there are a few things U ought to know...
>The 92' s alphabet is limited to "0" and "1" which correspond to
material
>states: " electrons not passing" and " electrons not passing".A letter
in
>this alphabet is called a BIT. 8 bits form a BYTE , 16 bits a WORD and
32
>bits a DOUBLE WORD or LONGWORD.
>These 4 structures are the structures with which you will be working (
it
>happens to be the ones with which the processor of the 92 is working ).
>Please: never forget : whatever the numbers you will be using, these
numbers
>are just a representation of a serie of bits stored in the memory of the
92 (
>under the form of micro interrupters swithed on or off ) 
>So: the computer is working with binary data ( these little bits got 2
>states: "bi"  of bin ) . But data isn' t enough: to build a program, you
need
>data and instructions. Instructions will thus be simply coded using
binary
>data.
>
>Here, a problem arises which you guys have surely seen: there is no way
for
>the calculator to do a difference between data and instructions, and
more
>genraly, between 2 form of data. Think about it : we' ll work on this 
later.
>
>2) binary 
>
>As you know, all programs can be restricted to the manipulations of
numbers:
>the program is a traduction of an algorythm, a pseudo code.
>So: how do we use numbers: all we got is 0 and 1 ? ? Take it easy: Can
you
>remember when you learned to count ? Then, that' s it. Basicaly, numbers
are
>representing objects: 10 is a representation of  " I I I I I I I I I I "
. 
>exemple: what is the diffrence between 27, 270, 2700. They are
multiplied by
>10 which is the number of letters we are using : they can decomposed in
:
>27=2*10+7, 270=2*100+7*10+0, 2700=2*1000+7*100+0*10+0. 
>let' s use the same principle with 2 letters: we' ll try to decompose a
>numbers into its 2 powers:
>exemple: 1=1*2^0                                             : 1
>              2= 1*2^1+0*2^0                                   : 10 
>              3= 1*2^1 +1*2^0                                  :  11
>              8= 1*2^3 +0                                        :  
>1000
>              9= 1*2^3+0+0+1*2^0                           :   1001
>that' s it ! we got numbers !  
>then with the structures we mentioned sooner, we can represent 
>255=2^8-1 as a
>maximum number with a byte... 
>
>To those of you who are reading this and saying: he thinks we are dumb!!
All
>he did is a base change... Yeah but i thnk that even if you got a calc
which
>does these conversions between decimal and binary much faster than we
will
>ever do these ( my casio does this quite well... ) , we should try to
work in
>binary, with these numbers, as they are at the heart of the machine. 
>Oh: i was about to forget: how do we represent negative numbers: we
adopt a
>convention: the bit the most to the left of a data is the sign bit; if
set,
>the data is negative...
>with a byte, you got then, as a maximum number and minimum number: +127
and,
>-127.
>we' ll see later how they are precisely coded...
>
>Ok: now, you know what is inside the calc : you understand the 
>headaches of
>the first programmers who had to program in binary: it is awfull...
>So, to represent the content of memory, we use hexadecimal.
>
>3) hexadecimal
>
>As i said sooner, hexadecimalis just a representation of the state  of
the
>memory. 
>We will now have 16 letters: 0-9 and A-F : this has been chosen because
it
>gets much easier to represent a word with this notation: to a group of 4
>bits, we associate a "letter"
>as 4 bits allow 2^4=16 states.  thus, you see well in the definition of
>hexadecimal how it is simple...
>
>ex: 1100 1010 1000 1101 is CA8D ( i think ... ) 
>
>4) convention
>  
>the "lower byte" of a word is the right 8 bits of the word ( the right 
>byte )
>
>the "higher byte" of a word is the left 8 bits of the word.. 
>Same for longwords: lower word and upper word...
>
>5) the calculator
>
>Your calc is made of 2 parts: the memory: where the data is stored 
>under a
>binary form 
>"Data" means the instructions with their parameters which are to be 
>executed
>by the processor. 
>The processor, the heart of the calc: 2parts
>                   a) a small memory where parameters for the near to 
>come
>instructions are
>                    stored: the registers...
>                   b) the processor itself, where instructions are
>executed...
>the registers are of 5 sort: 
>a) Dataregisters: numbered from 0 to 7 ( there are 8 ) : D0/D7  : 32 
>bits
>b) adressregisters: A0/A6  : 32 bits
>c) A7 : stack register ( it is phisicaly similar to A0/A6 but it isused
in a
>totaly differenrt manner and you should not meddle with it ... )  :32
bits
>d) Status register:  16 bits
>e) program counter: 24 bits 
>
>b) and b) are for you: you may store in these registers all data you
wish
>c) we' ll see later its use 
>d) composed of 2 bytes: the lower byte, the flag register is widely
used: its
>bits are set depending on the result of some operations executed by the
>processor. ( see jimmy mardel ' s guide : 68k programming for more
details or
>wait some days till i get to the instructions part ) 
>the upper byte, the system byte is a group of bits used by the system:
you
>can use them too but it requires to know what you are doing which is not
my
>case yet 
>e) the program counter is a register in which the adress in memory to
the
>next instuction to be executed is stored : you cannot modify its 
>content ! 
>
>well: i am getting tired this evening... if some of ypou found this
usefull
>and are looking forward a second part, Email me: i will try to write the
>following... 
>
>Mathieu, <hm lacage@aol.com>
>


References: