Tips and Tricks

ARGS - Here is an often overloooked command. ARGS will tell you the arguments required for any Amiga library function. The syntax is similar to CALL. Here is an example of using ARGS to find out the arguments for the Graphics library function Draw(). Enter:.

>ARGS GRAPHICS_LIB DRAW

ADISM can be used to disassemble code that is not in a Forth word. As an example here is how you can disassemble a function in an Amiga library. An Amiga library contains a jump table which points to each function. You can look in the jump table to get the function's address then disassemble it using DISM. In JForth V3, ARGS will also print the library offset.

>ARGS EXEC_LIB DISABLE

will print out:

Disable( ) ( ) $-78

To see the source code for Disable(), enter:

EXEC_LIB @ $ -78 + ADISM ( takes absolute address )

which will print:

5FE jmp $FC1428 4EF9 00FC 1428

By looking at the above printout we can see where the code is on your machine, then substitute that number in the following entry:

$ FC1428 adism

On my machine, the above printed out:

FC1428 move.w #$4000,$DFF09A 33FC 4000 00DF F09A
FC1430 ADDQ.B #$1,$126 (dsp) 522E 0126
FC1434 RTS 4E75 ok

The absolute address $DFF09A is an interrupt control register. This routine uses ADDQ to keep track of how many times Disable ( ) is called to allow nesting.

If you do not have V3, you can find out the offset of an Amiga library routine by compiling a call to that routine then looking at the code produced. For example:

TT call exec_lib disable

def tt

Examine the printout and look for a JSR relative to (DSP) such as the following example for Disable( ).

18E16 move.l (rp)+,dsp 2C5F "'_"
18E18 jsr $-78(dsp) 4EAE FF88
18E1C movem.l (rp)+,iloop/loc-dsp

Fast Recompile - If you want to recompile a file that you recently compiled, the command will often still be in the History buffer. To get to it, hit the <F1> function key to put "INCLUDE" in the input stream, then hit <SHIFT-UPARROW>.
That will search for the first line that matches the current line. If you find the right line, just hit return. This can save you some typing. If you have different files that you have been including, after hitting <F1>, enter the first letter of the file, then you will probably end up on on the right line when you enter <SHIFT-UPARROW>. (If you have ARexx and JForth V3 you can compile directly from the Textra editor.)

Sequential Constants - If you need to define a series of constants with sequential values, eg. 0,1,2,3,4, try the following:

DUP CONSTANT COLOR_RED

DUP CONSTANT COLOR_GREEN

Continued