htonl/s: Z80 implementation
authorAlan Cox <alan@linux.intel.com>
Fri, 25 Mar 2016 17:38:28 +0000 (17:38 +0000)
committerAlan Cox <alan@linux.intel.com>
Fri, 25 Mar 2016 17:38:28 +0000 (17:38 +0000)
Library/libs/htonl-z80.s [new file with mode: 0644]
Library/libs/htons-z80.s [new file with mode: 0644]

diff --git a/Library/libs/htonl-z80.s b/Library/libs/htonl-z80.s
new file mode 100644 (file)
index 0000000..8d47d33
--- /dev/null
@@ -0,0 +1,21 @@
+;
+;      SDCC makes a bit of a mess of this so do it by hand
+;
+               .area _CODE
+
+               .globl _htonl
+
+_htonl:
+       pop bc
+       pop hl
+       pop de
+       push de
+       push hl
+       push bc
+       ld a,l
+       ld l,d
+       ld d,a
+       ld a,h
+       ld h,e
+       ld e,a
+       ret
diff --git a/Library/libs/htons-z80.s b/Library/libs/htons-z80.s
new file mode 100644 (file)
index 0000000..e162f29
--- /dev/null
@@ -0,0 +1,16 @@
+;
+;      SDCC makes a bit of a mess of this so do it by hand
+;
+               .area _CODE
+
+               .globl _htons
+
+_htons:
+       pop de
+       pop hl
+       push hl
+       push de
+       ld a,h
+       ld h,l
+       ld l,a
+       ret