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 Жыл бұрын
Good catch, thank you for mentioning this!
@MASTERACADEMY4 Жыл бұрын
Excellent, your explanation is mind blowing, keep it up.
@olivestemlearning Жыл бұрын
Thank you! I'm glad to hear the video was helpful
@mrinalyadav42615 ай бұрын
@@olivestemlearning do you upload this code on github?
@MohamadModather9919 күн бұрын
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.
@lysdexic912911 ай бұрын
how does the compiler know the value in al after mov al, 0xFF is signed or unsigned? Cheers.
@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.
@danielleivy81809 ай бұрын
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?
@mehmeteminfincan801011 ай бұрын
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?
@olivestemlearning11 ай бұрын
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!
@mehmeteminfincan801011 ай бұрын
@@olivestemlearning ty for your respond. Your videos are very helpful.
@andersjjensen Жыл бұрын
How... did stuff from AL and AH end up in EAX?!?
@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 Жыл бұрын
@@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.