# Ethernet com link

This unit implements an Ethernet [com/link] that primarily deals with ethernet
frames:

6b Destination MAC
6b Source MAC
2b Ethertype or payload size
.. Payload

Optional 802.1Q VLAN tagging (Ethertype $8100) is not handled yet.

## API

### EtherLink struct

extends Link struct EtherLink
  field macptr
  method rxbuf ( link -- ?a u-or-0 )
  method txbuf ( link -- a u )
endstruct

macptr  Pointer to the MAC address of this ethernet link

rxbuf ( link -- ?a u-or-0 )
  Check for an incoming frame and yield its range if there is one. Otherwise,
  u=0 and a is absent.

txbuf ( link -- a u )
  Find a free outbound buffer and yield its range. As per [com/link]
  specifications, it must be at least $200 bytes in size.

### ivalmap of an ethernet frame

This ivalmap points to [com/link]'s active frame.

  $00 REF dstmac
  $06 REF srcmac
  $0c BE2 ethertype

### Words

.mac ( a -- )
  Print a MAC address living at "a".

.ether ( -- )
  Pretty-print the active ethernet frame

macmove ( src dst -- )
  Copy MAC address from src to dst.

newetherlink ( sendframext txbufxt rxbufxt macptr -- link )
  Create a new [com/link] from the specified method XTs as well as a pointer to
  this link's MAC address.

  This unit takes care of implementing "readframe" and "beginframe" and
  "replytoframe".
