spelling and moving around chapters

This commit is contained in:
Perry Kivolowitz 2022-06-10 02:55:31 -05:00
parent eb80d99d37
commit 45db9bbb07
7 changed files with 50 additions and 35 deletions

46
.vscode/settings.json vendored
View file

@ -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"
]
}

View file

@ -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

View file

@ -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.

View file

@ -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).

View file

@ -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.

View file

@ -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.

View file

@ -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 */