Difference between revisions of "Sub"

From Unofficial QEdit Wiki Guide
Jump to: navigation, search
 
 
Line 12: Line 12:
 
  <span style='color:blue'>100:    </span><span style='color:green'>leti </span>R1, '0000000A' <span style='color:orange'>//Set R1 to 10</span>
 
  <span style='color:blue'>100:    </span><span style='color:green'>leti </span>R1, '0000000A' <span style='color:orange'>//Set R1 to 10</span>
 
  <span style='color:green'>        leti </span>R2, '00000006' <span style='color:orange'>//Set R2 to 6</span>
 
  <span style='color:green'>        leti </span>R2, '00000006' <span style='color:orange'>//Set R2 to 6</span>
  <span style='color:green'>        window_msg </span>'Register 1 = <R1>' <span style='color:orange'>//Display the value of R1 in a window message</span>
+
  <span style='color:green'>        window_msg </span>'Register 1 = <r1>' <span style='color:orange'>//Display the value of R1 in a window message</span>
 
  <span style='color:green'>        sub </span>R1, R2 <span style='color:orange'>//Subtract R2 from R1</span>
 
  <span style='color:green'>        sub </span>R1, R2 <span style='color:orange'>//Subtract R2 from R1</span>
  <span style='color:green'>        add_msg </span>'Register 1 = <R1>' <span style='color:orange'>//Display the new value of R1 in a window message</span>
+
  <span style='color:green'>        add_msg </span>'Register 1 = <r1>' <span style='color:orange'>//Display the new value of R1 in a window message</span>
 
  <span style='color:green'>        winend </span> <span style='color:orange'>//Close window message</span>
 
  <span style='color:green'>        winend </span> <span style='color:orange'>//Close window message</span>
 
  <span style='color:green'>        ret </span>
 
  <span style='color:green'>        ret </span>

Latest revision as of 13:07, 12 April 2011

Syntax

Syntax: sub register1, register2

  • register1 = Register to subtract from
  • register2 = Register to subtract

Use

Used to subtract the value of one register from another. For subtracting integers from registers see subi

Example


100:     leti R1, '0000000A' //Set R1 to 10
         leti R2, '00000006' //Set R2 to 6
         window_msg 'Register 1 = <r1>' //Display the value of R1 in a window message
         sub R1, R2 //Subtract R2 from R1
         add_msg 'Register 1 = <r1>' //Display the new value of R1 in a window message
         winend  //Close window message
         ret 

Also see

leti, window_msg, add_msg, winend, ret