I am eager to expand the number of boards supported by the xbeaver emulator. Hence anyone with knowledge of an 80bus board that is not included in this emulation is encouraged to implement a new board.
New boards should be implemented in new files. This makes source control & merging easy. Either a single board or multiple similar boards can be implemented in a single c source file and associated header file. All functions implemented should be made static, use a common short prefix, and prototyped near the top of the file.
Each board requires a global instance of the type IOCARD_CARD_DEFN_T this should be given a suitable name reflecting the board name/number. It contains the following items:-
The name of the IOCARD_CARD_DEFN_T defined should be added to the list of boards defined in commands.c with the macro BOARD_LIST. New boards should be placed in a suitable position in the list to reflect their function as the order of this lists defines the order the boards are listed with the -h option.
This function is called once for each new board in the system. It has the following arguments:-
It should perform the following functions:-
Input ports are implemented as callbacks.
For an input port the callback takes the following arguments:-
Output ports are implemented as callbacks.
For an output port the callback takes the following arguments:-
The beaver system uses memory management to increase memory space accessable from 64kBytes to 1MByte. This 1MByte space is divided into 256 pages of physical memory each of 4k. The Z80 can reference any 16 of these pages as logical memory. Which 16 pages can be references is controlled by the memory management unit.
When implementing DMA it is important to decide if the DMA is to be performed with physical or logical memory.
If the DMA address is programmable then it is likely to be restricted to a 64k address range. In which case logical memory should be used. However it should be remembered that it is possible that the mapping of physical to logical pages may change while the DMA is in progress. Often the best way of avoiding this problem is to make sure that the DMA completes as soon as it is started.
If the DMA address is only set by the command tail parameters then there is no restriction on the address range. In this case the use of physical addressing is to be prefered. This is particularly true for video cards which need to retain the same display memory even when the memory management unit settings are changed.The following routines can be used to access memory:-
If the new board already exists as physical hardware it is likely that software exists to check the emulation works correctly. This is often the best way of ensuring the correctness of the emulation.
If the device is a character device, or can be treated as such, then a device driver can be written for VPMM. A guide to doing so is available here. It is also worthy of note that vpmm device drivers can be used under cp/m using the devload program.