source: trunk/minix/lib/i86/misc/hton86.s@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 561 bytes
RevLine 
[9]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.