Changeset 2110


Ignore:
Timestamp:
Jan 17, 2011, 10:44:52 PM (4 years ago)
Author:
wmb
Message:

X86 assembler - added imul-imm and imul2 for assembling alternative forms of the IMUL instruction. Trying to work out the instruction form automatically from the operands is just too hard.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpu/x86/assem.fth

    r1385 r2110  
    750750: cpuid   ( -- )  prefix-0f  h# a2 asm8,  ;  \ Arg in %eax, results in ax,bx,dx,cx
    751751
     752: imul2  ( MR REG -- )  \ REG <- REG * R/M
     753   prefix-0f h# AF asm8,  r/m,
     754;
     755
     756: imul-imm  ( imm # MR REG -- )  \ REG <- R/M * imm16/32   "500 #  bx cx  imul-imm"
     757   here >r                                    ( imm # MR r: adr )
     758   h# 69 asm8,                                ( imm # MR )
     759   r/m,                                       ( imm # )
     760   # <> abort" Expecting # in imul-imm"       ( imm )
     761   dup big?  if                               ( imm  r: adr )
     762      16bit?  if  asm16,  else  asm32,  then  (  r: adr )
     763      r> drop                                 ( )
     764   else                                       ( imm  r: adr )
     765      asm8,                                   (  r: adr )
     766      \ Change the opcode from 69 to 6b
     767      h# 6b r> asm8!                          ( )
     768   then
     769;
     770
    752771\ Structured Conditionals
    753772\ single pass forces fixed size. optimize for small, fast structures:
Note: See TracChangeset for help on using the changeset viewer.