Leanpub Header

Skip to main content
Go to Leanpub.comLeanpub Store Events Authors Readers Organizations Services

Assembly Arithmetic Algorithms-Linux

32-bit Linux Edition

This book is 85% completeLast updated on 2026年07月02日
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...
This book is 85% completeLast updated on 2026年07月02日
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...

Minimum price

5ドル.00

10ドル.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About
  1. About
  2. Author
  3. Launch
  4. Clips
  5. Contents
Assembly Arithmetic Algorithms-Linux

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 a Creative Writing graduate from Full Sail University with self-taught computer programming and graphic design skills. 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.

Launch

Launch Video

Subscribe on YouTube

Clips

Clips

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. Signed Number Jumps Table
  10. push/pop
  11. 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

Chapter 9: Numbers and Strings

  1. Why is this important?
  2. strint function
  3. FASM Add Arguments

Chapter 10: Stack Based Calculator

  1. FASM chastack
  2. chastelib32.asm

Chapter 11 A Note on Portability

  1. Difference between 32 and 64 bit modes
  2. Converting 32 to 64 bit mode
  3. Chastity’s Linux System Call Table
  4. 32-bit Intel System Calls for Linux
  5. 64-bit Intel System Calls for Linux
  6. Actual Conversion Example
  7. FASM chastack 64-bit
  8. chastelib64.asm
  9. Pros and Cons of Conversion to 64 Bits

Chapter 12: The Lseek System Call

  1. FASM cat upper
  2. How it works
  3. File Open Modes and Security

Chapter 13 chastext

  1. FASM chastext
  2. seashell.txt
  3. chastext test script
  4. How does chastext work?
  5. Fun Fact About Chastext

Chapter 14: Customizing the Linux PATH

  1. What is the PATH?
  2. Why did you choose .bin instead of bin?
  3. A Note to Windows Users
  4. Why is the PATH so important?
  5. The Core Four Assembly Programs

Chapter 15: chastecmp

  1. FASM chastecmp source
  2. How to use chastecmp
  3. How does chastecmp work?
  4. But why should I care?

Chapter 16: chastehex

  1. FASM chastehex
  2. dump mode
  3. peek mode
  4. poke mode
  5. But what does it all mean?

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.

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

AltStyle によって変換されたページ (->オリジナル) /