github.com/jflude/taocp@v0.0.0-20240210234939-99f2a91af3c2/mix/move.go (about)

     1  package mix
     2  
     3  func (c *Computer) move(aa Word, i, f, op, m int) (int64, error) {
     4  	if f == 0 {
     5  		return 1, nil
     6  	}
     7  	to := c.Reg[I1].Int()
     8  	c.checkAddress(m)
     9  	c.checkAddress(m + f)
    10  	c.checkAddress(to)
    11  	c.checkAddress(to + f)
    12  	c.checkInterlock(to, m+f)
    13  	for j := 0; j < f; j++ {
    14  		c.Contents[mBase+to+j] = c.Contents[mBase+m+j]
    15  	}
    16  	c.Reg[I1] = NewWord(to + f)
    17  	return 1 + 2*int64(f), nil
    18  }