PDA

View Full Version : MaxFORTH SEE


scotty
03-23-05, 01:35 PM
Hi,
Is there a maxforth equivalent to the ANS word SEE (that gives the definition of a particular word)?
Thanks, Scotty
PS. Am using IsoMax version 0.61

RMDumse
03-23-05, 01:44 PM
No, SEE goes back to the source, and the source is not in the chip. If the source were in the chip, there'd be no room for the object or the user program, so it isn't something we could do.

rob
03-23-05, 04:27 PM
On the other hand if you don't mind a variation of the SEE tool which is simple but does its best, try this:( Decompiler for MaxForth Rob Chapman Aug 29, 2002 )
HEX
SP@ SP@ - ABS CONSTANT CELL ( cell size )

: IFNOT BL WORD FIND IF 0 WORD DROP THEN DROP ; ( conditional compiled line )

IFNOT P@ : P@ @ ; ( for systems without P@ )

: WHAT ( a -- ) LATEST
BEGIN ?DUP WHILE PFAPTR 2DUP CFA = IF NFA ID. DROP EXIT THEN
LFA P@
REPEAT DROP ." _" ;

( list or see n cells from current address )
: SEE ( a n ) 0 DO DUP P@ SPACE WHAT CELL + LOOP DROP ;

: LIST ( a n ) CR
0 DO DUP CELL 2* U.R ." : " DUP P@ WHAT CR CELL + LOOP DROP ;


( Examples on different micros )
( on MCore with alignemnt example )
' LIST P@ 10 LIST ( ' LIST P@ for just the body )
800210: CR
800214: _
800218: _
80021C: _
800220: DUP
800224: CELL
800228: 2*
80022C: U.R
800230: _
800234: _
800238: DUP
80023C: @
800240: WHAT
800244: CR
OK
( on ARM )
' WORDS P@ 10 LIST
2374: _
2378: _
237C: _
2380: _
2384: _
2388: +
238C: 2+
2390: >R
2394: _
2398: BL
239C: WORD
23A0: COUNT
23A4: +
23A8: C!
23AC: @
23B0: ?DUP
OK
( on DSP in vertical mode )
HEX ' LIST P@ 10 LIST
7E58: CR
7E59: _
7E5A: _
7E5B: _
7E5C: DUP
7E5D: CELL
7E5E: 2*
7E5F: U.R
7E60: _
7E61: _
7E62: _
7E63: _
7E64: DUP
7E65: P@
( in horizontal mode )
7E64 A SEE DUP P@ WHAT CR CELL + _ _ DROP EXIT OK

( on HC12 there is no realignment after the string ": " )
' LIST P@ 10 LIST
78D: _
78F: _
791: CR
793: _
795: _
797: _
799: DUP
79B: CELL
79D: 2*
79F: U.R
7A1: _
7A3: _
7A5: _
7A7: _
7A9: _
7AB: _
OK
79F 1 DUMP
9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE
79F: D3 B0 D5 CB 02 3A 20 C9 87 C9 AD 07 34 D2 9E 07 .....: .....4... OK
7A7 3 SEE _ _ _ OK
7A6 3 SEE DUP @ WHAT OK
7A6 A SEE DUP @ WHAT CR CELL + _ _ DROP EXIT OK


Rob

scotty
03-24-05, 08:37 AM
Thanks for the speedy replies - I'll try this.
Scotty

mmbutler
04-21-06, 10:29 PM
Rob, thanks for this. It's handy enough to help some. :)