Question
Why is (Z / Y) equal to (N >> Z) ? ======== Calculate Z / Y ======== Divide_ZY: mov edx, 0 ; Zero-out edx because
Why is (Z / Y) equal to (N >> Z) ?
======== Calculate Z / Y ======== Divide_ZY: mov edx, 0 ; Zero-out edx because idiv treats it as high bits above eax! mov eax, 0 ; Initialize eax prior to using it mov ecx, 0 ; Initialize ecx prior to using it mov esi, Z ; Move the address of Z into esi mov eax, [esi] ; Move the value at Z into eax mov esi, Y ; Move the address of Y into esi mov ecx, [esi] ; Move the value at Y into ecx div ecx ; Divide: Z / Y mov [RESULT], eax ; Store the result Display_ZY_quotient: Print_Msg MSG_B0, LEN_B0, RESULT ; ======== Calculate N >> Z ======== Shift_Z_right_by_N: mov eax, 0 ; Initialize ebx prior to using it mov ecx, 0 ; Initialize ecx prior to using it mov esi, Z ; Move the address of Z into esi mov eax, [esi] ; Move the value at Z into eax mov esi, N ; Move the address of N into esi mov ecx, [esi] ; Move the value at N into ecx register shr al, cl ; Shift: N >> Z mov [RESULT], eax ; Store the result Display_Z_right_shift: Print_Msg MSG_B1, LEN_B1, RESULT ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started