mirror of
https://github.com/pkivolowitz/asm_book.git
synced 2026-06-21 09:16:46 +08:00
making markdown lint happier
This commit is contained in:
parent
42e79c31dc
commit
d99e803796
2 changed files with 6 additions and 7 deletions
|
|
@ -65,7 +65,7 @@ There are other reasons to specify a `using namespace` and even some reasons *no
|
|||
|
||||
`Line 5` is a function declaration declaring `main`. In command line
|
||||
programs (and indeed in many non-command line programs), a function
|
||||
called `main` is necessary.
|
||||
called `main` is necessary.
|
||||
|
||||
In all respects save one, `main` is an
|
||||
ordinary user-written function. What makes `main` special is its name
|
||||
|
|
@ -201,7 +201,7 @@ This marks the end of the `while` loop's *body*. The `}` causes a **jump**
|
|||
back to evaluating what is pointed to by argv to see if it is now null (which
|
||||
exits the loop). A synonym for **jump** is **branch** - remember this.
|
||||
|
||||
Also remember that braces in a higher level language can mean a branch or jump in
|
||||
Also remember that braces in a higher level language can mean a branch or jump in
|
||||
assembly language. A brace in a higher level language can also mean a *target* or landing place
|
||||
for a jump / branch elsewhere in the code.
|
||||
|
||||
|
|
@ -463,7 +463,6 @@ That is, subtract 8 from the stack pointer and copy `x21` to that location. Then
|
|||
|
||||
**The stack pointer in ARM V8 can only be manipulated in multiples of 16.**
|
||||
|
||||
|
||||
### Line 4
|
||||
|
||||
When a function is passed parameters, up to 8 of them can be found in the first 8 scratch registers (`x0` through `x7`). For example, recall:
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ For simplicity, let us assume that both `a` and `b` are defined as
|
|||
language. If `a` or `b` are not pointers and are not longs, `w` registers would sneak
|
||||
in somewhere. See [Interlude - Registers](./section_1/regs/README.md) for more information.
|
||||
|
||||
|
||||
## `if` in `AARCH64`
|
||||
|
||||
Here is the above `if` statement rendered into ARM V8 assembly language:
|
||||
|
|
@ -67,9 +66,10 @@ Handling of `>=` and `<=` follow from the above.
|
|||
Using the state of the condition bits (which are set by the faux subtraction of `x1`
|
||||
from `x0` performed by `cmp`), branch (a jump or goto) if the previous computation shows
|
||||
`less than or equal to` zero. Notice
|
||||
the use of the *opposite* condition as found in the `C` code. This use of the opposite condition is not a hard and fast rule. In this case, it allows the body of the `if`
|
||||
the use of the *opposite* condition as found in the `C` code.
|
||||
This use of the opposite condition is not a hard and fast rule. In this case, it allows the body of the `if`
|
||||
statement to be written directly below the branch so as to emulate the skipping of
|
||||
the code block contained between the `if` statement's braces.
|
||||
the code block contained between the `if` statement's braces.
|
||||
|
||||
This is a matter of
|
||||
style.
|
||||
|
|
@ -211,7 +211,7 @@ allow a branch to that code block, such as the beginning of an `else`.
|
|||
as the equivalent `if` statement in a high level language.
|
||||
|
||||
Answer: False - it is a matter of style but you may be able to
|
||||
save an instruction or two by doing so.
|
||||
save an instruction or two by doing so.
|
||||
|
||||
### 2
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue