emailler/libnet/libnet.s

96 lines
1.9 KiB
ArmAsm
Raw Normal View History

2013-12-13 21:24:03 +00:00
.export _libnet_init
.export _libnet_get_config
.export _libnet_MAC
2013-12-13 21:24:03 +00:00
.import cfg_init
.import cfg_ip
.import copymem
.import ip65_init
.import dhcp_init
.import ip65_error
.import cfg_mac_default
.import cfg_mac
.import cfg_size
_libnet_MAC = cfg_mac_default
2013-12-13 21:24:03 +00:00
; load A/X macro
.macro ldax arg
.if (.match (.left (1, arg), #)) ; immediate mode
lda #<(.right (.tcount (arg)-1, arg))
ldx #>(.right (.tcount (arg)-1, arg))
.else ; assume absolute or zero page
lda arg
ldx 1+(arg)
2013-12-13 21:24:03 +00:00
.endif
.endmacro
; store A/X macro
.macro stax arg
sta arg
stx 1+(arg)
.endmacro
2013-12-13 21:24:03 +00:00
NO_ERROR = $00
2013-12-13 21:24:03 +00:00
.importzp copy_src
.importzp copy_dest
2013-12-13 21:24:03 +00:00
.code
2013-12-13 21:24:03 +00:00
_libnet_init:
sta copy_src
stx copy_src+1
beq @dhcp_request
ldax #cfg_ip
stax copy_dest
ldax #$10 ; 4 items of config data
jsr copymem
jsr ip65_init
@check_error:
bcc @ok
lda ip65_error
rts
2013-12-13 21:24:03 +00:00
@ok:
lda #NO_ERROR
rts
2013-12-13 21:24:03 +00:00
@dhcp_request:
jsr ip65_init
jsr dhcp_init
jmp @check_error
2013-12-13 21:24:03 +00:00
_libnet_get_config:
stax copy_dest
ldax #cfg_ip
stax copy_src
ldax #$10 ; 4 items of config data
jmp copymem
2013-12-13 21:24:03 +00:00
.bss
2013-12-13 21:24:03 +00:00
tmp_ax: .res 2
; -- LICENSE FOR libnet.s --
2013-12-13 21:24:03 +00:00
; 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/
;
2013-12-13 21:24:03 +00:00
; 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.
;
2013-12-13 21:24:03 +00:00
; The Original Code is libnet.
;
2013-12-13 21:24:03 +00:00
; The Initial Developer of the Original Code is Jonno Downes,
; jonno@jamtronix.com.
; Portions created by the Initial Developer are Copyright (C) 2012
; Jonno DOwnes. All Rights Reserved.
2013-12-13 21:24:03 +00:00
; -- LICENSE END --