Counter Machine Reference Model - Reference Library (RefLib) - Counter Machine Instructions

Counter Machine Instructions

The various Counter machine instruction sets are like "ultra-RISC instruction sets". And, as is the case for different RISC machine builders, even for very similar machines, different authors have used different instruction sets. The "basic instructions" are used map these differences on the relevant Counter machine variant models.

Emulated instruction Implementation (script) Comments
J (i)

JZ (r0,i)

Go to i (unconditional jump); register #0 must contain 0.
JZ(rX, i1,i2)
  1. JZ (rX,i1)
  2. JZ (r0,i2)
IF rX=0 THEN i1 ELSE i2
  1. JZ (r,*i)
  2. DEC(r)
Test r=0; if r = 0 then DEC
  1. INC(r)
  2. J (i)
INC and J.
  1. JZ (r,*+3)
  2. DEC(r)
  3. J (*-2)
If r=0 goto *+3; if not then DEC and goto *-2
MOV(rX,rY) 1 CLR(rY) 2 JZ (rX,*+4) 3 INC(rY) 4 DEC(rX) 5 J (*-4) 6 CONTINUE Move rX to rY, clearing contents of rX.
CPY(rX,rY) 1 CLR(rY) 9 JZ (rW,13) 2 CLR(rW) 10 INC(rX) 3 JZ (rX,8) 11 DEC(rW) 4 INC(rY) 12 J (9) 5 INC(rW) 13 CONTINUE 6 DEC(rX) 7 J (3) 8 ?? Copy rX into rY, rW must be free (at end rW=0).
CPY (k,r)
  1. CLR (r)
  2. ( INC (r) )k
Immediate (explicit) copy constant k from instructions into R: Clear R and ( INC(r) )1 ,..., ( INC(r) )k i.e. do k times. Alternatively: put constant in register #K: CPY (K, r1)
CMP(rX,rY,r) 1 CPY(rX,r) 6 JZ(r0,3) 2 CPY(rY,rW) 7 JZ(rW,9) 3 JZ(r,7) 8 INC(r) 4 DEC(r) 9 CONTINUE 5 DEC(rW) Compare rX with rY and returns on r (r=0 if rX equal rY).
ADD(rX,rX,r) ... in terms of JZ, DEC, J, CLR, INC, CPY. r=rX+rY; perhaps preserving the contents of rX and rY.
MUL(rX,rY,r) ... in terms of JZ, DEC, J, CLR, INC, CPY, ADD. MULtiply, r=rX*rY; perhaps preserving the contents of rX and rY.
SUB(rX,rY,r) ... in terms of ... SUBtract, r=rX-rY; perhaps preserving the contents of rX and rY.

Read more about this topic:  Counter Machine Reference Model, Reference Library (RefLib)

Other articles related to "machine":

... built by RAND that was based on the von Neumann architecture that had been pioneered on the IAS machine ... After two "rescues" from the scrap heap, the machine currently resides at the Computer History Museum in Mountain View, California ... Like the IAS machine, JOHNNIAC used 40-bit words, and included 1024 words of Selectron tube main memory, each holding 256 bits of data ...
Isaac Singer - First Inventions
... In 1839, Singer obtained his first patent, for a machine to drill rock, selling it for $2,000 to the I M Canal Building Company ... He developed and patented a "machine for carving wood and metal" on April 10, 1849 ... to New York City, hoping to market his wood-block cutting machine there ...
Machine - Impact - Automata
... An automaton (plural automata or automatons) is a self-operating machine ... The word is sometimes used to describe a robot, more specifically an autonomous robot ...
Technical (vehicle) - History
... use of automobiles, and even earlier, to the horse-drawn tachankas mounting machine guns in eastern Europe and Russia ... Libya and Chad using unarmored motor vehicles, often fitted with machine guns and cannon of various types ... use of the Willys Jeep, this time fitted with a single.50 caliber Browning machine gun ...

Famous quotes containing the words instructions, counter and/or machine:

    They had supposed their formula was fixed.
    They had obeyed instructions to devise
    A type of cold, a type of hooded gaze.
    But when the Negroes came they were perplexed.
    These Negroes looked like men....
    Gwendolyn Brooks (b. 1917)

    The technological landscape of the present day has enfranchised its own electorates—the inhabitants of marketing zones in the consumer goods society, television audiences and news magazine readerships... vote with money at the cash counter rather than with the ballot paper at the polling booth.
    —J.G. (James Graham)

    Man is a shrewd inventor, and is ever taking the hint of a new machine from his own structure, adapting some secret of his own anatomy in iron, wood, and leather, to some required function in the work of the world.
    Ralph Waldo Emerson (1803–1882)