The 8237 has three software commands to control its operation and they are Clear first-last flip-flop, Master clear, and Clear mask register. These software commands can be enabled by executing a write operation to the internal address allotted to these commands. We need not worry about the data sent to these ports during the write operation because the 8237 will ignore the data. The functions of the software commands are given below.
Clear first-last flip-flop:
This command resets the first-last flip-flop in 8237 to zero. The first-last flip-flop selects the low or high byte during the read/write operation of the address and count registers of the channels. If the first-last flip-flop is zero (i.e., reset) then the low byte can be read/written. If it is one (i.e., set) then the high byte can be read/written. After every read/write operation, the first-last flip-flop automatically toggles.
This command is used as software RESET. The functions performed by this command are the same as that of hardware RESET. During RESET all internal registers and first-last flip-flop are cleared and all the mask bits of the channels are set.
Clear Mask Register:
This command is used to clear the mask bits of the DMA channels in order to enable all four DMA channels.