summaryrefslogtreecommitdiff
path: root/core/macros.inc
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-05-29 15:11:38 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-05-29 15:11:38 -0700
commitb536209dfb7bd50c37061735fe10d2c19a97d26d (patch)
tree9d8ca6882fc5d9721fb0efea1abfd6dc09886814 /core/macros.inc
parent3ec40a0119587f63411475c76c69f9db24c7598e (diff)
downloadsyslinux-b536209dfb7bd50c37061735fe10d2c19a97d26d.tar.gz
Move files out of root into core, dos, and utils
Move source files out of the root directory; the root is a mess and has become virtually unmaintainable. The Syslinux core now lives in core/; the Linux and generic utilities has moved into utils/, and copybs.com has moved into dos/; it had to go somewhere, and it seemed as good a place as any.
Diffstat (limited to 'core/macros.inc')
-rw-r--r--core/macros.inc110
1 files changed, 110 insertions, 0 deletions
diff --git a/core/macros.inc b/core/macros.inc
new file mode 100644
index 00000000..f5e2c924
--- /dev/null
+++ b/core/macros.inc
@@ -0,0 +1,110 @@
+;; -----------------------------------------------------------------------
+;;
+;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+;; Boston MA 02111-1307, USA; either version 2 of the License, or
+;; (at your option) any later version; incorporated herein by reference.
+;;
+;; -----------------------------------------------------------------------
+
+;;
+;; macros.inc
+;;
+;; Convenient macros
+;;
+
+%ifndef _MACROS_INC
+%define _MACROS_INC
+
+;
+; Identify the module we're compiling; the "correct" should be defined
+; in the module itself to 1
+;
+%ifndef IS_SYSLINUX
+%define IS_SYSLINUX 0
+%endif
+%ifndef IS_MDSLINUX
+%define IS_MDSLINUX 0
+%endif
+%ifndef IS_PXELINUX
+%define IS_PXELINUX 0
+%endif
+%ifndef IS_ISOLINUX
+%define IS_ISOLINUX 0
+%endif
+%ifndef IS_EXTLINUX
+%define IS_EXTLINUX 0
+%endif
+
+;
+; Macros similar to res[bwd], but which works in the code segment (after
+; section .text) or the data segment (section .data)
+;
+%macro zb 1.nolist
+ times %1 db 0
+%endmacro
+
+%macro zw 1.nolist
+ times %1 dw 0
+%endmacro
+
+%macro zd 1.nolist
+ times %1 dd 0
+%endmacro
+
+;
+; Macro to emit an unsigned decimal number as a string
+;
+%macro asciidec 1.nolist
+%ifndef DEPEND ; Not safe for "depend"
+%if %1 >= 1000000000
+ db ((%1/1000000000) % 10) + '0'
+%endif
+%if %1 >= 100000000
+ db ((%1/100000000) % 10) + '0'
+%endif
+%if %1 >= 10000000
+ db ((%1/10000000) % 10) + '0'
+%endif
+%if %1 >= 1000000
+ db ((%1/1000000) % 10) + '0'
+%endif
+%if %1 >= 100000
+ db ((%1/100000) % 10) + '0'
+%endif
+%if %1 >= 10000
+ db ((%1/10000) % 10) + '0'
+%endif
+%if %1 >= 1000
+ db ((%1/1000) % 10) + '0'
+%endif
+%if %1 >= 100
+ db ((%1/100) % 10) + '0'
+%endif
+%if %1 >= 10
+ db ((%1/10) % 10) + '0'
+%endif
+ db (%1 % 10) + '0'
+%endif
+%endmacro
+
+;
+; Macros for network byte order of constants
+;
+%define htons(x) ( ( ((x) & 0FFh) << 8 ) + ( ((x) & 0FF00h) >> 8 ) )
+%define ntohs(x) htons(x)
+%define htonl(x) ( ( ((x) & 0FFh) << 24) + ( ((x) & 0FF00h) << 8 ) + ( ((x) & 0FF0000h) >> 8 ) + ( ((x) & 0FF000000h) >> 24) )
+%define ntohl(x) htonl(x)
+
+;
+; ASCII
+;
+CR equ 13 ; Carriage Return
+LF equ 10 ; Line Feed
+FF equ 12 ; Form Feed
+BS equ 8 ; Backspace
+
+%endif ; _MACROS_INC