1 ;; -----------------------------------------------------------------------
3 ;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
5 ;; This program is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ;; Boston MA 02111-1307, USA; either version 2 of the License, or
9 ;; (at your option) any later version; incorporated herein by reference.
11 ;; -----------------------------------------------------------------------
23 ; Identify the module we're compiling; the "correct" should be defined
24 ; in the module itself to 1
43 ; Macros similar to res[bwd], but which works in the code segment (after
44 ; section .text) or the data segment (section .data)
59 ; Macro to emit an unsigned decimal number as a string
61 %macro asciidec 1.nolist
62 %ifndef DEPEND ; Not safe for "depend"
64 db ((%1/1000000000) % 10) + '0'
67 db ((%1/100000000) % 10) + '0'
70 db ((%1/10000000) % 10) + '0'
73 db ((%1/1000000) % 10) + '0'
76 db ((%1/100000) % 10) + '0'
79 db ((%1/10000) % 10) + '0'
82 db ((%1/1000) % 10) + '0'
85 db ((%1/100) % 10) + '0'
88 db ((%1/10) % 10) + '0'
95 ; Macros for network byte order of constants
97 %define htons(x) ( ( ((x) & 0FFh) << 8 ) + ( ((x) & 0FF00h) >> 8 ) )
98 %define ntohs(x) htons(x)
99 %define htonl(x) ( ( ((x) & 0FFh) << 24) + ( ((x) & 0FF00h) << 8 ) + ( ((x) & 0FF0000h) >> 8 ) + ( ((x) & 0FF000000h) >> 24) )
100 %define ntohl(x) htonl(x)
105 CR equ 13 ; Carriage Return
106 LF equ 10 ; Line Feed
107 FF equ 12 ; Form Feed