Errata: Raspberry Pi Assembly Language Raspbian

If you think that you’ve found an error in this book, please let us know about it. You will find any confirmed erratum below, so you can check if your concern has already been addressed.

The current active edition of this book is: Third Edition July 2016 [0003]. Please check the folio / copyright page at the start of your book to ascertain which edition you have.

Second Edition May 2014 [0002] – Print and eBook

>>Tony Palmer’s Errata File

Tony Palmer has written to say how much he enjoyed the book, and as a long-time developer he had noted any errors, inconsistency’s and typos as he went. Above and beyond the call of duty I am indebted to Tony for providing these a text file. Rather than print his (comprehensive) list here Tony has agreed to let me make it available as a simple text file to download. So click the ‘Tony’s Errata V2’ link below and save the file.

Tony has tested all the programs on  Pi 1 Model B and a Pi 2 Model B.   Tony has also included some updated program files for the Chapter 25 (floating point processor) as these need a slight modification to run on the Pi 2  – the code in the book for this chapter only works for a Pi 1 as printed.  The “Pi 2”  uses the BCM2836 which has a different GPIO Base (0x20200000 for  the Pi 1 versus 0x3F200000 for the Pi 2).  More details in Tony’s file which shows the changes needed. Here are the links – note the program files are saved as text files so you will need to reserve them as source files using the ‘.s’ postfix:

Tonys Errata V2   gpio22off   prog21f   prog25a   prog23b

>>Chapter 5 Setting Flags

The first paragraph has ‘CPN (ComPare Negative)’  it should read ‘CMN (CoMpare Negative). This also needs correcting a few paragraphs on (CPN to read CMN). Thanks to Steve for finding this one.

>>Chapter 6 Compare Instructions

The penultimate example reads: CMN R0,#0 and should read: CMN R0,#1

>>Chapter 7 Reading From The Keyboard

In the text towards the end of the chapter it states: “123345 having overwritten ‘Hello’”. It should be ‘12345’ – the ‘3’ has been repeated.

>> Chapter 9 LS Lower Than or Same (Unsigned)

Reads Z- 1, should be Z=1 in the minor title. Thanks to Grimble Gromble for pointing these out.  (GG : I have replied several times to you but I don’ think my emails are getting past your spam filter…)

>>Chapter 7 Reading From The Keyboard

The comment in the read: section of Program 7b should read: “stdin is keyboard” and not “stdout is monitor”. And in the comment for LDR R1,=string it should read: “string is located at string:”

>>Chapter 8 ORR to Convert Character Case

The comment in the read: section of Program 8a should read: “stdin is keyboard” and not “stdout is monitor”. The comments also suggest that the action is toggling the character case, probably poor choice of word on my behalf – the case is being changed would be more correct. Thanks to Dave Woodcock for pointing these out.

>>Chapter 12 UMULL Command. Smarter Numbers, section: Long Multiplication.

The code reads: UMULL R3, R4, R1, R1 It should read:   UMULL R3, R4, R1, R2. Thanks to Peter Gostanian for pointing this out.

>>Chapter 22 VSUB and VMUL Examples

VSUB.F64 D0,D2,D4 @Sub D0=D4- D2, the comment should read:  @Sub D0=D2- D4

VMUL.F32 S2,S4,S1 @Multiply S2- S4*D1, the comment should read: @Multiply S2=S4*S1

Thanks to Jim Deering for pointing these out.

First Edition August 2013 [0001] – Print and eBook

(These errors have all been corrected for the Second Edition.)

>> Chapter 3 VIM Editor

If you are running Debian then the Vim text editor I suggest you install in Chapter 3 is already packaged as part of the Debian distro so there is no need to go through that process.

>>Chapter 25 Label Errors

Thanks to the spell check feature on the typesetting software one error has been noted in Programs 25a and 25b (Chapter 25). The label: ‘open:’ near the start of both program listings, should  read: ‘openfile:’

The labels are not required and can be deleted if you prefer, they are in place to break the listing up into its component parts. As is the program will just enter a continuous loop. The files that you can download from here work correctly.

>> Chapter 25 LSR should be LSL

In the same chapter the listing segments in the ‘Building The Code’ (pages 222 and 223 in the print version) section contain:  MOV R2, R4, LSR #21

In two places. The LSR should be LSL in both places: MOV R2, R4, LSL #21

>> (Print version of book, page 35): Prog 3c

The line: .global part2

Should read: .global _part2

Thanks to John Willis for spotting that missing underscore.

>> Chapter 6  Move Instructions (Page 67 in book)

There are three examples of the MVN instruction. The middle instruction in the book reads MNV and should be MVN.

>>Chapter 8  TEQ instruction (Page 83 in book).

The example given for TEQ near the top of the page is wrong. It should read:

TEQ R0, R1 @ Test is R0 and R1 are the same.

Use the TEQ instruction to test if two values are equal, without affecting the V or C flags (as CMP does)

>> Chapter 15 Figure 15a (Page 131 in book).

The disassembly of the first instruction line should read:

0x8054   <_start>:     add r0, pc, #8

Thanks to Ron Saunders for pointing these out.

>> Chapter 20  Program 20a Description.

(Print version of book, page 170>): Prog 20a. The text talks about line numbers that are not provided in the program list. Easiest thing to do is load the program into Vim and turn line numbering on if you don’t want to mark them lightly in pencil on the page. Thanks to Rick Comeau for spotting that.

eBook Only

Thanks to Don Wunz for pointing out that the super scripts are not showing properly with the text in some places. For example, the text following Figure 4b shows 27 rather than 2 to the 7th power.

Last Updated: Sept 11 2015