MGMT 1000 Lecture Notes - Lecture 17: Goto
MGMT 1000 Tutorial 17 Notes – Thumbwheels
Introduction
• Assume that the hand counter has thumbwheels for this purpose.
• This means that the next instruction that the Little Man will execute is located at that
mailbox address.
• This instruction is very similar, conceptually, to the GOTO instruction in BASIC.
• Its execution will always result in a break in the sequence to another part of the
program.
• Note that this instruction also uses the address digits in an unusual way, since the Little
Man does not use the data at the address specified.
• Indeed, the Little Man expects to find an instruction at that address, the next to be
performed.
• BRANCH ON ZERO instruction—op code 7
• The Little Man will walk over to the calculator and will observe the number stored there.
• If its current value is zero, he will walk over to the instruction location counter and
modify its value to correspond to the address specified within the instruction.
• The next instruction executed by the Little Man will be located at that address.
• If the value in the calculator is not zero, he will simply proceed to the next instruction in
sequence.
• BRANCH ON POSITIVE instruction—op code 8
• The Little Man will walk over to the calculator and will observe the number stored there.
• If its current value is positive, he will walk over to the instruction location counter and
modify its value, to correspond to the address specified within the instruction.
• The next instruction executed by the Little Man will be located at that address.
• If the value in the calculator is negative, he will simply proceed to the next instruction in
sequence. Zero is considered to be a positive value.
• Note that is it not necessary to provide BRANCH ON NEGATIVE or BRANCH ON
NONZERO instructions.
find more resources at oneclass.com
find more resources at oneclass.com