( ************************** RTX2000 Debug Monitor  **********************
  This is source code for a public domain debug monitor that is compatible
  with the output of the fc compiler.   The monitor is ASCII
  character based and can be used with a terminal emulation program on 
  either an IBM PC or AMIGA if a serial interface is used for I/O on the 
  target system.  To use this monitor, hardware specific io routines must
  be added.   

     Definition files required for build:
       rtx2000.f -- defines rtx2000 register as ASIC bus locations
       logic.f -- definitions for TRUE and FALSE
       equal.f -- a definition of =
       shift.f -- definitions of shift instructions 


     Source ( code defintions ) files required for build:
       main -- Main loop and calls out required modules for build
       debugger -- Actual debugger code
       util -- Support routines for debugger
       gp -- Commonly used FORTH words
       io -- I/O module
  
     Instructions for use:

         1- Write I/O specific routines for key, emit, and initio 
           ( These routines comprise the io module )

        2- Set the heap and code addresses located in "main" to
           control addresses for code and variables

        3- Compile all files together using the command

              fc -lexs main

           to generate files compatiable with a DATAIO programmer

        4- Program PROMS or EEPROMs and install into system

        5- Application programs can now be downloaded from a host
           to the RTX2000 system using the monitor.  These application
           programs may call certain routines in the monitor if they
           inclued the file main.x generated when compiling the 
           monitor.
     
     Debugger commands are detailed in the debugger module
)


( Debug monitor prompt  )
#macro PROMPT "\nrtx> "

( Include files required for build )
#include rtx2000.f
#include logic.f
#include equal.f
#include shift.f

xheap

( Change the heap address from 0xC000 to the desired heap location.
  Variables are allocated by first decrementing the heap then assigning
  the address, so the highest RAM address + 1 makes a good choice for 
  the heap )

0xC000 heap           

( Change the code start address for the desired address of the monitor program 
code.  If PROMs or EEPROMs are available at location 0 and the code is
origined there, the monitor will automatically start-up upon reset )

0x0000  code

: main
   -1 slr!             ( initialize stack limit register )
   cr@                 ( read configuration register )
   0x10 or             ( want interrupts disabled )
   0xFFFb and          ( want Motorola mode )
   cr!                 ( set configuration, boot unchanged )
   0 spr!              ( init stack pointer register )
   0 cpr!              ( initialize code page register )
   init_io             ( initialize io )
   debug_init          ( initialize debugger )
   begin
     debugger          ( Call debugger )
   again
;

#include io
#include debugger
#include util
#include gp

