Learning x86 with NASM - ADD, ADC, and EFLAGS

  Рет қаралды 8,127

OliveStem

OliveStem

Күн бұрын

Пікірлер: 15
@Terrendum
@Terrendum Жыл бұрын
Small correction. The parity flag isn’t set when the result itself is odd. It is set if the least-significant byte of the result has an even number of set bits. So since 3 (0b11) had two bits set, the parity bit is set.
@olivestemlearning
@olivestemlearning Жыл бұрын
Good catch, thank you for mentioning this!
@MASTERACADEMY4
@MASTERACADEMY4 Жыл бұрын
Excellent, your explanation is mind blowing, keep it up.
@olivestemlearning
@olivestemlearning Жыл бұрын
Thank you! I'm glad to hear the video was helpful
@mrinalyadav4261
@mrinalyadav4261 5 ай бұрын
@@olivestemlearning do you upload this code on github?
@MohamadModather99
@MohamadModather99 19 күн бұрын
Just to clarify: Consider the number 9, which is 'odd'. The decimal number 9 is represented in binary as 1001. In the binary representation 1001, there are two 1s. Since there are two 1s (an even number), the Parity Flag (PF) would be set to 1.
@lysdexic9129
@lysdexic9129 11 ай бұрын
how does the compiler know the value in al after mov al, 0xFF is signed or unsigned? Cheers.
@syscall-y9i
@syscall-y9i Жыл бұрын
**Another Example for Parity Flag** `ADD bl,cl` where `bl` is `0b1101` = `13` and `cl` is `0b0001` = `1` Result of this will **not** set the `PF` parity flag since the result will be `14` = `0b1110` where 3 bits are set and hence number of bits set is odd.
@danielleivy8180
@danielleivy8180 9 ай бұрын
Mac doesn't allow accessing the high half, apparently? I'm having so much fun with Mac if you can't tell. I really think they want you to use the entire 16 bits from the get-go if there's even a slight possibility of a carry?
@mehmeteminfincan8010
@mehmeteminfincan8010 11 ай бұрын
Why I am getting segmentation fault, if I do not mov 1 to eax before interrupting the code with INT 80h? Why do not you get any segmentation fault error?
@olivestemlearning
@olivestemlearning 11 ай бұрын
The INT 80h instruction will request the operating system to perform a system call. The system call that is requested is based on the value in eax. When eax is set to 1, the INT 80h request will run the exit system call, which ends the program. If you don't set eax to 1 before INT 80h, it will run a different system call, which can result in a segmentation fault depending on the system call run (for example, if eax were 3, a read system call would run. This system call uses ebx to determine which file to read, and ecx as the buffer to read data into. If ebx is not a valid file or if ecx points to invalid memory, you would see a crash/segmentation fault) In the video, I never end up running the INT 80h command when stepping through in gdb, but if I did, I'd likely reach the same segmentation fault. I should have moved 1 into eax in the video to help avoid this error. Hopefully this clarifies!
@mehmeteminfincan8010
@mehmeteminfincan8010 11 ай бұрын
@@olivestemlearning ty for your respond. Your videos are very helpful.
@andersjjensen
@andersjjensen Жыл бұрын
How... did stuff from AL and AH end up in EAX?!?
@olivestemlearning
@olivestemlearning Жыл бұрын
eax is a 32 bit register in x86. The AL and AH registers are just different ways of accessing the 32 bits of eax. You can divide up the register like this: ax | ah | al 00000000 00000000 | 00000000 | 00000000 So, if I place some data in eax, I can access pieces of it using ah and al. For example, if we put the value 2 in eax we have: eax: 00000000 00000000 00000000 00000010 If I were to access al, I would just see the rightmost 8 bits, which gives me a value of 2.
@andersjjensen
@andersjjensen Жыл бұрын
@@olivestemlearning Ah, thanks! I haven't played with assembly level code since my Commodore 64 three decades ago. I'm a C programmer nowadays, but apparently I took some 6510 thinking with me into this topic.
Learning x86 with NASM - Subtraction and Sign Flags
6:27
OliveStem
Рет қаралды 4,6 М.
Learning x86 with NASM - Characters, Strings and Lists
11:52
OliveStem
Рет қаралды 10 М.
When u fight over the armrest
00:41
Adam W
Рет қаралды 21 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 2,9 МЛН
Mia Boyka х Карен Акопян | ЧТО БЫЛО ДАЛЬШЕ?
1:21:14
Что было дальше?
Рет қаралды 10 МЛН
Family Love #funny #sigma
00:16
CRAZY GREAPA
Рет қаралды 39 МЛН
computers suck at division (a painful discovery)
5:09
Low Level
Рет қаралды 1,7 МЛН
Learning x86 with NASM - Opening and Reading Files
13:55
OliveStem
Рет қаралды 5 М.
“Hello, world” from scratch on a 6502 - Part 1
27:25
Ben Eater
Рет қаралды 4,8 МЛН
x86 Assembly: Hello World!
14:33
John Hammond
Рет қаралды 1,4 МЛН
Just enough assembly to blow your mind
29:31
Kay Lack
Рет қаралды 127 М.
do you know how "return" works under the hood? (are you SURE?)
5:08
Assembly Basics: The Language Behind the Hardware
12:55
WhiteboardDoodles
Рет қаралды 26 М.
When u fight over the armrest
00:41
Adam W
Рет қаралды 21 МЛН