GithubHelp home page GithubHelp logo

prankapo / asm_book Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pkivolowitz/asm_book

0.0 0.0 0.0 12.65 MB

A book teaching assembly language programming on the ARM 64 bit ISA. Along the way, good programming practices and insights into code development are offer which apply directly to higher level languages.

C++ 11.52% C 9.25% Assembly 79.23%

asm_book's Introduction

Assembly Language Programming Made Not So Scary

This text book provides a fairly thorough examination of the ARM V8 ISA (Instruction Set Architecture). It begins from the perspective of a person knowledgeable in the C or C++ programming languages (or similar languages, of which there are many). Early chapters bridge your knowledge of C or C++ backwards into assembly language driving home a very sharp point: C is a high level assembly language. Further, assembly language is nothing to be scared about.

For Whom Is This Book Intended?

As mentioned, if you are already familiar with C or any language descended from C, this book begins with what you know. Later chapters dive 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.

Can This Book Be Used In Courses Covering Assembly Language?

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 sadistic and 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 far 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.

Calling Convention Used In This Book

Assembly language programming is quite closely intertwined with both the underlying hardware architecture and the host operating system. A "calling convention" refers to how functions are called and how parameters are passed. In this book we will use the ARM LINUX conventions. This means:

  • You will need to run a ARM Linux VM on the Macintosh - even on ARM-based Macs. Why? Apple. That's why.
  • You will need to run WSL (Windows Subsystem for Linux) on ARM-based Windows machines.
  • You will need to run an ARM Linux VM on x86-based Windows machines.

A Lot of Names

As commendable as the ARM designs are, ARM's naming conventions for their Intellectual Properties are horrid. In this book, AARCH64 and ARM V8 are taken to be synonyms for the 64 bit ARM Instruction Set Architecture (ISA).

Section 1 - Bridging from C / C++ to Assembly Language

Chapter Content
1 Hello World
2 If Statements
3 Loops
.... a .... While Loops
.... b .... For Loops
.... c .... Implementing Continue
.... d .... Implementing Break
4 Interludes
.... a .... Registers
.... b .... Load and Store
.... c .... More About ldr
.... d .... Register Sizes
5 Functions
.... a .... Calling and Returning
.... b .... Passing Parameters
6 FizzBuzz - a Complete Program
7 Structs
.... a .... Alignment
.... b .... Defining
.... c .... Using
8 const
9 Casting

Section 2 - Floating Point

Chapter Content
10 Floating Point
.... a .... What Are Floating Point Numbers?
.... b .... Registers (simplified)
.... c .... Literals
.... d .... fmov Not Yet Written
.... e .... Conversion To / From Integers
.... f .... Four Basic Operations Not Yet Written
.... g .... Selected Additional Operations Not Yet Written
.... z .... Half Precision Floats

Section 3 - Bit Manipulation

Chapter Content
11 Bit Fields
.... a .... Without Bit Fields
.... b .... With Bit Fields
.... c .... Review of Newly Described Instructions

Section 3 - More Stuff

Chapter Content
--- Determing string length for C functions

Projects

Here are some project specifications to offer a challenge to your growing mastery.

About The Author

Perry Kivolowitz's career in the Computer Sciences spans just under five decades. He launched more than 5 companies, mostly relating to hardware, image processing and visual effects (for motion pictures and television). Perry received Emmy recognition for his work on the The Gathering, the pilot episode of Babylon 5. Later he received an Emmy Award for Engineering along with his colleagues at SilhouetteFX, LLC. SilhouetteFX is used in almost every significant motion picture for rotoscoping, paint, tracking, 2D to 3D reconstruction, compositing and more.

In 1996 Perry received an Academy Award for Scientific and Technical Achievement for his invention of Shape Driven Warping and Morphing. This is the technique responsible for many of the famous effects in Forrest Gump, Titanic and Stargate.

Twenty twenty two marks Perry's 18th year teaching Computer Science at the college level, ten years at the UW Madison and now 8 at Carthage College.

Assembly language is a passion for Perry having worked in the following ISAs:

  • Univac 1100

  • Digital Equipment Corporation PDP-11

  • Digital Equipment Corporation VAX-11

  • Motorola 68000

  • ARM beginning with AARCH64

This work is dedicated to my wife Sara and sons Ian and Evan.

Gratuitous Plug

Perry has created a library of about 200 programming projects suitable for CS 1, CS 2, Data Structures, Networking, Operating Systems and Computer Organization classes. If a publisher of CS text books be interested in purchasing the library, please reach out.

asm_book's People

Contributors

pkivolowitz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.