Modified:
trunk/cc/test-cc.lisp
trunk/cc/x86-64-syntax.lisp
wiki/AssemblyX64D.wiki
wiki/AssemblyX64I.wiki
Log:
Add instruction inc/dec.
Modified: trunk/cc/test-cc.lisp
==============================================================================
--- trunk/cc/test-cc.lisp (original)
+++ trunk/cc/test-cc.lisp Tue Feb 17 05:57:12 2009
@@ -55,7 +55,19 @@
,@(arith-test-1 'add)
,@(arith-test-1 'and)
,@(arith-test-1 'cmp)
+ (dec bx)
+ (dec eax)
+ (dec dl)
+ (dec byte (msg))
+ (dec word (bp si 3))
+ (dec dword (msg))
,@(arith-test-2 'div)
+ (inc bx)
+ (inc eax)
+ (inc dl)
+ (inc byte (msg))
+ (inc word (bp si 3))
+ (inc dword (msg))
,@(arith-test-2 'mul)
,@(arith-test-2 'neg)
,@(arith-test-2 'not)
@@ -77,6 +89,10 @@
(bits 32)
(add ax 1000)
+ (dec dx)
+ (dec ebp)
+ (inc dx)
+ (inc ebp)
(bits 64)
(adc rax #x12345)
@@ -89,6 +105,12 @@
(add sil 6)
(add r10 rbx)
(add rsi (ebx))
+ (dec di)
+ (dec ecx)
+ (dec r10)
+ (inc di)
+ (inc ecx)
+ (inc r10)
(sbb rbx rdx)
(db msg "Hello World! ")
@@ -96,32 +118,35 @@
"Arithmetic instructions are tested separately.")
(defparameter *arith-code*
- '(4 8 5 232 3 128 195 3 128 6 12 126 4 129 195 210 4 129 6 12 126 46
- 22 131 193 9 131 6 12 126 12 0 216 0 46 12 126 1 217 1 22 12 126 2
- 46 12 126 3 22 12 126 36 8 37 232 3 128 227 3 128 38 12 126 4 129
- 227 210 4 129 38 12 126 46 22 131 225 9 131 38 12 126 12 32 216 32
- 46 12 126 33 217 33 22 12 126 34 46 12 126 35 22 12 126 60 8 61
- 232 3 128 251 3 128 62 12 126 4 129 251 210 4 129 62 12 126 46 22
- 131 249 9 131 62 12 126 12 56 216 56 46 12 126 57 217 57 22 12 126
- 58 46 12 126 59 22 12 126 246 245 246 54 12 126 247 247 247 114 3
- 246 229 246 38 12 126 247 231 247 98 3 246 221 246 30 12 126 247
- 223 247 90 3 246 213 246 22 12 126 247 215 247 82 3 12 8 13 232 3
- 128 203 3 128 14 12 126 4 129 203 210 4 129 14 12 126 46 22 131
- 201 9 131 14 12 126 12 8 216 8 46 12 126 9 217 9 22 12 126 10 46
- 12 126 11 22 12 126 208 230 208 38 12 126 210 230 210 38 12 126
- 192 230 5 192 38 12 126 5 209 226 209 38 12 126 211 226 211 38 12
- 126 193 226 5 193 38 12 126 5 208 238 208 46 12 126 210 238 210 46
- 12 126 192 238 5 192 46 12 126 5 209 234 209 46 12 126 211 234 211
- 46 12 126 193 234 5 193 46 12 126 5 44 8 45 232 3 128 235 3 128 46
- 12 126 4 129 235 210 4 129 46 12 126 46 22 131 233 9 131 46 12 126
- 12 40 216 40 46 12 126 41 217 41 22 12 126 42 46 12 126 43 22 12
- 126 168 8 169 232 3 246 195 3 246 6 12 126 4 247 195 210 4 247 6
- 12 126 46 22 132 216 132 46 12 126 133 217 133 22 12 126 52 8 53
- 232 3 128 243 3 128 54 12 126 4 129 243 210 4 129 54 12 126 46 22
- 131 241 9 131 54 12 126 12 48 216 48 46 12 126 49 217 49 22 12 126
- 50 46 12 126 51 22 12 126 102 5 232 3 72 21 69 35 1 0 129 195 232
- 3 0 0 72 5 3 2 1 16 72 5 10 0 0 0 72 129 195 11 1 0 0 73 129 199
- 86 52 18 0 65 131 194 3 64 128 198 6 73 1 218 72 3 51 72 25 211 72
+ '(4 8 5 232 3 128 195 3 128 6 68 126 4 129 195 210 4 129 6 68 126 46
+ 22 131 193 9 131 6 68 126 12 0 216 0 46 68 126 1 217 1 22 68 126 2
+ 46 68 126 3 22 68 126 36 8 37 232 3 128 227 3 128 38 68 126 4 129
+ 227 210 4 129 38 68 126 46 22 131 225 9 131 38 68 126 12 32 216 32
+ 46 68 126 33 217 33 22 68 126 34 46 68 126 35 22 68 126 60 8 61
+ 232 3 128 251 3 128 62 68 126 4 129 251 210 4 129 62 68 126 46 22
+ 131 249 9 131 62 68 126 12 56 216 56 46 68 126 57 217 57 22 68 126
+ 58 46 68 126 59 22 68 126 75 102 72 254 202 254 14 68 126 255 74 3
+ 102 255 14 68 126 246 245 246 54 68 126 247 247 247 114 3 67 102
+ 64 254 194 254 6 68 126 255 66 3 102 255 6 68 126 246 229 246 38
+ 68 126 247 231 247 98 3 246 221 246 30 68 126 247 223 247 90 3 246
+ 213 246 22 68 126 247 215 247 82 3 12 8 13 232 3 128 203 3 128 14
+ 68 126 4 129 203 210 4 129 14 68 126 46 22 131 201 9 131 14 68 126
+ 12 8 216 8 46 68 126 9 217 9 22 68 126 10 46 68 126 11 22 68 126
+ 208 230 208 38 68 126 210 230 210 38 68 126 192 230 5 192 38 68
+ 126 5 209 226 209 38 68 126 211 226 211 38 68 126 193 226 5 193 38
+ 68 126 5 208 238 208 46 68 126 210 238 210 46 68 126 192 238 5 192
+ 46 68 126 5 209 234 209 46 68 126 211 234 211 46 68 126 193 234 5
+ 193 46 68 126 5 44 8 45 232 3 128 235 3 128 46 68 126 4 129 235
+ 210 4 129 46 68 126 46 22 131 233 9 131 46 68 126 12 40 216 40 46
+ 68 126 41 217 41 22 68 126 42 46 68 126 43 22 68 126 168 8 169 232
+ 3 246 195 3 246 6 68 126 4 247 195 210 4 247 6 68 126 46 22 132
+ 216 132 46 68 126 133 217 133 22 68 126 52 8 53 232 3 128 243 3
+ 128 54 68 126 4 129 243 210 4 129 54 68 126 46 22 131 241 9 131 54
+ 68 126 12 48 216 48 46 68 126 49 217 49 22 68 126 50 46 68 126 51
+ 22 68 126 102 5 232 3 102 74 77 102 66 69 72 21 69 35 1 0 129 195
+ 232 3 0 0 72 5 3 2 1 16 72 5 10 0 0 0 72 129 195 11 1 0 0 73 129
+ 199 86 52 18 0 65 131 194 3 64 128 198 6 73 1 218 72 3 51 102 255
+ 207 255 201 73 255 202 102 255 199 255 193 73 255 194 72 25 211 72
101 108 108 111 32 87 111 114 108 100 33 32))
(defparameter *misc-asm*
Modified: trunk/cc/x86-64-syntax.lisp
==============================================================================
--- trunk/cc/x86-64-syntax.lisp (original)
+++ trunk/cc/x86-64-syntax.lisp Tue Feb 17 05:57:12 2009
@@ -93,12 +93,24 @@
((cld) . (#xfc))
((cli) . (#xfa))
,@(arith-syntax-1 'cmp nil)
+ ((dec (r/m8 r8)) . (#xfe /1))
+ ((dec byte m) . (#xfe /1))
+ ((dec (r/m16 r16)) . (o16 #xff /1))
+ ((dec word m) . (o16 #xff /1))
+ ((dec (r/m32 r32)) . (o32 #xff /1))
+ ((dec dword m) . (o32 #xff /1))
,@(arith-syntax-2 'div)
((hlt) . (#xf4))
((in al imm8) . (#xe4 ib))
((in ax imm8) . (#xe5 ib))
((in al dx) . (#xec))
((in ax dx) . (#xed))
+ ((inc (r/m8 r8)) . (#xfe /0))
+ ((inc byte m) . (#xfe /0))
+ ((inc (r/m16 r16)) . (o16 #xff /0))
+ ((inc word m) . (o16 #xff /0))
+ ((inc (r/m32 r32)) . (o32 #xff /0))
+ ((inc dword m) . (o32 #xff /0))
((int 3) . (#xcc))
((int imm8) . (#xcd ib))
((jmp short (imm8 label imm16)) . (#xeb rb))
@@ -154,6 +166,10 @@
(defparameter *x86-64-syntax-16/32-bit-only*
`(((call (imm16 imm8 label)) . (#xe8 rw))
+ ((dec r16) . (o16 (+ #x48 r)))
+ ((dec r32) . (o32 (+ #x48 r)))
+ ((inc r16) . (o16 (+ #x40 r)))
+ ((inc r32) . (o32 (+ #x40 r)))
((lgdt m) . (#x0f #x01 /2))
((lidt m) . (#x0f #x01 /3))
((pop ss) . (#x17))
@@ -170,6 +186,10 @@
,@(arith-syntax-1 'add t)
,@(arith-syntax-1 'and t)
,@(arith-syntax-1 'cmp t)
+ ((dec (r/m64 r64)) . (#xff /1))
+ ((dec qword m) . (#xff /1))
+ ((inc (r/m64 r64)) . (#xff /0))
+ ((inc qword m) . (#xff /0))
,@(arith-syntax-1 'or t)
,@(arith-syntax-1 'sbb t)
,@(arith-syntax-1 'sub t)
@@ -178,11 +198,11 @@
,@(arith-syntax-1 'xor t)))
(defparameter *x86-64-syntax-16/32-bit*
- (append *x86-64-syntax-common* *x86-64-syntax-16/32-bit-only*)
+ (append *x86-64-syntax-16/32-bit-only* *x86-64-syntax-common*)
"Syntax table for 16-bit mode.")
(defparameter *x86-64-syntax-64-bit*
- (append *x86-64-syntax-common* *x86-64-syntax-64-bit-only*)
+ (append *x86-64-syntax-64-bit-only* *x86-64-syntax-common*)
"Syntax table for 64-bit mode.")
(defun x86-64-syntax (bits)
Modified: wiki/AssemblyX64D.wiki
==============================================================================
--- wiki/AssemblyX64D.wiki (original)
+++ wiki/AssemblyX64D.wiki Tue Feb 17 05:57:12 2009
@@ -4,6 +4,18 @@
<wiki:toc max_depth="1" />
+= dec: Decrement by 1 =
+
+|| Instruction || Opcode || 64-Bit Mode || 16/32-Bit Mode ||
Description ||
+|| dec r/m8 || FE /1 || Valid || Valid || Decrement
r/m8 by 1 ||
+|| dec r/m16 || o16 FF /1 || Valid || Valid || Decrement
r/m16 by 1 ||
+|| dec r/m32 || o32 FF /1 || Valid || Valid || Decrement
r/m32 by 1 ||
+|| dec r/m64 || FF /1 || Valid || ~~N.E.~~ || Decrement
r/m64 by 1 ||
+|| dec r16 || o16 48+r || ~~N.E.~~ || Valid || Decrement
r/16 by 1 ||
+|| dec r32 || o32 48+r || ~~N.E.~~ || Valid || Decrement
r/32 by 1 ||
+
+--------
+
= div: Unsigned Divide =
|| Instruction || Opcode || 64-Bit Mode || 16/32-Bit Mode ||
Description ||
Modified: wiki/AssemblyX64I.wiki
==============================================================================
--- wiki/AssemblyX64I.wiki (original)
+++ wiki/AssemblyX64I.wiki Tue Feb 17 05:57:12 2009
@@ -14,6 +14,18 @@
--------
+= inc: Increment by 1 =
+
+|| Instruction || Opcode || 64-Bit Mode || 16/32-Bit Mode ||
Description ||
+|| inc r/m8 || FE /0 || Valid || Valid || Increment
r/m8 by 1 ||
+|| inc r/m16 || o16 FF /0 || Valid || Valid || Increment
r/m16 by 1 ||
+|| inc r/m32 || o32 FF /0 || Valid || Valid || Increment
r/m32 by 1 ||
+|| inc r/m64 || FF /0 || Valid || ~~N.E.~~ || Increment
r/m64 by 1 ||
+|| inc r16 || o16 40+r || ~~N.E.~~ || Valid || Increment
r/16 by 1 ||
+|| inc r32 || o32 40+r || ~~N.E.~~ || Valid || Increment
r/32 by 1 ||
+
+--------
+
= int: Call Interrupt Procedure =
|| Instruction || Opcode || 64-Bit Mode || 16/32-Bit Mode ||
Description ||