( *************************** MODULE IO *********************************
   io routines for monitor

   Write IO routines specific to your hardware.
   The monitor has been used with serial RS-232 io routines and
   using an IBM-PC or AMIGA as the host.  This allows the user to
   use a terminal emulation program to communicate with the target and
   download software generated from the fc compiler.
 
)

: init_io ( -- )
( Initialize io system )
( Replace this code with system specific code for your target )
   1 upr!              ( point page register to actel )
   0xC000 ubr!         ( point base register to actel )
   0x1000 0 u!         ( turn on testport )
;


: emit 	( u -- ) 
( Write character u to the output device )
( Replace this code with system specific code )
     7 of( 2* )
     begin
	0 3 u!		( reset watchdog timer )
 	0x200 0 u@ and  ( wait for transmitter ready )
     until
     1 u!	( send byte )
;
	

:  key ( -- u )		
( Wait for input, return input character as u )
( Replace this code with system specific code )
   begin
      0 3 u!		( reset watchdog timer )
      0x100 0 u@ and	( wait for receiver ready )
   until
   1 u@ 		( read the char )
   7 of( U2/ )		( shift it into the low byte )
; 

