Difference between revisions of "Switch jmp"

From Unofficial QEdit Wiki Guide
Jump to: navigation, search
(Use)
 
(7 intermediate revisions by 4 users not shown)
Line 3: Line 3:
  
 
* register1 = Register to check value
 
* register1 = Register to check value
* string = Function list to jump to on value
+
* string = Message to display
  
 
==Use==
 
==Use==
 
Used to jump to different functions depending on a registers value.
 
Used to jump to different functions depending on a registers value.
 +
 +
NOTE* Do not use above 16 for the jmp value
  
 
==Example==
 
==Example==
Line 13: Line 15:
 
  <span style='color:green'>        ret </span>
 
  <span style='color:green'>        ret </span>
 
  <span style='color:blue'>1:      </span><span style='color:green'>ret </span>
 
  <span style='color:blue'>1:      </span><span style='color:green'>ret </span>
  <span style='color:blue'>100:    </span><span style='color:green'>switch_jmp </span>R250, 4:101:102:103:104
+
  <span style='color:blue'>100:    </span><span style='color:green'>switch_jmp </span>R250, 4:101:102:103:104 <span style='color:orange'>//Registers value to check, number of switches, function to jmp to based on the registers value.</span>
  <span style='color:blue'>101:    </span><span style='color:green'>window_msg </span>'You are in Slot 0.'
+
  <span style='color:blue'>101:    </span><span style='color:green'>window_msg </span>'You are in the red slot.'
 
  <span style='color:green'>        winend </span>
 
  <span style='color:green'>        winend </span>
 
  <span style='color:green'>        ret </span>
 
  <span style='color:green'>        ret </span>
  <span style='color:blue'>102:    </span><span style='color:green'>window_msg </span>'You are in Slot 1.'
+
  <span style='color:blue'>102:    </span><span style='color:green'>window_msg </span>'You are in the green slot.'
 
  <span style='color:green'>        winend </span>
 
  <span style='color:green'>        winend </span>
 
  <span style='color:green'>        ret </span>
 
  <span style='color:green'>        ret </span>
  <span style='color:blue'>103:    </span><span style='color:green'>window_msg </span>'You are in Slot 2.'
+
  <span style='color:blue'>103:    </span><span style='color:green'>window_msg </span>'You are in the yellow slot.'
 
  <span style='color:green'>        winend </span>
 
  <span style='color:green'>        winend </span>
 
  <span style='color:green'>        ret </span>
 
  <span style='color:green'>        ret </span>
  <span style='color:blue'>104:    </span><span style='color:green'>window_msg </span>'You are in Slot 3.'
+
  <span style='color:blue'>104:    </span><span style='color:green'>window_msg </span>'You are in the blue slot.'
 
  <span style='color:green'>        winend </span>
 
  <span style='color:green'>        winend </span>
 
  <span style='color:green'>        ret </span>
 
  <span style='color:green'>        ret </span>
Line 29: Line 31:
  
 
==Also see==
 
==Also see==
[[get_slotnumber]], [[window_msg]], [[winend]], [[ret]]
+
[[get_slotnumber]], [[window_msg]], [[winend]], [[jmp]], [[ret]]

Latest revision as of 00:38, 24 January 2024

Syntax

Syntax: switch_jmp register1, string

  • register1 = Register to check value
  • string = Message to display

Use

Used to jump to different functions depending on a registers value.

NOTE* Do not use above 16 for the jmp value

Example


0:       get_slotnumber R250
         ret 
1:       ret 
100:     switch_jmp R250, 4:101:102:103:104 //Registers value to check, number of switches, function to jmp to based on the registers value.
101:     window_msg 'You are in the red slot.'
         winend 
         ret 
102:     window_msg 'You are in the green slot.'
         winend 
         ret 
103:     window_msg 'You are in the yellow slot.'
         winend 
         ret 
104:     window_msg 'You are in the blue slot.'
         winend 
         ret 

Also see

get_slotnumber, window_msg, winend, jmp, ret