/*
	MGRS232.C
	
	BL14xx/MicroG or BL15xx/MicroG2

	Show usage of the z180 serial port 0 for communication to a RS232 dumb
	terminal.
	
	Other samples are in ..\samples\network.

	Note that reload_vec() figures out if the Flash is being used. If so,
	it will do the proper protocol to transfer the vector to the flash
	eprom.	
*/

char rbuf[60];
char tbuf[60];

main()
{
   char readbuf[40];

#if ROM==0

	reload_vec(14, Dz0_circ_int);		// transfer the vector
		
#endif
   
   Dinit_z0(rbuf, tbuf, 60, 60, 0x04, 8, 0, 1);
   // rbuf is circular buffer for receiver
   // tbuf is circular buffer for transmitter
   // 60 is the size of the buffers
   // 0x04 for 8 bit, no parity, 1 stop bit
   // 0 for no modem
   // 1 for echo

	Dz0send_prompt();
   for(;;)
   {
   	hitwd();
   	runwatch();
   	if(Dread_z0(readbuf,ENTER))	// wait for stream terminated with
   											// carriage return
   	{
   		Dz0send_prompt();
			Dwrite_z0("hello ",6);
   		Dwrite_z0(readbuf, strlen(readbuf));
   		Dz0send_prompt();
   	}
   }
}