Meaning of this set of instructions in Mic-1 [MAL Language]

958 views Asked by At

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

1

There are 1 answers

2
Ross Ridge On BEST ANSWER

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.).