/*
 * Copyright © 1994-1996 Marko Mäkelä and Olaf Seibert
 * Original Linux and Commodore 64/128/Vic-20 version by Marko Mäkelä
 * Ported to the PET and the Amiga series by Olaf Seibert
 * 
 *     This program is free software; you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 * 
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 * 
 *     You should have received a copy of the GNU General Public License
 *     along with this program; if not, write to the Free Software
 *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/* definitions of the transfer routines */

int prinit (void);			/* initializes the routines */
void prclose (void);			/* closes the routines */

void output (unsigned char byte);	/* outputs a byte */
#ifndef MSDOS
void wait_output (unsigned char byte);	/* ditto, without busy-waiting */
#else
#  define wait_output output			/* Microsoft only knows busy-waiting */
#endif
unsigned input (void);			/* inputs a byte */
#ifndef MSDOS
unsigned wait_input (void);		/* ditto, without busy-waiting */
#else
#  define wait_input input		/* Microsoft only knows busy-waiting */
#endif

void send (unsigned char *buffer, unsigned length);	/* sends bytes */
void receive (unsigned char *buffer, unsigned length);	/* receives bytes */

void getname(char *dest, char *env_file, char *def_file);
void ascii2petscii(unsigned char *p);
void petscii2ascii(unsigned char *p);

typedef int main_t(int argc, char **argv);

extern main_t main_prload, main_prsave, main_prcart,
	      main_prrfile, main_prwfile, main_prdisk;

int vmain(main_t main, int argc, char *argv0, ...);

#define SLEEP_TIME 10000 /* amount of microseconds to wait in wait_input */

#ifdef MSDOS
#  define outb(data,port) outp(port,data)
#  define inb inp
#endif /* MSDOS */

#define REQ_INFO 0
#define REQ_LOAD 1
#define REQ_SAVE 2
#define REQ_JUMP 3
#define REQ_RUN  4

#ifndef DEFAULT_PORT
#  define DEFAULT_PORT 0
#endif

#ifndef TRUE
#  define TRUE (1)
#  define FALSE (0)
#endif

#ifdef __MAIN_C__
unsigned portaddr[] = {0x3BC, 0x378, 0x2BC, 0x278};
unsigned baseaddr;
#else
extern unsigned portaddr[];
extern unsigned baseaddr;
#endif /* __MAIN_C__ */
