One of the ways to look at programming at the assembly-language level
is to consider it as putting together code fragments that do various little
jobs. (This is a little higher-level than just thinking of it as a sequence of
machine instructions.) Write short, snappy little code fragments to per-
form the following tasks:
(a) Add two 16-bit numbers, one in file registers 0 and 1, and the other
in file registers 2 and 3. (Most significant byte in the second register
in each case.)
(b) Write a loop (its body consisting, in this case, of only a NOP in-struction) which will execute exactly a number of times determined by the value of the working register, W. (So, if W contains 33, the
NOP in the loop should be executed exactly 33 times.)
(c) Load the address of a variable (defined in a CBLOCK statement as “foo”) into FSR0.
(d) shift left 1 bit a 32-bit value, implemented as 4 memory locations, the address of which is in FSR1.

Want an answer?

No answer yet. Submit this
question to the community.