diff --git a/documentation/Guide.md b/documentation/Guide.md index ce68e37..285402c 100644 --- a/documentation/Guide.md +++ b/documentation/Guide.md @@ -1,21 +1,16 @@ # Source files ## main.c -Responsible for dispatching initialization, -deinitialization -and the compiler. -Only deals with the highest level of abstractions -and kept clean. +Responsible for dispatching initialization, deinitialization and the compiler. +Only deals with the highest level of abstractions and kept clean. ## eaxhla.l|y|c|h -Flex/Bison scanner/parser respectively. -The C source contains definitions which -store the abstract state and or -required to construct it +Flex/Bison scanner/parser respectively. The C source contains definitions which +store the abstract state and or required to construct it. `eaxhla.l` is strictly limited to raising errors which sabotage scanning. -(Unterminated/partial tokens.) +(Unterminated / partial tokens) `eaxhla.y` is strictly limited to raising syntax errors. @@ -24,26 +19,22 @@ syntax errors. logical errors ## compile.c|h -Responsible for transforming the abstract state -of eaxhla.c to something that can be understood -by the assembler, -dispatching it -and creating the executable. +Responsible for transforming the abstract state of eaxhla.c to something that +can be understood by the assembler, dispatching it and creating the executable. ## assembler.c|h Creates machine code from an array of tokens. ## debug.h -Defines various debug output functions or -nop alternatives for them in non-debug builds. -Must be kept in symmetrical ballance regarding -`#if DEBUG ==` `1` and `!1` +Defines various debug output functions or nop alternatives for them in +non-debug builds. Must be kept in symmetrical ballance regarding +`#if DEBUG ==` `1` and `!1`. # Builds We like Gnu Make. +// X: I hate it. -Debug builds might be create by defining `DEBUG` as 1. -The Makefile respects `DEBUG` in the environment. +Debug builds might be create by defining `DEBUG` as 1. The Makefile respects +`DEBUG` in the environment. -Some default values are determined as appropriate for -the compiling system. +Some default values are determined as appropriate for the compiling system. diff --git a/documentation/Instruction_reference.md b/documentation/Instruction_reference.md index 51be3ff..5a3d4bb 100644 --- a/documentation/Instruction_reference.md +++ b/documentation/Instruction_reference.md @@ -2,7 +2,40 @@ ## The following instructions are fully supported: ```asm - ; XXX fillin + add, or, adc, sbb, + and, sub, xor, cmp, + inc, dec, not, neg, + mul, imul, div, idiv, + fadd, fmul, fcom, fcomp, + fsub, fsubr, fdiv, fdivr, + rol, ror, rcl, rcr, + sal, shr, shl, sar, + nop, retn, retf, leave, + popf, pushf, + syscall, cpuid, fnop, fchs, + fabs, ftst, fxam, fld1, + fldl2t, fldl2e, fldpi, fldlg2, + fldln2, fldz, f2xm1, fyl2x, + fptan, fpatan, fxtract, fprem1, + fdecstp, fincstp, fprem, fyl2xp1, + fsqrt, fsincos, frndint, fscale, + fsin, fcos, + enter, call, in, out, + jmp, mov, pop, push, + jo, jno, jb, jae, + je, jne, jbe, ja, + js, jns, jpe, jpo, + jl, jge, jle, jg, + cmovo, cmovno, cmovb, cmovae, + cmove, cmovne, cmovbe, cmova, + cmovs, cmovns, cmovpe, cmovpo, + cmovl, cmovge, cmovle, cmovg, + seto, setno, setb, setae, + sete, setne, setbe, seta, + sets, setns, setpe, setpo, + setl, setge, setle, setg, + bswap, bsf, bsr, loop, + loope, loopne ``` ## 2 argument instructions (t6) diff --git a/documentation/Reference.md b/documentation/Reference.md index 629758e..63f67b4 100644 --- a/documentation/Reference.md +++ b/documentation/Reference.md @@ -29,6 +29,8 @@ options: ``` -o | --output -a | --architecture + -c | --compile-only + -v | --verbose ``` ## Syntax @@ -80,7 +82,7 @@ For the specifics of the supported instructions consult | E | r14 | r14d | r14w | r14b | | F | r15 | r15d | r15w | r15b | ``` - +// X: Legacy registers ah, ch, dh, bh aren't supported. ### Types ``` @@ -104,8 +106,10 @@ float prefixes: float sizes: + 32 + 64 -+ 80? ++ 80 + 128? ++ 256? ++ 512? All of these types would be generically available unless disabled by some compiler option. All of the traditional types would be enabled by default or require said flag to become usable, @@ -144,6 +148,7 @@ All literal values (string or numeric) are copied as machine code. + and + or + xor +// X: Since we're in assembly, overflow, sign and parity can be added! ### Functions ``` @@ -158,27 +163,37 @@ end qualifier: + fast -> use the fastcall calling convention + ? stack -> place all arguments on the stack ++ ? inline -> X: Just replace the thing. type: + procedure -+ ? function ++ ? function -> X: Return value is in accumulator register anyway. ### labels ```C my_label: ``` -Labels act like variables, -but should not be dereferenced. +Labels act like variables, but should not be dereferenced. Feel free to use them inside jump instructions. +// X: Is there flex way to verify when they are used...? +// X: I don't mind adding integers and labels tho, it's based. +// X: A label is just a number calculated at compile time. ### Come back to later + `register` + `volatile` + `extern` + `static` +// X: We don't really need 'register' or 'volatile'. +// X: Only either of 'static' or 'extern' should be added. +// X: If it's not declared as one, then it must be the other. +// X: Same as 'const' qualifier in C, there's no 'var' one. ## LATER + DWARF2 - ask xolatile very nicely + // X: Will do it, would work well with Valgrind. + linker? - support ld (thereby mold/gold) for speed reasons + // X: This is sadly very useful... + // X: It'll enable us to use C libraries with EAXHLA.