Stack push

From Unofficial QEdit Wiki Guide
Jump to: navigation, search


Syntax: stack_push register1

  • register1 = Value of register to push to stack.


Used to store a registers value into the stack so that the register can be freed up for another use.


100:     leti R1, 0000000A //Set R1 to 10
         window_msg 'R1 = <r1>'
         stack_push R1 //Push the value of R1 to the stack
         clear R1
         add_msg 'R1 = <r1>' //R1 now is set to 0
         stack_pop R1 //Retrieve value from stack and set R1 to value. Remember, when pushing and popping stacks are Last In First Out (LIFO)
         add_msg 'R1 = <r1>' //R1's value has now been restored to 10

Also see

window_msg, clear, add_msg, stack_pop, winend, ret