Kick off your book project in 3 hours! Live workshop on Zoom. You’ll leave with a real book project, progress on your first chapter, and a clear plan to keep going. Saturday, June 6, 2026. Learn more…

Leanpub Header

Skip to main content

Assembly Arithmetic Algorithms-Linux

32-bit Linux Edition

This book is 33% completeLast updated on 2026-06-07

Personally, I think that the Assembly system of conditional jumps makes a lot of sense. Other programming languages such as BASIC and C have "goto" statements that work like this. For example, `if(eax<ebx){goto less;}`.

Modern programming languages tend to discourage the use of goto or not allow it at all. However, these languages still use jumps I have described in this section because it is required by the hardware. Both "if" and "while" statements are written by using the conditional jump statements most relevant to what you are trying to do.

The only thing I have found difficult about jumps in assembly is remembering which acronym means which condition. However, since I created the chart in this chapter, now I can refer to it, and you can too! As long as I keep these six main types of conditions in my head and am working with unsigned numbers, I can write almost any assembly program from scratch.

Minimum price

$5.00

$10.00

You pay

Author earns

$
PDF
EPUB
About

About

About the Book

This book is meant for both new programmers who want to know more about how computers work and also experienced programmers who want a little bit more control over their programs than C or C++ compilers allow. All programs in this book are written for the Linux Operating System on Intel machines. There are some C programs included to aid in understanding what the Assembly programs do. If you enjoyed the DOS edition of this book, which was previously published, then you will probably like this one even more, especially if the Software Freedom and Privacy that Linux provides is important to you.

This book is not just a rewrite of the DOS book. Most of it is written from scratch with a special focus on the POSIX System Calls known as exit, read, write, open, close, and lseek. Learning these calls can allow you to write almost any Linux console application. Even if you don't become an Assembly master, you can still use much of the same information and efficiency when writing code in higher-level languages after coming back with a greater understanding of pointers, conditional loops, and numbers in bases like Binary, Hexadecimal, and Octal.

Right now, this book is still a work in progress, but those who purchase it now will still have access to future updates, and I also ask them to give me feedback on things they would like me to include. I fight for the users and wish to empower people to write the smallest and fastest command-line utilities possible.

Author

About the Author

Chastity White Rose

Chastity White Rose is an author of over twelve books and two WordPress blogs. She writes humorous and educational content about philosophical and religious topics. She also uses her writing and graphic design skills to teach people about the game of Chess. She is earning an associate’s degree in creative writing at Full Sail University. As a transgender Christian woman, she writes books and blog posts to help others like her process the seeming disconnect between religious faith and an LGBTQIA+ identity. She measures the success of her writing by its emotional impact rather than its sales. For this reason, most of her writing is available free of charge.

Contents

Table of Contents

Assembly Arithmetic Algorithms

Preface

Introduction

  1. Required Knowledge
  2. Low Level
  3. Why Linux?

Chapter 1: The First Program

  1. Assemble with FASM
  2. makefile for FASM users
  3. Assemble with NASM
  4. Interrupt FAQ
  5. The General Purpose Registers

Chapter 2: Assembler Choices

  1. chaste-elf-32.nasm
  2. main.asm
  3. NASM makefile
  4. GNU Assembler
  5. main.s
  6. GAS makefile

Chapter 3: Linux System Calls

  1. C Hello World with Write System Call
  2. FASM Hello World with Write System Call

Chapter 4: putstring

  1. C unistd putstring
  2. C stdlib putstring
  3. Assembly putstring
  4. Pointers vs Integers

Chapter 5: intstr and putint

  1. C putint
  2. FASM putint
  3. Side rant on condition jumps
  4. How the intstr function works
  5. Digit Character Table

Chapter 6: Chastity’s Intel Assembly Reference

  1. mov
  2. add
  3. sub
  4. mul
  5. div
  6. cmp
  7. jmp
  8. Conditional Jumps Table
  9. push/pop
  10. Take it slow

Chapter 7: Open and Close System Calls

  1. FASM Create a New File
  2. Syscall Reference
  3. FASM Open Existing File

Chapter 8: User Input

  1. FASM Keyboard Input
  2. FASM Command Line Arguments
  3. What is a Command Line Argument?
  4. Arguments vs Keyboard Input

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub