rplantz
Posts: 77
Joined: Sun Jul 01, 2012 2:38 am

Free assembly language book available online

Fri Sep 09, 2016 6:36 pm

My college-level textbook, Introduction to Computer Organization: ARM Assembly Language Using the Raspberry Pi, is ready for use at http://bob.cs.sonoma.edu. It is being used in the classroom for the first time this semester (Fall 2016) at Sonoma State University and Santa Rosa Jr. College.

All the programming is done with GNU tools already installed with Raspbian. Using my RPi 3, I can read the book with Epiphany while programming in a Terminal window.

I used MathBook XML to author the book. It is still undergoing development, so some of the formatting will change as I bring the early chapters up to the newer standards.

Comments are very welcome, especially any errors that you see.

User avatar
fos
Posts: 104
Joined: Wed Nov 16, 2011 1:48 am
Location: Texas & Kansas, United States
Contact: Website

Re: Free assembly language book available online

Tue Sep 13, 2016 11:48 pm

Thank you for sharing. I will download, give it a try and comment.

Jeff
https://faroutscience.com

RudyB
Posts: 35
Joined: Thu Apr 05, 2012 5:58 am

Re: Free assembly language book available online

Mon Oct 10, 2016 1:02 pm

is this book still up for download.
Can't seem to connect to this site for a few days now.
Maybe the book can be downloaded anywhere else?

regards

rplantz
Posts: 77
Joined: Sun Jul 01, 2012 2:38 am

Re: Free assembly language book available online

Mon Oct 10, 2016 2:54 pm

That's odd, I just clicked on the link (Chrome, Windows 10) and it opened right away. Have you tried typing in the url by hand? I used Chromium on my RPi3 (running PIXEL) to open the site last night.

The book is in HTML, created by Mathbook XML (https://mathbook.pugetsound.edu/), so is not downloadable. It is online. It is being used in the classroom this semester, which will provide me some feedback. I anticipate some changes, after which I plan to create a paperback version. This should be available early next year.

User avatar
scruss
Posts: 4493
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Free assembly language book available online

Mon Oct 10, 2016 3:43 pm

Thanks, Bob. The Mathbook presentation looks pretty good in Chromium on a Raspberry Pi 3 — a lot like O'Reilly's Safari Books Online.

I was just wondering about learning ARM assembly (I was all about the Z80 three decades ago …) and your book looks like a great place to start.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

rplantz
Posts: 77
Joined: Sun Jul 01, 2012 2:38 am

Re: Free assembly language book available online

Mon Oct 10, 2016 6:42 pm

Thank you for the kind words, scruss. I hope that the book does provide a good place to start learning about the ARM for people like you. I imagine you will skim over the first part of the book, until you get to the assembly language programming. Then when I describe the instructions, I use notation that is similar to the ARM manuals. I'm hoping this makes it easier for readers to use the manuals to extend their expertise.

And please let me know if you encounter any errors in the book.

--Bob

ejolson
Posts: 8631
Joined: Tue Mar 18, 2014 11:47 am

Re: Free assembly language book available online

Mon Oct 10, 2016 8:44 pm

rplantz wrote:I hope that the book does provide a good place to start learning about the ARM for people like you. I imagine you will skim over the first part of the book, until you get to the assembly language programming. Then when I describe the instructions, I use notation that is similar to the ARM manuals. I'm hoping this makes it easier for readers to use the manuals to extend their expertise.
It looks like a nice book. I like how it leverages previous C experience and find this reasonable because mixing assembly with C is probably more common than with other languages.

Your book seems related to the topic whether there is any use of teaching assembly language. Unfortunately, that thread was was recently locked. Such longer threads often get linked by search engines, so it is useful to update them even if they are old. For example, it would have been nice to put a link from that thread to this one so people who found that thread would know about this one.

The first book I read on programming was Introduction to Programming. That book starts out with an entire chapter on logic and octal arithmetic before discussing assembly language. For obvious reasons no prior high-level programming knowledge was assumed. At any rate learning a little assembly has provided me with a certain intuition regarding how computer hardware works that has served well.

RudyB
Posts: 35
Joined: Thu Apr 05, 2012 5:58 am

Re: Free assembly language book available online

Tue Oct 11, 2016 5:09 am

rplantz wrote:That's odd, I just clicked on the link (Chrome, Windows 10) and it opened right away. Have you tried typing in the url by hand? I used Chromium on my RPi3 (running PIXEL) to open the site last night.
.
Thank you. I just checked on a different internetprovider and there the page loads without problems.
Very strange, using my DSL connection, no connection. Using my fiber connection and the page loads.

By the way, great reading this material.

cirosantilli
Posts: 1
Joined: Sun Jul 22, 2018 7:23 am
Contact: Website

Re: Free assembly language book available online

Sun Jul 22, 2018 7:26 am

I am working on: https://github.com/cirosantilli/arm-assembly-cheat

Features:

- covers both ARMv7 and ARMv8
- the exact same assembly also works on QEMU, so you can try stuff out faster on your host before going native
- good GDB setup out of the box, both on host and native
- has asserts that show the assembly line number where things failed
- uses the C standard library for IO, which makes it OS portable in theory, and allows to easily reuse goodies like `printf` and `memcpy`

carlsmith
Posts: 3
Joined: Sun Aug 26, 2018 9:52 pm

Re: Free assembly language book available online

Thu Sep 20, 2018 9:44 pm

Hi Robert. I was going to study Introduction to Computer Organization: ARM Assembly Language Using the Raspberry Pi, but the restrictive license put me off.

I always typeset the textbooks I study so they render perfectly on my ebook reader (with grayscale syntax highlighting and navigation that takes advantage of the hardware), and will edit stuff and add a kind of marginalia over time. My ebook reader is over ten years old, so I rarely share anything I make for it, but the work is part of the learning process for me, even if only five people ever read it.

A GPL style license would be awesome.

rplantz
Posts: 77
Joined: Sun Jul 01, 2012 2:38 am

Re: Free assembly language book available online

Fri Sep 21, 2018 3:31 am

I'm sorry that the book does not meet your needs. I have some contractual agreements regarding use of the material, so there isn't much I can do at this time. The contract does allow me to maintain a free copy online, but I cannot share the source. As stated on my website, I am retired, so all the work I put into the book was on my own time.

ichibrosan
Posts: 6
Joined: Fri May 24, 2019 7:34 am

Re: Free assembly language book available online

Fri May 24, 2019 7:38 am

I think it was a very generous thing to do to publish the book on the web for free.

I am unemployed and trying to learn this material in order to become more viable as an employee.

Not everyone can afford to buy books, and the freedom to read them for free is a major boon for which I am grateful.

Thanks, Douglas
---
Douglas Goodall
Software Engineer

User avatar
kennyc
Posts: 75
Joined: Mon Jul 15, 2019 9:26 am

Re: Free assembly language book available online

Sun Jul 28, 2019 12:29 am

rplantz wrote:
Fri Sep 21, 2018 3:31 am
I'm sorry that the book does not meet your needs. I have some contractual agreements regarding use of the material, so there isn't much I can do at this time. The contract does allow me to maintain a free copy online, but I cannot share the source. As stated on my website, I am retired, so all the work I put into the book was on my own time.
Excellent and Good for You! Thank You!
Kenny A. Chaffin
Blog: http://mansionsofthemind.blogspot.com/
Art: https://www.deviantart.com/kennyc
"Strive on with Awareness" - Siddhartha Gautama

User avatar
DougieLawson
Posts: 41900
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Free assembly language book available online

Sun Jul 28, 2019 8:13 am

rplantz wrote:
Fri Sep 21, 2018 3:31 am
I'm sorry that the book does not meet your needs. I have some contractual agreements regarding use of the material, so there isn't much I can do at this time. The contract does allow me to maintain a free copy online, but I cannot share the source. As stated on my website, I am retired, so all the work I put into the book was on my own time.
This saddens me. You've provided an excellent resource for free and someone had to complain about it.

I've not done much with assembler on my RPis but found the arcane incantations in your book useful to get the as & gcc stuff running.

ARM assembly language is close enough to IBM's S/370 to be familiar territory for me.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on Twitter/LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

aoeuidhtn
Posts: 39
Joined: Sat Jun 13, 2015 10:27 pm
Location: Warsaw, Poland

Re: Free assembly language book available online

Sat Mar 28, 2020 10:15 pm

@rplantz

1. In http://bob.cs.sonoma.edu/IntroCompOrg-RPi/sec-mem.html
Computer scientists typically express the address of each byte in
memory in hexadecimal. So we would say that the 957th byte is at
address 3bc
Do you mean 956 or 0x3bd because 957 != 0x3bc?

2. In http://bob.cs.sonoma.edu/IntroCompOrg-RPi/sec-gdb2.html
And we see that the pc has incremented from 0x104b0 to 0x104b0
Do you mean from 'from 0x104b0 to 0x104d0'?
Last edited by aoeuidhtn on Sat Mar 28, 2020 10:52 pm, edited 1 time in total.

User avatar
DougieLawson
Posts: 41900
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Free assembly language book available online

Sat Mar 28, 2020 10:39 pm

aoeuidhtn wrote:
Sat Mar 28, 2020 10:15 pm
@rplantz

1. In http://bob.cs.sonoma.edu/IntroCompOrg-RPi/sec-mem.html
Computer scientists typically express the address of each byte in
memory in hexadecimal. So we would say that the 957th byte is at
address 3bc
Do you 956 or 0x3bd because 957 != 0x3bc?

2. In http://bob.cs.sonoma.edu/IntroCompOrg-RPi/sec-gdb2.html
And we see that the pc has incremented from 0x104b0 to 0x104b0
Do you mean from 'from 0x104b0 to 0x104d0'?
We count from zero in assembler. It's the COBOL wonks who count from 1.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on Twitter/LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

aoeuidhtn
Posts: 39
Joined: Sat Jun 13, 2015 10:27 pm
Location: Warsaw, Poland

Re: Free assembly language book available online

Sat Mar 28, 2020 10:51 pm

Which question have you answered - 1st or 2nd? Or both?

User avatar
DougieLawson
Posts: 41900
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Free assembly language book available online

Sat Mar 28, 2020 11:25 pm

aoeuidhtn wrote:
Sat Mar 28, 2020 10:51 pm
Which question have you answered - 1st or 2nd? Or both?
1st.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on Twitter/LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

aoeuidhtn
Posts: 39
Joined: Sat Jun 13, 2015 10:27 pm
Location: Warsaw, Poland

Re: Free assembly language book available online

Sat Mar 28, 2020 11:40 pm

DougieLawson wrote:
Sat Mar 28, 2020 11:25 pm
aoeuidhtn wrote:
Sat Mar 28, 2020 10:51 pm
Which question have you answered - 1st or 2nd? Or both?
1st.
ok
DougieLawson wrote: We count from zero in assembler. It's the COBOL wonks who count from 1.
Not only in assembly but also in C which is still a very popular language (unfortunately). Your answer, however, doesn't answer my question. Why would Robert count from 0 in hex but from 1 in dec?

User avatar
DougieLawson
Posts: 41900
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Free assembly language book available online

Sun Mar 29, 2020 12:49 am

Perhaps it's something that needs to have an errata published for it.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on Twitter/LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
rpdom
Posts: 19284
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Free assembly language book available online

Sun Mar 29, 2020 10:25 am

aoeuidhtn wrote:
Sat Mar 28, 2020 11:40 pm
Why would Robert count from 0 in hex but from 1 in dec?
Because the 1st byte is in memory location (or offset) 0x0000. 2nd byte is at 0x0001, etc and "957th byte is at address 3bc".
Unreadable squiggle

aoeuidhtn
Posts: 39
Joined: Sat Jun 13, 2015 10:27 pm
Location: Warsaw, Poland

Re: Free assembly language book available online

Sun Mar 29, 2020 5:58 pm

rpdom wrote:
Sun Mar 29, 2020 10:25 am
aoeuidhtn wrote:
Sat Mar 28, 2020 11:40 pm
Why would Robert count from 0 in hex but from 1 in dec?
Because the 1st byte is in memory location (or offset) 0x0000. 2nd byte is at 0x0001, etc and "957th byte is at address 3bc".
OK, that would be an explanation but it's still confusing to me to say `1st` instead of `0th` in this context.

One more question to Robert:

3. In solution to 5th exercise here http://bob.cs.sonoma.edu/IntroCompOrg-R ... es-18.html it says:

Code: Select all

printf("Enter a non-zero integer: ");
scanf("%i", &x);
As buffered stdout is used and there is no newline at the end the "Enter a non-zero integer" string isn't shown until user presses Enter on some systems. For example on MIPS-based OpenWRT system with uClibc:

Code: Select all

~ $ /tmp/a.out
12
Enter a non-zero integer: You entered 0x0000000c and it is stored
   0x7fe50fcc: 00
   0x7fe50fcd: 00
   0x7fe50fce: 00
   0x7fe50fcf: 0c
which is big endian.

aoeuidhtn
Posts: 39
Joined: Sat Jun 13, 2015 10:27 pm
Location: Warsaw, Poland

Re: Free assembly language book available online

Fri Apr 03, 2020 6:56 pm

ok, one more question:

4. At the end http://bob.cs.sonoma.edu/IntroCompOrg-R ... anage.html it says:

Code: Select all

(gdb) x/4xw 0x7efff5f8
0x7eff19f8:	0x00000000	0x76e7f294	0x76fa3000	0x7efff754
You know it's wrong just by looking at it because another address is used in the command than is shown. IMO it should be:

Code: Select all

(gdb) x/4xw 0x7efff1a0
because sp is 0x7efff1a0 and it should print:

Code: Select all

0x76fa0000	0x7efff2f4 ...
because these values were shown in the previous x/4xw after then current values of sp.

aoeuidhtn
Posts: 39
Joined: Sat Jun 13, 2015 10:27 pm
Location: Warsaw, Poland

Re: Free assembly language book available online

Mon Apr 06, 2020 5:36 pm

one more question:

5. At http://bob.cs.sonoma.edu/IntroCompOrg-R ... stack.html descriptions do not match listing. For example, it says

Code: Select all

equ    locals,8
but

Code: Select all

.equ    local,8
in listing 10.5.2 or

Code: Select all

stmfd   sp!, {fp, lr}   @ save caller's info
but there is no such line in the listing.

aoeuidhtn
Posts: 39
Joined: Sat Jun 13, 2015 10:27 pm
Location: Warsaw, Poland

Re: Free assembly language book available online

Mon Apr 06, 2020 6:40 pm

6. In http://bob.cs.sonoma.edu/IntroCompOrg-R ... stack.html it says:
Referring to Figure 10.5.4, subtracting n from the address in the stack pointer will place it so it now points at the registers we saved so they can be restored. At this point, the values “above” the stack pointer are considered invalid, and thus, deallocated."
Don't you mean "adding n to the address"? The code snippet also uses add:

Code: Select all

add     sp, sp, local   @ deallocate local var

Return to “Teaching and learning resources”