Microprocessor Simulator 0 Help



Download 1.18 Mb.
Page68/82
Date18.03.2021
Size1.18 Mb.
#56105
1   ...   64   65   66   67   68   69   70   71   ...   82
sms32v50 (3)
sms32v50 (3), sms32v50 (6)

Jump Instructions


Detailed Instruction Set


Jump Instructions - Flags are NOT set.


These instructions do NOT set the Z, S or O flags but conditional jumps use the flags to determine whether or not to jump.

The CPU contains a status register - SR. This contains flags that are set or cleared depending on the most recent calculation performed by the processor. The CMP compare instruction performs a subtraction like the SUB command. It sets the flags but the result is not stored.


The Flags - ISOZ


  1. ZERO - The Z flag is set if the most recent calculation gave a zero result.

  2. SIGN - The S flag is set if the most recent calculation gave a negative result.

  3. OVERFLOW - The O flag is set if the most recent calculation gave a result too big to fit a register.

  4. INTERRUPT - The I flag is set in software using the STI command. If this flag is set, the CPU will respond to hardware interrupts. The CLI command clears the I flag and hardware interrupts are ignored. The I flag is off by default.

The programmer enters a command like JMP HERE. The assembler converts this into machine code by calculating how far to jump. This tedious and error prone taks (for humans) is automated. In an 8 bit register, the largest numbers that can be stored are -128 and +127. This limits the maximum distance a jump can go. Negative numbers cause the processor to jump backwards towards zero. Positive numbers cause the processor to jump forward towards 255. The jump distance is added to IP, the instruction pointer.

To understand jumps properly, you also need to understand negative numbers.



COMMANDS

EXAMPLES


Download 1.18 Mb.

Share with your friends:
1   ...   64   65   66   67   68   69   70   71   ...   82




The database is protected by copyright ©ininet.org 2024
send message

    Main page