LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
c_branch.c
Go to the documentation of this file.
1 /*
2  * LEGO® MINDSTORMS EV3
3  *
4  * Copyright (C) 2010-2013 The LEGO Group
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 
22 #include "lms2012.h"
23 #include "c_branch.h"
24 
25 
26 //******* BYTE CODE SNIPPETS **************************************************
27 
28 
42 void cBranchJr(void)
43 {
45 }
46 
47 #include <stdio.h>
62 void cBranchJrFalse(void)
63 {
64  if (*(DATA8*)PrimParPointer() == (DATA8)0)
65  {
67  }
68  else
69  {
71  }
72 }
73 
74 
89 void cBranchJrTrue(void)
90 {
91  if (*(DATA8*)PrimParPointer() != (DATA8)0)
92  {
94  }
95  else
96  {
98  }
99 }
100 
101 
102 #include <math.h>
117 void cBranchJrNan(void)
118 {
119  DATAF Tmp;
120 
121  Tmp = *(DATAF*)PrimParPointer();
122 
123  if (isnan(Tmp))
124  {
126  }
127  else
128  {
129  PrimParAdvance();
130  }
131 }
132 
133 
149 void cBranchJrLt8(void)
150 {
151  DATA8 Tmp;
152 
153  Tmp = *(DATA8*)PrimParPointer();
154  if (Tmp < *(DATA8*)PrimParPointer())
155  {
157  }
158  else
159  {
160  PrimParAdvance();
161  }
162 }
163 
164 
180 void cBranchJrLt16(void)
181 {
182  DATA16 Tmp;
183 
184  Tmp = *(DATA16*)PrimParPointer();
185  if (Tmp < *(DATA16*)PrimParPointer())
186  {
188  }
189  else
190  {
191  PrimParAdvance();
192  }
193 }
194 
195 
211 void cBranchJrLt32(void)
212 {
213  DATA32 Tmp;
214 
215  Tmp = *(DATA32*)PrimParPointer();
216  if (Tmp < *(DATA32*)PrimParPointer())
217  {
219  }
220  else
221  {
222  PrimParAdvance();
223  }
224 }
225 
226 
242 void cBranchJrLtF(void)
243 {
244  DATAF Tmp;
245 
246  Tmp = *(DATAF*)PrimParPointer();
247  if (Tmp < *(DATAF*)PrimParPointer())
248  {
250  }
251  else
252  {
253  PrimParAdvance();
254  }
255 }
256 
257 
273 void cBranchJrGt8(void)
274 {
275  DATA8 Tmp;
276 
277  Tmp = *(DATA8*)PrimParPointer();
278  if (Tmp > *(DATA8*)PrimParPointer())
279  {
281  }
282  else
283  {
284  PrimParAdvance();
285  }
286 }
287 
288 
304 void cBranchJrGt16(void)
305 {
306  DATA16 Tmp;
307 
308  Tmp = *(DATA16*)PrimParPointer();
309  if (Tmp > *(DATA16*)PrimParPointer())
310  {
312  }
313  else
314  {
315  PrimParAdvance();
316  }
317 }
318 
319 
335 void cBranchJrGt32(void)
336 {
337  DATA32 Tmp;
338 
339  Tmp = *(DATA32*)PrimParPointer();
340  if (Tmp > *(DATA32*)PrimParPointer())
341  {
343  }
344  else
345  {
346  PrimParAdvance();
347  }
348 }
349 
350 
366 void cBranchJrGtF(void)
367 {
368  DATAF Tmp;
369 
370  Tmp = *(DATAF*)PrimParPointer();
371  if (Tmp > *(DATAF*)PrimParPointer())
372  {
374  }
375  else
376  {
377  PrimParAdvance();
378  }
379 }
380 
381 
397 void cBranchJrEq8(void)
398 {
399  DATA8 Tmp;
400 
401  Tmp = *(DATA8*)PrimParPointer();
402  if (Tmp == *(DATA8*)PrimParPointer())
403  {
405  }
406  else
407  {
408  PrimParAdvance();
409  }
410 }
411 
412 
428 void cBranchJrEq16(void)
429 {
430  DATA16 Tmp;
431 
432  Tmp = *(DATA16*)PrimParPointer();
433  if (Tmp == *(DATA16*)PrimParPointer())
434  {
436  }
437  else
438  {
439  PrimParAdvance();
440  }
441 }
442 
443 
459 void cBranchJrEq32(void)
460 {
461  DATA32 Tmp;
462 
463  Tmp = *(DATA32*)PrimParPointer();
464  if (Tmp == *(DATA32*)PrimParPointer())
465  {
467  }
468  else
469  {
470  PrimParAdvance();
471  }
472 }
473 
474 
490 void cBranchJrEqF(void)
491 {
492  DATAF Tmp;
493 
494  Tmp = *(DATAF*)PrimParPointer();
495  if (Tmp == *(DATAF*)PrimParPointer())
496  {
498  }
499  else
500  {
501  PrimParAdvance();
502  }
503 }
504 
505 
521 void cBranchJrNEq8(void)
522 {
523  DATA8 Tmp;
524 
525  Tmp = *(DATA8*)PrimParPointer();
526  if (Tmp != *(DATA8*)PrimParPointer())
527  {
529  }
530  else
531  {
532  PrimParAdvance();
533  }
534 }
535 
536 
552 void cBranchJrNEq16(void)
553 {
554  DATA16 Tmp;
555 
556  Tmp = *(DATA16*)PrimParPointer();
557  if (Tmp != *(DATA16*)PrimParPointer())
558  {
560  }
561  else
562  {
563  PrimParAdvance();
564  }
565 }
566 
567 
583 void cBranchJrNEq32(void)
584 {
585  DATA32 Tmp;
586 
587  Tmp = *(DATA32*)PrimParPointer();
588  if (Tmp != *(DATA32*)PrimParPointer())
589  {
591  }
592  else
593  {
594  PrimParAdvance();
595  }
596 }
597 
598 
614 void cBranchJrNEqF(void)
615 {
616  DATAF Tmp;
617 
618  Tmp = *(DATAF*)PrimParPointer();
619  if (Tmp != *(DATAF*)PrimParPointer())
620  {
622  }
623  else
624  {
625  PrimParAdvance();
626  }
627 }
628 
629 
645 void cBranchJrLtEq8(void)
646 {
647  DATA8 Tmp;
648 
649  Tmp = *(DATA8*)PrimParPointer();
650  if (Tmp <= *(DATA8*)PrimParPointer())
651  {
653  }
654  else
655  {
656  PrimParAdvance();
657  }
658 }
659 
660 
676 void cBranchJrLtEq16(void)
677 {
678  DATA16 Tmp;
679 
680  Tmp = *(DATA16*)PrimParPointer();
681  if (Tmp <= *(DATA16*)PrimParPointer())
682  {
684  }
685  else
686  {
687  PrimParAdvance();
688  }
689 }
690 
691 
707 void cBranchJrLtEq32(void)
708 {
709  DATA32 Tmp;
710 
711  Tmp = *(DATA32*)PrimParPointer();
712  if (Tmp <= *(DATA32*)PrimParPointer())
713  {
715  }
716  else
717  {
718  PrimParAdvance();
719  }
720 }
721 
722 
738 void cBranchJrLtEqF(void)
739 {
740  DATAF Tmp;
741 
742  Tmp = *(DATAF*)PrimParPointer();
743  if (Tmp <= *(DATAF*)PrimParPointer())
744  {
746  }
747  else
748  {
749  PrimParAdvance();
750  }
751 }
752 
753 
769 void cBranchJrGtEq8(void)
770 {
771  DATA8 Tmp;
772 
773  Tmp = *(DATA8*)PrimParPointer();
774  if (Tmp >= *(DATA8*)PrimParPointer())
775  {
777  }
778  else
779  {
780  PrimParAdvance();
781  }
782 }
783 
784 
800 void cBranchJrGtEq16(void)
801 {
802  DATA16 Tmp;
803 
804  Tmp = *(DATA16*)PrimParPointer();
805  if (Tmp >= *(DATA16*)PrimParPointer())
806  {
808  }
809  else
810  {
811  PrimParAdvance();
812  }
813 }
814 
815 
831 void cBranchJrGtEq32(void)
832 {
833  DATA32 Tmp;
834 
835  Tmp = *(DATA32*)PrimParPointer();
836  if (Tmp >= *(DATA32*)PrimParPointer())
837  {
839  }
840  else
841  {
842  PrimParAdvance();
843  }
844 }
845 
846 
862 void cBranchJrGtEqF(void)
863 {
864  DATAF Tmp;
865 
866  Tmp = *(DATAF*)PrimParPointer();
867  if (Tmp >= *(DATAF*)PrimParPointer())
868  {
870  }
871  else
872  {
873  PrimParAdvance();
874  }
875 }
876 
877 
void cBranchJrTrue(void)
opJR_TRUE byte code
Definition: c_branch.c:89
void PrimParAdvance(void)
Skip next encoded parameter from byte code stream.
Definition: lms2012.c:870
void AdjustObjectIp(IMOFFS Value)
Adjust current instruction pointer.
Definition: lms2012.c:287
void cBranchJrNEq16(void)
opJR_NEQ16 byte code
Definition: c_branch.c:552
void cBranchJrGtEqF(void)
opJR_GTEQF byte code
Definition: c_branch.c:862
void cBranchJrLtEq8(void)
opJR_LTEQ8 byte code
Definition: c_branch.c:645
void cBranchJrNEq32(void)
opJR_NEQ32 byte code
Definition: c_branch.c:583
SWORD DATA16
VM Type for 2 byte signed value.
Definition: lmstypes.h:62
void cBranchJrGt8(void)
opJR_GT8 byte code
Definition: c_branch.c:273
void cBranchJrEq32(void)
opJR_EQ32 byte code
Definition: c_branch.c:459
SLONG DATA32
VM Type for 4 byte signed value.
Definition: lmstypes.h:63
void cBranchJrLtF(void)
opJR_LTF byte code
Definition: c_branch.c:242
void cBranchJrNEq8(void)
opJR_NEQ8 byte code
Definition: c_branch.c:521
void cBranchJrLt8(void)
opJR_LT8 byte code
Definition: c_branch.c:149
void cBranchJrLtEqF(void)
opJR_LTEQF byte code
Definition: c_branch.c:738
void cBranchJrEq8(void)
opJR_EQ8 byte code
Definition: c_branch.c:397
void * PrimParPointer(void)
Get next encoded parameter from byte code stream.
Definition: lms2012.c:694
void cBranchJrEqF(void)
opJR_EQF byte code
Definition: c_branch.c:490
void cBranchJrNEqF(void)
opJR_NEQF byte code
Definition: c_branch.c:614
void cBranchJr(void)
opJR byte code
Definition: c_branch.c:42
void cBranchJrEq16(void)
opJR_EQ16 byte code
Definition: c_branch.c:428
void cBranchJrGtEq16(void)
opJR_GTEQ16 byte code
Definition: c_branch.c:800
void cBranchJrLtEq16(void)
opJR_LTEQ16 byte code
Definition: c_branch.c:676
void cBranchJrGt32(void)
opJR_GT32 byte code
Definition: c_branch.c:335
SLONG IMOFFS
ImageData offset type.
Definition: lmstypes.h:83
void cBranchJrGtEq32(void)
opJR_GTEQ32 byte code
Definition: c_branch.c:831
void cBranchJrGtF(void)
opJR_GTF byte code
Definition: c_branch.c:366
void cBranchJrLtEq32(void)
opJR_LTEQ32 byte code
Definition: c_branch.c:707
FLOAT DATAF
VM Type for 4 byte floating point value.
Definition: lmstypes.h:64
void cBranchJrGtEq8(void)
opJR_GTEQ8 byte code
Definition: c_branch.c:769
void cBranchJrLt16(void)
opJR_LT16 byte code
Definition: c_branch.c:180
void cBranchJrLt32(void)
opJR_LT16 byte code
Definition: c_branch.c:211
SBYTE DATA8
VM Type for 1 byte signed value.
Definition: lmstypes.h:61
void cBranchJrFalse(void)
opJR_FALSE byte code
Definition: c_branch.c:62
void cBranchJrNan(void)
opJR_NAN byte code
Definition: c_branch.c:117
void cBranchJrGt16(void)
opJR_GT16 byte code
Definition: c_branch.c:304