First page Back Continue Last page Overview Graphics

Decisions: if else



This program pushes onto the stack either a plus or minus sign character to the calling subroutine. The program performs an initial test and, if the test condition is false, jumps to the else clause. If the initial test condition is true, the code pushes the + character and branches past the code that pushes the - character.

Both instructions “pula” and “leas 1,s” change the stack pointer by 1. “pula” changes the value in register A but “leas 1,ps” does not change the value in A. “pula” uses 3 system cycles while “leas 1,s” uses 2 system cycles.