implement IF-THEN-ELSE
This commit is contained in:
+13
-7
@@ -28,16 +28,21 @@ enum fb_instruction_kind {
|
||||
|
||||
/* Data = numeric value to push onto the data stack */
|
||||
FH_INSTR_NUMBER,
|
||||
};
|
||||
|
||||
/** Bytecode word indices that are not in the dict, have special effect */
|
||||
enum compiler_word {
|
||||
/** End of a user defined word, pop address and jump back */
|
||||
CPLWORD_ENDWORD = DICT_SIZE + 1,
|
||||
FH_INSTR_ENDWORD,
|
||||
|
||||
/** This is the `s"` instruction, the length (u32) and string data immediately follow */
|
||||
CPLWORD_ALLOCSTR,
|
||||
FH_INSTR_ALLOCSTR,
|
||||
|
||||
/** This is the `."` instruction, same format as above. */
|
||||
CPLWORD_TYPESTR,
|
||||
FH_INSTR_TYPESTR,
|
||||
|
||||
/* Unconditional jump */
|
||||
FH_INSTR_JUMP,
|
||||
|
||||
/* Jump if zero */
|
||||
FH_INSTR_JUMPZERO,
|
||||
};
|
||||
|
||||
/** One instruction in bytecode */
|
||||
@@ -160,7 +165,8 @@ enum fh_error w_user_word(struct fh_thread_s *fh, const struct fh_word_s *w);
|
||||
|
||||
// SFR and magic addresses are "negative"
|
||||
#define MAGICADDR_INTERACTIVE 0xFFFFFFFFULL
|
||||
#define MAGICADDR_BASE 0xFFFBA5EFULL
|
||||
#define MAGICADDR_BASE 0xFFFFBA5EULL
|
||||
#define MAGICADDR_UNRESOLVED 0xFFFFFBADULL
|
||||
|
||||
/** Get a value rounded up to multiple of word size */
|
||||
#define WORDALIGNED(var) (((var) + 3) & ~3)
|
||||
|
||||
Reference in New Issue
Block a user