From 45db9bbb077139121d1718e039af618f39419608 Mon Sep 17 00:00:00 2001 From: Perry Kivolowitz Date: Fri, 10 Jun 2022 02:55:31 -0500 Subject: [PATCH] spelling and moving around chapters --- .vscode/settings.json | 46 +++++++++++++++++++++++------------- README.md | 19 ++++++++------- section_1/fizzbuzz/README.md | 2 +- section_1/funcs/README.md | 2 +- section_1/funcs/README2.md | 2 +- section_1/regs/README.md | 4 ++-- section_1/regs/ldr.md | 10 ++++---- 7 files changed, 50 insertions(+), 35 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 854fb8f..faaa783 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,21 +1,35 @@ { "cSpell.words": [ - "AARCH", - "argc", - "argv", - "asciz", - "cout", - "csel", - "Formulus", - "iostream", - "memcpy", - "pseudocode", - "stringstream", - "strncpy", - "struct", - "structs" - ], + "AARCH", + "argc", + "argv", + "asciz", + "cbnz", + "cout", + "csel", + "fizzbuzz", + "fname", + "Formulus", + "funcs", + "iostream", + "ldrb", + "ldrh", + "lname", + "memcpy", + "pimm", + "pseudocode", + "regs", + "simm", + "smaddl", + "stringstream", + "strncpy", + "struct", + "structs" + ], "markdownlint.config": { "MD024":false - } + }, + "cSpell.ignoreWords": [ + "foov" + ] } \ No newline at end of file diff --git a/README.md b/README.md index 7457a22..97c80d7 100644 --- a/README.md +++ b/README.md @@ -45,15 +45,16 @@ the 64 bit ARM Instruction Set Architecture (ISA). | 1 | [Hello World](./section_1/hello_world/README.md) | | 2 | [If Statements](./section_1/if/README.md) | | 3 | Loops | -| 3 a | [   While Loops](./section_1/while/README.md) | -| 3 b | [   For Loops](./section_1/for/README.md) | -| 3 c | [   Implementing Continue](./section_1/for/README.md#implementing-a-continue) -| 3 d | [   Implementing Break](./section_1/for/README.md#implementing-a-break) -| 4 | [Interlude - Registers](./section_1/regs/README.md) | -| 5 | [Interlude - Load and Store](./section_1/regs/ldr.md) | -| 6 | [Calling and Returning From Functions](./section_1/funcs/README.md) | -| 7 | [Passing Parameters To Functions](./section_1/funcs/README2.md) | -| 8 | [FizzBuzz - a Complete Program](./section_1/fizzbuzz/README.md) | +| 3 a | [....While Loops](./section_1/while/README.md) | +| 3 b | [....For Loops](./section_1/for/README.md) | +| 3 c | [....Implementing Continue](./section_1/for/README.md#implementing-a-continue) +| 3 d | [....Implementing Break](./section_1/for/README.md#implementing-a-break) +| 4 | Interludes | +| 4 a | [....Registers](./section_1/regs/README.md) | +| 4 b | [....Load and Store](./section_1/regs/ldr.md) | +| 5 | [Calling and Returning From Functions](./section_1/funcs/README.md) | +| 6 | [Passing Parameters To Functions](./section_1/funcs/README2.md) | +| 7 | [FizzBuzz - a Complete Program](./section_1/fizzbuzz/README.md) | ## Section 2 - Stuff diff --git a/section_1/fizzbuzz/README.md b/section_1/fizzbuzz/README.md index ffffbfb..57848a4 100644 --- a/section_1/fizzbuzz/README.md +++ b/section_1/fizzbuzz/README.md @@ -1,4 +1,4 @@ -# Section 1 / Chapter 8 / FizzBuzz +# Section 1 / Chapter 7 / FizzBuzz In this chapter we build the classic tech interview question: FizzBuzz. diff --git a/section_1/funcs/README.md b/section_1/funcs/README.md index ae0c631..d5d3fc9 100644 --- a/section_1/funcs/README.md +++ b/section_1/funcs/README.md @@ -1,4 +1,4 @@ -# Section 1 / Chapter 6 / Calling and Returning From Functions +# Section 1 / Chapter 5 / Calling and Returning From Functions Calling functions, passing parameters to them and receiving back return values is basic to using `C` and and `C++`. Calling methods (which are functions connected to classes) is similar but with enough differences to warrant its own discussion to be provided later in the chapter on [structs](../struct/structs.md). diff --git a/section_1/funcs/README2.md b/section_1/funcs/README2.md index f65dbe0..2c29984 100644 --- a/section_1/funcs/README2.md +++ b/section_1/funcs/README2.md @@ -1,4 +1,4 @@ -# Section 1 / Chapter 7 / Passing Parameters To Functions +# Section 1 / Chapter 6 / Passing Parameters To Functions Up to 8 parameters can be passed directly via registers. Each parameter can be up to the size of an address, long or double (8 bytes). If you need to pass more than 8 parameters or you need to pass parameters which are larger than 8 bytes or are `structs`, you would use a different technique described later. diff --git a/section_1/regs/README.md b/section_1/regs/README.md index 217ea58..0ad2bf9 100644 --- a/section_1/regs/README.md +++ b/section_1/regs/README.md @@ -1,4 +1,4 @@ -# Section 1 / Chapter 4 / Interlude - Registers +# Section 1 / Chapter 4 a / Interlude - Registers We have discussed and used registers in the previous chapters without explanation. This chapter introduces the concept of registers and explains why registers are critical. @@ -62,7 +62,7 @@ In the next image, the relative latencies within a computer are expressed in a d Resist the urge to cling tightly to the idea of data being only found in RAM. -In order to manipulate data, the data must be loaded into registers. +In order to manipulate data, the data must be loaded into registers. **YOU ARE THE HUMAN!** With planning and forethought YOU can arrange for the data you need most to be resident in registers rather than in RAM. In fact, ideally, you can organize your code and algorithms to minimize the dependence upon RAM and in some cases, you can write whole sophisticated programs using RAM for little more than a place to store string literals. diff --git a/section_1/regs/ldr.md b/section_1/regs/ldr.md index 0f6346f..2089c46 100644 --- a/section_1/regs/ldr.md +++ b/section_1/regs/ldr.md @@ -1,4 +1,4 @@ -# Section 1 / Chapter 5 / Interlude - Load and Store +# Section 1 / Chapter 4 b / Interlude - Load and Store In this section we will review the `ldr` and `str` families of instructions. @@ -53,7 +53,7 @@ Lines 2 and 3 says you can specify a *change* to the dereferenced register eithe Assume `ptr` is a pointer to a `long`: -* Line 2 corresponds to: `*(ptr++)`. +* Line 2 corresponds to: `*(ptr++)`. * Line 3 corresponds to: `*(++ptr)`. Concerning the restrictions placed on the offsets: @@ -76,7 +76,7 @@ Concerning the restrictions placed on the offsets: Notice the following: -* Pointers and longs use `x` registers. +* Pointers and longs use `x` registers. * All other integer sizes use `w` registers where the instruction itself specifies the size. ### Array Indexing 1 - Wasteful @@ -366,7 +366,7 @@ age older than the oldest found so far, it updates both values. Upon reaching the end of the array, it will return a pointer to the instance containing the oldest age. If there is a tie, it will return the first oldest instance. -`Line 18` is **defensive programming**. It ensures that no search is performed if the +`Line 18` is **defensive programming**. It ensures that no search is performed if the function is handed a null pointer. `gcc` with `-O2` or `-O3` optimization rendered `OriginalFindOldestPerson()` into 18 lines of assembly language. @@ -487,7 +487,7 @@ of 8. smaddl x4, w1, w5, x3 // initialize end_ptr // 19 ``` -`w1` (the length) will be multipled by `w5` (the size of each array member), added to `x3` (the base address of the array) and the result will be placed into `x4`. This assembly language instruction implements this in C: +`w1` (the length) will be multiplied by `w5` (the size of each array member), added to `x3` (the base address of the array) and the result will be placed into `x4`. This assembly language instruction implements this in C: ```c struct Person * end_ptr = people + length; /* 20 */