#ifndef BUFSIZ
#define BUFSIZ 2
#endif

unsigned int __write(int,const char *,unsigned int);
unsigned int __read(int,char *,unsigned int);

#define _R __regsused("a/x")

_R void __chrout(__reg("a") unsigned char x)="\tjsr\t0xffd2";
_R char __chrin(void)="\tjsr\t0xffcf";
_R void __setnam(__reg("r0/r1") const char *name,__reg("r2") char len)="\tlda\tr2\n\tldx\tr0\n\tldy\tr1\n\tjsr\t$ffbd";
_R void __setlfs(__reg("r0") char lnum,__reg("r1") char dev,__reg("r2") char sec)="\tlda\tr0\n\tldx\tr1\n\tldy\tr2\n\tjsr\t$ffba";
_R signed char __open(void)="\tinline\n\tjsr\t$ffc0\n\tbcs\t.l1\n\tlda\t#0\n.l1:\n\teinline";
_R void __close(__reg("a") char lnum)="\tjsr\t$ffc3";
_R void __chkin(__reg("x") char lnum)="\tjsr\t$ffc6";
_R void __chkout(__reg("x") char lnum)="\tjsr\t$ffc9";
_R char __readst(void)="\tjsr\t$ffb7";
_R void __clrchn(void)="\tjsr\t$ffcc";
_R void __clall(void)="\tjsr\t$ffe7";


long __rdtim(void)="\tjsr\t0xffde\n"
                   "\tsta\tbtmp0\n"
                   "\tstx\tbtmp0+1\n"
                   "\tsty\tbtmp0+2\n"
                   "\tlda\t#0\n"
                   "\tsta\tbtmp0+3";
