Diff for /gforth/arch/mips/disasm.fs between versions 1.2 and 1.3

version 1.2, 2000/05/28 08:32:55 version 1.3, 2000/06/01 21:04:26
Line 18 Line 18
 \       along with this program; if not, write to the Free Software  \       along with this program; if not, write to the Free Software
 \       Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  \       Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   
 require arch/mips/asm.fs  : disasm-illegal ( addr w -- )
       \ disassemble illegal instruction w at addr
       hex. ." , ( illegal inst ) " drop ;
   
 : hex.r ( u n -- )  : init-disasm-table ( n -- )
     drop hex. ;      \ initialize table with n entries with disasm-illegal
   
 : (disasm-op) ( code -- n )  
     $1a rshift $6 asm-bitmask and ;  
   
 : disasm-op ( code -- )  
     (disasm-op) 2 hex.r space ;  
   
 : (disasm-rs) ( code -- n )  
     $15 rshift $5 asm-bitmask and ;  
   
 : disasm-rs ( code -- )  
     (disasm-rs) 2 hex.r space ;  
   
 : (disasm-rt) ( code -- n )  
     $10 rshift $5 asm-bitmask and ;  
   
 : disasm-rt ( code -- )  
     (disasm-rt) 2 hex.r space ;  
   
 : (disasm-imm) ( code -- n )  
     $10 asm-bitmask and ;  
   
 : disasm-imm ( code -- )  
     (disasm-imm) 4 hex.r space ;  
   
 : disasm-addr ( addr code -- n )  
     (disasm-imm) $2 lshift asm-expand dup 4 hex.r space ." ( " + cell+ hex. ." ) " ;  
   
 : (disasm-target) ( code -- n )  
     $1a asm-bitmask and ;  
   
 : disasm-target ( code -- )  
     (disasm-target) $2 lshift or hex. ;  
   
 : (disasm-rd) ( code -- n )  
     $b rshift $5 asm-bitmask and ;  
   
 : disasm-rd ( code -- )  
     (disasm-rd) 2 hex.r space ;  
   
 : (disasm-shamt) ( code -- n )  
     $6 rshift $5 asm-bitmask and ;  
   
 : disasm-shamt ( code -- )  
     (disasm-shamt) 2 hex.r space ;  
   
 ' disasm-shamt alias disasm-sa  
   
 : disasm-funct ( code -- n )  
     $6 asm-bitmask and ;  
   
 \ ***** I-types  
 : disasm-I-rt,imm ( addr -- )  
     @ dup disasm-rt disasm-imm ;  
   
 : disasm-I-rs,imm ( addr -- )  
     dup @ dup disasm-rs disasm-addr ;  
   
 : disasm-I-rt,rs,imm ( addr -- )  
     @ dup disasm-rt dup disasm-rs disasm-imm ;  
   
 : disasm-I-rs,rt,imm ( addr -- )  
     dup @ dup disasm-rs dup disasm-rt disasm-addr ;  
   
 : disasm-I-rt,offset,rs ( addr -- )  
     @ dup disasm-rt dup disasm-imm disasm-rs ;  
   
 \ ***** regimm types  
 ' disasm-I-rs,imm alias disasm-regimm-rs,imm  
   
 \ ***** copz types 1  
 : disasm-copz-imm ( addr -- )  
     dup @ dup disasm-addr disasm-op ;  
   
 : disasm-copz-rt,offset,rs,z ( addr -- )  
     @ dup disasm-rt dup disasm-imm  
     dup disasm-rs disasm-op ;  
   
 \ ***** J-types  
 : disasm-J-target ( addr -- )  
     dup $fc000000 and swap @ disasm-target ;  
   
 \ ***** R-types  
 : disasm-R-nothing ( addr -- )  
     @ hex. ;  
   
 : disasm-R-rd ( addr -- )  
     @ disasm-rd ;  
   
 : disasm-R-rs ( addr -- )  
     @ disasm-rs ;  
   
 : disasm-R-rd,rs ( addr -- )  
     @ dup disasm-rd disasm-rs ;  
   
 : disasm-R-rs,rt ( addr -- )  
     @ dup disasm-rs disasm-rt ;  
   
 : disasm-R-rd,rs,rt ( addr -- )  
     @ dup disasm-rd dup disasm-rs disasm-rt ;  
   
 : disasm-R-rd,rt,rs ( addr -- )  
     @ dup disasm-rd dup disasm-rt disasm-rs ;  
   
 : disasm-R-rd,rt,sa ( addr -- )  
     @ dup disasm-rd dup disasm-rt disasm-sa ;  
   
 \ ***** special types  
 ' disasm-R-nothing      alias disasm-special-nothing  
 ' disasm-R-rd           alias disasm-special-rd  
 ' disasm-R-rs           alias disasm-special-rs  
 ' disasm-R-rd,rs        alias disasm-special-rd,rs  
 ' disasm-R-rs,rt        alias disasm-special-rs,rt  
 ' disasm-R-rd,rs,rt     alias disasm-special-rd,rs,rt  
 ' disasm-R-rd,rt,rs     alias disasm-special-rd,rt,rs  
 ' disasm-R-rd,rt,sa     alias disasm-special-rd,rt,sa  
   
 \ ***** copz types 2  
 : disasm-cop0 ( addr -- )  
     @ disasm-rs ;  
   
 : disasm-copz-rt,rd ( addr -- )  
     @ dup disasm-rt dup disasm-rd disasm-op ;  
   
 $40 2 matrix disasm-opc  
 $40 2 matrix disasm-opc-special  
 $20 2 matrix disasm-opc-regimm  
 $20 2 matrix disasm-opc-copzrs  
 $20 2 matrix disasm-opc-copzrt  
 $40 2 matrix disasm-opc-cop0  
   
 : (disasm-print) ( addr n addr -- )  
     >r dup 1 r@ [ 1 -2 wword-regs-adjust ] execute @ rot swap [ 0 -1 wword-regs-adjust ] execute  
     0 r> [ 1 -2 wword-regs-adjust ] execute @ name. ;  
   
 : disasm-print ( addr -- )  
     dup @ if  
         dup @ (disasm-op)  
         dup 0 disasm-opc @ NIL <> if  
             ['] disasm-opc (disasm-print)  
         else  
             1 disasm-opc @ [ 0 -1 wword-regs-adjust ] execute  
         endif  
     else  
         drop ['] nop, name.  
     endif ;  
   
 : disasm-dump ( addr count -- )  
     cr  
     over + swap ?do  
         i ." ( " dup hex. ." , " dup @ hex. ." ) " disasm-print cr  
     4 +loop ;  
   
 : (disasm-gen) ( name func n addr -- )  
     >r tuck 1 r@ [ 1 -2 wword-regs-adjust ] execute !  
     0 r> [ 1 -2 wword-regs-adjust ] execute ! ;  
   
 : disasm-gen ( name func n -- )  
     ['] disasm-opc (disasm-gen) ;  
   
 : disasm-print-special ( addr -- )  
     dup @ disasm-funct ['] disasm-opc-special (disasm-print) ;  
   
 : disasm-gen-special ( name func n -- )  
     ['] disasm-opc-special (disasm-gen) ;  
   
 : disasm-print-regimm ( addr -- )  
     dup @ (disasm-rt) ['] disasm-opc-regimm (disasm-print) ;  
   
 : disasm-gen-regimm ( name func n -- )  
     ['] disasm-opc-regimm (disasm-gen) ;  
   
 : disasm-print-copzrs ( addr -- )  
     dup @ (disasm-rs)  
     dup 0 disasm-opc-copzrs @ NIL <> if  
         ['] disasm-opc-copzrs (disasm-print)  
     else  
         1 disasm-opc-copzrs @  
         [ 0 -1 wword-regs-adjust ]  
         execute  
     endif ;  
   
 : disasm-gen-copzrs ( name func n -- )  
     ['] disasm-opc-copzrs (disasm-gen) ;  
   
 : disasm-print-copzrt ( addr -- )  
     dup @ (disasm-rt) ['] disasm-opc-copzrt (disasm-print) ;  
   
 : disasm-gen-copzrt ( name func n -- )  
     ['] disasm-opc-copzrt (disasm-gen) ;  
   
 : disasm-print-copzi ( addr -- )  
     dup @ (disasm-rs) ['] disasm-opc-copzrs (disasm-print) ;  
   
 : disasm-gen-copzi ( name func n -- )  
     >r 2dup r@ 1+ disasm-gen  
     2dup r@ 2 + disasm-gen  
     r> 3 + disasm-gen ;  
   
 : disasm-print-cop0 ( addr -- )  
     dup @ disasm-funct ['] disasm-opc-cop0 (disasm-print) ;  
   
 : disasm-gen-cop0 ( name func n -- )  
     ['] disasm-opc-cop0 (disasm-gen) ;  
   
 : illegal-code ( -- ) ;  
   
 : disasm-nop ( code -- )  
     @ 8 ." ( " hex.r space ." ) " ;  
   
 : disasm-init ( xt n -- )  
     0 ?do      0 ?do
         ['] illegal-code ['] disasm-nop i 3 pick          ['] disasm-illegal ,
         [ 0 -3 wword-regs-adjust ] execute      loop ;
     loop  
     drop ;  
 ' disasm-gen $40 disasm-init  
 ' disasm-gen-special $40 disasm-init  
 ' disasm-gen-regimm $20 disasm-init  
 ' disasm-gen-copzrs $20 disasm-init  
 ' disasm-gen-copzrt $20 disasm-init  
 ' disasm-gen-cop0 $40 disasm-init  
 NIL ' disasm-print-special $00 disasm-gen  
 NIL ' disasm-print-regimm $01 disasm-gen  
 NIL ' disasm-print-cop0 $10 disasm-gen  
 NIL ' disasm-print-copzrs $11 disasm-gen  
 NIL ' disasm-print-copzrs $12 disasm-gen  
 NIL ' disasm-print-copzrs $13 disasm-gen  
 NIL ' disasm-print-copzrt asm-copz-BC disasm-gen-copzrs  
   
 ' beq,          ' disasm-I-rs,rt,imm $04 disasm-gen  
 ' bne,          ' disasm-I-rs,rt,imm $05 disasm-gen  
 ' blez,         ' disasm-I-rs,imm $06 disasm-gen  
 ' bgtz,         ' disasm-I-rs,imm $07 disasm-gen  
 ' addi,         ' disasm-I-rt,rs,imm $08 disasm-gen  
 ' addiu,        ' disasm-I-rt,rs,imm $09 disasm-gen  
 ' slti,         ' disasm-I-rt,rs,imm $0a disasm-gen  
 ' sltiu,        ' disasm-I-rt,rs,imm $0b disasm-gen  
 ' andi,         ' disasm-I-rt,rs,imm $0c disasm-gen  
 ' ori,          ' disasm-I-rt,rs,imm $0d disasm-gen  
 ' xori,         ' disasm-I-rt,rs,imm $0e disasm-gen  
 ' lui,          ' disasm-I-rt,imm $0f disasm-gen  
 ' lb,           ' disasm-I-rt,offset,rs $20 disasm-gen  
 ' lh,           ' disasm-I-rt,offset,rs $21 disasm-gen  
 ' lwl,          ' disasm-I-rt,offset,rs $22 disasm-gen  
 ' lw,           ' disasm-I-rt,offset,rs $23 disasm-gen  
 ' lbu,          ' disasm-I-rt,offset,rs $24 disasm-gen  
 ' lhu,          ' disasm-I-rt,offset,rs $25 disasm-gen  
 ' lwr,          ' disasm-I-rt,offset,rs $26 disasm-gen  
 ' sb,           ' disasm-I-rt,offset,rs $28 disasm-gen  
 ' sh,           ' disasm-I-rt,offset,rs $29 disasm-gen  
 ' swl,          ' disasm-I-rt,offset,rs $2a disasm-gen  
 ' sw,           ' disasm-I-rt,offset,rs $2b disasm-gen  
 ' swr,          ' disasm-I-rt,offset,rs $2e disasm-gen  
   
 ' j,            ' disasm-J-target $02 disasm-gen  
 ' jal,          ' disasm-J-target $03 disasm-gen  
   
 ' sll,          ' disasm-special-rd,rt,sa $00 disasm-gen-special  
 ' srl,          ' disasm-special-rd,rt,sa $02 disasm-gen-special  
 ' sra,          ' disasm-special-rd,rt,sa $03 disasm-gen-special  
 ' sllv,         ' disasm-special-rd,rt,rs $04 disasm-gen-special  
 ' srlv,         ' disasm-special-rd,rt,rs $06 disasm-gen-special  
 ' srav,         ' disasm-special-rd,rt,rs $07 disasm-gen-special  
 ' jr,           ' disasm-special-rs $08 disasm-gen-special  
 ' jalr,         ' disasm-special-rd,rs $09 disasm-gen-special  
 ' syscall,      ' disasm-special-nothing $0c disasm-gen-special  
 ' break,        ' disasm-special-nothing $0d disasm-gen-special  
 ' mfhi,         ' disasm-special-rd $10 disasm-gen-special  
 ' mthi,         ' disasm-special-rs $11 disasm-gen-special  
 ' mflo,         ' disasm-special-rd $12 disasm-gen-special  
 ' mtlo,         ' disasm-special-rs $13 disasm-gen-special  
 ' mult,         ' disasm-special-rs,rt $18 disasm-gen-special  
 ' multu,        ' disasm-special-rs,rt $19 disasm-gen-special  
 ' div,          ' disasm-special-rs,rt $1a disasm-gen-special  
 ' divu,         ' disasm-special-rs,rt $1b disasm-gen-special  
 ' add,          ' disasm-special-rd,rs,rt $20 disasm-gen-special  
 ' addu,         ' disasm-special-rd,rs,rt $21 disasm-gen-special  
 ' sub,          ' disasm-special-rd,rs,rt $22 disasm-gen-special  
 ' subu,         ' disasm-special-rd,rs,rt $23 disasm-gen-special  
 ' and,          ' disasm-special-rd,rs,rt $24 disasm-gen-special  
 ' or,           ' disasm-special-rd,rs,rt $25 disasm-gen-special  
 ' xor,          ' disasm-special-rd,rs,rt $26 disasm-gen-special  
 ' nor,          ' disasm-special-rd,rs,rt $27 disasm-gen-special  
 ' slt,          ' disasm-special-rd,rs,rt $2a disasm-gen-special  
 ' sltu,         ' disasm-special-rd,rs,rt $2b disasm-gen-special  
   
 ' bltz,         ' disasm-regimm-rs,imm $00 disasm-gen-regimm  
 ' bgez,         ' disasm-regimm-rs,imm $01 disasm-gen-regimm  
 ' bltzal,       ' disasm-regimm-rs,imm $10 disasm-gen-regimm  
 ' bgezal,       ' disasm-regimm-rs,imm $11 disasm-gen-regimm  
   
 ' lwcz,         ' disasm-copz-rt,offset,rs,z $30 disasm-gen-copzi  
 ' swcz,         ' disasm-copz-rt,offset,rs,z $38 disasm-gen-copzi  
 ' mfcz,         ' disasm-copz-rt,rd asm-copz-MF disasm-gen-copzrs  
 ' cfcz,         ' disasm-copz-rt,rd asm-copz-CF disasm-gen-copzrs  
 ' mtcz,         ' disasm-copz-rt,rd asm-copz-MT disasm-gen-copzrs  
 ' ctcz,         ' disasm-copz-rt,rd asm-copz-CT disasm-gen-copzrs  
 ' bczf,         ' disasm-copz-imm asm-copz-BCF disasm-gen-copzrt  
 ' bczt,         ' disasm-copz-imm asm-copz-BCT disasm-gen-copzrt  
 ' tlbr,         ' disasm-cop0 $01 disasm-gen-cop0  
 ' tlbwi,        ' disasm-cop0 $02 disasm-gen-cop0  
 ' tlbwr,        ' disasm-cop0 $06 disasm-gen-cop0  
 ' tlbl,         ' disasm-cop0 $08 disasm-gen-cop0  
   
 ?test $0800 [IF]  create opc-table $40 init-disasm-table \ top-level decode table
 cr ." Test for disasm..fs" cr  create funct-table $40 init-disasm-table \ special function table
   create regimm-table $20 init-disasm-table \ regim instructions rt field
   create copz-rs-table $20 init-disasm-table \ COPz instructions rs field
   create copz-rt-table $20 init-disasm-table \ COPz instructions rt field
   create cp0-table $40 init-disasm-table \ COP0 function table
   
   \ fields
   
   : disasm-op ( w -- u )
       26 rshift ;
   
   : disasm-rs ( w -- u )
       21 rshift $1F and ;
   
   : disasm-rt ( w -- u )
       16 rshift $1f and ;
   
   : disasm-rd ( w -- u )
       11 rshift $1f and ;
   
   : disasm-shamt ( w -- u )
       \ shift amount field
       6 rshift $1f and ;
   
   : disasm-funct ( w -- u )
       $3f and ;
   
   : disasm-copz ( w -- u )
       disasm-op 3 and ;
   
   : disasm-imm ( w -- n )
       $ffff and dup 15 rshift negate 15 lshift or ;
   
   : disasm-relative ( addr n -- w )
       \ compute printable form of relative address n relative to addr
       nip ( + ) ;
   
   \ disassembler central decode cascade
   
   : disasm-inst ( addr w -- )
       \G disassemble instruction w at addr (addr is used for computing
       \G branch targets)
       dup disasm-op cells opc-table + @ execute ;
   
   : disasm-dump ( addr u -- ) \ gforth
       \G disassemble u aus starting at addr
       bounds u+do
           cr ." ( " i hex. ." ) " i i @ disasm-inst
           1 cells +loop ;
   
   : disasm-special ( addr w -- )
       \ disassemble inst with opcode special
       dup disasm-funct cells funct-table + @ execute ;
   ' disasm-special 0 cells opc-table + !
   
   : disasm-regimm ( addr w -- )
       \ disassemble regimm inst
       dup disasm-rt cells regimm-table + @ execute ;
   ' disasm-regimm 1 cells opc-table + !
   
   : disasm-copz-rs ( addr w -- )
       \ disassemble inst with opcode COPz
       dup disasm-rs cells copz-rs-table + @ execute ;
   ' disasm-copz-rs $10 cells opc-table + !
   ' disasm-copz-rs $11 cells opc-table + !
   ' disasm-copz-rs $12 cells opc-table + !
   
   : disasm-copz-rt ( addr w -- )
       \ disassemble inst with opcode COPz, rs=BC
       dup disasm-rt cells copz-rt-table + @ execute ;
   ' disasm-copz-rt $08 cells copz-rs-table + !
   
   : disasm-cp0 ( addr w -- )
       \ disassemble inst with opcode COPz, rs=CO
       dup disasm-funct cells cp0-table + @ execute ;
   ' disasm-cp0 $10 cells copz-rs-table + !
   
   \ disassemble various formats
   
   : asm-op ( -- ) ;
   
   : disasm-J-target ( addr w -- )
       \ print jump target
       $3ffffff and swap $fc000000 and or hex. ;
   
   : asm-J-target ( u "inst" -- ; compiled code: addr w -- )
       \ disassemble jump inst with opcode u
       :noname POSTPONE disasm-J-target
       name POSTPONE sliteral POSTPONE type POSTPONE ;
       swap cells opc-table + ! ;
   
   : disasm-I-rs,rt,imm ( addr w -- )
       dup disasm-rs .
       dup disasm-rt .
       disasm-imm disasm-relative . ;
   
   : asm-I-rs,rt,imm ( u "name" -- ; compiled code: addr w -- )
       :noname POSTPONE disasm-I-rs,rt,imm
       name POSTPONE sliteral POSTPONE type POSTPONE ;
       swap cells opc-table + ! ;
   
   : asm-rt ( -- ) ;
   
   : disasm-I-rs,imm ( addr w -- )
       \ !! does not check for correctly set rt ( should be 0 )
       dup disasm-rs .
       disasm-imm disasm-relative . ;
   
   : asm-I-rs,imm ( u1 u2 "name" -- ; compiled code: addr w -- )
       :noname POSTPONE disasm-I-rs,imm
       name POSTPONE sliteral POSTPONE type POSTPONE ;
       swap cells opc-table + ! ;
   
   : disasm-rt,rs,imm ( addr w -- )
       dup disasm-rt .
       dup disasm-rs .
       disasm-imm .
       drop ;
   
 : gen ( coden ... code0 n -- )  : asm-I-rt,rs,imm ( u "name" -- ; compiled code: addr w -- )
     0 ?do      :noname POSTPONE disasm-rt,rs,imm
         a,      name POSTPONE sliteral POSTPONE type POSTPONE ;
     loop ;      swap cells opc-table + ! ;
   
   : disasm-rt,imm ( addr w -- )
       dup disasm-rt .
       disasm-imm .
       drop ;
   
 here  : asm-I-rt,imm ( u "name" -- ; compiled code: addr w -- )
 $00210820 $00000820 $00200020 $00010020 $03fff820 5 gen      :noname POSTPONE disasm-rt,imm
 $20210001 $20010000 $20200000 $20000001 $23ffffff 5 gen      name POSTPONE sliteral POSTPONE type POSTPONE ;
 $24210001 $24010000 $24200000 $24000001 $27ffffff 5 gen      swap cells opc-table + ! ;
 $00210821 $00000821 $00200021 $00010021 $03fff821 5 gen  
 $00210824 $00000824 $00200024 $00010024 $03fff824 5 gen  : disasm-rt,imm,rs ( addr w -- )
 $30210001 $30010000 $30200000 $30000001 $33ffffff 5 gen      dup disasm-rt .
 $45000001 $4500ffff 2 gen      dup disasm-imm .
 $45010001 $4501ffff 2 gen      dup disasm-rs .
 $10210001 $10200000 $10010000 $10000001 $13ffffff 5 gen      2drop ;
 $04210001 $04210000 $04010001 $07e1ffff 4 gen  
 $04310001 $04310000 $04110001 $07f1ffff 4 gen  : asm-I-rt,offset,rs ( u "name" -- ; compiled code: addr w -- )
 $1c200001 $1c200000 $1c000001 $1fe0ffff 4 gen      :noname POSTPONE disasm-rt,imm,rs
 $18200001 $18200000 $18000001 $1be0ffff 4 gen      name POSTPONE sliteral POSTPONE type POSTPONE ;
 $04200001 $04200000 $04000001 $07e0ffff 4 gen      swap cells opc-table + ! ;
 $04300001 $04300000 $04100001 $07f0ffff 4 gen  
 $14210001 $14200000 $14010000 $14000001 $17ffffff 5 gen  : disasm-rd,rt,sa ( addr w -- )
 $0000000d 1 gen      dup disasm-rd .
 $44410800 $44410000 $44400800 $445ff800 4 gen      dup disasm-rt .
 $44c10800 $44c10000 $44c00800 $44dff800 4 gen      dup disasm-shamt .
 $0021001a $0020001a $0001001a $03ff001a 4 gen      2drop ;
 $0021001b $0020001b $0001001b $03ff001b 4 gen  
 $08000001 $0bffffff 2 gen  : asm-special-rd,rt,sa ( u "name" -- ; compiled code: addr w -- )
 $0c000001 $0fffffff 2 gen      :noname POSTPONE disasm-rd,rt,sa
 $00200809 $00000809 $00200009 $03e0f809 4 gen      name POSTPONE sliteral POSTPONE type POSTPONE ;
 $00200008 $03e00008 2 gen      swap cells funct-table + ! ;
 $80210001 $80010000 $80000001 $80200000 $83ffffff 5 gen  
 $90210001 $90010000 $90000001 $90200000 $93ffffff 5 gen  : disasm-rd,rt,rs ( addr w -- )
 $84210001 $84010000 $84000001 $84200000 $87ffffff 5 gen      dup disasm-rd .
 $94210001 $94010000 $94000001 $94200000 $97ffffff 5 gen      dup disasm-rt .
 $3c010001 $3c010000 $3c000001 $3c1fffff 4 gen      dup disasm-rs .
 $8c210001 $8c010000 $8c000001 $8c200000 $8fffffff 5 gen      2drop ;
 $c4210001 $c4010000 $c4000001 $c4200000 $c7ffffff 5 gen  
 $88210001 $88010000 $88000001 $88200000 $8bffffff 5 gen  : asm-special-rd,rt,rs ( u "name" -- ; compiled code: addr w -- )
 $98210001 $98010000 $98000001 $98200000 $9bffffff 5 gen      :noname POSTPONE disasm-rd,rt,rs
 $44010800 $44010000 $44000800 $441ff800 4 gen      name POSTPONE sliteral POSTPONE type POSTPONE ;
 $00000810 $0000f810 2 gen      swap cells funct-table + ! ;
 $00000812 $0000f812 2 gen  
 $44810800 $44810000 $44800800 $449ff800 4 gen  : disasm-rs. ( addr w -- )
 $00200011 $03e00011 2 gen      dup disasm-rs .
 $00200013 $03e00013 2 gen      2drop ;
 $00210018 $00200018 $00010018 $03ff0018 4 gen  
 $00210019 $00200019 $00010019 $03ff0019 4 gen  : asm-special-rs ( u "name" -- ; compiled code: addr w -- )
 $00210827 $00000827 $00200027 $00010027 $03fff827 5 gen      :noname POSTPONE disasm-rs.
 $00210825 $00000825 $00200025 $00010025 $03fff825 5 gen      name POSTPONE sliteral POSTPONE type POSTPONE ;
 $34210001 $34010000 $34200000 $34000001 $37ffffff 5 gen      swap cells funct-table + ! ;
 $a0210001 $a0010000 $a0000001 $a0200000 $a3ffffff 5 gen  
 $a4210001 $a4010000 $a4000001 $a4200000 $a7ffffff 5 gen  : disasm-rd,rs ( addr w -- )
 $0021082a $0000082a $0020002a $0001002a $03fff82a 5 gen      dup disasm-rd .
 $28210001 $28010000 $28200000 $28000001 $2bffffff 5 gen      dup disasm-rs .
 $2c210001 $2c010000 $2c200000 $2c000001 $2fffffff 5 gen      2drop ;
 $0021082b $0000082b $0020002b $0001002b $03fff82b 5 gen  
 $00210822 $00000822 $00200022 $00010022 $03fff822 5 gen  : asm-special-rd,rs ( u "name" -- ; compiled code: addr w -- )
 $00210823 $00000823 $00200023 $00010023 $03fff823 5 gen      :noname POSTPONE disasm-rd,rs
 $ac210001 $ac010000 $ac000001 $ac200000 $afffffff 5 gen      name POSTPONE sliteral POSTPONE type POSTPONE ;
 $e4210001 $e4010000 $e4000001 $e4200000 $e7ffffff 5 gen      swap cells funct-table + ! ;
 $a8210001 $a8010000 $a8000001 $a8200000 $abffffff 5 gen  
 $b8210001 $b8010000 $b8000001 $b8200000 $bbffffff 5 gen  : asm-special-nothing ( u "name" -- ; compiled code: addr w -- )
 $0000000c 1 gen      :noname POSTPONE 2drop
 $42000008 1 gen      name POSTPONE sliteral POSTPONE type POSTPONE ;
 $42000001 1 gen      swap cells funct-table + ! ;
 $42000002 1 gen  
 $42000006 1 gen  : disasm-rd. ( addr w -- )
 $00210826 $00000826 $00200026 $00010026 $03fff826 5 gen      dup disasm-rd .
 $38210001 $38010000 $38200000 $38000001 $3bffffff 5 gen      2drop ;
   
 $00200821 $00000821 $00200021 $03e0f821 4 gen  : asm-special-rd ( u "name" -- ; compiled code: addr w -- )
 $00010822 $00200821 $04210002 $00000822 $00000821 $04010002      :noname POSTPONE disasm-rd.
 $00010022 $00200021 $04210002 $001ff822 $03e0f821 $07e10002 12 gen      name POSTPONE sliteral POSTPONE type POSTPONE ;
 $00010822 $00000822 $00010022 $001ff822 4 gen      swap cells funct-table + ! ;
 $00010823 $00000823 $00010023 $001ff823 4 gen  
 $00200827 $00000827 $00200027 $03e0f827 4 gen  : disasm-rs,rt ( addr w -- )
 $14200001 $0021082a $14200000 $0020082a $14200000 $0001082a      dup disasm-rs .
 $14200001 $0000082a $1420ffff $03ff082a 10 gen      dup disasm-rt .
 $10200001 $0021082a $10200000 $0001082a $10200000 $0020082a      2drop ;
 $10200001 $0000082a $1020ffff $03ff082a 10 gen  
 $14200001 $0021082a $14200000 $0001082a $14200000 $0020082a  : asm-special-rs,rt ( u "name" -- ; compiled code: addr w -- )
 $14200001 $0000082a $1420ffff $03ff082a 10 gen      :noname POSTPONE disasm-rs,rt
 $10200001 $0021082b $10200000 $0020082b $10200000 $0001082b      name POSTPONE sliteral POSTPONE type POSTPONE ;
 $10200001 $0000082b $1020ffff $03ff082b 10 gen      swap cells funct-table + ! ;
 $14200001 $0021082b $14200000 $0020082b $14200000 $0001082b  
 $14200001 $0000082b $1420ffff $03ff082b 10 gen  : disasm-rd,rs,rt ( addr w -- )
 $10200001 $0021082b $10200000 $0001082b $10200000 $0020082b      dup disasm-rd .
 $10200001 $0000082b $1020ffff $03ff082b 10 gen      dup disasm-rs .
 $14200001 $0021082b $14200000 $0001082b $14200000 $0020082b      dup disasm-rt .
 $14200001 $0000082b $1420ffff $03ff082b 10 gen      2drop ;
 $10200001 $0021082b $10200000 $0020082b $10200000 $0001082b  
 $10200001 $0000082b $1020ffff $03ff082b 10 gen  : asm-special-rd,rs,rt ( u "name" -- ; compiled code: addr w -- )
 here over - disasm-dump      :noname POSTPONE disasm-rd,rs,rt
       name POSTPONE sliteral POSTPONE type POSTPONE ;
       swap cells funct-table + ! ;
   
   : asm-regimm-rs,imm ( u "name" -- )
       :noname POSTPONE disasm-I-rs,imm
       name POSTPONE sliteral POSTPONE type POSTPONE ;
       swap cells regimm-table + ! ;
   
   : asm-copz-rt,offset,rs ( u "name" -- )
       \ ignore these insts, we disassemble using  asm-I-rt,offset,rs
       drop name 2drop ;
   
   : asm-copz0 ( u "name" -- )
       :noname POSTPONE 2drop
       name POSTPONE sliteral POSTPONE type POSTPONE ;
       swap cells cp0-table + ! ;
   
   $00 constant asm-copz-MF
   $02 constant asm-copz-CF
   $04 constant asm-copz-MT
   $06 constant asm-copz-CT
   $08 constant asm-copz-BC
   $10 constant asm-copz-C0
   
   $00 constant asm-copz-BCF
   $01 constant asm-copz-BCT
   
   : asm-rs ( -- ) ;
   
   : disasm-rt,rd,z ( addr w -- )
       dup disasm-rt .
       dup disasm-rd .
       dup disasm-copz .
       2drop ;
   
   : asm-copz-rt,rd ( u1 u2 "name" -- )
       drop :noname POSTPONE disasm-rt,rd,z
       name POSTPONE sliteral POSTPONE type POSTPONE ;
       swap cells copz-rs-table + ! ;
   
   : disasm-I-imm ( addr w -- )
       disasm-imm disasm-relative . ;
   
   : asm-copz-imm ( u1 u2 u3 "name" -- )
       drop nip :noname POSTPONE disasm-I-imm
       name POSTPONE sliteral POSTPONE type POSTPONE ;
       swap cells copz-rt-table + ! ;
   
 finish  include ./insts.fs
 [THEN]  

Removed from v.1.2  
changed lines
  Added in v.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>