📄 apnasm.mac
字号:
;;
;; aPLib compression library - the smaller the better :)
;;
;; NASM assembler macro definitions 2001.09.04
;;
;; Copyright (c) 1998-2002 by Joergen Ibsen / Jibz
;; All Rights Reserved
;;
; define _ELF_ for ELF32 object files
; define _OBJ_ for OMF object files
; define _OBJ_ and _DLL_ for OMF object files for a dll (stdcall)
%ifdef _DLL_
%ifndef _OBJ_
%error "_DLL_ needs _OBJ_ defined!"
%endif
%endif
; --- define ap- section names
;
; a number of linkers require omf objects where the section
; names are equal to those produces by tasm.
%ifdef _OBJ_
%define aptext _TEXT class=CODE public use32 align=4 FLAT
%define apdata _DATA class=DATA public use32 align=4
%define apbss _BSS class=BSS public use32 align=4 FLAT
group FLAT
group DGROUP _DATA
%else ; _OBJ_
%define aptext .text
%define apdata .data
%define apbss .bss
%endif ; _OBJ_
; --- define cglobal, cextern, cimport and cexport macros
;
; elf32 objects do not have the leading underscore, and the
; :function declaration is needed if producing shared objects.
%ifdef _ELF_
%macro cglobal 2-*
%rep %0/2
global %{1}:function
%rotate 2
%endrep
%endmacro
%define cextern extern
%define cimport import
%define cexport export
%else ; _ELF_
%ifdef _DLL_
%macro cglobal 2-*
%rep %0/2
global _%1
global _%1@%2
export _%1
export _%1@%2
%rotate 2
%endrep
%endmacro
%else
%macro cglobal 2-*
%rep %0/2
global _%1
%rotate 2
%endrep
%endmacro
%endif
%macro cextern 1-*
%rep %0
extern _%1
%define %1 _%1
%rotate 1
%endrep
%endmacro
%macro cimport 1-*
%rep %0
import _%1
%rotate 1
%endrep
%endmacro
%ifdef _DLL_
%macro cexport 1-*
%rep %0
export _%1
%rotate 1
%endrep
%endmacro
%else
%macro cexport 1-*
%endmacro
%endif
%endif ; _ELF_
; --- define aplabel, apadjust and apret macros
;
; we need special labels and stdcall calling convention when
; assembling for a dll.
%ifdef _ELF_
%macro aplabel 2
%1:
%endmacro
%macro apadjust 1
add esp, byte %1
%endmacro
%macro apret 1
ret
%endmacro
%else ; _ELF_
%ifdef _DLL_
%macro aplabel 2
_%1:
_%1@%2:
%endmacro
%macro apadjust 1
%endmacro
%macro apret 1
ret %1
%endmacro
%else
%macro aplabel 2
_%1:
%endmacro
%macro apadjust 1
add esp, byte %1
%endmacro
%macro apret 1
ret
%endmacro
%endif
%endif ; _ELF_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -