💾 Archived View for gemini.spam.works › mirrors › textfiles › apple › machinel.app captured on 2022-04-28 at 19:13:27.
View Raw
More Information
⬅️ Previous capture (2020-10-31)
-=-=-=-=-=-=-
Filename: M/L Part I
- **************************************
- *
- *
- MACHINE LANGUAGE TUTORIAL DISK *
- *
- WRITTEN BY DR. FIRMWARE *
- *
- *
- **************************************
The aim of this disk is for you the reader to understand machine language to an
extent so that you can program fully in machine language (ml).
PART I
======
The fundamentals.
-----------------
The first part of the course is number bases. if you undestand binary and
hexadecimal numbers and conversion between these and decimal, you can skip to
the next section.
Binary: Base two.
-----------------
Number bases are what we are dealing with here. The number base that we normally
use in everday life is decimal. 'Decimal' comes from latin where it meant ten.
We have ten digits, 0,1,2,3,4,5,6,7,8, and 9, which are combined in various ways
to produced other numbers. It is understood that the number '345' means
3x100+4x10+5x1. The right-most digit has the least significance, while the
left-most has the most significance. FrgiO?????O??a?8? P$ B?? ! ? ???$??? `?.?#???] ???4??? G? .??? ?? ?`????Ta? `hQ????????a+?phPhRs{???c?Ks9?C+?)3?s#k+s?c?a?);ca{s??????C)?)??ya{?Ks??as?k+?hS????+iq3K????C+?)?)??y#K;K??a?as!?q?ya?C)?K;C?kk{??#K;K?C??C(hSc+???K;sK3Ks)s!?C)c+3?kk{??a?C)k{???K;sK3Ks)aS???cK[)KphS#+Kkaqs{?a?C)s?k+??k?c?K?cK+!?K?A?C)#K;Hts will be successive powers
of two. 2~0=1, 2~1=2, 2~2=4, 2~3=8, etc. We now have the basics down, so we'll
take a number, such as '1001101', and find it's decimal value.
To start, we'll take the right-most digit and find out what it is multiplied
with. Since it's the right- most digit, it's multiplied with two to the power of
zero. 1x2~0=1. Now, repeat the process, this time with the second right most
digit, which is a 0. 0x2~1=0. Continueing produces: 1x2~2=4, 1x2~3=8, 0x2~4=0,
0x2~5=0, and 1x2~6=64. Summing the results, 1+0+4+8+0+0+64=77. So 77 is the
decimal value of the binary number 1001101.
If you want to practice some, just make strings of 0's and 1's and do what we
did above.
Conversion from decimal to binary is a little more complex. Suppose we take a
decimal number, 35. To convert, we do a series of steps.
1> Divide the number by two, and put the remainder aside.
2> Replace the dividend with the quotient.
3> Repeat step 1 & 2 until the number reaches zero.
4> Take the remainders and place them in a row, the first is right-most, the
last is left-most.
And that's it. To demostrate, we'll convert 35 to binary.
0 R=1 -------
--- !
2) 1 R=0 !
--- !
2) 2 R=0 !
--- v
2) 4 R=0 100011
--- ~
2) 8 R=1 !
--- !
2) 17 R=1 ------------
---
2) 35
There. Quite simple. The diagram would look somewhat better on paper, but this
will have to do in the mean while.
Hexadecimal
-----------
'Hex', as it is affectionately called by in most computerese dialects, is
nothing more than a base sixteen number system. Let's go through some basics.
It has 16 digits. These digits are the numbers 0-9, and the letters A-F. The
reason why the letters are included is because there aren't enough numbers.
Let's take a number, $4A. Note that when you see a '