开发者

can anyone help me and write the program of this equation: x=n mod y, in assembly lsnguage

开发者 https://www.devze.com 2023-01-28 12:35 出处:网络
How can i solve this problem in assembly language: using only SUB, M开发者_Go百科OV, AND instructions, show how to calculate x = n mod y, assuming that you are given the values of n and y. n is any 16

How can i solve this problem in assembly language: using only SUB, M开发者_Go百科OV, AND instructions, show how to calculate x = n mod y, assuming that you are given the values of n and y. n is any 16-bit unsigned integer, and y is power of 2.


There are two main steps to solving a problems like this:

  1. determine the algorithm and express it in pseudocode or a language such as C

  2. implement (1) in assembler.

For step (1) you need to know that n mod y, where y is a power of 2, is equivalent to n AND (y - 1).

0

精彩评论

暂无评论...
验证码 换一张
取 消