-2

The sequence of Mic-1 instructions below realize a new instruction bish8pu x (x is an offset in 8 bit in binary code). What is the meaning of this set of instructions?

bish8pu1    MAR=SP 
bish8pu2    H=TOS << 8
bish8pu3    TOS=MDR=MBRU OR H;wr 
bish8pu4    PC=PC+1;fetch 
bish8pu5    goto Main1

Thanks a lot

Michael
  • 41,989
  • 11
  • 82
  • 128
rammar
  • 11
  • 1

1 Answers1

0

The instruction shifts the value in the TOS register to the left by 8 and stores the result in the H register. It then bitwise ORs the value in the H register with the value of the instruction's immediate byte and stores the resulting value both in the TOS register and in the location in memory pointed to by the SP.

Basically it computes [SP] = [SP] * 256 + immediate, where [SP] is the memory location pointed to by the SP register. (That is, assuming that the TOS register caches the value pointed to by SP.).

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
  • Thanks for the answer, only with one thing i'm confused. With what do you make bitwise ORs? With the word not shifted and that later shifted? – rammar Jun 08 '15 at 18:16
  • @rammar I've updated my answer to try to make that more explicit. – Ross Ridge Jun 08 '15 at 19:22