100% found this document useful (1 vote)
16 views

Download ebooks file Foundations of ARM64 Linux Debugging, Disassembling, and Reversing: Analyze Code, Understand Stack Memory Usage, and Reconstruct Original C/C++ Code with ARM64 1st Edition Dmitry Vostokov all chapters

The document is a promotional overview for various ebooks available for download, including 'Foundations of ARM64 Linux Debugging, Disassembling, and Reversing' by Dmitry Vostokov. It highlights the content of the book, which covers topics such as code analysis, stack memory usage, and reconstructing C/C++ code. Additional titles listed include works on Linux debugging, historical studies, and conversational AI development.

Uploaded by

binetafatya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
16 views

Download ebooks file Foundations of ARM64 Linux Debugging, Disassembling, and Reversing: Analyze Code, Understand Stack Memory Usage, and Reconstruct Original C/C++ Code with ARM64 1st Edition Dmitry Vostokov all chapters

The document is a promotional overview for various ebooks available for download, including 'Foundations of ARM64 Linux Debugging, Disassembling, and Reversing' by Dmitry Vostokov. It highlights the content of the book, which covers topics such as code analysis, stack memory usage, and reconstructing C/C++ code. Additional titles listed include works on Linux debugging, historical studies, and conversational AI development.

Uploaded by

binetafatya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Download Full Version ebook - Visit ebookmeta.

com

Foundations of ARM64 Linux Debugging,


Disassembling, and Reversing: Analyze Code,
Understand Stack Memory Usage, and Reconstruct
Original C/C++ Code with ARM64 1st Edition Dmitry
Vostokov
https://ebookmeta.com/product/foundations-of-arm64-linux-
debugging-disassembling-and-reversing-analyze-code-
understand-stack-memory-usage-and-reconstruct-original-c-c-
code-with-arm64-1st-edition-dmitry-vostokov/

OR CLICK HERE

DOWLOAD NOW

Discover More Ebook - Explore Now at ebookmeta.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

Foundations of Linux Debugging, Disassembling, and


Reversing: Analyze Binary Code, Understand Stack Memory
Usage, and Reconstruct C/C++ Code with Intel x64 1st
Edition Dmitry Vostokov
https://ebookmeta.com/product/foundations-of-linux-debugging-
disassembling-and-reversing-analyze-binary-code-understand-stack-
memory-usage-and-reconstruct-c-c-code-with-intel-x64-1st-edition-
dmitry-vostokov/
ebookmeta.com

Cambridge IGCSE and O Level History Workbook 2C - Depth


Study: the United States, 1919-41 2nd Edition Benjamin
Harrison
https://ebookmeta.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-
benjamin-harrison/
ebookmeta.com

Accelerated Linux Core Dump Analysis Third Edition Dmitry


Vostokov

https://ebookmeta.com/product/accelerated-linux-core-dump-analysis-
third-edition-dmitry-vostokov/

ebookmeta.com

Open Wide for Christmas Rough BDSM Milking 1st Edition


Leandra Camilli

https://ebookmeta.com/product/open-wide-for-christmas-rough-bdsm-
milking-1st-edition-leandra-camilli/

ebookmeta.com
Phoenix Vigilante Daddies 3 1st Edition Lucky Moon

https://ebookmeta.com/product/phoenix-vigilante-daddies-3-1st-edition-
lucky-moon/

ebookmeta.com

Microsoft Conversational AI Platform for Developers: End-


to-End Chatbot Development from Planning to Deployment 1st
Edition Stephan Bisser
https://ebookmeta.com/product/microsoft-conversational-ai-platform-
for-developers-end-to-end-chatbot-development-from-planning-to-
deployment-1st-edition-stephan-bisser/
ebookmeta.com

Gender and Sexuality in Modern Japan Sabine Frühstück

https://ebookmeta.com/product/gender-and-sexuality-in-modern-japan-
sabine-fruhstuck/

ebookmeta.com

A Matter of Death and Life 1st Edition Simon R Green

https://ebookmeta.com/product/a-matter-of-death-and-life-1st-edition-
simon-r-green/

ebookmeta.com

Greeks Books and Libraries in Renaissance Venice 1st


Edition Rosa Maria Piccione

https://ebookmeta.com/product/greeks-books-and-libraries-in-
renaissance-venice-1st-edition-rosa-maria-piccione/

ebookmeta.com
Love and Monsters Book Club Boys 1 1st Edition Max Walker

https://ebookmeta.com/product/love-and-monsters-book-club-boys-1-1st-
edition-max-walker/

ebookmeta.com
Foundations of ARM64
Linux Debugging,
Disassembling, and
Reversing
Analyze Code, Understand Stack
Memory Usage, and Reconstruct
Original C/C++ Code with ARM64

Dmitry Vostokov
Foundations of
ARM64 Linux
Debugging,
Disassembling, and
Reversing
Analyze Code, Understand
Stack Memory Usage,
and Reconstruct Original C/C++
Code with ARM64

Dmitry Vostokov
Foundations of ARM64 Linux Debugging, Disassembling, and Reversing:
Analyze Code, Understand Stack Memory Usage, and Reconstruct Original
C/C++ Code with ARM64

Dmitry Vostokov
Dublin, Ireland

ISBN-13 (pbk): 978-1-4842-9081-1 ISBN-13 (electronic): 978-1-4842-9082-8


https://doi.org/10.1007/978-1-4842-9082-8
Copyright © 2023 by Dmitry Vostokov
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Celestin Suresh John
Development Editor: James Markham
Coordinating Editor: Mark Powers
Cover designed by eStudioCalamar
Cover image by Susan Wilkinson on Unsplash (www.unsplash.com)
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY
10004, U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected],
or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance
Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for
reprint, paperback, or audio rights, please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub (https://github.com/Apress). For more detailed information,
please visit http://www.apress.com/source-code.
Printed on acid-free paper
Table of Contents
About the Author���������������������������������������������������������������������������������ix

About the Technical Reviewer�������������������������������������������������������������xi

Preface����������������������������������������������������������������������������������������������xiii

Chapter 1: Memory, Registers, and Simple Arithmetic�������������������������1


Memory and Registers Inside an Idealized Computer������������������������������������������1
Memory and Registers Inside ARM 64-Bit Computer��������������������������������������������2
“Arithmetic” Project: Memory Layout and Registers��������������������������������������������3
“Arithmetic” Project: A Computer Program�����������������������������������������������������������5
“Arithmetic” Project: Assigning Numbers to Memory Locations���������������������������5
Assigning Numbers to Registers���������������������������������������������������������������������������8
“Arithmetic” Project: Adding Numbers to Memory Cells���������������������������������������9
Incrementing/Decrementing Numbers in Memory and Registers�����������������������12
Multiplying Numbers�������������������������������������������������������������������������������������������15
Summary������������������������������������������������������������������������������������������������������������18

Chapter 2: Code Optimization�������������������������������������������������������������19


“Arithmetic” Project: C/C++ Program�����������������������������������������������������������������19
Downloading GDB�����������������������������������������������������������������������������������������������20
GDB Disassembly Output – No Optimization�������������������������������������������������������21
GDB Disassembly Output – Optimization������������������������������������������������������������27
Summary������������������������������������������������������������������������������������������������������������28

iii
Table of Contents

Chapter 3: Number Representations��������������������������������������������������29


Numbers and Their Representations�������������������������������������������������������������������29
Decimal Representation (Base Ten)��������������������������������������������������������������������30
Ternary Representation (Base Three)������������������������������������������������������������������30
Binary Representation (Base Two)����������������������������������������������������������������������31
Hexadecimal Representation (Base Sixteen)������������������������������������������������������32
Why Are Hexadecimals Used?�����������������������������������������������������������������������������32
Summary������������������������������������������������������������������������������������������������������������34

Chapter 4: Pointers�����������������������������������������������������������������������������35
A Definition���������������������������������������������������������������������������������������������������������35
“Pointers” Project: Memory Layout and Registers����������������������������������������������36
“Pointers” Project: Calculations��������������������������������������������������������������������������38
Using Pointers to Assign Numbers to Memory Cells�������������������������������������������39
Adding Numbers Using Pointers�������������������������������������������������������������������������46
Incrementing Numbers Using Pointers���������������������������������������������������������������51
Multiplying Numbers Using Pointers�������������������������������������������������������������������54
Summary������������������������������������������������������������������������������������������������������������58

Chapter 5: Bytes, Halfwords, Words, and Doublewords����������������������59


Using Hexadecimal Numbers������������������������������������������������������������������������������59
Byte Granularity��������������������������������������������������������������������������������������������������60
Bit Granularity�����������������������������������������������������������������������������������������������������60
Memory Layout���������������������������������������������������������������������������������������������������61
Summary������������������������������������������������������������������������������������������������������������64

iv
Table of Contents

Chapter 6: Pointers to Memory�����������������������������������������������������������65


Pointers Revisited�����������������������������������������������������������������������������������������������65
Addressing Types������������������������������������������������������������������������������������������������65
Registers Revisited���������������������������������������������������������������������������������������������70
NULL Pointers�����������������������������������������������������������������������������������������������������70
Invalid Pointers���������������������������������������������������������������������������������������������������70
Variables As Pointers������������������������������������������������������������������������������������������71
Pointer Initialization��������������������������������������������������������������������������������������������71
Initialized and Uninitialized Data�������������������������������������������������������������������������72
More Pseudo Notation�����������������������������������������������������������������������������������������72
“MemoryPointers” Project: Memory Layout�������������������������������������������������������73
Summary������������������������������������������������������������������������������������������������������������87

Chapter 7: Logical Instructions and PC����������������������������������������������89


Instruction Format����������������������������������������������������������������������������������������������89
Logical Shift Instructions������������������������������������������������������������������������������������90
Logical Operations����������������������������������������������������������������������������������������������90
Zeroing Memory or Registers�����������������������������������������������������������������������������91
Program Counter�������������������������������������������������������������������������������������������������92
Code Section�������������������������������������������������������������������������������������������������������93
Summary������������������������������������������������������������������������������������������������������������94

Chapter 8: Reconstructing a Program with Pointers��������������������������95


Example of Disassembly Output: No Optimization����������������������������������������������95
Reconstructing C/C++ Code: Part 1��������������������������������������������������������������������98
Reconstructing C/C++ Code: Part 2������������������������������������������������������������������100
Reconstructing C/C++ Code: Part 3������������������������������������������������������������������102

v
Table of Contents

Reconstructing C/C++ Code: C/C++ Program��������������������������������������������������103


Example of Disassembly Output: Optimized Program���������������������������������������104
Summary����������������������������������������������������������������������������������������������������������106

Chapter 9: Memory and Stacks��������������������������������������������������������107


Stack: A Definition���������������������������������������������������������������������������������������������107
Stack Implementation in Memory���������������������������������������������������������������������108
Things to Remember�����������������������������������������������������������������������������������������110
Stack Push Implementation������������������������������������������������������������������������������111
Stack Pop Implementation��������������������������������������������������������������������������������111
Register Review������������������������������������������������������������������������������������������������111
Application Memory Simplified�������������������������������������������������������������������������112
Stack Overflow��������������������������������������������������������������������������������������������������113
Jumps���������������������������������������������������������������������������������������������������������������114
Calls������������������������������������������������������������������������������������������������������������������115
Call Stack����������������������������������������������������������������������������������������������������������116
Exploring Stack in GDB�������������������������������������������������������������������������������������118
Summary����������������������������������������������������������������������������������������������������������121

Chapter 10: Frame Pointer and Local Variables�������������������������������123


Stack Usage������������������������������������������������������������������������������������������������������123
Register Review������������������������������������������������������������������������������������������������124
Addressing Array Elements�������������������������������������������������������������������������������124
Stack Structure (No Function Parameters)�������������������������������������������������������126
Function Prolog�������������������������������������������������������������������������������������������������127
Raw Stack (No Local Variables and Function Parameters)�������������������������������127
Function Epilog�������������������������������������������������������������������������������������������������129

vi
Table of Contents

“Local Variables” Project����������������������������������������������������������������������������������130


Disassembly of Optimized Executable��������������������������������������������������������������133
Summary����������������������������������������������������������������������������������������������������������134

Chapter 11: Function Parameters�����������������������������������������������������135


“FunctionParameters” Project��������������������������������������������������������������������������135
Stack Structure�������������������������������������������������������������������������������������������������136
Function Prolog and Epilog�������������������������������������������������������������������������������138
Project Disassembled Code with Comments����������������������������������������������������139
Parameter Mismatch Problem��������������������������������������������������������������������������144
Summary����������������������������������������������������������������������������������������������������������145

Chapter 12: More Instructions����������������������������������������������������������147


PSTATE Flags�����������������������������������������������������������������������������������������������������147
Testing for 0������������������������������������������������������������������������������������������������������147
TST – Logical Compare�������������������������������������������������������������������������������������148
CMP – Compare Two Operands�������������������������������������������������������������������������149
TST or CMP?�����������������������������������������������������������������������������������������������������150
Conditional Jumps��������������������������������������������������������������������������������������������150
Function Return Value���������������������������������������������������������������������������������������151
Summary����������������������������������������������������������������������������������������������������������152

Chapter 13: Function Pointer Parameters����������������������������������������153


“FunctionPointerParameters” Project���������������������������������������������������������������153
Commented Disassembly���������������������������������������������������������������������������������154
Summary����������������������������������������������������������������������������������������������������������161

vii
Table of Contents

Chapter 14: Summary of Code Disassembly Patterns����������������������163


Function Prolog/Epilog��������������������������������������������������������������������������������������163
ADR (Address)���������������������������������������������������������������������������������������������������164
Passing Parameters������������������������������������������������������������������������������������������164
Accessing Saved Parameters and Local Variables��������������������������������������������165
Summary����������������������������������������������������������������������������������������������������������166

Index�������������������������������������������������������������������������������������������������167

viii
About the Author
Dmitry Vostokov is an internationally
recognized expert, speaker, educator, scientist,
and author. He is the founder of the pattern-
oriented software diagnostics, forensics,
and prognostics discipline and Software
Diagnostics Institute (DA+TA: DumpAnalysis.
org + TraceAnalysis.org). Vostokov has also
authored more than 50 books on software
diagnostics, anomaly detection and analysis,
software and memory forensics, root cause analysis and problem solving,
memory dump analysis, debugging, software trace and log analysis,
reverse engineering, and malware analysis. He has more than 25 years
of experience in software architecture, design, development, and
maintenance in various industries, including leadership, technical, and
people management roles. Dmitry also founded Syndromatix, Anolog.
io, BriteTrace, DiaThings, Logtellect, OpenTask Iterative and Incremental
Publishing (OpenTask.com), Software Diagnostics Technology and
Services (former Memory Dump Analysis Services; PatternDiagnostics.
com), and Software Prognostics. In his spare time, he presents various
topics on Debugging TV and explores Software Narratology, its further
development as Narratology of Things and Diagnostics of Things (DoT),
Software Pathology, and Quantum Software Diagnostics. His current
areas of interest are theoretical software diagnostics and its mathematical
and computer science foundations, application of formal logic, artificial
intelligence, machine learning and data mining to diagnostics and anomaly
detection, software diagnostics engineering and diagnostics-driven

ix
About the Author

development, and diagnostics workflow and interaction. Recent areas


of interest also include cloud native computing, security, automation,
functional programming, and applications of category theory to software
development and big data.

x
About the Technical Reviewer
Sundar Pandian has more than three
years of experience in embedded software
development, including development of device
drivers, middleware software, and application
services for the infotainment system on the
Android platform. He’s also developed CAN
protocol drivers for the automotive braking
system on the Autosar platform.
He’s developed software with C, C++,
and Java and worked in the automotive,
semiconductor, and telecom industries. He has
a bachelor’s in electronics and communication engineering. Currently, he
serves as a firmware/middleware engineer for audio DSPs.

xi
Preface
The book covers topics ranging from ARM64 assembly language
instructions and writing programs in assembly language to pointers, live
debugging, and static binary analysis of compiled C and C++ code.
Diagnostics of core memory dumps, live and postmortem debugging
of Linux applications, services, and systems, memory forensics, malware,
and vulnerability analysis require an understanding of ARM64 assembly
language and how C and C++ compilers generate code, including
memory layout and pointers. This book is about background knowledge
and practical foundations that are needed to understand internal Linux
program structure and behavior, start working with the GDB debugger, and
use it for disassembly and reversing. It consists of practical step-by-step
exercises of increasing complexity with explanations and many diagrams,
including some necessary background topics.
By the end of the book, you will have a solid understanding of how
Linux C and C++ compilers generate binary code. In addition, you will be
able to analyze such code confidently, understand stack memory usage,
and reconstruct original C/C++ code.
The book will be useful for

• Software support and escalation engineers, cloud


security engineers, SRE, and DevSecOps

• Software engineers coming from JVM background

• Software testers

• Engineers coming from non-Linux environments, for


example, Windows or Mac OS X

xiii
Preface

• Engineers coming from non-ARM environments, for


example, x86/x64

• Linux C/C++ software engineers without assembly


language background

• Security researchers without assembly language


background

• Beginners learning Linux software reverse engineering


techniques

This book can also be used as an ARM64 assembly language and Linux
debugging supplement for relevant undergraduate-level courses.

Source Code
All source code used in this book can be downloaded from ­github.com/
apress/arm64-linux-debugging-disassembling-reversing.

xiv
CHAPTER 1

Memory, Registers,
and Simple Arithmetic
 emory and Registers Inside an
M
Idealized Computer
Computer memory consists of a sequence of memory cells, and each cell
has a unique address (location). Every cell contains a “number.” We refer
to these “numbers” as contents at addresses (locations). Because memory
access is slower than arithmetic instructions, there are so-called registers
to speed up complex operations that require memory to store temporary
results. We can also think about them as stand-alone memory cells. The
name of a register is its address. Figure 1-1 illustrates this.

© Dmitry Vostokov 2023 1


D. Vostokov, Foundations of ARM64 Linux Debugging, Disassembling, and Reversing,
https://doi.org/10.1007/978-1-4842-9082-8_1
Chapter 1 Memory, Registers, and Simple Arithmetic

Figure 1-1. Computer memory represented as a sequence of memory


cells and locations

 emory and Registers Inside ARM


M
64-Bit Computer
Here, addresses for memory locations containing integer values usually
differ by four or eight, and we also show two registers called X0 and X1.
The first halves of them are called W0 and W1 as shown in Figure 1-2.

2
Chapter 1 Memory, Registers, and Simple Arithmetic

Figure 1-2. Typical ARM 64-bit memory and register layout

Because memory cells contain “numbers,” we start with simple


arithmetic and ask a processor to compute the sum of two numbers to see
how memory and registers change their values.

“ Arithmetic” Project: Memory Layout


and Registers
For our project, we have two memory addresses (locations) that we call
“a” and “b.” We can think about “a” and “b” as names of their respective
addresses (locations). Now we introduce a special notation where (a)

3
Chapter 1 Memory, Registers, and Simple Arithmetic

means contents at the memory address (location) “a.” If we use the C


or C++ language to write our project, we declare and define memory
locations “a” and “b” as

static int a, b;

By default, when we load a program, static memory locations are filled


with zeroes, and we can depict our initial memory layout after loading the
program, as shown in Figure 1-3.

Figure 1-3. Initial memory layout after loading the program

4
Chapter 1 Memory, Registers, and Simple Arithmetic

“Arithmetic” Project: A Computer Program


We can think of a computer program as a sequence of instructions for
the manipulation of contents of memory cells and registers. For example,
addition operation: add the contents of memory cell №12 to the contents
of memory cell №14. In our pseudo-code, we can write

[14] <- [14] + [12]

Our first program in pseudo-code is shown on the left of the table:

[a] <- 1 Here, we put assembly instructions corresponding to


[b] <- 1 pseudo-code.
[b] <- [b] + [a]
[a] <- [a] + 1
[b] <- [b] * [a]

“<-” means moving (assigning) the new value to the contents of a


memory location (address). “//” is a comment sign, and the rest of the line
is a comment. “=” shows the current value at a memory location (address).
To remind, a code written in a high-level programming language is
translated to a machine language by a compiler. However, the machine
language can be readable if its digital codes are represented in some
mnemonic system called assembly language. For example, ADD X1, X1, #1
is increment by one of what is stored in the register memory cell X1.

“ Arithmetic” Project: Assigning Numbers


to Memory Locations
We remind that “a” means the location (address) of the memory cell,
and it is also the name of the location (address) 00000000004b2b00 (see
Figure 1-3). [a] means the contents (number) stored at the address “a.”

5
Chapter 1 Memory, Registers, and Simple Arithmetic

If we use the C or C++ language, “a” is called “the variable a,” and we
write the assignment as

a = 1;

In ARM64 assembly language, we write several instructions for that:

adr x0, a
mov w1, #1
str w1, [x0]

In the GDB disassembly output, we may see the following code:

adrp    x0, 0x4b2000
add     x0, x0, #0xb00
mov     w1, #0x1
str     w1, [x0]

We show the translation of our pseudo-code into assembly language in


the right column:

[a] <- 1          // x0 = a adr  x0, a


// w1 = 1 mov  w1, #1
// [a] = 1 str  w1, [x0]
[b] <- 1          // x0 = b adr  x0, b
// w1 = 1 mov  w1, #1
// [b] = 1 str  w1, [x0]
[b] <- [b] + [a]
[a] <- [a] + 1
[b] <- [b] * [a]

adrp x0, 0x4b2000, and subsequent add x0, x0, #0xb00 is how the
compiler generates code to calculate the address “a” instead of specifying it
directly. Such code is required for addressing large regions of memory, and

6
Chapter 1 Memory, Registers, and Simple Arithmetic

the compiler uses it even for smaller regions where just one adr instruction
is sufficient.
Literal constants have the # prefix, for example, #0x1. The 0x prefix
means the following number is hexadecimal. We explain such numbers
in Chapter 3. Please also notice that the movement direction is the same
in both the disassembly output and the pseudo-code: from right to left
(except for the str instruction).
After executing the first three assembly language instructions, we have
the memory layout shown in Figure 1-4A.

Figure 1-4A. Memory layout after executing the first three assembly
language instructions

7
Chapter 1 Memory, Registers, and Simple Arithmetic

After executing the next three assembly language instructions, we have


the memory layout shown in Figure 1-4B.

Figure 1-4B. Memory layout after executing the next three assembly
language instructions

Assigning Numbers to Registers


In the previous section, we saw that assigning numbers was a part of
memory assignments. We can write in pseudo-code:

register <- 1
register <- [a]

8
Chapter 1 Memory, Registers, and Simple Arithmetic

Note that we do not use brackets when we refer to register contents.


The latter instruction means assigning (copying) the number at the
location (address) “a” to a register.
In assembly language, we write

mov  w1, #1              // 1 is copied to the first half of X1


register
mov  x1, #1              // full contents of X1 register are
replaced with 1
adr  x0, a               // copy the location (address) "a" to
X0 register
ldr  w1, [x0]            // copy the number at the location
stored in X0 to
                         // the first half of X1 register
Ldr  x1, [x0]            // copy the number at the location
stored in X0 to X1

In the GDB disassembly output, we may see the output where one
adr instruction is replaced by adrp/add instructions with parts of the
address value:

adrp x0, 0x4b2000        // 0x4b2000 + 0xb00 = 0x4b2b00


("a" address)
add  x0, x0, #0xb00
ldr  w1, [x0]

“ Arithmetic” Project: Adding Numbers


to Memory Cells
Now let's look at the following pseudo-code statement in more detail:

[b] <- [b] + [a]

9
Chapter 1 Memory, Registers, and Simple Arithmetic

To recall, “a” and “b” mean the names of locations (addresses)


00000000004b2b00 and 00000000004b2b04, respectively (see Figures 1-4A
and 1-4B). [a] and [b] mean contents at addresses “a” and “b,” respectively,
simply some numbers stored there.
In the C or C++ language, we write the following statement:

b = b + a;
b += a;

In assembly language, we use the instruction ADD. Because of ARM


architecture limitations, we cannot use memory addresses in one step
(instruction), for example, add b, b, a. We can only use the add register1,
register1, register0 instruction to add the value stored in the register0 to
the value stored in the register1 and move the result to the register1. So,
first, we need to load (ldr) contents at addresses “a” and “b” to registers
and store (str) the result back to the memory location “b” after addition.
Recall that a register is like a temporary memory cell itself here:

Register2 <- [b]


Register1 <- [a]
Register2 <- register2 + register1
[b] <- register2

In assembly language, we write

adr  x0, b
ldr  w1, [x0]
adr  x0, a
ldr  w0, [x0]
add  w1, w1, w0
adr  x0, b
str  w1, [x0]

In the GDB disassembly output, we may see the following code:

10
Chapter 1 Memory, Registers, and Simple Arithmetic

adrp x0, 0x4b2000


add  x0, x0, #0xb00
ldr  w1, [x0]
adrp x0, 0x4b2000
add  x0, x0, #0xb04
ldr  w0, [x0]
add  w1, w1, w0
adrp x0, 0x4b2000
add  x0, x0, #0xb04
str  w1, [x0]

Now we can translate our pseudo-code into assembly language:

[a] <- 1          // x0 = a adr  x0, a


// w1 = 1 mov  w1, #1
// [a] = 1 str  w1, [x0]
[b] <- 1          // x0 = b adr  x0, b
// w1 = 1 mov  w1, #1
// [b] = 1 str  w1, [x0]
[b] <- [b] + [a]  // x0 = b adr  x0, b
// w1 = 1 ldr  w1, [x0]
// x0 = a adr  x0, a
// w0 = 1 ldr  w0, [x0]
// w1 = 2 add  w1, w1, w0
// x0 = b adr  x0, b
// [b] = 2 str  w1, [x0]
[a] <- [a] + 1
[b] <- [b] * [a]

After executing ADR, LDR, ADD, and STR instructions, we have the
memory layout illustrated in Figure 1-5.

11
Chapter 1 Memory, Registers, and Simple Arithmetic

Figure 1-5. Memory layout after executing ADR, LDR, ADD, and STR
instructions

Incrementing/Decrementing Numbers
in Memory and Registers
In pseudo-code, it looks simple and means increment (decrement) a
number stored at the location (address) “a”:

[a] <- [a] + 1


[a] <- [a] – 1

In the C or C++ language, we can write this using three possible ways:

12
Chapter 1 Memory, Registers, and Simple Arithmetic

a = a + 1;
++a;
a++;
b = b – 1;
--b;
b--;

In assembly language, we use instructions ADD and SUB and write

add  x0, x0, #1
sub  x0, x0, #1

adr  x0, a
ldr  w1, [x0]
add  w1, w1, #1
str  w1, [x0]

adr  x0, b
ldr  w1, [x0]
sub  w1, w1, #1
str  w1, [x0]

In the GDB disassembly output, we may see the similar instructions:

adrp x0, 0x4b2000


add  x0, x0, #0xb00
ldr  w0, [x0]
add  w1, w0, #0x1
adrp x0, 0x4b2000
add  x0, x0, #0xb00
str  w1, [x0]

13
Chapter 1 Memory, Registers, and Simple Arithmetic

Now we add the assembly language translation of increment:

[a] <- 1          // x0 = a adr  x0, a


                  // w1 = 1 mov  w1, #1
                  // [a] = 1 str  w1, [x0]
[b] <- 1          // x0 = b adr  x0, b
                  // w1 = 1 mov  w1, #1
                  // [b] = 1 str  w1, [x0]
[b] <- [b] + [a]  // x0 = b adr  x0, b
                  // w1 = 1 ldr  w1, [x0]
                  // x0 = a adr  x0, a
                  // w0 = 1 ldr  w0, [x0]
                  // w1 = 2 add  w1, w1, w0
                  // x0 = b adr  x0, b
                  // [b] = 2 str  w1, [x0]
[a] <- [a] + 1    // x0 = a adr  x0, a
                  // w1 = 1 ldr  w1, [x0]
                  // w1 = 2 add  w1, w1, #1
                  // [a] = 2 str  w1, [x0]
[b] <- [b] * [a]

After the execution of the ADD instruction, we have the memory layout
illustrated in Figure 1-6.

14
Chapter 1 Memory, Registers, and Simple Arithmetic

Figure 1-6. Memory layout after the execution of the ADD instruction

Multiplying Numbers
In pseudo-code, we write

[b] <- [b] * [a]

It means that we multiply the number at the location (address) “b” by


the number at the location (address) “a.”
In the C or C++ language, we can write that using two ways:

b =  b * a;
b *= a;

15
Chapter 1 Memory, Registers, and Simple Arithmetic

In assembly language, we use instruction MUL and write

adr  x0, b
ldr  w1, [x0]
adr  x0, a
ldr  w0, [x0]
mul  w1, w1, w0
adr  x0, b
str  w1, [x0]

In the GDB disassembly output, we may see the following code:

adrp x0, 0x4b2000


add  x0, x0, #0xb04
ldr  w1, [x0]
adrp x0, 0x4b2000
add  x0, x0, #0xb00
ldr  w0, [x0]
mul  w1, w1, w0
adrp x0, 0x4b2000
add  x0, x0, #0xb04
str  w1, [x0]

Now we add additional assembly instructions to our pseudo-code


assembly language translation:

16
Discovering Diverse Content Through
Random Scribd Documents
ROBBY AND RUTH.
Robby and Ruth strolled out one day,
Over the meadows, beyond the town;
The robins sang, and the fields looked gay,
And the orchards dropped their blossoms down:
But they took no thought of song or flower,
For this, to them, was love’s sweet hour;
And love’s hour is fleet,
And swift love’s feet,
When a lad and a winsome lassie meet!

Robby and Ruth in the church were wed,


Ere the orchard apples began to fall;
“Till death shall part,” were the words they said,
And love’s pure sunlight hallowed all.
Ah! never a bride more sweet and fair
Wore orange-blooms in her sunny hair!
The maiden sung,
And the joy-bells rung
And echoed the orchards and groves among.

Robby and Ruth kept house together,


Till both were old and bent and gray,
And little they cared for outside weather,
For home’s sweet light gilded all their way;
And many a precious nestling came
To be called by the dear old household name;
And the love that blessed
When first confessed
Remained in their hearts a constant guest.
Robby and Ruth grew weary at last—
Bobby went first the shining way;
And when the earth on his grave was cast,
The faithful Ruth could no longer stay;
And daisy ne’er blossomed or wild-rose grew
O’er hearts more tender, leal and true!
Love’s vows were sweet
When they sat at Love’s feet,
And Heaven makes love itself complete.

Louisa S. Upham.
Recitations for Children.

The perplexing question of obtaining something suitable


for the “little tots” to recite, is solved by the choice collection
of pieces here presented. The pathetic, the humorous, the
beautiful, in short, every variety of recitation for the young
people, may be found in the following pages, including drills
and motion recitals, and selections for special occasions, all
of which are entertaining and admirably suited to the little
folks.

TWO LITTLE MAIDENS


A sorry little maiden
Is Miss Fuss-and-Feather,
Crying for the golden moon,
Grumbling at the weather;
The sun will fade her gown,
The rain will spoil her bonnet,
If she ventures out,
And lets it fall upon it.

A merry little maiden


Is Miss Rags-and-Tatters,
Chatting of the twinkling stars
And many other matters;
Dancing in the sunshine,
Pattering through the rain,
Her clothes never cause her
A single thought or pain.
Agnes Carr.

THE WAY TO SUCCEED.


Drive the nail aright, boys,
Hit it on the head;
Strike with all your might, boys,
While the iron’s red.

When you’ve work to do, boys,


Do it with a will;
They who reach the top, boys,
First must climb the hill.

Standing at the foot, boys,


Gazing at the sky,
How can you ever get up, boys,
If you never try?

Though you stumble oft, boys,


Never be downcast;
Try, and try again, boys—
You’ll succeed at last.

WHEN PA BEGINS TO SHAVE.


When Sunday mornin’ comes around
My pa hangs up his strop,
An’ takes his razor out an’ makes
It go c’flop! c’flop!
An’ then he gits his mug an’ brush
An’ yells t’ me, “Behave!”
I tell y’u, things is mighty still—
When pa begins t’ shave.
Then pa he stirs his brush around
An’ makes th’ soapsuds fly;
An’ sometimes, when he stirs too hard,
He gits some in his eye.
I tell y’u, but it’s funny then
To see pa stamp and rave;
But y’u mustn’t git ketched laffin’—
When pa begins t’ shave.

Th’ hired hand he dassent talk,


An’ even ma’s afeard,
An’ y’u can hear th’ razor click
A-cuttin’ through pa’s beard!
An’ then my Uncle Bill he laffs
An’ says: “Gosh! John, you’re brave,”
An’ pa he swears, an’ ma jest smiles—
When pa begins t’ shave.

When pa gits done a-shavin’ of


His face, he turns around,
And Uncle Bill says: “Why, John,
Yu’r chin looks like plowed ground!”
An’ then he laffs—jest laffs an’ laffs,
But I got t’ behave,
Cos things’s apt to happen quick—
When pa begins t’ shave.

Harry Douglass Robbins.

A BOY’S VIEW.
Girl is very nice! Everybody who has not the misfortune to be girl will
allow this. Nice girl will allow it also as far as itself is concerned.
Strange girl is objectionable in the eyes of girl generally.
Powder improves girl sometimes, but it seldom finds this out until it
is suggested to it by one of experience.
Healthy girl costs its parents less money for doctors’ bills, but
persons who write romantic tales for circulating libraries choose
unhealthy and pasty faced girl to write about—the swooning kind
preferred.
If I were not boy I think I should like to be girl. It’s best fun to be
boy when there’s plenty of girl about.

MAMMY’S CHURNING SONG.


Set still, honey, let ole Mammy tell yer ’bout de churn,
Wid de cream en clabber dashin’,
En de buttermilk er-splashin’.
Dis de chune hit am er-singin’ ’fore hit ’gin ter turn:
Jiggery, jiggery, jiggery, jum,
Bum-bum-bum,
But-ter-come,
Massa give old nigger some.

Jump down, honey, en fotch me dat rag fum de table, fer ter wipe
off dis hyah led. Tole yer so, dat milk gwine ter splatter up hyah
’reckly! Dar now, dat’s er good chile, git back in mer lap.

Now de cream, en milk, en clabber’s churnin’ up so fas’,


Hyah hit splatterin’ en er-splutterin’,
En er-mixin’, en er-mutterin’,
In de churn en roun’ de dasher, singin’ ter de las’;
Jiggery, jiggery, jiggery, jum,
Bum-bum-bum,
But-ter-come,
Massa gib old nigger some.

Uh-er! Teck kyah, honey, keep dem fingers way fum dar! Butter
mos’ come now: set still jis’ er leetle w’ile longer.

Sooen de lumps ob butter ’ll be er-floatin’ on de top—


Now de ole churn’s fa’rly hummin’,
Tell yer wot, de butter comin’—
Done come! Mammy’s arm so ti-yerd, now she’s gwine ter stop.
Jiggery, jiggery, jiggery, jum,
Bum-bum-bum,
But-ter-come,
Mammy ’ll gib de baby some.

Dar now! [removing the top and giving the dasher a circular
motion] jis’ peep in dar en see de lumps ob yaller butter er-huddlin’
tergedder. Now run fotch yer leetle blue mug, en Mammy ’ll gib yer
some nice sweet buttermilk right outen dis hyah churn.
Edward A. Oldham.

THE TWENTY FROGS!


Twenty froggies went to school,
Down beside a rushy pool;
Twenty little coats of green,
Twenty vests all white and clean.
“We must be in time,” said they;
“First we study, then we play;
That is how we keep the rule
When we froggies go to school.”

Master Bullfrog, grave and stern,


Called the classes in their turn;
Taught them how to nobly strive,
Likewise how to leap and dive.
From his seat upon the log,
Taught them how to say “Ker-chug,”
Also how to dodge a blow
From the sticks which bad boys throw.

Twenty froggies grew up fast;


Bullfrogs they became at last;
Not one dunce among the lot,
Not one lesson they forgot;
Polished in a high degree,
As each froggie ought to be;
Now they sit on other logs,
Teaching other little frogs.

ONLY A BIRD.
Only a bird! and a vagrant boy
Fits a pebble with a boyish skill
Into the fold of a supple sling.
“Watch me hit him. I can an’ I will.”
Whirr! and a silence chill and sad
Falls like a pall on the vibrant air,
From a birchen tree, whence a shower of song
Has fallen in ripples everywhere.

Only a bird! and the tiny throat


With quaver and trill and whistle of flute,
Bruised and bleeding and silent lies
There at his feet. Its chords are mute.
And the boy, with a loud and boisterous laugh,
Proud of his prowess and brutal skill,
Throws it aside with a careless toss—
“Only a bird! it was made to kill.”

Only a bird! yet far away


Little ones clamor and cry for food—
Clamor and cry, and the chill of night
Settles over the orphan brood.
Weaker and fainter the moaning call
For a brooding breast that shall never come.
Morning breaks o’er a lonely nest,
Songless and lifeless; mute and dumb.

Mary Morrison.
THE WAY TO DO IT.
Teach the child to make all the gestures and facial
expressions. This is a captivating recital for any “little tot”
who can do it well, and this will require patient practice.
I’ll tell you how I speak a piece:
First, I make my bow;
Then I bring my words out clear
And plain as I know how.

Next, I throw my hands up—so!


Then I lift my eyes:
That’s to let my hearers know
Something doth surprise.

Next, I grin and show my teeth,


Nearly every one,
Shake my shoulders, hold my sides:
That’s the sign of fun.

Next, I start, and knit my brows,


Hold my head erect:
Something’s wrong, you see, and I
Decidedly object.

Then I wabble at my knees,


Clutch at shadows near,
Tremble well from top to toe:
That’s the sign of fear.

Now I start, and with a leap,


Seize an airy dagger.
“Wretch!” I cry: that’s tragedy
Every soul to stagger.

Then I let my voice grow faint,


Gasp, and hold my breath,
Tumble down and plunge about:
That’s a villain’s death.
Quickly then I come to life,
Perfectly restored;
With a bow my speech is done.
Now you’ll please applaud.

Mary Mapes Dodge.

WE MUST ALL SCRATCH.


For five little children and one older, a girl, who takes the
part of the mother. They stand in a row and each steps
forward and recites the verse.
Said the first little chicken,
With a queer little squirm,
“I wish I could find
A fat little worm.”

Said the next little chicken,


With an odd little shrug,
“I wish I could find
A fat little bug,”

Said the third little chicken,


With a sharp little squeal,
“I wish I could find
Some nice yellow meal.”

Said the fourth little chicken,


With a small sigh of grief,
“I wish I could find
A green little leaf.”

Said the fifth little chicken,


With a faint little moan,
“I wish I could find
A wee gravel stone.”
“Now, see here,” said the mother,
From the green garden patch,
“If you want any breakfast,
Just come here and scratch.”

KITTY AT SCHOOL.
Come, Kitty dear, I’ll tell you what
We’ll do this rainy day;
Just you and I, all by ourselves,
At keeping school, will play.

The teacher, Kitty, I will be;


And you shall be the class;
And you must close attention give,
If you expect to pass.

Now, Kitty, “C-A-T” spells cat.


Stop playing with your tail!
You are so heedless, I am sure
In spelling you will fail.

“C-A” oh, Kitty! do sit still!


You must not chase that fly!
You’ll never learn a single word,
You do not even try.

I’ll tell you what my teacher says


To me most ev’ry day—
She says that girls can never learn
While they are full of play.

So try again—another word;


“L-A-C-E” spells “lace.”
Why, Kitty, it is not polite
In school to wash your face!

You are a naughty, naughty puss,


And keep you in I should;
But then, I love you, dear, so much
I don’t see how I could!

O, see! the sun shines bright again!


We’ll run out doors and play;
We’ll leave our school and lessons for
Another rainy day.

Kate Ulmer.

A FELLOW’S MOTHER.
“A fellow’s mother,” said Fred the wise,
With his rosy cheeks and his merry eyes,
“Knows what to do if a fellow gets hurt
By a thump, or a bruise, or a fall in the dirt.

“A fellow’s mother has bags and strings,


Rags and buttons, and lots of things;
No matter how busy she is, she’ll stop
To see how well you can spin your top.

“She does not care—not much, I mean—


If a fellow’s face is not always clean;
And if your trousers are torn at the knee
She can put in a patch that you’d never see.

“A fellow’s mother is never mad,


But only sorry if you are bad,
And I’ll tell you this, if you’re only true,
She’ll always forgive whate’er you do.

“I’m sure of this,” said Fred the wise,


With a manly look in his laughing eyes,
“I’ll mind my mother, quick, every day,
A fellow’s a baby that don’t obey.”
M. E. Sangster.

THE STORY KATIE TOLD.


Now, stay right still and listen, kitty-cat, and I’ll tell you a story.
Once there was a girl.
She was a pretty good little girl, and minded her papa ’n’ mamma
everything they said, only sometimes she didn’t, and then she was
naughty; but she was always sorry, and said she wouldn’t do so any
more, and her mamma’d forgive her.
She was going to hang up her stocking.
“You’ll have to be pretty good, ’lest ’twon’t be filled,” said her
mamma.
“’Less maybe there’ll be a big bunch of sticks in it,” said her papa.
Do you think that’s a nice way to talk, kitty-cat? I don’t.
So the little girl was good as she could be, ’less she was bigger, and
didn’t cry and slap her little sister hardly any at all, and always minded
her mamma when she came where the chimney was, ’specially much.
So she hung up her stocking.
And in the night she got awake, and wanted it to come morning;
but in the morning she didn’t get awake till ’twas all sunshiny out
doors.
Then she ran quick as she could to look at her stocking where she’d
hung it; and true’s you live, kitty-cat, there wasn’t the leastest thing in
it—not the leastest bit of a scrimp!
Oh, the little girl felt dreadfully! How’d you feel, s’pose it had been
you, kitty-cat?
She ’menced to cry, the little girl did, and she kept going harder ’n
harder, till by’mby she screeched orfly, and her mamma came running
to see what the matter was.
“Mercy me!” said her mamma. “Look over by the window ’fore you
do that any more, Kathie.”
That little girl’s name was Kathie too, kitty-cat, just the same’s mine.
So she looked over by the window, the way her mamma said, and—
oh! there was the loveliest dolly’s house you ever saw in all your born
life.
It had curtains to pull to the sides when you wanted to play, and
pull in front when you didn’t.
There was a bed-room, kitty-cat, and a dinner-room, and a kitchen,
and a parlor, and they all had carpets on.
And there was the sweetest dolly in the parlor, all dressed up in blue
silk! Oh, dear! And a penano, to play real little tunes on, and a
rocking-chair, and—O kitty-cat! I can’t begin to tell you half about it.
I can’t about the bed-room, either, and the dinner-room.
But the kitchen was the very bestest of all. There was a stove—a
teeny tonty mite of a one, kitty-cat,—with dishes just zactly like
mamma’s, only littler, of course, and fry-pans and everything; and
spoons to stir with, and a rolling-pin, and two little cutters-out, and
the darlingest baker-sheet ever you saw!
And the first thing that little girl did was to make some teenty mites
of cookies, ’cause her mamma let her; and if you’ll come right down
stairs, kitty-cat, I’ll give you one.
’Cause I was that little girl, kitty-cat, all the time.

A LITTLE ROGUE.
Grandma was nodding, I rather think;
Harry was sly and quick as a wink;
He climbed in the back of her great arm-chair,
And nestled himself very snugly there;
Grandma’s dark locks were mingled with white,
And quick this fact came to his sight;
A sharp twinge soon she felt at her hair,
And woke with a start, to find Harry there.
“Why, what are you doing, my child?” she said;
He answered, “I’se pulling a basting fread?”

MATTIE’S WANTS AND WISHES.


I wants a piece of cal’co
To make my doll a dess;
I doesn’t want a big piece;
A yard’ll do, I guess.
I wish you’d fred my needle,
And find my fimble, too—
I has such heaps o’ sewin’
I don’t know what to do.

I wants my Maud a bonnet;


She hasn’t none at all;
And Fred must have a jacket;
His ozzer one’s too small.
I wants to go to grandma’s;
You promised me I might.
I know she’d like to see me;
I wants to go to-night.

She lets me wipe the dishes,


And see in grandpa’s watch—
I wish I’d free, four pennies
To buy some butter-scotch.
My Hepsy tored her apron
A tum’lin’ down the stair,
And Cæsar’s lost his pantloons.
And needs anozzer pair.

I wants some newer mittens—


I wish you’d knit me some,
’Cause most my fingers freezes,
They leaks so in the fum.
I wored ’em out last summer,
A pullin’ George’s sled;
I wish you wouldn’t laugh so—
It hurts me in my head.

I wish I had a cookie;


I’m hungry’s I can be.
If you hasn’t pretty large ones,
You’d better bring me free.
I wish I had a p’ano—
Won’t you buy me one to keep?
O, dear! I feels so tired,
I wants to go to sleep.

Grace Gordon.

WON’T AND WILL.


Sha’n’t and Won’t were two little brothers,
Angry, and sullen, and gruff;
Try and Will are dear little sisters,
One can scarcely love them enough.

Sha’n’t and Won’t looked down on their noses,


Their faces were dismal to see;
Try and Will are brighter than roses
In June, and as blithe as a bee.

Sha’n’t and Won’t are backward and stupid,


Little, indeed, did they know;
Try and Will learn something new daily,
And seldom are heedless or slow.

Sha’n’t and Won’t loved nothing, no, nothing,


So much as to have their own way;
Try and Will give up to their elders,
And try to please others at play.
Sha’n’t and Won’t came to terrible trouble:
Their story is awful to tell;
Try and Will are in the schoolroom,
Learning to read and spell.

WILLIE’S BREECHES.
The boy’s garments should suit the description contained
in the piece. In reciting the last two lines he should point to
his head, stretch out his hands to show them, look down at
his feet, and then catch hold of his pants and spread them
out on the sides, putting on at the same time a look of
pride.
I’m just a little boy, you know,
And hardly can remember,
When people ask how old I am,
To tell ’em four last ’vember.
And yet for all I am so small,
I made so many stitches
For mamma’s fingers, that she put
Her little boy in breeches.

You may be sure that I was glad;


I marched right up and kissed her,
Then gave my bibs and petticoats,
And all, to baby sister.
I never whine, now I’m so fine,
And don’t get into messes;
For mamma says, if I am bad,
She’ll put me back in dresses!

There’s buttons up and down my legs,


And buttons on my jacket;
I’d count ’em all, but baby makes
Just now, an awful racket.
She’s sitting there, behind the chair,
With blocks, and dolls, and kitty,
A playing “go to gran’ma’s house,”
Alone, ’n that’s a pity.

I think I’ll go and help her some,


I’m sure it would amuse me;
So I won’t bother any more
To talk—if you’ll excuse me.
But first I’ll stand before the glass,
From top to toe it reaches;
Now look! there’s head, and hands, and feet,
But all the rest is breeches!

Etta G. Salsbury.

LITTLE DORA’S SOLILOQUY.


I tan’t see what our baby boy is dood for anyway:
He don’t know how to walk or talk, he don’t know how to play;
He tears up ev’ry single zing he posser-bil-ly tan,
An’ even tried to break, one day, my mamma’s bestest fan.
He’s al’ays tumblin’ ’bout ze floor, an’ gives us awful scares,
An’ when he goes to bed at night, he never says his prayers.
On Sunday, too, he musses up my go-to-meetin’ clothes,
An’ once I foun’ him hard at work a-pinc’in’ Dolly’s nose;
An’ ze uzzer day zat naughty boy (now what you s’pose you zink?)
Upset a dreat big bottle of my papa’s writin’ ink;
An’, ’stead of kyin’ dood an’ hard, as course he ought to done,
He laughed and kicked his head ’most off, as zough he zought ’twas
fun.

He even tries to reach up high, an’ pull zings off ze shelf,


An’ he’s al’ays wantin’ you, of course, jus’ when you wants you’self.
I rather dess, I really do, from how he pulls my turls,
Zey all was made a-purpose for to ’noy us little dirls;
An’ I wish zere wasn’t no such zing as naughty baby boys
Why—why, zat’s him a-kyin’ now; he makes a drefful noise,
I dess I better run and see, for if he has—boo-hoo!—
Felled down ze stairs and killed his-self, whatever s-s-s’all I do!

THE SQUIRREL’S LESSON.


Two little squirrels, out in the sun,
One gathered nuts, and the other had none;
“Time enough yet,” his constant refrain;
“Summer is still just on the wane.”

Listen, my child, while I tell you his fate:


He roused him at last, but he roused him too late;
Down fell the snow from a pitiless cloud,
And gave little squirrel a spotless white shroud.

Two little boys in a school-room were placed,


One always perfect, the other disgraced;
“Time though yet for my learning,” he said;
“I will climb, by and by, from the foot to the head.”

Listen, my darling; their locks are turned gray;


One as a Governor sitteth to-day;
The other, a pauper, looks out at the door
Of the almshouse, and idles his days as of yore.

Two kinds of people we meet every day;


One is at work, the other at play,
Living uncared for, dying unknown—
The busiest hive hath ever a drone.

LITTLE KITTY.
Once there was a little kitty,
Whiter than snow;
In the barn she used to frolic,
Long time ago;
In the barn a little mousie
Ran to and fro;
For she heard the kitty coming,
Long time ago.

Two black eyes had little kitty,


Black as a sloe;
And they spied the little mousie,
Long time ago.
Nine pearl teeth had little kitty,
All in a row;
And they bit the little mousie,
Long time ago.

When the teeth bit little mousie,


Little mousie cried, “Oh!”
But she got away from kitty,
Long time ago.
Kitty White so shyly comes,
To catch the mousie Gray;
But mousie hears her softly step
And quickly runs away.

LABOR SONG.
This is a charming exercise for boys and girls. Each should
be dressed in the costume of the character to be
represented, and, as far as possible, should go through the
motions called for by the part. The properties can all be
placed on the stage before the performance begins. Each
character comes in alone, those who have already entered
remaining until the close. All unite in singing the chorus,
after each performer has spoken or sung (according to
choice) the part he or she is to act. Music suitable for this
selection is herewith furnished. Come in promptly and avoid
long pauses.

The Farmer (with scythe and dressed like a farmer.)

I’m glad I am a husbandman,


My acres broad to till,
And in the Autumn of the year
My many barns to fill.
How happy is the farmer’s life,
’Tis one of peace and joy,
To reap and sow, and plow and mow,
And thus the time employ.

Chorus.

How happy is the laborer,


For when the day is o’er,
The evening shadows gather round,
That he may work no more;
How happy is the laborer,
His heart is light and gay,
And merrily his song rings out,
Throughout the livelong day.

The Farmer’s Wife (kneading bread).

I’m glad I am a farmer’s wife,


The wheaten bread to knead,
And when the men come home from work
Their hungry mouths to feed.
I keep my house in perfect trim,
I sweep and dust and bake,
And when the busy day is done,
Sweet is the rest I take.—Chorus.

The Farmer’s Girl (with broom and milk pail)

I’m glad I am a farmer’s girl,


I love the farmer’s life,
And if I ever wed at all,
I’ll be a farmer’s wife.
My milking pails make music sweet,
I’m happy all the day,
Work gives my cheek the glow of health,
And drives dull care away.—Chorus.

The Farmer’s Boy (with rake).

I’m glad I am a farmer’s boy,


To plant and rake and hoe—
I get upon old Dobbin’s back,
And don’t I make him go?
I shout and make the welkin ring,
I sing my merry song,
And, roaming through the fields and woods,
I’m jolly all day long. [Boy whistles Chorus.

Dairy Maid (with churn.)

I’m glad I am a dairy maid,


My butter is so yellow;
I know the lad that catches me
Will be a lucky fellow.
I’m glad I am a dairy maid,
My heart is light and gay,
And with my milk and cream and churn,
I’m happy all the day.—Chorus.

Washerwoman (with tub and washboard).

I’m glad I am a washerwoman,


Ye know me by my look,
I’ll wash and starch your snowy clothes,
And fold them like a book;
Then sind me in your orders quick
For I’ve no time for fooling;

(Spoken).

I’ll do thim to the best of my ability,


Ontirely sure.—Chorus.

The Shoemaker (shoe, last and hammer).

I’m glad I am a shoemaker,


With hammer, last and shoe;
Without the slippers that I make,
What would the ladies do?
I cut the leather, fit the last—
To me, my work is play—
From morn to night, with heart so light,
I sing and peg away.—Chorus.

The Blacksmith (with anvil and hammer).


I’m glad I am a blacksmith,
A noble horse to shoe,
I hold within my lap his hoof,
And whack the shoe-nail through;
I swing the hammer and I know
Just how to make a hit,
And indigestion, if you please,
Don’t trouble me a bit.—Chorus.

The School-Teacher (with slate, hook and rule;


three or four children to take part of scholars).

I’m glad I am a school-teacher,


With slate and book and rule,
To teach the young idea to shoot,
And extirpate the fool.
The heights of knowledge I point out,
And upward lead the way,
And with my pupils pressing on,
I’m happy every day.—Chorus.

WHAT BABY SAID.


I am here. And if this is what they call the world, I don’t think much of
it. It’s a very flannelly world and smells of paregoric awfully. It’s a
dreadful light world, too, and makes me blink, I tell you. And I don’t
know what to do with my hands; I think I’ll dig my fists in my eyes.
No, I won’t. I’ll scratch at the corner of my blanket and chew it up,
and then I’ll holler; whatever happens, I’ll holler. And the more
paregoric they give me, the louder I’ll yell. That old nurse puts the
spoon in the corner of my mouth, sidewise like, and keeps tasting my
milk herself all the while. She spilt snuff in it last night, and when I
hollered she trotted me. That comes of being a two-days-old baby.
Never mind; when I’m a man, I’ll pay her back good.
There’s a pin sticking in me now, and if I say a word about it, I’ll be
trotted or fed; and I would rather have catnip-tea. I heard folks say,
“Hush! don’t wake up Emeline’s baby;” and I suppose that pretty,
white-faced woman on the pillow is Emeline.
No, I was mistaken; for a chap was in here just now and wanted to
see Bob’s baby and looked at me and said I was a funny little toad,
and looked just like Bob. He smelt of cigars. I wonder who else I
belong to! Yes, there’s another one—that’s “Gamma.” “It was
Gamma’s baby, so it was.” I declare, I don’t know who I belong to;
but I’ll holler, and maybe I’ll find out. There comes snuffy with catnip
tea. I’m going to sleep. I wonder why my hands won’t go where I
want them to!

ONE LITTLE ACT.


I saw a man, with tottering steps,
Come down a graveled walk, one day;
The honored frost of many years
Upon his scattered thin locks lay.
With trembling hands he strove to raise
The latch that held the little gate,
When rosy lips looked up and smiled,—
A silvery child-voice said, “Please wait.”

A little girl oped wide the gate,


And held it till he passed quite through,
Then closed it, raising to his face
Her modest eyes of winsome blue.
“May Heaven bless you, little one,”
The old man said, with tear-wet eyes;
“Such deeds of kindness to the old
Will be rewarded in the skies.”

’Twas such a little thing to do—


A moment’s time it took—no more;
And then the dancing, graceful feet
Had vanished through the school-room door.
And yet I’m sure the angels smiled,
And penned it down in words of gold;
’Tis such a blessed thing to see
The young so thoughtful of the old.

THE LITTLE ORATOR.


Lines written for Edward Everett, when a child.
Pray, how should I, a little lad,
In speaking make a figure?
You’re only joking, I’m afraid—
Do wait till I am bigger.

But, since you wish to hear my part,


And urge me to begin it,
I’ll strive for praise, with all my heart,
Though small the hope to win it.

I’ll tell a tale how Farmer John


A little roan colt bred, sir,
And every night and every morn
He watered and he fed, sir.

Said Neighbor Joe to Farmer John,


“Aren’t you a silly dolt, sir,
To spend such time and care upon
A little useless colt, sir?”

Said Farmer John to Neighbor Joe,


“I bring my little roan up,
Not for the good he now can do,
But will do when he’s grown up.”

The moral you can well espy,


To keep the tale from spoiling;
The little colt, you think, is I—
I know it by your smiling.

And now, my friends, please to excuse


My lisping and my stammers;
I, for this once, have done my best,
And so—I’ll make my manners.

Thaddeus Mason Harris.

A GENTLEMAN.
I knew him for a gentleman
By signs that never fail;
His coat was rough and rather worn,
His cheeks were thin and pale—
A lad who had his way to make,
With little time for play;
I knew him for a gentleman
By certain signs to-day.

He met his mother on the street;


Off came his little cap.
My door was shut; he waited there
Until I heard his rap.
He took the bundle from my hand,
And when I dropped my pen,
He sprang to pick it up for me—
This gentleman of ten.

He does not push and crowd along;


His voice is gently pitched;
He does not fling his books about
As if he were bewitched,
He stands aside to let you pass;
He always shuts the door;
He runs on errands willingly
To forge and mill and store.

He thinks of you before himself,


He serves you if he can;
For, in whatever company,
The manners make the man.
At ten or forty, ’tis the same;
The manner tells the tale,
And I discern the gentleman
By signs that never fail.

Margaret E. Sangster.

BABIES AND KITTENS.


There were two kittens, a black and a gray,
And grandma said with a frown:
“It never will do to keep them both,
The black one we had better drown.”

“Don’t cry, my dear,” to tiny Bess,


“One kitten is enough to keep,
Now run to nurse, for ’tis growing late
And time you were fast asleep.”

The morning dawned, and rosy and sweet,


Came little Bess from her nap,
The nurse said, “Go in mamma’s room,
And look in grandma’s lap.”

“Come here,” said grandma, with a smile,


From the rocking-chair, where she sat,
“God has sent you two little sisters,
What do you think of that?”

Bess looked at the babies a moment,


With their wee heads, yellow and brown,
And then to grandma soberly said:
“Which one are you going to drown?”

L. M. Hadley.
A DISSATISFIED CHICKEN.
There was a little chicken that was shut up in a shell,
He thought to himself, “I’m sure I cannot tell
What I am walled in here for—a shocking coop I find,
Unfitted for a chicken with an enterprising mind.”

He went out in the barnyard one lovely morn in May,


Each hen he found spring-cleaning in the only proper way;
“This yard is much too narrow—a shocking coop I find,
Unfitted for a chicken with an enterprising mind.”

He crept up to the gateway and slipped betwixt a crack,


The world stretched wide before him, and just as widely back;
“This world is much too narrow—a shocking coop I find,
Unfitted for a chicken with an enterprising mind.

“I should like to have ideals, I should like to tread the stars,


To get the unattainable, and free my soul from bars;
I should like to leave this dark earth, and some other dwelling find
More fitted for a chicken with an enterprising mind.

“There’s a place where ducks and pleasure boats go sailing to and fro,
There’s one world on the surface and another world below.”
The little waves crept nearer and, on the brink inclined,
They swallowed up the chicken with an enterprising mind.

A. G. Waters.

THE LITTLE TORMENT.


My name’s Jack. I’m eight years old. I’ve a sister Arathusa, and she
calls me a little torment. I’ll tell you why: You know Arathusa has got
a beau, and he comes to see her every night, and they turn the gas
’way, ’way down ’till you can’t hardly see. I like to stay in the room
with the gas on full blaze, but Arathusa skites me out of the room
every night.
I checked her once, you better believe. You know she went to the
door to let Alphonso in, and I crawled under the sofa. Then they came
in, and it got awful dark, and they sat down on the sofa, and I
couldn’t hear nothing but smack! smack! smack! Then I reached out
and jerked Arathusa’s foot. Then she jumped and said, “Oh, mercy,
what’s that?” and Alphonso said she was a “timid little creature.” “Oh,
Alphonso, I’m happy by your side, but when I think of your going
away it almost breaks my heart.”
Then I snickered right out, I couldn’t help it, and Arathusa got up,
went and peeked through the keyhole and said, “I do believe that’s
Jack, nasty little torment, he’s always where he isn’t wanted.” Do you
know this made me mad, and I crawled out from under the sofa and
stood up before her and said, “You think you are smart because you
have got a beau. I guess I know what you’ve been doing; you’ve been
sitting on Alphonso’s lap, and letting him kiss you like you let Bill
Jones kiss you. You ought to be ashamed of yourself. If it hadn’t been
for that old false front of yours, Pa would have let me have a bicycle
like Tom Clifford’s. You needn’t be grinding them false teeth of yours
at me, I ain’t a-going out of here. I ain’t so green as I look. I guess I
know a thing or two. I don’t care if you are 28 years old, you ain’t no
boss of me!”

THE REASON WHY.


A Boston master said, one day,
“Boys, tell me, if you can, I pray,
Why Washington’s birthday should shine
In to-day’s history, more than mine?”

At once such stillness in the hall


You might have heard a feather fall;
Exclaims a boy not three feet high,
“Because he never told a lie!”

You might also like