diff --git a/docs/instr_file.txt b/docs/instr_file.txt new file mode 100644 index 0000000..4e4fece --- /dev/null +++ b/docs/instr_file.txt @@ -0,0 +1,40 @@ +/* + * + * MOMENT OF INERTIA STANDARD BYTECODE FILE FORMAT - .moi files + * + * Created by Tyler Liu on 2016/09/23. + * Copyright © 2016 Tyler Liu. All rights reserved. + * + * PUBLISHED UNDER THE GNU GENERAL PUBLIC LICENSE v3.0. + * + * Byte -1: total instruction count + * pointer: point to the location of the desired byte instruction + * + * #define INERTIA_ADD 0x0 // Addition + * #define INERTIA_DIV 0x1 // Division + * #define INERTIA_MUL 0x2 // Multiplication + * + * #define INERTIA_LTN 0x3 // Less Than + * #define INERTIA_EQL 0x4 // Equal To + * #define INERTIA_AND 0x5 // Bitwise AND + * #define INERTIA_NOT 0x6 // Bitwise NOT + * #define INERTIA_OR 0x7 // Bitwise OR + * #define INERTIA_SHIFTL 0x8 //Bitwise SHIFTL + * #define INERTIA_SHIFTR 0x9 //Bitwise SHIFTR + * + * #define INERTIA_PRINT 0xA // Print to stdout + * #define INERTIA_LOAD 0xB // Load value + * #define INERTIA_GOTO 0xC //goto + * #define INERTIA_IF 0xD //if reg1 = false, skip to reg2 + * #define INERTIA_RETURN 0xE //return + * #define INERTIA_CALL 0xF // call function + * + * //0 as memory, 1 as register, 2 as const + * + * instruction set as the first 4 bits + * type of input as following 2 bits, 2*3 = 6 bits + * field for register as following 2 bits, 2*3 = 6bits + * field for memory as folloing 16 bits, 16 + 16* 2 = 48 bits, later two in second unsigned + * field for const as following unsigned, optional(does not need without use of it). + */ +