BORG for a 68000 SBC - Device Control Block

1. Device Control Block

In a DCB, the first 8 bytes are reserved for the chain header. Following that are 8 bytes for the device name, and fields for the device hardware address, the IOB being worked on by the device at that moment, and then two addresses of routines to start and stop I/O on the device. Fields following that may be flexible and vary between devices.

1.1 Static device list

The following is the static list of devices for my build of BORG:

;
devlists:      dc.l      serialadcb               ; Static list of devices
               dc.l      serialbdcb
devliste:

Each entry corresponds to a DCB that must also be included (see example below). Just include the new DCB somewhere, and add a line in the device list.

1.2 DCB layout

In 68000 assembler, the DCB for a serial device looks like this:

;
;
serialadcb:    dc.l      0,0                      ; Device chain header
               dc.b      "SerialA "               ; Device name
               dc.l      m68681                   ; Device hardware address
               dc.l      0                        ; IOB being worked on by this device
               dc.l      startserial              ; Starts serial I/O
               dc.l      stopserial               ; Stops serial I/O
               dc.b      $01                      ; Mask to start transmit
               dc.b      $fe                      ; Mask to stop transmit
               dc.b      $02                      ; Mask to start receive
               dc.b      $fd                      ; Mask to stop receive
               dc.l      offseta                  ; Offset for port-A regs

1.3 DCB field offsets

The following defined offsets may be used to refer to fields within the DCB.

;
; Device Control Block (DCB) offsets
;
; Required items first
;
devname:       equ       8                        ; Device name
devaddr:       equ       16                       ; Hardware address of device
devioblk:      equ       20                       ; IOB being worked on by this device
devstart:      equ       24                       ; Address of routine to start I/O
devstop:       equ       28                       ; Address of routine to stop I/O
;
; Device-specific items follow
;
devstartxmsk:  equ       32                       ; Mask for starting xmit
devstopxmsk:   equ       33                       ; Mask for stopping xmit
devstartrmsk:  equ       34                       ; Mask for starting rcv
devstoprmsk:   equ       35                       ; Mask for stopping rcv
devseroffset:  equ       36                       ; Offset for channel A/B registers

The required items must be present in any DCB. The optional items which follow will vary between different devices.