Mail Archives: djgpp-workers/2001/05/18/15:39:06
Here are the patches for the next round of changes to djasm. The first
one removes two `sh[lr]d' double precision shifts (see wc204.txi entry
for the reason). With those out of the way the second patch completes
the support for (`single-precision') shift/rotate instructions. I'll
then restore the double-precision instructions (with new mnemonics and
a trap for old usage), but I'd like to commit these changes first.
--
jeff
PS: `stub.asm' builds fine with patched djasm
--- wc204.txi 2001/03/31 10:33:42 1.62
+++ wc204.txi 2001/05/18 19:19:24
@@ -375,3 +375,12 @@
File handles connected to the console device are no longer reported by
the @code{select} function as not ready for input when termios functions
are used to read those handles in cooked mode.
+
+@pindex djasm AT r{, double-precision shift mnemonics}
+The double-precision shift instructions `sh[lr]d' are removed because
+they violate @code{djasm}'s convention of using a [bwd] mnemonic suffix
+to specify the memory operand size.
+
+@pindex djasm AT r{, shift instructions}
+@pindex djasm AT r{, rotate instructions}
+Support completed for byte/word/double shift/rotate instructions.
--- djasm.y.12345 Fri Feb 2 09:21:23 2001
+++ djasm.y Thu May 17 12:55:27 2001
@@ -230,7 +230,7 @@
%token <i> ARITH2 ARITH2B ARITH2D ARITH2W
%token <i> LXS MOVSZX MOVSZXB MOVSZXW
%token <i> JCC JCCL JCXZ LOOP SETCC
-%token <i> SHIFT SHLRD
+%token <i> SHIFT
%token <i> ONEBYTE TWOBYTE ASCADJ
%token <i> BITTEST GROUP3 GROUP3B GROUP3D GROUP3W GROUP6 GROUP7 STRUCT
%token ALIGN ARPL
@@ -571,9 +571,7 @@
{"sldt", GROUP6, 0},
{"sal", SHIFT, 4},
{"shl", SHIFT, 4},
- {"shld", SHLRD, 0xa4},
{"shr", SHIFT, 5},
- {"shrd", SHLRD, 0xac},
{"smsw", GROUP7, 4},
{"str", GROUP6, 1},
{"sub", ARITH2, 5},
@@ -1015,17 +1013,6 @@
| SHIFT REG16 ',' REG8 { if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0xd3); modrm(3, $1, $2); }
| SHIFT REG32 ',' const { emitb(0x66); emitb($4 == 1 ? 0xd1 : 0xc1); modrm(3, $1, $2); if ($4 != 1) emitb($4); }
| SHIFT REG32 ',' REG8 { if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0x66); emitb(0xd3); modrm(3, $1, $2); }
-
- | SHLRD REG16 ',' REG16 ',' const
- { emitb(0x0f); emitb($1); modrm(3, $4, $2); emitb($6); }
- | SHLRD REG16 ',' REG16 ',' REG8
- { if ($6 != 1) djerror ("Non-constant shift count must be `cl'");
- emitb(0x0f); emitb($1+1); modrm(3, $4, $2); }
- | SHLRD REG32 ',' REG32 ',' const
- { emitb(0x66); emitb(0x0f); emitb($1); modrm(3, $4, $2); emitb($6); }
- | SHLRD REG32 ',' REG32 ',' REG8
- { if ($6 != 1) djerror ("Non-constant shift count must be `cl'");
- emitb(0x66); emitb(0x0f); emitb($1+1); modrm(3, $4, $2); }
| STACK { stack_ptr = pc; }
| START { start_ptr = pc; main_obj=1; }
--- /home/jeffw/dos/djgpp/CVS/djgpp/src/stub/djasm.y Thu May 17 12:55:27 2001
+++ djasm.y Fri May 18 13:43:02 2001
@@ -230,7 +227,7 @@
%token <i> ARITH2 ARITH2B ARITH2D ARITH2W
%token <i> LXS MOVSZX MOVSZXB MOVSZXW
%token <i> JCC JCCL JCXZ LOOP SETCC
-%token <i> SHIFT
+%token <i> SHIFT SHIFTB SHIFTD SHIFTW
%token <i> ONEBYTE TWOBYTE ASCADJ
%token <i> BITTEST GROUP3 GROUP3B GROUP3D GROUP3W GROUP6 GROUP7 STRUCT
%token ALIGN ARPL
@@ -522,14 +519,29 @@
{"pushw", PUSHW, NO_ATTR},
{"pushd", PUSHD, NO_ATTR},
{"rcl", SHIFT, 2},
+ {"rclb", SHIFTB, 2},
+ {"rcld", SHIFTD, 2},
+ {"rclw", SHIFTW, 2},
{"rcr", SHIFT, 3},
+ {"rcrb", SHIFTB, 3},
+ {"rcrd", SHIFTD, 3},
+ {"rcrw", SHIFTW, 3},
{"ret", RET, NO_ATTR},
{"retd", RETD, NO_ATTR},
{"retf", RETF, NO_ATTR},
{"retfd", RETFD, NO_ATTR},
{"rol", SHIFT, 0},
+ {"rolb", SHIFTB, 0},
+ {"rold", SHIFTD, 0},
+ {"rolw", SHIFTW, 0},
{"ror", SHIFT, 1},
+ {"rorb", SHIFTB, 1},
+ {"rord", SHIFTD, 1},
+ {"rorw", SHIFTW, 1},
{"sar", SHIFT, 7},
+ {"sarb", SHIFTB, 7},
+ {"sard", SHIFTD, 7},
+ {"sarw", SHIFTW, 7},
{"sbb", ARITH2, 3},
{"sbbb", ARITH2B, 3},
{"sbbd", ARITH2D, 3},
@@ -570,8 +582,17 @@
{"sidt", GROUP7, 1},
{"sldt", GROUP6, 0},
{"sal", SHIFT, 4},
+ {"salb", SHIFTB, 4},
+ {"sald", SHIFTD, 4},
+ {"salw", SHIFTW, 4},
{"shl", SHIFT, 4},
+ {"shlb", SHIFTB, 4},
+ {"shld", SHIFTD, 4},
+ {"shlw", SHIFTW, 4},
{"shr", SHIFT, 5},
+ {"shrb", SHIFTB, 5},
+ {"shrd", SHIFTD, 5},
+ {"shrw", SHIFTW, 5},
{"smsw", GROUP7, 4},
{"str", GROUP6, 1},
{"sub", ARITH2, 5},
@@ -1009,10 +1030,16 @@
| SHIFT REG8 ',' const { emitb($4 == 1 ? 0xd0 : 0xc0); modrm(3, $1, $2); if ($4 != 1) emitb($4); }
| SHIFT REG8 ',' REG8 { if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0xd2); modrm(3, $1, $2); }
+ | SHIFTB regmem ',' const { emitb($4 == 1 ? 0xd0 : 0xc0); reg($1); if ($4 != 1) emitb($4); }
+ | SHIFTB regmem ',' REG8 { if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0xd2); reg($1); }
| SHIFT REG16 ',' const { emitb($4 == 1 ? 0xd1 : 0xc1); modrm(3, $1, $2); if ($4 != 1) emitb($4); }
| SHIFT REG16 ',' REG8 { if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0xd3); modrm(3, $1, $2); }
+ | SHIFTW regmem ',' const { emitb($4 == 1 ? 0xd1 : 0xc1); reg($1); if ($4 != 1) emitb($4); }
+ | SHIFTW regmem ',' REG8 { if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0xd3); reg($1); }
| SHIFT REG32 ',' const { emitb(0x66); emitb($4 == 1 ? 0xd1 : 0xc1); modrm(3, $1, $2); if ($4 != 1) emitb($4); }
| SHIFT REG32 ',' REG8 { if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0x66); emitb(0xd3); modrm(3, $1, $2); }
+ | SHIFTD regmem ',' const { emitb(0x66); emitb($4 == 1 ? 0xd1 : 0xc1); reg($1); if ($4 != 1) emitb($4); }
+ | SHIFTD regmem ',' REG8 { if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0x66); emitb(0xd3); reg($1); }
| STACK { stack_ptr = pc; }
| START { start_ptr = pc; main_obj=1; }
- Raw text -