emailler/docs/ip65_eth_s.html

114 lines
4.9 KiB
HTML
Raw Normal View History

<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><link rel="stylesheet" type="text/css" href="ca65-doc-style.css"/></head><body><a href="ref_index.html"><h1>ip65 technical reference</h1></a><h1>File : ip65/eth.s</h1><pre> Common ethernet driver code (independant of host computer or ethernet chipset)
</pre><h2 id="functions">functions</h2><table><tr><th>function</th><th>description</th></tr><tr><td id="eth_set_broadcast_dest">eth_set_broadcast_dest</td><td><pre>set the destination address in the packet under construction to be the ethernet
broadcast address (FF:FF:FF:FF:FF:FF)
inputs:
eth_outp: buffer in which outbound ethernet packet is being constructed
outputs: none </pre></td></tr><tr><td id="eth_set_my_mac_src">eth_set_my_mac_src</td><td><pre>set the source address in the packet under construction to be local mac address
inputs:
eth_outp: buffer in which outbound ethernet packet is being constructed
outputs: none </pre></td></tr><tr><td id="eth_set_proto">eth_set_proto</td><td><pre>set the 'protocol' field in the packet under construction
inputs:
A = protocol number (per 'eth_proto_*' constants)
outputs: none </pre></td></tr></table><h2 id="variables">variables</h2><table><tr><th>variable</th><th>description</th><th>size (bytes)</th></tr><tr><td id="eth_inp">eth_inp</td><td> space for input packet </td><td>1518</td></tr><tr><td id="eth_inp_len">eth_inp_len</td><td> input packet length </td><td>2</td></tr><tr><td id="eth_outp">eth_outp</td><td> space for output packet </td><td>1518</td></tr><tr><td id="eth_outp_len">eth_outp_len</td><td> output packet length </td><td>2</td></tr></table><h2 id="constants">constants</h2><table><tr><th>constants</th><th>description</th><th>value</th></tr><tr><td id="eth_data">eth_data</td><td> offset of packet data in ethernet packet </td><td>14 </td></tr><tr><td id="eth_dest">eth_dest</td><td> offset of destination address in ethernet packet </td><td>0 </td></tr><tr><td id="eth_proto_arp">eth_proto_arp</td><td></td><td>6
</td></tr><tr><td id="eth_proto_ip">eth_proto_ip</td><td> protocols </td><td>0
</td></tr><tr><td id="eth_src">eth_src</td><td> offset of source address in ethernet packet </td><td>6 </td></tr><tr><td id="eth_type">eth_type</td><td> offset of packet type in ethernet packet </td><td>12 </td></tr></table><h2>implementation</h2><pre id="code">; Common ethernet driver code (independant of host computer or ethernet chipset)
.include "../inc/common.i"
.export eth_set_broadcast_dest
.export eth_set_my_mac_src
.export eth_set_proto
.exportzp eth_proto_ip
.exportzp eth_proto_arp
.exportzp eth_dest
.exportzp eth_src
.exportzp eth_type
.exportzp eth_data
.export eth_outp
.export eth_outp_len
.export eth_inp
.export eth_inp_len
.import cfg_mac
.bss
; input and output buffers
eth_inp_len: .res 2 ; input packet length
eth_inp: .res 1518 ; space for input packet
eth_outp_len: .res 2 ; output packet length
eth_outp: .res 1518 ; space for output packet
; ethernet packet offsets
eth_dest = 0 ; offset of destination address in ethernet packet
eth_src = 6 ; offset of source address in ethernet packet
eth_type = 12 ; offset of packet type in ethernet packet
eth_data = 14 ; offset of packet data in ethernet packet
; protocols
eth_proto_ip = 0
eth_proto_arp = 6
.code
;set the destination address in the packet under construction to be the ethernet
;broadcast address (FF:FF:FF:FF:FF:FF)
;inputs:
; eth_outp: buffer in which outbound ethernet packet is being constructed
;outputs: none
eth_set_broadcast_dest:
ldx #5
lda #$ff
: sta eth_outp,x
dex
bpl :-
rts
;set the source address in the packet under construction to be local mac address
;inputs:
; eth_outp: buffer in which outbound ethernet packet is being constructed
;outputs: none
eth_set_my_mac_src:
ldx #5
: lda cfg_mac,x
sta eth_outp + 6,x
dex
bpl :-
rts
;set the 'protocol' field in the packet under construction
;inputs:
; A = protocol number (per 'eth_proto_*' constants)
;outputs: none
eth_set_proto:
sta eth_outp + eth_type + 1
lda #8
sta eth_outp + eth_type
rts
;-- LICENSE FOR eth.s --
; The contents of this file are subject to the Mozilla Public License
; Version 1.1 (the "License"); you may not use this file except in
; compliance with the License. You may obtain a copy of the License at
; http://www.mozilla.org/MPL/
;
; Software distributed under the License is distributed on an "AS IS"
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
; License for the specific language governing rights and limitations
; under the License.
;
; The Original Code is ip65.
;
; The Initial Developer of the Original Code is Per Olofsson,
; MagerValp@gmail.com.
; Portions created by the Initial Developer are Copyright (C) 2009
; Per Olofsson. All Rights Reserved.
; -- LICENSE END --
</pre></body></html>