I use Dallas 390 and I want to map the device I/O into RAM which can be accessed by Dallas 390.I have the following solution: 1. Using XSEG in Ax51 as the following example
XSEG AT 08000h IO_PORT: DS 1
//head file: head.h extern unsigned char IO_PORT; //source file:source.c #include "head.h" ... IO_PORT = 0x01; ...
XSEG AT 40BC00h IO_PORT: DS 1
//file IO.c unsigned char far IO_PORT _at_ 0x40BC00; //head file:head.h extern unsigned char far IO_PORT; //using IO_PORT in sourc.c #include "head.h" ... IO_PORT = 0x01; ...
#define IO_PORT 0x8000 unsigned int addr; XBYTE[IO_PORT] = 0x01; addr = 0x8000; XBYTE[addr] = 0x01;//segment number + (addr) FVAR(unsigned char,0x40BC00) = 0x01;
unsigned char IO_PORT _at_ 0x8000; ... IO_PORT = 0x01 ...