fixing lec + adding lec4 base: TODO<all of lec4>
This commit is contained in:
parent
cdbfb3e0a4
commit
5e3ad68a0c
@ -1,21 +1,31 @@
|
|||||||
# lec3
|
# lec3
|
||||||
|
|
||||||
> Conceptual things
|
|
||||||
|
|
||||||
Until the technical lectures really start, I'll be feeding in a few technical things here and there for the sake of getting used to them.
|
|
||||||
|
|
||||||
## One's & Two's Complement
|
## One's & Two's Complement
|
||||||
|
|
||||||
_Previous lecture went over signedness of numbers so this section won't as much_.
|
_Previous lecture went over signedness of numbers so this section won't as much_.
|
||||||
One's complement in xor(just flip)
|
|
||||||
> xor 0xFF, target
|
First we'll deal with flipping bits: this is where you may hear the term _1's complement_.
|
||||||
|
While not very useful on it's own for most purposes it does help get closer to creating a seperation between _positive_ and _negative_ numbers.
|
||||||
|
|
||||||
|
The only other step after flipping all the bits is just adding 1.
|
||||||
|
|
||||||
|
`1001 1110` becomes `0110 0010`.
|
||||||
|
|
||||||
|
> shouldn't that last 2 bits be 01?
|
||||||
|
|
||||||
|
Close, the reason why we have `b10` is because if we: `b01 + b1` the `1` will carry over to the next bit.
|
||||||
|
The actual term for this is just __negate__; the other way around is essentially cannon fodder.
|
||||||
|
|
||||||
|
>Ok, but what does that look like _assembly_ the thing I came here to learn.
|
||||||
|
|
||||||
|
Most assemblers accept something like `neg targetValue` however you can also use an _exclusive or_[`xor targetValue, 0xFF`]. Keep in mind that the immediate value should be sign-extended to reflect the proper targetValue size.
|
||||||
|
|
||||||
Two's complement proccess:
|
Two's complement proccess:
|
||||||
1. Flips bits
|
1. Flips bits
|
||||||
2. Add 1
|
2. Add 1
|
||||||
|
|
||||||
The actual term for this is just __negate__; the other way around is essentially cannon fodder.
|
|
||||||
|
|
||||||
## Sign Flag
|
## Sign Flag
|
||||||
|
|
||||||
Set whenever we produce (any) number where the leading bit is set(1).
|
Set whenever we produce (any) number where the leading bit is set(1).
|
||||||
Regardless if we're dealing with signed or unsigned data.
|
Regardless if we're dealing with signed or unsigned data.
|
||||||
|
|
||||||
|
9
cst337/lec/lec4.md
Normal file
9
cst337/lec/lec4.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# lec4
|
||||||
|
|
||||||
|
_this page to be updated late since i just got lazy this time_
|
||||||
|
Topics to cover:
|
||||||
|
* add/sub
|
||||||
|
* intro to overflows
|
||||||
|
* intro to carries
|
||||||
|
* translating this to some 64 bit add/sub instructions and becoming more familiar with the flags register
|
||||||
|
* eflags won't be covered indepth yet but merely mentioned for sake of preparative clarity
|
Loading…
Reference in New Issue
Block a user