diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2020-03-15 20:43:50 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2020-03-15 20:43:50 +0100 |
commit | e1a0f8cfbce954aaa1568514b9e81bb7a65d2b8c (patch) | |
tree | dc0896fee4fbfdb8626eae95c725d5e418a76521 | |
parent | d40ced8e51c27e83d54c7fbbfddd5d9c2d512d28 (diff) | |
download | compilertests-e1a0f8cfbce954aaa1568514b9e81bb7a65d2b8c.tar.gz compilertests-e1a0f8cfbce954aaa1568514b9e81bb7a65d2b8c.tar.bz2 |
some work on understand Intel opcodes add and sub
-rw-r--r-- | ecomp-c/README | 1 | ||||
-rw-r--r-- | ecomp-c/asm-i386.c | 2 | ||||
-rw-r--r-- | ecomp-c/test1.e | 3 |
3 files changed, 5 insertions, 1 deletions
diff --git a/ecomp-c/README b/ecomp-c/README index 4ae60e4..cebd76a 100644 --- a/ecomp-c/README +++ b/ecomp-c/README @@ -154,4 +154,5 @@ http://ref.x86asm.net/coder32.html "Art Of Intel x86 Assembly" Intel® 64 and IA-32 Architectures Software Developer’s Manual https://www.felixcloutier.com/x86/index.html +http://www.c-jump.com/CIS77/CPU/x86/lecture.html#X77_0140_encoding_add_ecx_eax diff --git a/ecomp-c/asm-i386.c b/ecomp-c/asm-i386.c index a6b0344..019e49e 100644 --- a/ecomp-c/asm-i386.c +++ b/ecomp-c/asm-i386.c @@ -11,6 +11,8 @@ * 58+r pop r32 * A3 XX XX XX XX mov moffs32, eax * A1 XX XX XX XX mov eax, moffs32 + * 01 XX add r32, r32 + * 29 XX sub r32, r32 * F7 E3 mul ebx * F7 F3 div ebx * E9 XX XX XX XX jmp rel32 diff --git a/ecomp-c/test1.e b/ecomp-c/test1.e index cc4f336..ca531f9 100644 --- a/ecomp-c/test1.e +++ b/ecomp-c/test1.e @@ -15,7 +15,7 @@ var // this is also an integer b : integer; c : integer; // c too - d, e : integer; + d, e, f : integer; begin a := 1; @@ -26,4 +26,5 @@ begin d := a * c + b; // d should be 8 * 20 + 7 = 167 (A7 hex) d := a * ( c + b ); // d should be 8 * ( 20 + 7 ) = 216 (D8 hex) e := ( ( 7 * a + b ) + 2 * ( b + a + 3 ) ) * 4 / 2; // ((7*8+7)+2*(7+8+3))*4/2=198 (C6 hex) + f := a - b; // should be 8-7=1 end |