#ifndef __mcs85bus_h
#define __mcs85bus_h

#define CTRLPORT PORTC
#define CTRLPIN  PINC
#define CTRLDDR  DDRC

// bit definitions
#define ALE      0
#define CS       1
#define WR       2
#define RD       3

#define ALELOW()   ClearBit(ALE, CTRLPORT)
#define ALEHIGH()  SetBit(  ALE, CTRLPORT)

#define RDLOW()    ClearBit(RD, CTRLPORT)
#define RDHIGH()   SetBit(  RD, CTRLPORT)

#define WRLOW()    ClearBit(WR, CTRLPORT)
#define WRHIGH()   SetBit(  WR, CTRLPORT)

#define CSLOW()    ClearBit(CS, CTRLPORT)
#define CSHIGH()   SetBit(  CS, CTRLPORT)


void BusModeOutput(void);
void BusModeInput(void);
void OutputByte(unsigned char d);
unsigned char InputByte();
unsigned char ReadMCS85(unsigned char address);
void WriteMCS85(unsigned char address, unsigned char data);
void IDLE(void);




#endif
