Diff for /gforth/arch/alpha/disasm.fs between versions 1.2 and 1.9

version 1.2, 1999/10/13 13:00:08 version 1.9, 2007/12/31 19:02:24
Line 1 Line 1
   
 \ bernd thallner 9725890 e881  
 \ disassembler in forth for alpha  \ disassembler in forth for alpha
   
   \ Copyright (C) 1999,2000,2007 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 3
   \ of the License, or (at your option) any later version.
   
   \ This program is distributed in the hope that it will be useful,
   \ but WITHOUT ANY WARRANTY; without even the implied warranty of
   \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   \ 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, see http://www.gnu.org/licenses/.
   
   \ contributed by Bernd Thallner
   
 \ util  \ util
   
 : h@ ( addr -- n )  \ 32 bit fetch  \ require asm.fs
 dup dup aligned = if  
   @  \  : h@ ( addr -- n )  \ 32 bit fetch
   $00000000ffffffff and  \  dup dup aligned = if
 else  \    @
   4 - @  \    $00000000ffffffff and
   $20 rshift  \  else
 endif  \    4 - @
 ;  \    $20 rshift
   \  endif
   \  ;
   
   also assembler
   vocabulary disassembler
   get-current
   also disassembler definitions
   
 create string_table  create string_table
 1000 allot  1000 allot
Line 257  create decode_code Line 281  create decode_code
   print_string drop    print_string drop
 ;  ;
   
 : decode_Bra ( instruction tbentry -- )  : decode_Bra ( addr instruction tbentry -- addr )
   swap    swap
   dup $03e00000 and 21 rshift decode_register    dup $03e00000 and 21 rshift decode_register
   $001fffff and .    $001fffff and 2* 2* 2 pick + 4 + hex.
   print_string    print_string
 ;  ;
   
Line 282  create decode_code Line 306  create decode_code
 : decode_Mem ( instruction tbentry -- )  : decode_Mem ( instruction tbentry -- )
   swap    swap
   dup $03e00000 and 21 rshift decode_register    dup $03e00000 and 21 rshift decode_register
   dup $0000ffff and .    dup $0000ffff and dup 15 rshift negate 15 lshift or .
   $001f0000 and 16 rshift decode_register    $001f0000 and 16 rshift decode_register
   print_string    print_string
 ;  ;
Line 415  create opcode_table Line 439  create opcode_table
   
 drop \ string_table end  drop \ string_table end
   
 : decode_inst ( n -- )  \ instruction decoder  set-current
   
   : disasm-inst ( addr n -- addr )  \ instruction decoder
   dup $fc000000 and    dup $fc000000 and
   26 rshift cells    26 rshift cells
   opcode_table +    opcode_table +
Line 424  drop \ string_table end Line 450  drop \ string_table end
   $2c emit cr    $2c emit cr
 ;  ;
   
 : disasm ( addr n -- )  \ disassembler  : disasm ( addr u -- )  \ gforth
 cr 0      \G disassemble u aus starting at addr
 ?do      cr bounds
   dup h@      u+do
   over $28 emit space . $29 emit space          ." ( " i hex. ." ) "
   decode_inst          i i h@ disasm-inst drop
   4 +          4
 loop      +loop ;
 drop  
 ;  ' disasm is discode
   
   previous previous

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


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