refactored the main readme and added more projects to that readme

This commit is contained in:
Perry Kivolowitz 2023-01-19 10:23:50 -06:00
parent bf6f2d2160
commit 1af3816bf1
4 changed files with 64 additions and 61 deletions

123
README.md
View file

@ -16,26 +16,16 @@ We drive home a very sharp point:
## For Whom Is This Book Intended? ## For Whom Is This Book Intended?
As mentioned, if you are already familiar with C (or languages descended As mentioned, if you are already familiar with C (or languages descended
from C such as C++), this book begins with what you already know. Later from C such as C++), this book begins with what you already know.
chapters dive more deeply into the corners and recesses of the ARM V8
ISA and are suitable for those wishing to master the rich instruction Later chapters dive more deeply into the corners and recesses of the ARM
V8 ISA and are suitable for those wishing to master the rich instruction
set of the 64 bit ARM processors. set of the 64 bit ARM processors.
## Can This Book Be Used In Courses Covering Assembly Language? ## Can This Book Be Used In Courses Covering Assembly Language?
Yes, absolutely. Yes, absolutely.
In fact, we would argue that the study of assembly language is extremely
important to the building of competent software engineers. Further, we
would argue that teaching the x86 instruction set is cruel as that ISA
was born in the 1970s and has simply gotten more muddled with age.
The MIPS instruction set is another ISA that is often covered in College
level courses. While kinder and gentler than the x86 ISA, the MIPS
processor isn't nearly as relevant as the ARM family. Phones, tablets,
laptops and even desktops contain ARM V8 processors making the study of
the ARM ISA far more topical. Perhaps even more "cool".
## Calling Convention Used In This Book ## Calling Convention Used In This Book
Assembly language programming is quite closely dependent upon the Assembly language programming is quite closely dependent upon the
@ -54,20 +44,19 @@ In this book we will use the ARM LINUX conventions. This means:
machines while the Apple calling convention is specific to Apple machines while the Apple calling convention is specific to Apple
Silicon-based machines. Silicon-based machines.
This necessity for a VM even when running on an Apple Silicon machine This necessity for a VM even when running on an Apple Silicon machine
did not sit well with some on reddit. We listened. did not sit well with some, who made this criticism known. We assessed
this to be a valid and constructive criticism and have responded.
We now have a chapter devoted to bringing Linux and Apple code We now have a chapter devoted to bringing Linux and Apple code
together to the degree possible. together to the degree possible.
[This chapter](./more/apple_silicon/) provides a suite of macros that * The macros are a work in progress. [This link](./macros/) will lead
provide this help. If you're willing to adjust how you code (and use to a current copy of them as well as documentation. Macros that make
the macros), you can successfully write assembly language once and programming a bit easier are also included.
build it on both Linux and Mac OS.
The macros are a work in progress. [This * [This chapter](./more/apple_silicon/) provides some additional
link](./macros/apple-linux-convergence.S) will lead to a current copy information about Apple Silicon assembly language programming.
of them. We will try to keep this file up to date.
* You will need to run WSL (Windows Subsystem for Linux) on ARM-based * You will need to run WSL (Windows Subsystem for Linux) on ARM-based
Windows machines. These do exist! Windows machines. These do exist!
@ -76,18 +65,18 @@ In this book we will use the ARM LINUX conventions. This means:
This is true even if you are on an ARM-based Windows machine as there This is true even if you are on an ARM-based Windows machine as there
are so many differences between a Unix-like environment and Windows. are so many differences between a Unix-like environment and Windows.
You'll notice right away that we make use of the C-runtime directly You'll notice that we make use of the C-runtime directly rather than
rather than make OS service calls. So, for instance, if we want to call make OS system calls. So, for instance, if we want to call `write()`,
`write()`, we call `write` from the assembly language. This version of we call `write` from the assembly language. This version of the system
the system call `write` is a wrapper function built into the C-runtime call `write` is a wrapper function built into the C-runtime (CRT) which
(CRT) handles the lower level details of performing a system call. See the
which handles the lower level details of performing a system call. See the
[here](./more/system_calls/README.md) on what actually happens inside [here](./more/system_calls/README.md) on what actually happens inside
these wrapper functions. these wrapper functions.
The benefit of using the CRT wrappers is that there are details, explained The benefit of using the CRT wrappers is that there are details,
in the chapter, that differ from system to system and architecture to explained in the chapter, that differ from system to system and
architecture even for making the same system call. architecture to architecture even for making the same system call. The
CRT hides these differences.
## A Lot of Names ## A Lot of Names
@ -107,22 +96,32 @@ is a link to "a" main instruction set page.
## What you need to work with assembly language on Linux ## What you need to work with assembly language on Linux
Getting the tools for assembly language development is quite Getting the tools for assembly language development is quite straight
straight forward - perhaps you already have them. Using `apt` from forward - perhaps you already have them. Using `apt` from the Linux
the Linux terminal, say: terminal, say:
```text ```text
sudo apt update sudo apt update
sudo apt install build-essential gdb sudo apt install build-essential gdb
``` ```
On the Macintosh type:
`xcode-select --install`
into a terminal and follow directions. Note that `gdb` is replaced by
`lldb` with just enough differences to make you cry.
Then you'll need your favorite editor. We currently use `vi` for quick Then you'll need your favorite editor. We currently use `vi` for quick
edits and Visual Studio Code for any heavy lifting. edits and Visual Studio Code for any heavy lifting.
## How to build an assembly language ## How to build an assembly language
We use `gcc`, the C "compiler". `g++` could also be used. What sense We use `gcc`, the C "compiler". `g++` could also be used. On the Mac,
does that make... using the "compiler" to "compile" assembly language? `clang` can also be used.
What sense does that make... using the "compiler" to "compile" assembly
language?
Well, to answer that one must understand that the word "compiler" refers Well, to answer that one must understand that the word "compiler" refers
to only one step in a build sequence. What we talk about as being the to only one step in a build sequence. What we talk about as being the
@ -154,13 +153,13 @@ the above steps with other benefits such as automatically linking in
the C runtime. the C runtime.
Suppose you've implemented `main()` in a C file (main.c) and want to Suppose you've implemented `main()` in a C file (main.c) and want to
call out to an assembly language file you have written (asm.s). It can make use of an assembly language file you have written (asm.S). It can
be done in several ways. be done in several ways.
### All at once ### All at once
```text ```text
gcc main.c asm.s gcc main.c asm.S
``` ```
That's all you need for a minimal build. The resulting program will be That's all you need for a minimal build. The resulting program will be
@ -171,7 +170,7 @@ removed.
```text ```text
gcc -c main.c gcc -c main.c
gcc -c asm.s gcc -c asm.S
gcc main.o asm.o gcc main.o asm.o
``` ```
@ -184,13 +183,13 @@ Suppose `main()` is implemented in assembly language and `main.s` is
self-contained, then simply: self-contained, then simply:
```text ```text
gcc main.s gcc main.S
``` ```
Often, you will want to enable the debugger `gdb`. Do this: Often, you will want to enable the debugger `gdb` or `lldb`. Do this:
```text ```text
gcc -g main.s gcc -g main.S
``` ```
### The C Pre-Processor ### The C Pre-Processor
@ -207,13 +206,11 @@ Will not go through the C pre-processor but
will. will.
See the [Apple Silicon](./more/apple_silicon/README.md) chapter for
more information.
### Programs called by the "Compiler" ### Programs called by the "Compiler"
Using gcc to "compile" a program causes the following to be called To drive home the point that the "compiler" is an umbrella, using gcc to
on Ubuntu running on ARM: "compile" a program causes the following to be called on Ubuntu running
on ARM:
```text ```text
/usr/bin/cpp /usr/bin/cpp
@ -306,6 +303,10 @@ What would a book about assembly language be without bit bashing?
| --- | [Apple Silicon](./more/apple_silicon/README.md) | [Link](./more/apple_silicon/README.pdf) | | --- | [Apple Silicon](./more/apple_silicon/README.md) | [Link](./more/apple_silicon/README.pdf) |
| --- | [Apple / Linux Convergence](./macros) | [Link](./macros/README.pdf) | | --- | [Apple / Linux Convergence](./macros) | [Link](./macros/README.pdf) |
## Macro Suite
As mentioned above, the macro suite [can be found here](./macros/).
## Projects ## Projects
[Here](./projects/README.md) are some project specifications to offer a [Here](./projects/README.md) are some project specifications to offer a
@ -340,11 +341,10 @@ decades. He launched more than 5 companies, mostly relating to hardware,
image processing and visual effects (for motion pictures and image processing and visual effects (for motion pictures and
television). Perry received Emmy recognition for his work on the The television). Perry received Emmy recognition for his work on the The
Gathering, the pilot episode of Babylon 5. Later he received an Emmy Gathering, the pilot episode of Babylon 5. Later he received an Emmy
Award for Engineering along with his colleagues at Award for Engineering along with his colleagues at [SilhouetteFX,
[SilhouetteFX, LLC](https://en.wikipedia.org/wiki/SilhouetteFX). LLC](https://en.wikipedia.org/wiki/SilhouetteFX). SilhouetteFX is used
SilhouetteFX is used in almost every significant motion picture for in almost every significant motion picture for rotoscoping, paint,
rotoscoping, paint, tracking, 2D to 3D reconstruction, compositing and tracking, 2D to 3D reconstruction, compositing and more.
more.
In 1996 Perry received an [Academy Award for Scientific and In 1996 Perry received an [Academy Award for Scientific and
Technical Achievement](https://en.wikipedia.org/wiki/Academy_Award_for_Technical_Achievement) Technical Achievement](https://en.wikipedia.org/wiki/Academy_Award_for_Technical_Achievement)
@ -352,9 +352,9 @@ for his invention of Shape Driven Warping and
Morphing. This is the technique responsible for many of the Morphing. This is the technique responsible for many of the
famous effects in Forrest Gump, Titanic and Stargate. famous effects in Forrest Gump, Titanic and Stargate.
Twenty twenty two marks Perry's 18th year teaching Computer Twenty twenty three marks Perry's 19th year teaching Computer Science at
Science at the college level, the college level, ten years at the UW Madison and now 8+ at Carthage
ten years at the UW Madison and now 8 at Carthage College. College.
Assembly language is a passion for Perry having worked in the following Assembly language is a passion for Perry having worked in the following
ISAs: ISAs:
@ -379,10 +379,11 @@ Systems and Computer Organization classes. If a publisher of
CS text books be interested in purchasing the library, please CS text books be interested in purchasing the library, please
reach out. reach out.
Also, check out [Get Off My L@wn](https://www.amazon.com/Get-Off-My-Zombie-Novel-ebook/dp/B00DQ26J8G), a Zombie novel for Also, check out [Get Off My
coders. You read that right... elite programmer Doug Handsman retires L@wn](https://www.amazon.com/Get-Off-My-Zombie-Novel-ebook/dp/B00DQ26J8G),
to his wife Ruth Ann's native northern Wisconsin. And then, well, the a Zombie novel for coders. You read that right... elite programmer Doug
apocalypse happens. Bummer. Handsman retires to his wife Ruth Ann's native northern Wisconsin. And
then, well, the apocalypse happens. Bummer.
Rated 4.3 out of 5 with more than 70 reviews, it's a fun read and costs Rated 4.3 out of 5 with more than 70 reviews, it's a fun read and costs
next to nothing. next to nothing.

Binary file not shown.

View file

@ -5,6 +5,8 @@ Here are a number of challenges for you to flex your new found knowledge.
| Name | Challenge | | Name | Challenge |
| ---- | --------- | | ---- | --------- |
| [DIRENT](./DIRENT/README.md) | Read Directory Entries to extract information about files. | | [DIRENT](./DIRENT/README.md) | Read Directory Entries to extract information about files. |
| [FIRST](./first_project/README.md) | A good first project. |
| [FIZZBUZZ](../section_1/fizzbuzz/) | The interview question. A video is also provided. |
| [PI](./PI/README.md) | Compute an approximation of PI using stochastic (random) methods. | | [PI](./PI/README.md) | Compute an approximation of PI using stochastic (random) methods. |
| [SNOW](./snow/README.md) | A fun little animation. | | [SNOW](./snow/README.md) | A fun little animation. |
| [WALKIES](./walkies/README.md) | A fun little animation. | | [WALKIES](./walkies/README.md) | A fun little animation. |

Binary file not shown.