Line | |
---|
1 | ! htonX(), ntohX() - Host to network byte order conversion
|
---|
2 | ! Author: Kees J. Bot
|
---|
3 | ! 7 Jan 1997
|
---|
4 | !
|
---|
5 | ! This is a little endian 8086, so we swap bytes to/from the big endian network
|
---|
6 | ! order. The normal <net/hton.h> macros are not used, they give lousy code.
|
---|
7 |
|
---|
8 | .text
|
---|
9 | .define _htons, _ntohs
|
---|
10 | _htons:
|
---|
11 | _ntohs:
|
---|
12 | mov bx, sp
|
---|
13 | movb ah, 2(bx) ! Load bytes into ax in reverse order
|
---|
14 | movb al, 3(bx)
|
---|
15 | ret
|
---|
16 |
|
---|
17 | .define _htonl, _ntohl
|
---|
18 | _htonl:
|
---|
19 | _ntohl:
|
---|
20 | mov bx, sp
|
---|
21 | movb dh, 2(bx) ! Load bytes into dx:ax in reverse order
|
---|
22 | movb dl, 3(bx)
|
---|
23 | movb ah, 4(bx)
|
---|
24 | movb al, 5(bx)
|
---|
25 | ret
|
---|
Note:
See
TracBrowser
for help on using the repository browser.