Raspberry Pi Assembly Language RISC OS

Posted on February 1, 2015

“Information well presented, I am a fan of RISC OS. Bruce has a very readable style of writing.”

Raspberry Pi Assembly Language RISC OS is a Hands-On-Guide to learning to program ARM assembly language on the Raspberry Pi using the RISC operating system.

The book starts from first principles using a modular approach with clear descriptions. Gradually progressing onto more complex topics you will become an accomplished and confident programmer by following the examples and applying them yourself. The book continues right through to advanced topics such as the use of floating point arithmetic, Thumb code and how to turn LEDs on and off using the GPIO interface.



The book shows how to use the inbuilt BBC BASIC Assembler to create and generate machine code and includes examples that demonstrate how to integrate the flexibility of BASIC into your assembler. Later chapters introduce the industry standard (and free) GCC Compiler and demonstrate how to create machine code.

Thoroughly enjoyable – Owen

Information well presented, I am a fan of Risc OS. Bruce has a very readable style of writing. The information is well presented – Paul Dunnington

From learning binary numbers, through to the use of logical instructions, this book continues right through to the use of floating point arithmetic, Thumb code and how to turn LEDs on and off using the GPIO interface. There is also a section of how to disassemble C programs to generate your own assembly language files.

This book was originally published under the title Raspberry Pi Assembly Language Beginners. It has been significantly revised and updated and renamed so as to distinguish it from its sister volume Raspberry Pi Assembly Language RASPBIAN Beginners.  Just some of the many features include:

  • 290 Pages
  • Practical tutorial approach
  • Example programs and segments
  • Use of the BBC BASIC Assembler
  • ARM registers and arrangements
  • Data processing
  • Branches, shifts and rotates
  • Conditional execution
  • Addressing modes
  • Use of operating system SWI calls
  • Macros and look-up tables
  • Debugging
  • Vector Floating Point
  • GPIO and Thumb
  • GCC Compiler

All example programs, in BBC BASIC and for use with the GCC Compiler, are available on the book resource page here.

Raspberry Pi Assembly Language RISC OS: Reviews

Another great Bruce Smith book. 18 July 2014, By Warren L. Gibbs Published on Amazon.com [Edited version]

Another great Bruce Smith book. This time, it’s Assembly Language on the RISC OS. I purchased this book and the Raspbian Assembly book. They have similar content but this one is focused on assembler on RISC OS. It’s great to have another perspective on programming Assembler for different OS’s on the same hardware platform. What you’ll see is that while the tools and OS calls differ, in the end, assembler offers the same instructions on the SoC (system on a chip) computer. Understanding assembler is key to understanding how computers work. Buying this book and installing RISC OS is a great way to learn assembler in a not-so-familiar (to me) environment.

Raspberry Pi Assembly Language: Contents List

1: Welcome Home

Imagination Unlimited, Start Experimenting, Raspbian Pi GCC, Learn By Example, What Will You Learn? Companion Website, Notation in Use, Acknowledgements

2: Starting Out

Numbers with Meaning, ARM Instructions, The Transformation Process, Why Machine Code?, Language Levels, Into Orbit, RISC and Instruction Sets, Assembler Structure, Error Of Your Ways,, The Raspberry Pi ARM Chip, Cross Compiler

3: Basic Environment

Emulating Pi, Your RISC OS World, Keyboard Drivers, Editing Programs, !Edit Options

4: The Assembler

The Assembler Listing, Executing and Saving Machine Code Programs, USR Calls, Dumping Code, A Comment On Comments

5: Bits of a RISC Machine

Binary to Decimal, Decimal to Binary, Binary to Hex, Hex to Decimal and Back, Binary Arithmetic, Addition, Subtraction, Twos Complement Numbers, When Two’s Doesn’t Add Up

6: ARM Arrangements

Word Lengths, Byte and Word Accessed Memory, Registers, R15 – Program Counter, Current Program Status Register, Bits and Flags, Setting Flags, S Suffix, R14: The Link Register, R13: Stack Pointer

7: Data Processing

Arithmetic Instructions, Addition, Integer to Register Transfer, Subtraction, Multiplication, Move Instructions, Compare Instructions

8: RISC OS Ins and Outs

SWI Commands, Names and Numbers, OS_Write C, The PRMs

9: Logical Operations

Logical AND, Logical OR, Logical EOR, Logical Instructions, ORR to Convert Character Case, Toggling Characters with EOR, Bit Clear with BIC, Flag Tests, Syscall Registers

10: Conditional Execution

Single Flag Condition Codes, Multiple Flag Condition Code, Mixing the S Suffix

11: Shifts and Rotates

Logical Shifts, Logical Shift Right, Arithmetic Shift Right, Rotations, Extended Rotate, Uses of Shifts and Rotates, Immediate Constant Range, Smarter Multiplication, Full Multiply, Division and Remainder

12: Branch, Compare and SWI

Branch Instructions, The Link Register, Using Compare Instructions , Compare Forward Thinking, SWI, Combining SWI and Suffixes

13: Smarter Numbers

Long Multiplication, Long Accumulation, Division and Remainder, Smarter Simple Multiplication

14: Register 15

Pipelining, Calculating Branches

15: Data Transfer

ADR Directive, Indirect Addressing, Immediate Constants, Pre- Indexed Addressing, Accessing Memory Bytes, Address Write Back, Post- Indexed Addressing, Byte Conditions, PC Relative Addressing

16: Block Transfer

Counting Options, Write Back, Block Copy Routine

17: Stacks

Push and Pull, Stack Growth, Stack Application

18: BASIC Assembler Revisited

OPT Settings, Offset Assembly, Range Check, Data Storage Directives, ALIGNing Data, OS Write String, Call Parameters, Anatomy of a Parameter Block

19: SWI Routines

Characters In, Characters Out, Conversion Routines, Executing OS Commands

20 : Debugging

Frozen Cases, Use of SWI 256 Plus, The Debugger, Breakpoints, Memory Manipulation, Setting Memory, The Disassembler

21 : Assembly Types

Conditional Assembly, Macros, Look Up Tables, Greater Accuracy

22 : Floating Point

VFP2 Architecture, The Register File, Load, Store and Move, Precision Conversion, Vector Arithmetic, Staying Legal

23 : Context Switching

Creating A Context, Demonstration.. Summing Up

24 : VFP Control Register

Conditional Execution, Scalar and Vector Operations, Which Type of Operator?, Len and Stride.

25: Exception Handling

Interrupt Modes, Register Arrangements, Software Interrupts

26: GPIO Functions

The GPIO Controller, Building the Code, Virtual Memory, Using and Adapting , Other GPIO Functions

27 : GCC – An Introduction

C Compilers and GCC, Downloading and Installing GCC, Running and Testing GCC, Configuring the GCC Environment, GCC – The Swiss Army Knife., Assembly Language with GCC, Come to the Execution, Assembler Errors, Source Components, Exiting to RISC OS, Lack of _start., Linking Files, Tidying Up, A Simple C Framework

28 : C Library and Directives

Directives, Data Storage Directives, ALIGNing Data, Using C Functions in Assembler, Source File Structure, Using printf, Number Input with Scanf, Getting This Information, Function Standards, Register Use, More Than Three, Preserving Links and Flags

29 : C to Create Assembler

Getting the Assembly Language, Building Blocks, A printf Example, Frame Pointer Variables, In Summary