From 5427dee30dc21c1c97fb9a59299d2e452110635a Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Thu, 9 Nov 2017 21:48:08 +0100
Subject: [PATCH] Added C interface to SNTP function.
---
ip65/Makefile | 1 +
ip65/sntp_c.s | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+)
create mode 100644 ip65/sntp_c.s
diff --git a/ip65/Makefile b/ip65/Makefile
index 3ffe3b8..7e6dd35 100644
--- a/ip65/Makefile
+++ b/ip65/Makefile
@@ -35,6 +35,7 @@ IP65OBJS=\
output_buffer.o \
parser.o \
sntp.o \
+ sntp_c.o \
string_utils.o \
udp.o \
udp_c.o \
diff --git a/ip65/sntp_c.s b/ip65/sntp_c.s
new file mode 100644
index 0000000..16ea9eb
--- /dev/null
+++ b/ip65/sntp_c.s
@@ -0,0 +1,26 @@
+.include "../inc/common.i"
+
+.export _sntp_get_time
+
+.import sntp_get_time
+.import sntp_ip
+.import sntp_utc_timestamp
+
+.importzp sreg
+
+_sntp_get_time:
+ stax sntp_ip
+ ldax sreg
+ stax sntp_ip+2
+ jsr sntp_get_time
+ bcs error
+ ldax sntp_utc_timestamp+2
+ stax sreg
+ ldax sntp_utc_timestamp
+ rts
+
+error:
+ ldx #$00
+ txa
+ stax sreg
+ rts