--- gforth/arch/mips/disasm.fs 2000/09/23 15:47:02 1.12 +++ gforth/arch/mips/disasm.fs 2010/12/31 18:09:02 1.16 @@ -1,12 +1,12 @@ -\ disasm.fs disassembler file (for MIPS R3000) +\ disasm.fs disassembler file (for MIPS32) \ -\ Copyright (C) 2000 Free Software Foundation, Inc. +\ Copyright (C) 2000,2007,2010 Free Software Foundation, Inc. \ This file is part of Gforth. \ Gforth is free software; you can redistribute it and/or \ modify it under the terms of the GNU General Public License -\ as published by the Free Software Foundation; either version 2 +\ as published by the Free Software Foundation, either version 3 \ of the License, or (at your option) any later version. \ This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ \ GNU General Public License for more details. \ You should have received a copy of the GNU General Public License -\ along with this program; if not, write to the Free Software -\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. +\ along with this program. If not, see http://www.gnu.org/licenses/. \ this disassembler is based on data from the R4400 manual \ http://www.mips.com/Documentation/R4400_Uman_book_Ed2.pdf, in @@ -80,6 +79,7 @@ does> ( u -- addr ) $40 disasm-table opc-tab-entry \ top-level decode table $40 disasm-table funct-tab-entry \ special function table +$40 disasm-table funct-tab2-entry \ special2 function table $20 disasm-table regimm-tab-entry \ regim instructions rt table $20 disasm-table copz-rs-tab-entry \ COPz instructions rs table $20 disasm-table copz-rt-tab-entry \ COPz BC instructions rt table @@ -97,8 +97,8 @@ dup set-current : disasm ( addr u -- ) \ gforth \G disassemble u aus starting at addr bounds u+do - cr ." ( " i hex. ." ) " i i @ disasm-inst - 1 cells +loop + cr ." ( " i hex. ." ) " i i ul@ disasm-inst + 4 +loop cr ; ' disasm IS discode @@ -110,6 +110,11 @@ definitions dup disasm-funct funct-tab-entry @ execute ; ' disasm-special 0 opc-tab-entry ! \ enter it for opcode special +: disasm-special2 ( addr w -- ) \ todo factor out! + \ disassemble inst with opcode special2 + dup disasm-funct funct-tab2-entry @ execute ; +' disasm-special2 $1C opc-tab-entry ! \ enter it for opcode special + : disasm-regimm ( addr w -- ) \ disassemble regimm inst dup disasm-rt regimm-tab-entry @ execute ; @@ -261,6 +266,9 @@ does> ( addr w -- ) ' disasm-rd. ' funct-tab-entry define-format asm-special-rd ' disasm-rs,rt ' funct-tab-entry define-format asm-special-rs,rt ' disasm-rd,rs,rt ' funct-tab-entry define-format asm-special-rd,rs,rt +' disasm-rd,rs ' funct-tab2-entry define-format asm-special2-rd,rs +' disasm-rs,rt ' funct-tab2-entry define-format asm-special2-rs,rt +' disasm-rd,rs,rt ' funct-tab2-entry define-format asm-special2-rd,rs,rt ' disasm-I-rs,imm ' regimm-tab-entry define-format asm-regimm-rs,imm ' 2drop ' cp0-tab-entry define-format asm-copz0 ' disasm-rt,rd,z ' copz-rs-tab-entry define-format asm-copz-rt,rd1