#pragma code symbols debug objectextend
#include <reg51.h> /* special function register declarations */
/* for the intended 8051 derivative */
#include <stdio.h> /* prototype declarations for I/O functions */
#define BYTE unsigned char
#define WORD unsigned int
#define LONG unsigned long
#define dword unsigned long
#define DWORD unsigned long
#define byte unsigned char
#define word unsigned int
#define XBYTE ((unsigned char volatile xdata *) 0)
#define XWORD ((unsigned int volatile xdata *) 0)
#define NES 0x6000
data union{
LONG l;
BYTE b[];
}lShift;
data BYTE bCnt;
/****************/
/* main program */
/****************/
void main (void) { /* execution starts here after stack init */
#define KEY_BREAK 0x1f800
#define BCNT_VALUE 0
//BYTE code abBitHi[] ={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
//BYTE code KeyTable[][2]={}
data BYTE bKey=0xff, bC, bKeyTmp;
//data WORD wKb;
//data long lBrk;
data union{
LONG l;
BYTE b[];
}lTmp;
bit fParity, fP;
TCON=0x01; //bit0: 1/0 falling edge/low level triggered external interrupts
IP=0x01; //bit0:Externl interrupt 0 Priority control bit
IE=0x81; //bit0:Enable External interrupt 0 control bit
//bit7:All control bit
XBYTE[NES]=0x00;
///if (bCnt>=BCNT_VALUE) {
){
T0=~T0;
bCnt=BCNT_VALUE;
lTmp.l=lShift.l;
] & ] & 0xfc)==0x80)) ||
((lTmp.b[]==]<=0x10)))
{
//fBrk=1;
bKey &= 0x7f;
}
] & 0xa0)==0x80) && //stop bit=1, data bit7=0
((lTmp.b[] & 0x20)==0x00) ){ //start bit==0 bit0 , data bit7==0
] & ; //parity bit bit9
;
lTmp.l<<=;
bKeyTmp=lTmp.b[];
fParity=;
; bC<=; bC++){
] & ) fParity=~fParity;
lTmp.b[]<<=;
}
if (fP==fParity) {
//fOk=1;
//bKey=KeyTable[bKeyTmp];
bKey=bKeyTmp | 0x80;
}
}
P1=bKey;
XBYTE[NES]=bKey;
}
////else bCnt++; //while (1)
} //void main (void)
{
bit fT0;
fT0=INT1;
lShift.l>>=;
] |= 0x80;
///bCnt=0;
}
/* link
hello.obj
XDATA(0) IDATA(80H) RAMSIZE(256) SYMBOLS
*/