laag-nasm 2.13.03.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +57 -0
- data/LICENSE.txt +29 -0
- data/README.org +34 -0
- data/ext/laag/nasm/extconf.rb +16 -0
- data/laag-nasm.gemspec +20 -0
- data/lib/laag/nasm.rb +29 -0
- data/patches/Makefile.in.patch +13 -0
- data/vendor/repo.or.cz/nasm/.gitignore +102 -0
- data/vendor/repo.or.cz/nasm/AUTHORS +137 -0
- data/vendor/repo.or.cz/nasm/CHANGES +2 -0
- data/vendor/repo.or.cz/nasm/ChangeLog +2905 -0
- data/vendor/repo.or.cz/nasm/INSTALL +102 -0
- data/vendor/repo.or.cz/nasm/LICENSE +29 -0
- data/vendor/repo.or.cz/nasm/Makefile.in +855 -0
- data/vendor/repo.or.cz/nasm/Mkfiles/README +46 -0
- data/vendor/repo.or.cz/nasm/Mkfiles/msvc.mak +732 -0
- data/vendor/repo.or.cz/nasm/Mkfiles/openwcom.mak +706 -0
- data/vendor/repo.or.cz/nasm/README +23 -0
- data/vendor/repo.or.cz/nasm/SubmittingPatches +116 -0
- data/vendor/repo.or.cz/nasm/TODO +376 -0
- data/vendor/repo.or.cz/nasm/aclocal.m4 +139 -0
- data/vendor/repo.or.cz/nasm/asm/assemble.c +2957 -0
- data/vendor/repo.or.cz/nasm/asm/assemble.h +54 -0
- data/vendor/repo.or.cz/nasm/asm/directiv.c +566 -0
- data/vendor/repo.or.cz/nasm/asm/directiv.dat +92 -0
- data/vendor/repo.or.cz/nasm/asm/error.c +202 -0
- data/vendor/repo.or.cz/nasm/asm/eval.c +1014 -0
- data/vendor/repo.or.cz/nasm/asm/eval.h +49 -0
- data/vendor/repo.or.cz/nasm/asm/exprdump.c +79 -0
- data/vendor/repo.or.cz/nasm/asm/exprlib.c +200 -0
- data/vendor/repo.or.cz/nasm/asm/float.c +952 -0
- data/vendor/repo.or.cz/nasm/asm/float.h +54 -0
- data/vendor/repo.or.cz/nasm/asm/labels.c +540 -0
- data/vendor/repo.or.cz/nasm/asm/listing.c +346 -0
- data/vendor/repo.or.cz/nasm/asm/listing.h +113 -0
- data/vendor/repo.or.cz/nasm/asm/nasm.c +1855 -0
- data/vendor/repo.or.cz/nasm/asm/parser.c +1167 -0
- data/vendor/repo.or.cz/nasm/asm/parser.h +45 -0
- data/vendor/repo.or.cz/nasm/asm/phash.pl +109 -0
- data/vendor/repo.or.cz/nasm/asm/pptok.dat +96 -0
- data/vendor/repo.or.cz/nasm/asm/pptok.pl +271 -0
- data/vendor/repo.or.cz/nasm/asm/pragma.c +218 -0
- data/vendor/repo.or.cz/nasm/asm/preproc-nop.c +188 -0
- data/vendor/repo.or.cz/nasm/asm/preproc.c +5459 -0
- data/vendor/repo.or.cz/nasm/asm/preproc.h +55 -0
- data/vendor/repo.or.cz/nasm/asm/quote.c +479 -0
- data/vendor/repo.or.cz/nasm/asm/quote.h +44 -0
- data/vendor/repo.or.cz/nasm/asm/rdstrnum.c +68 -0
- data/vendor/repo.or.cz/nasm/asm/segalloc.c +51 -0
- data/vendor/repo.or.cz/nasm/asm/stdscan.c +345 -0
- data/vendor/repo.or.cz/nasm/asm/stdscan.h +49 -0
- data/vendor/repo.or.cz/nasm/asm/strfunc.c +359 -0
- data/vendor/repo.or.cz/nasm/asm/tokens.dat +135 -0
- data/vendor/repo.or.cz/nasm/asm/tokhash.pl +284 -0
- data/vendor/repo.or.cz/nasm/autogen.sh +9 -0
- data/vendor/repo.or.cz/nasm/common/common.c +122 -0
- data/vendor/repo.or.cz/nasm/config/msvc.h +192 -0
- data/vendor/repo.or.cz/nasm/config/unknown.h +51 -0
- data/vendor/repo.or.cz/nasm/config/watcom.h +74 -0
- data/vendor/repo.or.cz/nasm/configure.ac +253 -0
- data/vendor/repo.or.cz/nasm/contrib/MSVC6.txt +25 -0
- data/vendor/repo.or.cz/nasm/contrib/VSrules/nasm.README +16 -0
- data/vendor/repo.or.cz/nasm/contrib/VSrules/nasm.rules +79 -0
- data/vendor/repo.or.cz/nasm/disasm/disasm.c +1735 -0
- data/vendor/repo.or.cz/nasm/disasm/disasm.h +49 -0
- data/vendor/repo.or.cz/nasm/disasm/ndisasm.c +397 -0
- data/vendor/repo.or.cz/nasm/disasm/sync.c +132 -0
- data/vendor/repo.or.cz/nasm/disasm/sync.h +45 -0
- data/vendor/repo.or.cz/nasm/doc/Makefile.in +86 -0
- data/vendor/repo.or.cz/nasm/doc/README +20 -0
- data/vendor/repo.or.cz/nasm/doc/afmmetrics.ph +102 -0
- data/vendor/repo.or.cz/nasm/doc/changes.src +2588 -0
- data/vendor/repo.or.cz/nasm/doc/findfont.ph +180 -0
- data/vendor/repo.or.cz/nasm/doc/genps.pl +1294 -0
- data/vendor/repo.or.cz/nasm/doc/inslist.pl +108 -0
- data/vendor/repo.or.cz/nasm/doc/internal.doc +290 -0
- data/vendor/repo.or.cz/nasm/doc/local.css +1 -0
- data/vendor/repo.or.cz/nasm/doc/nasmdoc.css +150 -0
- data/vendor/repo.or.cz/nasm/doc/nasmdoc.src +8309 -0
- data/vendor/repo.or.cz/nasm/doc/nasmlogo.eps +212 -0
- data/vendor/repo.or.cz/nasm/doc/nasmlogw.png +0 -0
- data/vendor/repo.or.cz/nasm/doc/psfonts.ph +53 -0
- data/vendor/repo.or.cz/nasm/doc/pspdf.pl +98 -0
- data/vendor/repo.or.cz/nasm/doc/pswidth.ph +25 -0
- data/vendor/repo.or.cz/nasm/doc/rdsrc.pl +1111 -0
- data/vendor/repo.or.cz/nasm/doc/ttfmetrics.ph +63 -0
- data/vendor/repo.or.cz/nasm/headers/c +33 -0
- data/vendor/repo.or.cz/nasm/headers/doc +33 -0
- data/vendor/repo.or.cz/nasm/headers/mac +33 -0
- data/vendor/repo.or.cz/nasm/headers/perl +33 -0
- data/vendor/repo.or.cz/nasm/include/compiler.h +277 -0
- data/vendor/repo.or.cz/nasm/include/disp8.h +45 -0
- data/vendor/repo.or.cz/nasm/include/error.h +135 -0
- data/vendor/repo.or.cz/nasm/include/hashtbl.h +85 -0
- data/vendor/repo.or.cz/nasm/include/iflag.h +173 -0
- data/vendor/repo.or.cz/nasm/include/insns.h +76 -0
- data/vendor/repo.or.cz/nasm/include/labels.h +60 -0
- data/vendor/repo.or.cz/nasm/include/md5.h +21 -0
- data/vendor/repo.or.cz/nasm/include/nasm.h +1246 -0
- data/vendor/repo.or.cz/nasm/include/nasmint.h +219 -0
- data/vendor/repo.or.cz/nasm/include/nasmlib.h +524 -0
- data/vendor/repo.or.cz/nasm/include/opflags.h +271 -0
- data/vendor/repo.or.cz/nasm/include/perfhash.h +52 -0
- data/vendor/repo.or.cz/nasm/include/raa.h +46 -0
- data/vendor/repo.or.cz/nasm/include/rbtree.h +51 -0
- data/vendor/repo.or.cz/nasm/include/rdoff.h +169 -0
- data/vendor/repo.or.cz/nasm/include/saa.h +94 -0
- data/vendor/repo.or.cz/nasm/include/strlist.h +55 -0
- data/vendor/repo.or.cz/nasm/include/tables.h +70 -0
- data/vendor/repo.or.cz/nasm/include/ver.h +47 -0
- data/vendor/repo.or.cz/nasm/install-sh +250 -0
- data/vendor/repo.or.cz/nasm/macros/altreg.mac +107 -0
- data/vendor/repo.or.cz/nasm/macros/fp.mac +54 -0
- data/vendor/repo.or.cz/nasm/macros/ifunc.mac +48 -0
- data/vendor/repo.or.cz/nasm/macros/macros.pl +294 -0
- data/vendor/repo.or.cz/nasm/macros/smartalign.mac +189 -0
- data/vendor/repo.or.cz/nasm/macros/standard.mac +226 -0
- data/vendor/repo.or.cz/nasm/misc/Doxyfile +752 -0
- data/vendor/repo.or.cz/nasm/misc/Nindent +18 -0
- data/vendor/repo.or.cz/nasm/misc/README +2 -0
- data/vendor/repo.or.cz/nasm/misc/c16.mac +82 -0
- data/vendor/repo.or.cz/nasm/misc/c32.mac +52 -0
- data/vendor/repo.or.cz/nasm/misc/crcgen.c +44 -0
- data/vendor/repo.or.cz/nasm/misc/exebin.mac +57 -0
- data/vendor/repo.or.cz/nasm/misc/exebin2.mac +114 -0
- data/vendor/repo.or.cz/nasm/misc/fmtinsns.pl +40 -0
- data/vendor/repo.or.cz/nasm/misc/genfma.pl +63 -0
- data/vendor/repo.or.cz/nasm/misc/hints.txt +26 -0
- data/vendor/repo.or.cz/nasm/misc/magic +6 -0
- data/vendor/repo.or.cz/nasm/misc/myC32.mac +121 -0
- data/vendor/repo.or.cz/nasm/misc/nasm.sl +320 -0
- data/vendor/repo.or.cz/nasm/misc/nasmstab +296 -0
- data/vendor/repo.or.cz/nasm/misc/omfdump.c +517 -0
- data/vendor/repo.or.cz/nasm/misc/pmw.bat +9 -0
- data/vendor/repo.or.cz/nasm/misc/proc32.ash +441 -0
- data/vendor/repo.or.cz/nasm/misc/scitech.mac +1223 -0
- data/vendor/repo.or.cz/nasm/misc/xcrcgen.c +80 -0
- data/vendor/repo.or.cz/nasm/nasm.spec.in +83 -0
- data/vendor/repo.or.cz/nasm/nasm.spec.sed +3 -0
- data/vendor/repo.or.cz/nasm/nasm.txt +306 -0
- data/vendor/repo.or.cz/nasm/nasmlib/badenum.c +43 -0
- data/vendor/repo.or.cz/nasm/nasmlib/bsi.c +77 -0
- data/vendor/repo.or.cz/nasm/nasmlib/crc64.c +189 -0
- data/vendor/repo.or.cz/nasm/nasmlib/file.c +259 -0
- data/vendor/repo.or.cz/nasm/nasmlib/file.h +128 -0
- data/vendor/repo.or.cz/nasm/nasmlib/filename.c +69 -0
- data/vendor/repo.or.cz/nasm/nasmlib/hashtbl.c +232 -0
- data/vendor/repo.or.cz/nasm/nasmlib/ilog2.c +168 -0
- data/vendor/repo.or.cz/nasm/nasmlib/malloc.c +108 -0
- data/vendor/repo.or.cz/nasm/nasmlib/md5c.c +247 -0
- data/vendor/repo.or.cz/nasm/nasmlib/mmap.c +139 -0
- data/vendor/repo.or.cz/nasm/nasmlib/path.c +186 -0
- data/vendor/repo.or.cz/nasm/nasmlib/perfhash.c +55 -0
- data/vendor/repo.or.cz/nasm/nasmlib/perfhash.pl +362 -0
- data/vendor/repo.or.cz/nasm/nasmlib/raa.c +173 -0
- data/vendor/repo.or.cz/nasm/nasmlib/rbtree.c +119 -0
- data/vendor/repo.or.cz/nasm/nasmlib/readnum.c +172 -0
- data/vendor/repo.or.cz/nasm/nasmlib/realpath.c +135 -0
- data/vendor/repo.or.cz/nasm/nasmlib/saa.c +431 -0
- data/vendor/repo.or.cz/nasm/nasmlib/srcfile.c +128 -0
- data/vendor/repo.or.cz/nasm/nasmlib/string.c +242 -0
- data/vendor/repo.or.cz/nasm/nasmlib/strlist.c +100 -0
- data/vendor/repo.or.cz/nasm/nasmlib/ver.c +51 -0
- data/vendor/repo.or.cz/nasm/nasmlib/zerobuf.c +42 -0
- data/vendor/repo.or.cz/nasm/ndisasm.txt +94 -0
- data/vendor/repo.or.cz/nasm/nsis/NASMMultiUser.nsh +478 -0
- data/vendor/repo.or.cz/nasm/nsis/getpearch.pl +76 -0
- data/vendor/repo.or.cz/nasm/nsis/nasm-un.ico +0 -0
- data/vendor/repo.or.cz/nasm/nsis/nasm.ico +0 -0
- data/vendor/repo.or.cz/nasm/nsis/nasm.nsi +241 -0
- data/vendor/repo.or.cz/nasm/output/codeview.c +814 -0
- data/vendor/repo.or.cz/nasm/output/dwarf.h +566 -0
- data/vendor/repo.or.cz/nasm/output/elf.h +537 -0
- data/vendor/repo.or.cz/nasm/output/legacy.c +112 -0
- data/vendor/repo.or.cz/nasm/output/nulldbg.c +93 -0
- data/vendor/repo.or.cz/nasm/output/nullout.c +51 -0
- data/vendor/repo.or.cz/nasm/output/outaout.c +954 -0
- data/vendor/repo.or.cz/nasm/output/outaout.mac +37 -0
- data/vendor/repo.or.cz/nasm/output/outas86.c +650 -0
- data/vendor/repo.or.cz/nasm/output/outas86.mac +37 -0
- data/vendor/repo.or.cz/nasm/output/outbin.c +1713 -0
- data/vendor/repo.or.cz/nasm/output/outbin.mac +40 -0
- data/vendor/repo.or.cz/nasm/output/outcoff.c +1242 -0
- data/vendor/repo.or.cz/nasm/output/outcoff.mac +43 -0
- data/vendor/repo.or.cz/nasm/output/outdbg.c +425 -0
- data/vendor/repo.or.cz/nasm/output/outelf.c +3370 -0
- data/vendor/repo.or.cz/nasm/output/outelf.h +156 -0
- data/vendor/repo.or.cz/nasm/output/outelf.mac +41 -0
- data/vendor/repo.or.cz/nasm/output/outform.c +120 -0
- data/vendor/repo.or.cz/nasm/output/outform.h +379 -0
- data/vendor/repo.or.cz/nasm/output/outieee.c +1528 -0
- data/vendor/repo.or.cz/nasm/output/outlib.c +58 -0
- data/vendor/repo.or.cz/nasm/output/outlib.h +63 -0
- data/vendor/repo.or.cz/nasm/output/outmacho.c +2387 -0
- data/vendor/repo.or.cz/nasm/output/outmacho.mac +49 -0
- data/vendor/repo.or.cz/nasm/output/outobj.c +2725 -0
- data/vendor/repo.or.cz/nasm/output/outobj.mac +49 -0
- data/vendor/repo.or.cz/nasm/output/outrdf.mac +40 -0
- data/vendor/repo.or.cz/nasm/output/outrdf2.c +791 -0
- data/vendor/repo.or.cz/nasm/output/outrdf2.mac +43 -0
- data/vendor/repo.or.cz/nasm/output/pecoff.h +532 -0
- data/vendor/repo.or.cz/nasm/output/stabs.h +144 -0
- data/vendor/repo.or.cz/nasm/perllib/crc64.ph +158 -0
- data/vendor/repo.or.cz/nasm/perllib/gensv.pl +34 -0
- data/vendor/repo.or.cz/nasm/perllib/phash.ph +200 -0
- data/vendor/repo.or.cz/nasm/perllib/random_sv_vectors.ph +67 -0
- data/vendor/repo.or.cz/nasm/rdoff/README +185 -0
- data/vendor/repo.or.cz/nasm/rdoff/collectn.c +44 -0
- data/vendor/repo.or.cz/nasm/rdoff/collectn.h +22 -0
- data/vendor/repo.or.cz/nasm/rdoff/doc/Makefile +37 -0
- data/vendor/repo.or.cz/nasm/rdoff/doc/rdoff.texi +137 -0
- data/vendor/repo.or.cz/nasm/rdoff/doc/v1-v2.txt +62 -0
- data/vendor/repo.or.cz/nasm/rdoff/hash.c +122 -0
- data/vendor/repo.or.cz/nasm/rdoff/hash.h +17 -0
- data/vendor/repo.or.cz/nasm/rdoff/ldrdf.1 +41 -0
- data/vendor/repo.or.cz/nasm/rdoff/ldrdf.c +1395 -0
- data/vendor/repo.or.cz/nasm/rdoff/ldsegs.h +59 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2bin.1 +65 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2bin.c +431 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2com.1 +1 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2ihx.1 +1 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2ith.1 +1 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2srec.1 +1 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdfdump.1 +24 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdfdump.c +347 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdflib.1 +39 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdflib.c +434 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdfload.c +213 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdfload.h +29 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdfutils.h +165 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdlar.c +492 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdlar.h +34 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdlib.c +290 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdlib.h +62 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdoff.c +621 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdx.1 +21 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdx.c +90 -0
- data/vendor/repo.or.cz/nasm/rdoff/segtab.c +172 -0
- data/vendor/repo.or.cz/nasm/rdoff/segtab.h +45 -0
- data/vendor/repo.or.cz/nasm/rdoff/symtab.c +159 -0
- data/vendor/repo.or.cz/nasm/rdoff/symtab.h +55 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/Makefile +10 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/makelib.sh +14 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdfseg.asm +20 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdfseg2.asm +12 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdftest1.asm +54 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdftest2.asm +33 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdtlib.asm +48 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdtmain.asm +47 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/testlib.asm +18 -0
- data/vendor/repo.or.cz/nasm/stdlib/snprintf.c +29 -0
- data/vendor/repo.or.cz/nasm/stdlib/strlcpy.c +51 -0
- data/vendor/repo.or.cz/nasm/stdlib/strnlen.c +46 -0
- data/vendor/repo.or.cz/nasm/stdlib/vsnprintf.c +51 -0
- data/vendor/repo.or.cz/nasm/test/Makefile +106 -0
- data/vendor/repo.or.cz/nasm/test/_file_.asm +5 -0
- data/vendor/repo.or.cz/nasm/test/_version.asm +2 -0
- data/vendor/repo.or.cz/nasm/test/a32offs.asm +9 -0
- data/vendor/repo.or.cz/nasm/test/absolute.asm +40 -0
- data/vendor/repo.or.cz/nasm/test/addr64x.asm +18 -0
- data/vendor/repo.or.cz/nasm/test/align13.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/align13s.asm +20 -0
- data/vendor/repo.or.cz/nasm/test/alonesym-obj.asm +166 -0
- data/vendor/repo.or.cz/nasm/test/andbyte.asm +15 -0
- data/vendor/repo.or.cz/nasm/test/aoutso.asm +99 -0
- data/vendor/repo.or.cz/nasm/test/aouttest.asm +86 -0
- data/vendor/repo.or.cz/nasm/test/aouttest.c +36 -0
- data/vendor/repo.or.cz/nasm/test/avx.asm +46 -0
- data/vendor/repo.or.cz/nasm/test/avx005.asm +529 -0
- data/vendor/repo.or.cz/nasm/test/avx2.asm +1608 -0
- data/vendor/repo.or.cz/nasm/test/avx512cd.asm +106 -0
- data/vendor/repo.or.cz/nasm/test/avx512er.asm +144 -0
- data/vendor/repo.or.cz/nasm/test/avx512f.asm +7000 -0
- data/vendor/repo.or.cz/nasm/test/avx512pf.asm +88 -0
- data/vendor/repo.or.cz/nasm/test/bcd.asm +23 -0
- data/vendor/repo.or.cz/nasm/test/binexe.asm +35 -0
- data/vendor/repo.or.cz/nasm/test/bintest.asm +59 -0
- data/vendor/repo.or.cz/nasm/test/bisect.sh +22 -0
- data/vendor/repo.or.cz/nasm/test/br1879590.asm +25 -0
- data/vendor/repo.or.cz/nasm/test/br2003451.asm +17 -0
- data/vendor/repo.or.cz/nasm/test/br2030823.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/br2148476.asm +221 -0
- data/vendor/repo.or.cz/nasm/test/br2222615.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/br2496848.asm +42 -0
- data/vendor/repo.or.cz/nasm/test/br3005117.asm +26 -0
- data/vendor/repo.or.cz/nasm/test/br3026808.asm +20 -0
- data/vendor/repo.or.cz/nasm/test/br3028880.asm +8 -0
- data/vendor/repo.or.cz/nasm/test/br3041451.asm +59 -0
- data/vendor/repo.or.cz/nasm/test/br3058845.asm +14 -0
- data/vendor/repo.or.cz/nasm/test/br3066383.asm +70 -0
- data/vendor/repo.or.cz/nasm/test/br3074517.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/br3092924.asm +25 -0
- data/vendor/repo.or.cz/nasm/test/br3104312.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/br3109604.asm +9 -0
- data/vendor/repo.or.cz/nasm/test/br3174983.asm +9 -0
- data/vendor/repo.or.cz/nasm/test/br3187743.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/br3189064.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/br3200749.asm +9 -0
- data/vendor/repo.or.cz/nasm/test/br3385573.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/br3392252.asm +43 -0
- data/vendor/repo.or.cz/nasm/test/br3392259.asm +8 -0
- data/vendor/repo.or.cz/nasm/test/br3392363.asm +4 -0
- data/vendor/repo.or.cz/nasm/test/br3392392.asm +16 -0
- data/vendor/repo.or.cz/nasm/test/br3392396.asm +5 -0
- data/vendor/repo.or.cz/nasm/test/br3392411.asm +22 -0
- data/vendor/repo.or.cz/nasm/test/br3392418.asm +3 -0
- data/vendor/repo.or.cz/nasm/test/br3392439.asm +25 -0
- data/vendor/repo.or.cz/nasm/test/br3392442.asm +6 -0
- data/vendor/repo.or.cz/nasm/test/br560575.asm +17 -0
- data/vendor/repo.or.cz/nasm/test/br560873.asm +27 -0
- data/vendor/repo.or.cz/nasm/test/br890790.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/br890790_i.asm +1 -0
- data/vendor/repo.or.cz/nasm/test/br978756.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/changed.asm +383 -0
- data/vendor/repo.or.cz/nasm/test/cofftest.asm +85 -0
- data/vendor/repo.or.cz/nasm/test/cofftest.c +35 -0
- data/vendor/repo.or.cz/nasm/test/crc32.asm +37 -0
- data/vendor/repo.or.cz/nasm/test/cv8struc.asm +14 -0
- data/vendor/repo.or.cz/nasm/test/dtbcd.asm +72 -0
- data/vendor/repo.or.cz/nasm/test/elf64so.asm +118 -0
- data/vendor/repo.or.cz/nasm/test/elfso.asm +100 -0
- data/vendor/repo.or.cz/nasm/test/elftest.asm +87 -0
- data/vendor/repo.or.cz/nasm/test/elftest.c +38 -0
- data/vendor/repo.or.cz/nasm/test/elftest64.c +43 -0
- data/vendor/repo.or.cz/nasm/test/elif.asm +39 -0
- data/vendor/repo.or.cz/nasm/test/expimp.asm +90 -0
- data/vendor/repo.or.cz/nasm/test/far64.asm +10 -0
- data/vendor/repo.or.cz/nasm/test/float.asm +186 -0
- data/vendor/repo.or.cz/nasm/test/float8.asm +135 -0
- data/vendor/repo.or.cz/nasm/test/floatb.asm +35 -0
- data/vendor/repo.or.cz/nasm/test/floatexp.asm +382 -0
- data/vendor/repo.or.cz/nasm/test/floatize.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/floattest.asm +28 -0
- data/vendor/repo.or.cz/nasm/test/floatx.asm +525 -0
- data/vendor/repo.or.cz/nasm/test/fpu.asm +127 -0
- data/vendor/repo.or.cz/nasm/test/fwdopt.asm +133 -0
- data/vendor/repo.or.cz/nasm/test/fwdoptpp.asm +150 -0
- data/vendor/repo.or.cz/nasm/test/gas2nasm.py +104 -0
- data/vendor/repo.or.cz/nasm/test/gather.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/gotoff64.asm +25 -0
- data/vendor/repo.or.cz/nasm/test/hexfp.asm +25 -0
- data/vendor/repo.or.cz/nasm/test/hle.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/ifelse.asm +46 -0
- data/vendor/repo.or.cz/nasm/test/ifenv.asm +31 -0
- data/vendor/repo.or.cz/nasm/test/ifmacro.asm +413 -0
- data/vendor/repo.or.cz/nasm/test/iftoken.asm +317 -0
- data/vendor/repo.or.cz/nasm/test/iftoken.pl +32 -0
- data/vendor/repo.or.cz/nasm/test/ilog2.asm +271 -0
- data/vendor/repo.or.cz/nasm/test/imacro.asm +8 -0
- data/vendor/repo.or.cz/nasm/test/imm.asm +23 -0
- data/vendor/repo.or.cz/nasm/test/imm64.asm +61 -0
- data/vendor/repo.or.cz/nasm/test/immwarn.asm +91 -0
- data/vendor/repo.or.cz/nasm/test/imul.asm +117 -0
- data/vendor/repo.or.cz/nasm/test/inc1.asm +6 -0
- data/vendor/repo.or.cz/nasm/test/inc2.asm +8 -0
- data/vendor/repo.or.cz/nasm/test/incbin.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/incbin.data +2 -0
- data/vendor/repo.or.cz/nasm/test/inctest.asm +15 -0
- data/vendor/repo.or.cz/nasm/test/insnlbl.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/invlpga.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/jmp64.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/lar_lsl.asm +124 -0
- data/vendor/repo.or.cz/nasm/test/larlsl.asm +23 -0
- data/vendor/repo.or.cz/nasm/test/lnxhello.asm +54 -0
- data/vendor/repo.or.cz/nasm/test/local.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/loopoffs.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/lwp.asm +213 -0
- data/vendor/repo.or.cz/nasm/test/macro-defaults.asm +64 -0
- data/vendor/repo.or.cz/nasm/test/macroerr.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/macroerr.inc +3 -0
- data/vendor/repo.or.cz/nasm/test/mmxsize.asm +38 -0
- data/vendor/repo.or.cz/nasm/test/movd.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/movd64.asm +15 -0
- data/vendor/repo.or.cz/nasm/test/movimm.asm +28 -0
- data/vendor/repo.or.cz/nasm/test/movnti.asm +10 -0
- data/vendor/repo.or.cz/nasm/test/mpx-64.asm +120 -0
- data/vendor/repo.or.cz/nasm/test/mpx.asm +89 -0
- data/vendor/repo.or.cz/nasm/test/multisection.asm +96 -0
- data/vendor/repo.or.cz/nasm/test/nasmformat.asm +17 -0
- data/vendor/repo.or.cz/nasm/test/new +9 -0
- data/vendor/repo.or.cz/nasm/test/newrdwr.asm +24 -0
- data/vendor/repo.or.cz/nasm/test/nop.asm +17 -0
- data/vendor/repo.or.cz/nasm/test/nullfile.asm +4 -0
- data/vendor/repo.or.cz/nasm/test/objexe.asm +30 -0
- data/vendor/repo.or.cz/nasm/test/objlink.c +33 -0
- data/vendor/repo.or.cz/nasm/test/objtest.asm +85 -0
- data/vendor/repo.or.cz/nasm/test/optimization.asm +104 -0
- data/vendor/repo.or.cz/nasm/test/org.asm +18 -0
- data/vendor/repo.or.cz/nasm/test/paste.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/pcrel.asm +52 -0
- data/vendor/repo.or.cz/nasm/test/perf/label.pl +18 -0
- data/vendor/repo.or.cz/nasm/test/perf/macro.pl +18 -0
- data/vendor/repo.or.cz/nasm/test/perf/token.pl +23 -0
- data/vendor/repo.or.cz/nasm/test/performtest.pl +192 -0
- data/vendor/repo.or.cz/nasm/test/pextrw.asm +3 -0
- data/vendor/repo.or.cz/nasm/test/pinsr16.asm +53 -0
- data/vendor/repo.or.cz/nasm/test/pinsr32.asm +53 -0
- data/vendor/repo.or.cz/nasm/test/pinsr64.asm +68 -0
- data/vendor/repo.or.cz/nasm/test/popcnt.asm +32 -0
- data/vendor/repo.or.cz/nasm/test/ppindirect.asm +42 -0
- data/vendor/repo.or.cz/nasm/test/pragma.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/prefix66.asm +28 -0
- data/vendor/repo.or.cz/nasm/test/ptr.asm +4 -0
- data/vendor/repo.or.cz/nasm/test/pushseg.asm +17 -0
- data/vendor/repo.or.cz/nasm/test/r13.asm +15 -0
- data/vendor/repo.or.cz/nasm/test/radix.asm +54 -0
- data/vendor/repo.or.cz/nasm/test/rdpid.asm +21 -0
- data/vendor/repo.or.cz/nasm/test/reldef.asm +57 -0
- data/vendor/repo.or.cz/nasm/test/relocs.asm +20 -0
- data/vendor/repo.or.cz/nasm/test/riprel.asm +5357 -0
- data/vendor/repo.or.cz/nasm/test/riprel.pl +29 -0
- data/vendor/repo.or.cz/nasm/test/riprel2.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/sha-64.asm +30 -0
- data/vendor/repo.or.cz/nasm/test/sha.asm +31 -0
- data/vendor/repo.or.cz/nasm/test/smartalign16.asm +36 -0
- data/vendor/repo.or.cz/nasm/test/smartalign32.asm +36 -0
- data/vendor/repo.or.cz/nasm/test/smartalign64.asm +36 -0
- data/vendor/repo.or.cz/nasm/test/splitea.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/sreg.asm +65 -0
- data/vendor/repo.or.cz/nasm/test/strlen.asm +5 -0
- data/vendor/repo.or.cz/nasm/test/struc.asm +33 -0
- data/vendor/repo.or.cz/nasm/test/test67.asm +38 -0
- data/vendor/repo.or.cz/nasm/test/testdos.asm +13 -0
- data/vendor/repo.or.cz/nasm/test/testnos3.asm +973 -0
- data/vendor/repo.or.cz/nasm/test/time.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/times.asm +21 -0
- data/vendor/repo.or.cz/nasm/test/timesneg.asm +3 -0
- data/vendor/repo.or.cz/nasm/test/tmap.nas +1447 -0
- data/vendor/repo.or.cz/nasm/test/uscore.asm +15 -0
- data/vendor/repo.or.cz/nasm/test/utf.asm +82 -0
- data/vendor/repo.or.cz/nasm/test/vaesenc.asm +22 -0
- data/vendor/repo.or.cz/nasm/test/vex.asm +9 -0
- data/vendor/repo.or.cz/nasm/test/vgather.asm +76 -0
- data/vendor/repo.or.cz/nasm/test/vmread.asm +26 -0
- data/vendor/repo.or.cz/nasm/test/weirdpaste.asm +29 -0
- data/vendor/repo.or.cz/nasm/test/xchg.asm +96 -0
- data/vendor/repo.or.cz/nasm/test/xcrypt.asm +24 -0
- data/vendor/repo.or.cz/nasm/test/xmm0.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/zerobyte.asm +22 -0
- data/vendor/repo.or.cz/nasm/tools/cleanfile +176 -0
- data/vendor/repo.or.cz/nasm/tools/cleanpatch +258 -0
- data/vendor/repo.or.cz/nasm/tools/mkdep.pl +261 -0
- data/vendor/repo.or.cz/nasm/tools/release +105 -0
- data/vendor/repo.or.cz/nasm/tools/syncfiles.pl +137 -0
- data/vendor/repo.or.cz/nasm/tools/tag-release +58 -0
- data/vendor/repo.or.cz/nasm/version +1 -0
- data/vendor/repo.or.cz/nasm/version.pl +189 -0
- data/vendor/repo.or.cz/nasm/x86/disp8.c +131 -0
- data/vendor/repo.or.cz/nasm/x86/insns-iflags.ph +280 -0
- data/vendor/repo.or.cz/nasm/x86/insns.dat +5371 -0
- data/vendor/repo.or.cz/nasm/x86/insns.pl +1043 -0
- data/vendor/repo.or.cz/nasm/x86/regs.dat +138 -0
- data/vendor/repo.or.cz/nasm/x86/regs.pl +204 -0
- metadata +520 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
rem some batch file to bind nasm and ndisasm with pmode/w
|
|
3
|
+
rem a mega cool dos extender for watcom done by tran
|
|
4
|
+
rem
|
|
5
|
+
rem max 8 megs, dpmi stack 256*16=4096, no banner
|
|
6
|
+
pmwlite.exe nasm.exe
|
|
7
|
+
pmwsetup.exe /X8388608 /P256 /B0 nasm.exe
|
|
8
|
+
pmwlite.exe ndisasm.exe
|
|
9
|
+
pmwsetup.exe /X8388608 /P256 /B0 ndisasm.exe
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
;--------=========xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=========--------
|
|
2
|
+
;
|
|
3
|
+
; Copyright (C) 1999 by Andrew Zabolotny
|
|
4
|
+
; Miscelaneous NASM macros that makes use of new preprocessor features
|
|
5
|
+
;
|
|
6
|
+
; This library is free software; you can redistribute it and/or
|
|
7
|
+
; modify it under the terms of the GNU Library General Public
|
|
8
|
+
; License as published by the Free Software Foundation; either
|
|
9
|
+
; version 2 of the License, or (at your option) any later version.
|
|
10
|
+
;
|
|
11
|
+
; This library is distributed in the hope that it will be useful,
|
|
12
|
+
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14
|
+
; Library General Public License for more details.
|
|
15
|
+
;
|
|
16
|
+
; You should have received a copy of the GNU Library General Public
|
|
17
|
+
; License along with this library; if not, write to the Free
|
|
18
|
+
; Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
19
|
+
;
|
|
20
|
+
;--------=========xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=========--------
|
|
21
|
+
|
|
22
|
+
; The macros in this file provides support for writing 32-bit C-callable
|
|
23
|
+
; NASM routines. For a short description of every macros see the
|
|
24
|
+
; corresponding comment before every one. Simple usage example:
|
|
25
|
+
;
|
|
26
|
+
; proc sin,1
|
|
27
|
+
; targ %$angle
|
|
28
|
+
; fld %$angle
|
|
29
|
+
; fsin
|
|
30
|
+
; endproc sin
|
|
31
|
+
|
|
32
|
+
%ifndef __PROC32_ASH__
|
|
33
|
+
%define __PROC32_ASH__
|
|
34
|
+
|
|
35
|
+
[WARNING -macro-selfref]
|
|
36
|
+
|
|
37
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
38
|
+
; Summary:
|
|
39
|
+
; Mangle a name to be compatible with the C compiler
|
|
40
|
+
; Arguments:
|
|
41
|
+
; The name
|
|
42
|
+
; Example:
|
|
43
|
+
; cname (my_func)
|
|
44
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
45
|
+
%ifdef EXTERNC_UNDERSCORE
|
|
46
|
+
%define cname(x) _ %+ x
|
|
47
|
+
%else
|
|
48
|
+
%define cname(x) x
|
|
49
|
+
%endif
|
|
50
|
+
|
|
51
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
52
|
+
; Summary:
|
|
53
|
+
; Import an external C procedure definition
|
|
54
|
+
; Arguments:
|
|
55
|
+
; The name of external C procedure
|
|
56
|
+
; Example:
|
|
57
|
+
; cextern printf
|
|
58
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
59
|
+
%macro cextern 1
|
|
60
|
+
%xdefine %1 cname(%1)
|
|
61
|
+
%ifidni __OUTPUT_FORMAT__,obj
|
|
62
|
+
extern %1:wrt FLAT
|
|
63
|
+
%else
|
|
64
|
+
extern %1
|
|
65
|
+
%endif
|
|
66
|
+
%endmacro
|
|
67
|
+
|
|
68
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
69
|
+
; Summary:
|
|
70
|
+
; Export an C procedure definition
|
|
71
|
+
; Arguments:
|
|
72
|
+
; The name of C procedure
|
|
73
|
+
; Example:
|
|
74
|
+
; cglobal my_printf
|
|
75
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
76
|
+
%macro cglobal 1
|
|
77
|
+
%xdefine %1 cname(%1)
|
|
78
|
+
global %1
|
|
79
|
+
%endmacro
|
|
80
|
+
|
|
81
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
82
|
+
; Summary:
|
|
83
|
+
; Misc macros to deal with PIC shared libraries
|
|
84
|
+
; Comment:
|
|
85
|
+
; Note that we have a different syntax for working with and without
|
|
86
|
+
; PIC shared libraries. In a PIC environment we should load first
|
|
87
|
+
; the address of the variable into a register and then work through
|
|
88
|
+
; that address, i.e: mov eax,myvar; mov [eax],1
|
|
89
|
+
; In a non-PIC environment we should directly write: mov myvar,1
|
|
90
|
+
; Example:
|
|
91
|
+
; extvar myvar
|
|
92
|
+
; GetGOT
|
|
93
|
+
; %ifdef PIC
|
|
94
|
+
; mov ebx,myvar ; get offset of myvar into ebx
|
|
95
|
+
; %else
|
|
96
|
+
; lea ebx,myvar
|
|
97
|
+
; %endif
|
|
98
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
99
|
+
%ifdef PIC
|
|
100
|
+
cextern _GLOBAL_OFFSET_TABLE_
|
|
101
|
+
%macro GetGOT 0
|
|
102
|
+
%ifdef .$proc.stkofs
|
|
103
|
+
%assign .$proc.stkofs .$proc.stkofs+4
|
|
104
|
+
%endif
|
|
105
|
+
call %$Get_GOT
|
|
106
|
+
%$Get_GOT:
|
|
107
|
+
pop ebx
|
|
108
|
+
add ebx,_GLOBAL_OFFSET_TABLE_ + $$ - %$Get_GOT wrt ..gotpc
|
|
109
|
+
%endmacro
|
|
110
|
+
%macro extvar 1
|
|
111
|
+
cextern %1
|
|
112
|
+
%xdefine %1 [ebx+%1 wrt ..got]
|
|
113
|
+
%endmacro
|
|
114
|
+
%else
|
|
115
|
+
%define GetGOT
|
|
116
|
+
%macro extvar 1
|
|
117
|
+
cextern %1
|
|
118
|
+
%endmacro
|
|
119
|
+
%endif
|
|
120
|
+
|
|
121
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
122
|
+
; Summary:
|
|
123
|
+
; Begin a procedure definition
|
|
124
|
+
; For performance reasons we don't use stack frame pointer EBP,
|
|
125
|
+
; instead we're using the [esp+xx] addressing. Because of this
|
|
126
|
+
; you should be careful when you work with stack pointer.
|
|
127
|
+
; The push/pop instructions are macros that are defined to
|
|
128
|
+
; deal correctly with these issues.
|
|
129
|
+
; Arguments:
|
|
130
|
+
; First argument - the procedure name
|
|
131
|
+
; Second optional argument - the number of bytes for local variables
|
|
132
|
+
; The following arguments could specify the registers that should be
|
|
133
|
+
; pushed at beginning of procedure and popped before exiting
|
|
134
|
+
; Example:
|
|
135
|
+
; proc MyTestProc
|
|
136
|
+
; proc MyTestProc,4,ebx,esi,edi
|
|
137
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
138
|
+
%macro proc 1-3+ 0
|
|
139
|
+
cglobal %1
|
|
140
|
+
%push %1
|
|
141
|
+
align 16
|
|
142
|
+
%1:
|
|
143
|
+
%xdefine %$proc.name %1
|
|
144
|
+
; total size of local arguments
|
|
145
|
+
%assign %$proc.locsize (%2+3) & 0xFFFC
|
|
146
|
+
; offset from esp to argument
|
|
147
|
+
%assign %$proc.argofs 4+%$proc.locsize
|
|
148
|
+
; additional offset to args (tracks push/pops)
|
|
149
|
+
%assign .$proc.stkofs 0
|
|
150
|
+
; offset from esp to local arguments
|
|
151
|
+
%assign %$proc.locofs 0
|
|
152
|
+
; Now push the registers that we should save
|
|
153
|
+
%define %$proc.save %3
|
|
154
|
+
%if %$proc.locsize != 0
|
|
155
|
+
sub esp,%$proc.locsize
|
|
156
|
+
%endif
|
|
157
|
+
push %$proc.save
|
|
158
|
+
%endmacro
|
|
159
|
+
|
|
160
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
161
|
+
; Summary:
|
|
162
|
+
; Declare an argument passed on stack
|
|
163
|
+
; This macro defines two additional macros:
|
|
164
|
+
; first (with the name given by first argument) - [esp+xx]
|
|
165
|
+
; second (with a underscore appended to first argument) - esp+xx
|
|
166
|
+
; Arguments:
|
|
167
|
+
; First argument defines the procedure argument name
|
|
168
|
+
; Second optional parameter defines the size of the argument
|
|
169
|
+
; Default value is 4 (a double word)
|
|
170
|
+
; Example:
|
|
171
|
+
; arg .my_float
|
|
172
|
+
; arg .my_double,8
|
|
173
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
174
|
+
%macro arg 1-2 4
|
|
175
|
+
%ifndef %$proc.argofs
|
|
176
|
+
%error "`arg' not in a proc context"
|
|
177
|
+
%else
|
|
178
|
+
; Trick: temporary undefine .$proc.stkofs so that it won't be expanded
|
|
179
|
+
%assign %%. .$proc.stkofs
|
|
180
|
+
%undef .$proc.stkofs
|
|
181
|
+
%xdefine %{1}_ esp+%$proc.argofs+.$proc.stkofs
|
|
182
|
+
%xdefine %1 [esp+%$proc.argofs+.$proc.stkofs]
|
|
183
|
+
%assign .$proc.stkofs %%.
|
|
184
|
+
%assign %$proc.argofs %2+%$proc.argofs
|
|
185
|
+
%endif
|
|
186
|
+
%endmacro
|
|
187
|
+
|
|
188
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
189
|
+
; Summary:
|
|
190
|
+
; Declare an local variable
|
|
191
|
+
; first (with the name given by first argument) - [esp+xx]
|
|
192
|
+
; second (with a slash prefixing the first argument) - esp+xx
|
|
193
|
+
; Arguments:
|
|
194
|
+
; First argument defines the procedure argument name
|
|
195
|
+
; Second optional parameter defines the size of the argument
|
|
196
|
+
; Default value is 4 (a double word)
|
|
197
|
+
; Example:
|
|
198
|
+
; loc .int_value
|
|
199
|
+
; loc .double_value,8
|
|
200
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
201
|
+
%macro loc 1-2 4
|
|
202
|
+
%ifndef %$proc.locofs
|
|
203
|
+
%error "`loc' not in a proc context"
|
|
204
|
+
%elif %$proc.locofs + %2 > %$proc.locsize
|
|
205
|
+
%error "local stack space exceeded"
|
|
206
|
+
%else
|
|
207
|
+
%assign %%. .$proc.stkofs
|
|
208
|
+
%undef .$proc.stkofs
|
|
209
|
+
%xdefine %{1}_ esp+%$proc.locofs+.$proc.stkofs
|
|
210
|
+
%xdefine %1 [esp+%$proc.locofs+.$proc.stkofs]
|
|
211
|
+
%assign .$proc.stkofs %%.
|
|
212
|
+
%assign %$proc.locofs %$proc.locofs+%2
|
|
213
|
+
%endif
|
|
214
|
+
%endmacro
|
|
215
|
+
|
|
216
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
217
|
+
; Summary:
|
|
218
|
+
; Get the type of given size into context-local variable %$type
|
|
219
|
+
; Arguments:
|
|
220
|
+
; Size of type we want (1,2,4,8 or 10)
|
|
221
|
+
; Example:
|
|
222
|
+
; type 4 ; gives "dword"
|
|
223
|
+
; type 10 ; gives "tword"
|
|
224
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
225
|
+
%macro type 1
|
|
226
|
+
%if %1 = 1
|
|
227
|
+
%define %$type byte
|
|
228
|
+
%elif %1 = 2
|
|
229
|
+
%define %$type word
|
|
230
|
+
%elif %1 = 4
|
|
231
|
+
%define %$type dword
|
|
232
|
+
%elif %1 = 8
|
|
233
|
+
%define %$type qword
|
|
234
|
+
%elif %1 = 10
|
|
235
|
+
%define %$type tword
|
|
236
|
+
%else
|
|
237
|
+
%define %$. %1
|
|
238
|
+
%error "unknown type for argument size %$."
|
|
239
|
+
%endif
|
|
240
|
+
%endmacro
|
|
241
|
+
|
|
242
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
243
|
+
; Summary:
|
|
244
|
+
; Same as `arg' but prepends "word", "dword" etc (typed arg)
|
|
245
|
+
; first (with the name given by first argument) - dword [esp+xx]
|
|
246
|
+
; second (with a slash prefixing the first argument) - esp+xx
|
|
247
|
+
; Arguments:
|
|
248
|
+
; Same as for `arg'
|
|
249
|
+
; Example:
|
|
250
|
+
; targ .my_float ; .my_float is now "dword [esp+xxx]"
|
|
251
|
+
; targ .my_double,8 ; .my_double is now "qword [esp+xxx]"
|
|
252
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
253
|
+
%macro targ 1-2 4
|
|
254
|
+
%ifndef %$proc.argofs
|
|
255
|
+
%error "`targ' not in a proc context"
|
|
256
|
+
%else
|
|
257
|
+
arg %1,%2
|
|
258
|
+
type %2
|
|
259
|
+
%assign %%. .$proc.stkofs
|
|
260
|
+
%undef .$proc.stkofs
|
|
261
|
+
%xdefine %1 %$type %1
|
|
262
|
+
%assign .$proc.stkofs %%.
|
|
263
|
+
%endif
|
|
264
|
+
%endmacro
|
|
265
|
+
|
|
266
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
267
|
+
; Summary:
|
|
268
|
+
; Same as `loc' but prepends "word", "dword" etc (typed loc)
|
|
269
|
+
; first (with the name given by first argument) - dword [esp+xx]
|
|
270
|
+
; second (with a slash prefixing the first argument) - esp+xx
|
|
271
|
+
; Arguments:
|
|
272
|
+
; Same as for `loc'
|
|
273
|
+
; Example:
|
|
274
|
+
; tloc int_value
|
|
275
|
+
; tloc double_value,8
|
|
276
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
277
|
+
%macro tloc 1-2 4
|
|
278
|
+
%ifndef %$proc.locofs
|
|
279
|
+
%error "`tloc' not in a proc context"
|
|
280
|
+
%else
|
|
281
|
+
loc %1,%2
|
|
282
|
+
type %2
|
|
283
|
+
%assign %%. .$proc.stkofs
|
|
284
|
+
%undef .$proc.stkofs
|
|
285
|
+
%xdefine %1 %$type %1
|
|
286
|
+
%assign .$proc.stkofs %%.
|
|
287
|
+
%endif
|
|
288
|
+
%endmacro
|
|
289
|
+
|
|
290
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
291
|
+
; Summary:
|
|
292
|
+
; Finish a procedure
|
|
293
|
+
; Gives an error if proc/endproc pairs mismatch
|
|
294
|
+
; Defines an label called __end_(procedure name)
|
|
295
|
+
; which is useful for calculating function size
|
|
296
|
+
; Arguments:
|
|
297
|
+
; (optional) The name of procedure
|
|
298
|
+
; Example:
|
|
299
|
+
; endproc MyTestProc
|
|
300
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
301
|
+
%push tmp ; trick: define a dummy context to avoid error in next line
|
|
302
|
+
%macro endproc 0-1 %$proc.name
|
|
303
|
+
%ifndef %$proc.argofs
|
|
304
|
+
%error "`endproc' not in a proc context"
|
|
305
|
+
%elifnidn %$proc.name,%1
|
|
306
|
+
%define %$. %1
|
|
307
|
+
%error "endproc names mismatch: expected `%$proc.name'"
|
|
308
|
+
%error "but got `%$.' instead"
|
|
309
|
+
%elif %$proc.locofs < %$proc.locsize
|
|
310
|
+
%error "unused local space declared (used %$proc.locofs, requested %$proc.locsize)"
|
|
311
|
+
%else
|
|
312
|
+
%$exit:
|
|
313
|
+
; Now pop the registers that we should restore on exit
|
|
314
|
+
pop %$proc.save
|
|
315
|
+
%if %$proc.locsize != 0
|
|
316
|
+
add esp,%$proc.locsize
|
|
317
|
+
%endif
|
|
318
|
+
ret
|
|
319
|
+
__end_%1:
|
|
320
|
+
%pop
|
|
321
|
+
%endif
|
|
322
|
+
%endmacro
|
|
323
|
+
%pop
|
|
324
|
+
|
|
325
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
326
|
+
; Summary:
|
|
327
|
+
; A replacement for "push" for use within procedures
|
|
328
|
+
; Arguments:
|
|
329
|
+
; any number of registers which will be push'ed successively
|
|
330
|
+
; Example:
|
|
331
|
+
; push eax,ebx,ecx,edx
|
|
332
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
333
|
+
%macro push 0-*
|
|
334
|
+
; dummy comment to avoid problems with "push" on the same line with a label
|
|
335
|
+
%rep %0
|
|
336
|
+
push %1
|
|
337
|
+
%rotate 1
|
|
338
|
+
%assign .$proc.stkofs .$proc.stkofs+4
|
|
339
|
+
%endrep
|
|
340
|
+
%endmacro
|
|
341
|
+
|
|
342
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
343
|
+
; Summary:
|
|
344
|
+
; A replacement for "pop" for use within procedures
|
|
345
|
+
; Arguments:
|
|
346
|
+
; any number of registers which will be pop'ed in reverse order
|
|
347
|
+
; Example:
|
|
348
|
+
; pop eax,ebx,ecx,edx
|
|
349
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
350
|
+
%macro pop 0-*
|
|
351
|
+
; dummy comment to avoid problems with "pop" on the same line with a label
|
|
352
|
+
%rep %0
|
|
353
|
+
%rotate -1
|
|
354
|
+
pop %1
|
|
355
|
+
%assign .$proc.stkofs .$proc.stkofs-4
|
|
356
|
+
%endrep
|
|
357
|
+
%endmacro
|
|
358
|
+
|
|
359
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
360
|
+
; Summary:
|
|
361
|
+
; Replacements for "pushfd" and "popfd" that takes care of esp
|
|
362
|
+
; Example:
|
|
363
|
+
; pushfd
|
|
364
|
+
; popfd
|
|
365
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
366
|
+
%macro pushfd 0
|
|
367
|
+
pushfd
|
|
368
|
+
%assign .$proc.stkofs .$proc.stkofs+4
|
|
369
|
+
%endmacro
|
|
370
|
+
%macro popfd 0
|
|
371
|
+
popfd
|
|
372
|
+
%assign .$proc.stkofs .$proc.stkofs-4
|
|
373
|
+
%endmacro
|
|
374
|
+
|
|
375
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
376
|
+
; Summary:
|
|
377
|
+
; Exit from current procedure (optionally on given condition)
|
|
378
|
+
; Arguments:
|
|
379
|
+
; Either none or a condition code
|
|
380
|
+
; Example:
|
|
381
|
+
; exit
|
|
382
|
+
; exit nz
|
|
383
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
384
|
+
%macro exit 0-1 mp
|
|
385
|
+
j%1 near %$exit
|
|
386
|
+
%endmacro
|
|
387
|
+
|
|
388
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
389
|
+
; Summary:
|
|
390
|
+
; start an conditional branch
|
|
391
|
+
; Arguments:
|
|
392
|
+
; A condition code
|
|
393
|
+
; second (optional) argument - "short" (by default - "near")
|
|
394
|
+
; Example:
|
|
395
|
+
; if nz
|
|
396
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
397
|
+
%macro if 1-2 near
|
|
398
|
+
; dummy comment to avoid problems with "if" on the same line with a label
|
|
399
|
+
%push if
|
|
400
|
+
j%-1 %2 %$elseif
|
|
401
|
+
%endmacro
|
|
402
|
+
|
|
403
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
404
|
+
; Summary:
|
|
405
|
+
; define the "else" branch of a conditional statement
|
|
406
|
+
; Arguments:
|
|
407
|
+
; optionaly: "short" if jmp to endif is less than 128 bytes away
|
|
408
|
+
; Example:
|
|
409
|
+
; else
|
|
410
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
411
|
+
%macro else 0-1
|
|
412
|
+
%ifnctx if
|
|
413
|
+
%error "`else' without matching `if'"
|
|
414
|
+
%else
|
|
415
|
+
jmp %1 %$endif
|
|
416
|
+
%$elseif:
|
|
417
|
+
%define %$elseif_defined
|
|
418
|
+
%endif
|
|
419
|
+
%endmacro
|
|
420
|
+
|
|
421
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
422
|
+
; Summary:
|
|
423
|
+
; Finish am conditional statement
|
|
424
|
+
; Arguments:
|
|
425
|
+
; none
|
|
426
|
+
; Example:
|
|
427
|
+
; endif
|
|
428
|
+
;-----======xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======-----
|
|
429
|
+
%macro endif 0
|
|
430
|
+
%ifnctx if
|
|
431
|
+
%error "`endif' without matching `if'"
|
|
432
|
+
%else
|
|
433
|
+
%ifndef %$elseif_defined
|
|
434
|
+
%$elseif:
|
|
435
|
+
%endif
|
|
436
|
+
%$endif:
|
|
437
|
+
%pop
|
|
438
|
+
%endif
|
|
439
|
+
%endmacro
|
|
440
|
+
|
|
441
|
+
%endif ; __PROC32_ASH__
|
|
@@ -0,0 +1,1223 @@
|
|
|
1
|
+
;****************************************************************************
|
|
2
|
+
;*
|
|
3
|
+
;* ========================================================================
|
|
4
|
+
;*
|
|
5
|
+
;* The contents of this file are subject to the SciTech MGL Public
|
|
6
|
+
;* License Version 1.0 (the "License"); you may not use this file
|
|
7
|
+
;* except in compliance with the License. You may obtain a copy of
|
|
8
|
+
;* the License at http://www.scitechsoft.com/mgl-license.txt
|
|
9
|
+
;*
|
|
10
|
+
;* Software distributed under the License is distributed on an
|
|
11
|
+
;* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
12
|
+
;* implied. See the License for the specific language governing
|
|
13
|
+
;* rights and limitations under the License.
|
|
14
|
+
;*
|
|
15
|
+
;* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
|
|
16
|
+
;*
|
|
17
|
+
;* The Initial Developer of the Original Code is SciTech Software, Inc.
|
|
18
|
+
;* All Rights Reserved.
|
|
19
|
+
;*
|
|
20
|
+
;* ========================================================================
|
|
21
|
+
;*
|
|
22
|
+
;* Language: NetWide Assembler (NASM) or Turbo Assembler (TASM)
|
|
23
|
+
;* Environment: Any Intel Environment
|
|
24
|
+
;*
|
|
25
|
+
;* Description: Macros to provide memory model independant assembly language
|
|
26
|
+
;* module for C programming. Supports the large and flat memory
|
|
27
|
+
;* models.
|
|
28
|
+
;*
|
|
29
|
+
;* The defines that you should use when assembling modules that
|
|
30
|
+
;* use this macro package are:
|
|
31
|
+
;*
|
|
32
|
+
;* __LARGE__ Assemble for 16-bit large model
|
|
33
|
+
;* __FLAT__ Assemble for 32-bit FLAT memory model
|
|
34
|
+
;* __NOU__ No underscore for all external C labels
|
|
35
|
+
;* __NOU_VAR__ No underscore for global variables only
|
|
36
|
+
;*
|
|
37
|
+
;* The default settings are for 16-bit large memory model with
|
|
38
|
+
;* leading underscores for symbol names.
|
|
39
|
+
;*
|
|
40
|
+
;* The main intent of the macro file is to enable programmers
|
|
41
|
+
;* to write _one_ set of source that can be assembled to run
|
|
42
|
+
;* in either 16 bit real and protected modes or 32 bit
|
|
43
|
+
;* protected mode without the need to riddle the code with
|
|
44
|
+
;* 'if flatmodel' style conditional assembly (it is still there
|
|
45
|
+
;* but nicely hidden by a macro layer that enhances the
|
|
46
|
+
;* readability and understandability of the resulting code).
|
|
47
|
+
;*
|
|
48
|
+
;****************************************************************************
|
|
49
|
+
|
|
50
|
+
; Include the appropriate version in here depending on the assembler. NASM
|
|
51
|
+
; appears to always try and parse code, even if it is in a non-compiling
|
|
52
|
+
; block of a ifdef expression, and hence crashes if we include the TASM
|
|
53
|
+
; macro package in the same header file. Hence we split the macros up into
|
|
54
|
+
; two separate header files.
|
|
55
|
+
|
|
56
|
+
ifdef __NASM_MAJOR__
|
|
57
|
+
|
|
58
|
+
;============================================================================
|
|
59
|
+
; Macro package when compiling with NASM.
|
|
60
|
+
;============================================================================
|
|
61
|
+
|
|
62
|
+
; Turn off underscores for globals if disabled for all externals
|
|
63
|
+
|
|
64
|
+
%ifdef __NOU__
|
|
65
|
+
%define __NOU_VAR__
|
|
66
|
+
%endif
|
|
67
|
+
|
|
68
|
+
; Define the __WINDOWS__ symbol if we are compiling for any Windows
|
|
69
|
+
; environment
|
|
70
|
+
|
|
71
|
+
%ifdef __WINDOWS16__
|
|
72
|
+
%define __WINDOWS__ 1
|
|
73
|
+
%endif
|
|
74
|
+
%ifdef __WINDOWS32__
|
|
75
|
+
%define __WINDOWS__ 1
|
|
76
|
+
%define __WINDOWS32_386__ 1
|
|
77
|
+
%endif
|
|
78
|
+
|
|
79
|
+
; Macros for accessing 'generic' registers
|
|
80
|
+
|
|
81
|
+
%ifdef __FLAT__
|
|
82
|
+
%idefine _ax eax
|
|
83
|
+
%idefine _bx ebx
|
|
84
|
+
%idefine _cx ecx
|
|
85
|
+
%idefine _dx edx
|
|
86
|
+
%idefine _si esi
|
|
87
|
+
%idefine _di edi
|
|
88
|
+
%idefine _bp ebp
|
|
89
|
+
%idefine _sp esp
|
|
90
|
+
%idefine _es
|
|
91
|
+
%idefine UCHAR BYTE ; Size of a character
|
|
92
|
+
%idefine USHORT WORD ; Size of a short
|
|
93
|
+
%idefine UINT DWORD ; Size of an integer
|
|
94
|
+
%idefine ULONG DWORD ; Size of a long
|
|
95
|
+
%idefine BOOL DWORD ; Size of a boolean
|
|
96
|
+
%idefine DPTR DWORD ; Size of a data pointer
|
|
97
|
+
%idefine FDPTR FWORD ; Size of a far data pointer
|
|
98
|
+
%idefine NDPTR DWORD ; Size of a near data pointer
|
|
99
|
+
%idefine CPTR DWORD ; Size of a code pointer
|
|
100
|
+
%idefine FCPTR FWORD ; Size of a far code pointer
|
|
101
|
+
%idefine NCPTR DWORD ; Size of a near code pointer
|
|
102
|
+
%idefine FPTR NEAR ; Distance for function pointers
|
|
103
|
+
%idefine DUINT dd ; Declare a integer variable
|
|
104
|
+
%idefine intsize 4
|
|
105
|
+
%idefine flatmodel 1
|
|
106
|
+
%else
|
|
107
|
+
%idefine _ax ax
|
|
108
|
+
%idefine _bx bx
|
|
109
|
+
%idefine _cx cx
|
|
110
|
+
%idefine _dx dx
|
|
111
|
+
%idefine _si si
|
|
112
|
+
%idefine _di di
|
|
113
|
+
%idefine _bp bp
|
|
114
|
+
%idefine _sp sp
|
|
115
|
+
%idefine _es es:
|
|
116
|
+
%idefine UCHAR BYTE ; Size of a character
|
|
117
|
+
%idefine USHORT WORD ; Size of a short
|
|
118
|
+
%idefine UINT WORD ; Size of an integer
|
|
119
|
+
%idefine ULONG DWORD ; Size of a long
|
|
120
|
+
%idefine BOOL WORD ; Size of a boolean
|
|
121
|
+
%idefine DPTR DWORD ; Size of a data pointer
|
|
122
|
+
%idefine FDPTR DWORD ; Size of a far data pointer
|
|
123
|
+
%idefine NDPTR WORD ; Size of a near data pointer
|
|
124
|
+
%idefine CPTR DWORD ; Size of a code pointer
|
|
125
|
+
%idefine FCPTR DWORD ; Size of a far code pointer
|
|
126
|
+
%idefine NCPTR WORD ; Size of a near code pointer
|
|
127
|
+
%idefine FPTR FAR ; Distance for function pointers
|
|
128
|
+
%idefine DUINT dw ; Declare a integer variable
|
|
129
|
+
%idefine intsize 2
|
|
130
|
+
%endif
|
|
131
|
+
%idefine invert ~
|
|
132
|
+
%idefine offset
|
|
133
|
+
%idefine use_nasm
|
|
134
|
+
|
|
135
|
+
; Convert all jumps to near jumps, since NASM does not so this automatically
|
|
136
|
+
|
|
137
|
+
%idefine jo jo near
|
|
138
|
+
%idefine jno jno near
|
|
139
|
+
%idefine jz jz near
|
|
140
|
+
%idefine jnz jnz near
|
|
141
|
+
%idefine je je near
|
|
142
|
+
%idefine jne jne near
|
|
143
|
+
%idefine jb jb near
|
|
144
|
+
%idefine jbe jbe near
|
|
145
|
+
%idefine ja ja near
|
|
146
|
+
%idefine jae jae near
|
|
147
|
+
%idefine jl jl near
|
|
148
|
+
%idefine jle jle near
|
|
149
|
+
%idefine jg jg near
|
|
150
|
+
%idefine jge jge near
|
|
151
|
+
%idefine jc jc near
|
|
152
|
+
%idefine jnc jnc near
|
|
153
|
+
%idefine js js near
|
|
154
|
+
%idefine jns jns near
|
|
155
|
+
|
|
156
|
+
%ifdef DOUBLE
|
|
157
|
+
%idefine REAL QWORD
|
|
158
|
+
%idefine DREAL dq
|
|
159
|
+
%else
|
|
160
|
+
%idefine REAL DWORD
|
|
161
|
+
%idefine DREAL dd
|
|
162
|
+
%endif
|
|
163
|
+
|
|
164
|
+
; Boolean truth values (same as those in debug.h)
|
|
165
|
+
|
|
166
|
+
%idefine False 0
|
|
167
|
+
%idefine True 1
|
|
168
|
+
%idefine No 0
|
|
169
|
+
%idefine Yes 1
|
|
170
|
+
%idefine Yes 1
|
|
171
|
+
|
|
172
|
+
; Macro to be invoked at the start of all modules to set up segments for
|
|
173
|
+
; later use. Does nothing for NASM.
|
|
174
|
+
|
|
175
|
+
%imacro header 1
|
|
176
|
+
%endmacro
|
|
177
|
+
|
|
178
|
+
; Macro to begin a data segment
|
|
179
|
+
|
|
180
|
+
%imacro begdataseg 1
|
|
181
|
+
%ifdef __GNUC__
|
|
182
|
+
segment .data public class=DATA use32 flat
|
|
183
|
+
%else
|
|
184
|
+
%ifdef flatmodel
|
|
185
|
+
segment _DATA public align=4 class=DATA use32 flat
|
|
186
|
+
%else
|
|
187
|
+
segment _DATA public align=4 class=DATA use16
|
|
188
|
+
%endif
|
|
189
|
+
%endif
|
|
190
|
+
%endmacro
|
|
191
|
+
|
|
192
|
+
; Macro to end a data segment
|
|
193
|
+
|
|
194
|
+
%imacro enddataseg 1
|
|
195
|
+
%endmacro
|
|
196
|
+
|
|
197
|
+
; Macro to begin a code segment
|
|
198
|
+
|
|
199
|
+
%imacro begcodeseg 1
|
|
200
|
+
%ifdef __GNUC__
|
|
201
|
+
segment .text public class=CODE use32 flat
|
|
202
|
+
%else
|
|
203
|
+
%ifdef flatmodel
|
|
204
|
+
segment _TEXT public align=16 class=CODE use32 flat
|
|
205
|
+
%else
|
|
206
|
+
segment %1_TEXT public align=16 class=CODE use16
|
|
207
|
+
%endif
|
|
208
|
+
%endif
|
|
209
|
+
%endmacro
|
|
210
|
+
|
|
211
|
+
; Macro to begin a near code segment
|
|
212
|
+
|
|
213
|
+
%imacro begcodeseg_near 0
|
|
214
|
+
%ifdef __GNUC__
|
|
215
|
+
segment .text public class=CODE use32 flat
|
|
216
|
+
%else
|
|
217
|
+
%ifdef flatmodel
|
|
218
|
+
segment _TEXT public align=16 class=CODE use32 flat
|
|
219
|
+
%else
|
|
220
|
+
segment _TEXT public align=16 class=CODE use16
|
|
221
|
+
%endif
|
|
222
|
+
%endif
|
|
223
|
+
%endmacro
|
|
224
|
+
|
|
225
|
+
; Macro to end a code segment
|
|
226
|
+
|
|
227
|
+
%imacro endcodeseg 1
|
|
228
|
+
%endmacro
|
|
229
|
+
|
|
230
|
+
; Macro to end a near code segment
|
|
231
|
+
|
|
232
|
+
%imacro endcodeseg_near 0
|
|
233
|
+
%endmacro
|
|
234
|
+
|
|
235
|
+
; Macro for an extern C symbol. If the C compiler requires leading
|
|
236
|
+
; underscores, then the underscores are added to the symbol names, otherwise
|
|
237
|
+
; they are left off. The symbol name is referenced in the assembler code
|
|
238
|
+
; using the non-underscored symbol name.
|
|
239
|
+
|
|
240
|
+
%imacro cextern 2
|
|
241
|
+
%ifdef __NOU_VAR__
|
|
242
|
+
extern %1
|
|
243
|
+
%else
|
|
244
|
+
extern _%1
|
|
245
|
+
%define %1 _%1
|
|
246
|
+
%endif
|
|
247
|
+
%endmacro
|
|
248
|
+
|
|
249
|
+
%imacro cexternfunc 2
|
|
250
|
+
%ifdef __NOU__
|
|
251
|
+
extern %1
|
|
252
|
+
%else
|
|
253
|
+
extern _%1
|
|
254
|
+
%define %1 _%1
|
|
255
|
+
%endif
|
|
256
|
+
%endmacro
|
|
257
|
+
|
|
258
|
+
; Macro for a public C symbol. If the C compiler requires leading
|
|
259
|
+
; underscores, then the underscores are added to the symbol names, otherwise
|
|
260
|
+
; they are left off. The symbol name is referenced in the assembler code
|
|
261
|
+
; using the non-underscored symbol name.
|
|
262
|
+
|
|
263
|
+
%imacro cpublic 1
|
|
264
|
+
%ifdef __NOU_VAR__
|
|
265
|
+
global %1
|
|
266
|
+
%1:
|
|
267
|
+
%else
|
|
268
|
+
global _%1
|
|
269
|
+
_%1:
|
|
270
|
+
%define %1 _%1
|
|
271
|
+
%endif
|
|
272
|
+
%endmacro
|
|
273
|
+
|
|
274
|
+
; Macro for an global C symbol. If the C compiler requires leading
|
|
275
|
+
; underscores, then the underscores are added to the symbol names, otherwise
|
|
276
|
+
; they are left off. The symbol name is referenced in the assembler code
|
|
277
|
+
; using the non-underscored symbol name.
|
|
278
|
+
|
|
279
|
+
%imacro cglobal 1
|
|
280
|
+
%ifdef __NOU_VAR__
|
|
281
|
+
global %1
|
|
282
|
+
%else
|
|
283
|
+
global _%1
|
|
284
|
+
%define %1 _%1
|
|
285
|
+
%endif
|
|
286
|
+
%endmacro
|
|
287
|
+
|
|
288
|
+
; Macro for an global C function symbol. If the C compiler requires leading
|
|
289
|
+
; underscores, then the underscores are added to the symbol names, otherwise
|
|
290
|
+
; they are left off. The symbol name is referenced in the assembler code
|
|
291
|
+
; using the non-underscored symbol name.
|
|
292
|
+
|
|
293
|
+
%imacro cglobalfunc 1
|
|
294
|
+
%ifdef __NOU__
|
|
295
|
+
global %1
|
|
296
|
+
%else
|
|
297
|
+
global _%1
|
|
298
|
+
%define %1 _%1
|
|
299
|
+
%endif
|
|
300
|
+
%endmacro
|
|
301
|
+
|
|
302
|
+
; Macro to start a C callable function. This will be a far function for
|
|
303
|
+
; 16-bit code, and a near function for 32-bit code.
|
|
304
|
+
|
|
305
|
+
%imacro cprocstatic 1
|
|
306
|
+
%push cproc
|
|
307
|
+
%1:
|
|
308
|
+
%ifdef flatmodel
|
|
309
|
+
%stacksize flat
|
|
310
|
+
%define ret retn
|
|
311
|
+
%else
|
|
312
|
+
%stacksize large
|
|
313
|
+
%define ret retf
|
|
314
|
+
%endif
|
|
315
|
+
%assign %$localsize 0
|
|
316
|
+
%endmacro
|
|
317
|
+
|
|
318
|
+
%imacro cprocstart 1
|
|
319
|
+
%push cproc
|
|
320
|
+
cglobalfunc %1
|
|
321
|
+
%1:
|
|
322
|
+
%ifdef flatmodel
|
|
323
|
+
%stacksize flat
|
|
324
|
+
%define ret retn
|
|
325
|
+
%else
|
|
326
|
+
%stacksize large
|
|
327
|
+
%define ret retf
|
|
328
|
+
%endif
|
|
329
|
+
%assign %$localsize 0
|
|
330
|
+
%endmacro
|
|
331
|
+
|
|
332
|
+
; This macro sets up a procedure to be exported from a 16 bit DLL. Since the
|
|
333
|
+
; calling conventions are always _far _pascal for 16 bit DLL's, we actually
|
|
334
|
+
; rename this routine with an extra underscore with 'C' calling conventions
|
|
335
|
+
; and a small DLL stub will be provided by the high level code to call the
|
|
336
|
+
; assembler routine.
|
|
337
|
+
|
|
338
|
+
%imacro cprocstartdll16 1
|
|
339
|
+
%ifdef __WINDOWS16__
|
|
340
|
+
cprocstart _%1
|
|
341
|
+
%else
|
|
342
|
+
cprocstart %1
|
|
343
|
+
%endif
|
|
344
|
+
%endmacro
|
|
345
|
+
|
|
346
|
+
; Macro to start a C callable near function.
|
|
347
|
+
|
|
348
|
+
%imacro cprocnear 1
|
|
349
|
+
%push cproc
|
|
350
|
+
cglobalfunc %1
|
|
351
|
+
%1:
|
|
352
|
+
%define ret retn
|
|
353
|
+
%ifdef flatmodel
|
|
354
|
+
%stacksize flat
|
|
355
|
+
%else
|
|
356
|
+
%stacksize small
|
|
357
|
+
%endif
|
|
358
|
+
%assign %$localsize 0
|
|
359
|
+
%endmacro
|
|
360
|
+
|
|
361
|
+
; Macro to start a C callable far function.
|
|
362
|
+
|
|
363
|
+
%imacro cprocfar 1
|
|
364
|
+
%push cproc
|
|
365
|
+
cglobalfunc %1
|
|
366
|
+
%1:
|
|
367
|
+
%define ret retf
|
|
368
|
+
%ifdef flatmodel
|
|
369
|
+
%stacksize flat
|
|
370
|
+
%else
|
|
371
|
+
%stacksize large
|
|
372
|
+
%endif
|
|
373
|
+
%assign %$localsize 0
|
|
374
|
+
%endmacro
|
|
375
|
+
|
|
376
|
+
; Macro to end a C function
|
|
377
|
+
|
|
378
|
+
%imacro cprocend 0
|
|
379
|
+
%pop
|
|
380
|
+
%endmacro
|
|
381
|
+
|
|
382
|
+
; Macros for entering and exiting C callable functions. Note that we must
|
|
383
|
+
; always save and restore the SI and DI registers for C functions, and for
|
|
384
|
+
; 32 bit C functions we also need to save and restore EBX and clear the
|
|
385
|
+
; direction flag.
|
|
386
|
+
|
|
387
|
+
%imacro enter_c 0
|
|
388
|
+
push _bp
|
|
389
|
+
mov _bp,_sp
|
|
390
|
+
%ifnidn %$localsize,0
|
|
391
|
+
sub _sp,%$localsize
|
|
392
|
+
%endif
|
|
393
|
+
%ifdef flatmodel
|
|
394
|
+
push ebx
|
|
395
|
+
%endif
|
|
396
|
+
push _si
|
|
397
|
+
push _di
|
|
398
|
+
%endmacro
|
|
399
|
+
|
|
400
|
+
%imacro leave_c 0
|
|
401
|
+
pop _di
|
|
402
|
+
pop _si
|
|
403
|
+
%ifdef flatmodel
|
|
404
|
+
pop ebx
|
|
405
|
+
cld
|
|
406
|
+
%endif
|
|
407
|
+
%ifnidn %$localsize,0
|
|
408
|
+
mov _sp,_bp
|
|
409
|
+
%endif
|
|
410
|
+
pop _bp
|
|
411
|
+
%endmacro
|
|
412
|
+
|
|
413
|
+
%imacro use_ebx 0
|
|
414
|
+
%ifdef flatmodel
|
|
415
|
+
push ebx
|
|
416
|
+
%endif
|
|
417
|
+
%endmacro
|
|
418
|
+
|
|
419
|
+
%imacro unuse_ebx 0
|
|
420
|
+
%ifdef flatmodel
|
|
421
|
+
pop ebx
|
|
422
|
+
%endif
|
|
423
|
+
%endmacro
|
|
424
|
+
|
|
425
|
+
; Macros for saving and restoring the value of DS,ES,FS,GS when it is to
|
|
426
|
+
; be used in assembly routines. This evaluates to nothing in the flat memory
|
|
427
|
+
; model, but is saves and restores DS in the large memory model.
|
|
428
|
+
|
|
429
|
+
%imacro use_ds 0
|
|
430
|
+
%ifndef flatmodel
|
|
431
|
+
push ds
|
|
432
|
+
%endif
|
|
433
|
+
%endmacro
|
|
434
|
+
|
|
435
|
+
%imacro unuse_ds 0
|
|
436
|
+
%ifndef flatmodel
|
|
437
|
+
pop ds
|
|
438
|
+
%endif
|
|
439
|
+
%endmacro
|
|
440
|
+
|
|
441
|
+
%imacro use_es 0
|
|
442
|
+
%ifndef flatmodel
|
|
443
|
+
push es
|
|
444
|
+
%endif
|
|
445
|
+
%endmacro
|
|
446
|
+
|
|
447
|
+
%imacro unuse_es 0
|
|
448
|
+
%ifndef flatmodel
|
|
449
|
+
pop es
|
|
450
|
+
%endif
|
|
451
|
+
%endmacro
|
|
452
|
+
|
|
453
|
+
; Macros for loading the address of a data pointer into a segment and
|
|
454
|
+
; index register pair. The %imacro explicitly loads DS or ES in the 16 bit
|
|
455
|
+
; memory model, or it simply loads the offset into the register in the flat
|
|
456
|
+
; memory model since DS and ES always point to all addressable memory. You
|
|
457
|
+
; must use the correct _REG (ie: _BX) %imacros for documentation purposes.
|
|
458
|
+
|
|
459
|
+
%imacro _lds 2
|
|
460
|
+
%ifdef flatmodel
|
|
461
|
+
mov %1,%2
|
|
462
|
+
%else
|
|
463
|
+
lds %1,%2
|
|
464
|
+
%endif
|
|
465
|
+
%endmacro
|
|
466
|
+
|
|
467
|
+
%imacro _les 2
|
|
468
|
+
%ifdef flatmodel
|
|
469
|
+
mov %1,%2
|
|
470
|
+
%else
|
|
471
|
+
les %1,%2
|
|
472
|
+
%endif
|
|
473
|
+
%endmacro
|
|
474
|
+
|
|
475
|
+
; Macros for adding and subtracting a value from registers. Two value are
|
|
476
|
+
; provided, one for 16 bit modes and another for 32 bit modes (the extended
|
|
477
|
+
; register is used in 32 bit modes).
|
|
478
|
+
|
|
479
|
+
%imacro _add 3
|
|
480
|
+
%ifdef flatmodel
|
|
481
|
+
add e%1, %3
|
|
482
|
+
%else
|
|
483
|
+
add %1, %2
|
|
484
|
+
%endif
|
|
485
|
+
%endmacro
|
|
486
|
+
|
|
487
|
+
%imacro _sub 3
|
|
488
|
+
%ifdef flatmodel
|
|
489
|
+
sub e%1, %3
|
|
490
|
+
%else
|
|
491
|
+
sub %1, %2
|
|
492
|
+
%endif
|
|
493
|
+
%endmacro
|
|
494
|
+
|
|
495
|
+
; Macro to clear the high order word for the 32 bit extended registers.
|
|
496
|
+
; This is used to convert an unsigned 16 bit value to an unsigned 32 bit
|
|
497
|
+
; value, and will evaluate to nothing in 16 bit modes.
|
|
498
|
+
|
|
499
|
+
%imacro clrhi 1
|
|
500
|
+
%ifdef flatmodel
|
|
501
|
+
movzx e%1,%1
|
|
502
|
+
%endif
|
|
503
|
+
%endmacro
|
|
504
|
+
|
|
505
|
+
%imacro sgnhi 1
|
|
506
|
+
%ifdef flatmodel
|
|
507
|
+
movsx e%1,%1
|
|
508
|
+
%endif
|
|
509
|
+
%endmacro
|
|
510
|
+
|
|
511
|
+
; Macro to load an extended register with an integer value in either mode
|
|
512
|
+
|
|
513
|
+
%imacro loadint 2
|
|
514
|
+
%ifdef flatmodel
|
|
515
|
+
mov e%1,%2
|
|
516
|
+
%else
|
|
517
|
+
xor e%1,e%1
|
|
518
|
+
mov %1,%2
|
|
519
|
+
%endif
|
|
520
|
+
%endmacro
|
|
521
|
+
|
|
522
|
+
; Macros to load and store integer values with string instructions
|
|
523
|
+
|
|
524
|
+
%imacro LODSINT 0
|
|
525
|
+
%ifdef flatmodel
|
|
526
|
+
lodsd
|
|
527
|
+
%else
|
|
528
|
+
lodsw
|
|
529
|
+
%endif
|
|
530
|
+
%endmacro
|
|
531
|
+
|
|
532
|
+
%imacro STOSINT 0
|
|
533
|
+
%ifdef flatmodel
|
|
534
|
+
stosd
|
|
535
|
+
%else
|
|
536
|
+
stosw
|
|
537
|
+
%endif
|
|
538
|
+
%endmacro
|
|
539
|
+
|
|
540
|
+
; Macros to provide resb, resw, resd compatibility with NASM
|
|
541
|
+
|
|
542
|
+
%imacro dclb 1
|
|
543
|
+
times %1 db 0
|
|
544
|
+
%endmacro
|
|
545
|
+
|
|
546
|
+
%imacro dclw 1
|
|
547
|
+
times %1 dw 0
|
|
548
|
+
%endmacro
|
|
549
|
+
|
|
550
|
+
%imacro dcld 1
|
|
551
|
+
times %1 dd 0
|
|
552
|
+
%endmacro
|
|
553
|
+
|
|
554
|
+
; macros to declare assembler function stubs for function structures
|
|
555
|
+
|
|
556
|
+
%imacro BEGIN_STUBS_DEF 2
|
|
557
|
+
begdataseg _STUBS
|
|
558
|
+
%ifdef __NOU_VAR__
|
|
559
|
+
extern %1
|
|
560
|
+
%define STUBS_START %1
|
|
561
|
+
%else
|
|
562
|
+
extern _%1
|
|
563
|
+
%define STUBS_START _%1
|
|
564
|
+
%endif
|
|
565
|
+
enddataseg _STUBS
|
|
566
|
+
begcodeseg _STUBS
|
|
567
|
+
%assign off %2
|
|
568
|
+
%endmacro
|
|
569
|
+
|
|
570
|
+
%imacro DECLARE_STUB 1
|
|
571
|
+
%ifdef __NOU__
|
|
572
|
+
global %1
|
|
573
|
+
%1:
|
|
574
|
+
%else
|
|
575
|
+
global _%1
|
|
576
|
+
_%1:
|
|
577
|
+
%endif
|
|
578
|
+
jmp [DWORD STUBS_START+off]
|
|
579
|
+
%assign off off+4
|
|
580
|
+
%endmacro
|
|
581
|
+
|
|
582
|
+
%imacro DECLARE_STDCALL 2
|
|
583
|
+
%ifdef STDCALL_MANGLE
|
|
584
|
+
global _%1@%2
|
|
585
|
+
_%1@%2:
|
|
586
|
+
%else
|
|
587
|
+
%ifdef __GNUC__
|
|
588
|
+
global _%1
|
|
589
|
+
_%1:
|
|
590
|
+
%else
|
|
591
|
+
global %1
|
|
592
|
+
%1:
|
|
593
|
+
%endif
|
|
594
|
+
%endif
|
|
595
|
+
jmp [DWORD STUBS_START+off]
|
|
596
|
+
%assign off off+4
|
|
597
|
+
%endmacro
|
|
598
|
+
|
|
599
|
+
%imacro END_STUBS_DEF 0
|
|
600
|
+
endcodeseg _STUBS
|
|
601
|
+
%endmacro
|
|
602
|
+
|
|
603
|
+
; macros to declare assembler import stubs for binary loadable drivers
|
|
604
|
+
|
|
605
|
+
%imacro BEGIN_IMPORTS_DEF 1
|
|
606
|
+
BEGIN_STUBS_DEF %1,4
|
|
607
|
+
%endmacro
|
|
608
|
+
|
|
609
|
+
%imacro DECLARE_IMP 1
|
|
610
|
+
DECLARE_STUB %1
|
|
611
|
+
%endmacro
|
|
612
|
+
|
|
613
|
+
%imacro END_IMPORTS_DEF 0
|
|
614
|
+
END_STUBS_DEF
|
|
615
|
+
%endmacro
|
|
616
|
+
|
|
617
|
+
else ; __NASM_MAJOR__
|
|
618
|
+
|
|
619
|
+
;============================================================================
|
|
620
|
+
; Macro package when compiling with TASM.
|
|
621
|
+
;============================================================================
|
|
622
|
+
|
|
623
|
+
; Turn off underscores for globals if disabled for all externals
|
|
624
|
+
|
|
625
|
+
ifdef __NOU__
|
|
626
|
+
__NOU_VAR__ = 1
|
|
627
|
+
endif
|
|
628
|
+
|
|
629
|
+
; Define the __WINDOWS__ symbol if we are compiling for any Windows
|
|
630
|
+
; environment
|
|
631
|
+
|
|
632
|
+
ifdef __WINDOWS16__
|
|
633
|
+
__WINDOWS__ = 1
|
|
634
|
+
endif
|
|
635
|
+
ifdef __WINDOWS32__
|
|
636
|
+
__WINDOWS__ = 1
|
|
637
|
+
__WINDOWS32_386__ = 1
|
|
638
|
+
endif
|
|
639
|
+
ifdef __WIN386__
|
|
640
|
+
__WINDOWS__ = 1
|
|
641
|
+
__WINDOWS32_386__ = 1
|
|
642
|
+
endif
|
|
643
|
+
ifdef __VXD__
|
|
644
|
+
__WINDOWS__ = 1
|
|
645
|
+
__WINDOWS32_386__ = 1
|
|
646
|
+
MASM
|
|
647
|
+
.386
|
|
648
|
+
NO_SEGMENTS = 1
|
|
649
|
+
include vmm.inc ; IGNORE DEPEND
|
|
650
|
+
include vsegment.inc ; IGNORE DEPEND
|
|
651
|
+
IDEAL
|
|
652
|
+
endif
|
|
653
|
+
|
|
654
|
+
; Macros for accessing 'generic' registers
|
|
655
|
+
|
|
656
|
+
ifdef __FLAT__
|
|
657
|
+
_ax EQU eax ; EAX is used for accumulator
|
|
658
|
+
_bx EQU ebx ; EBX is used for accumulator
|
|
659
|
+
_cx EQU ecx ; ECX is used for looping
|
|
660
|
+
_dx EQU edx ; EDX is used for data register
|
|
661
|
+
_si EQU esi ; ESI is the source index register
|
|
662
|
+
_di EQU edi ; EDI is the destination index register
|
|
663
|
+
_bp EQU ebp ; EBP is used for base pointer register
|
|
664
|
+
_sp EQU esp ; ESP is used for stack pointer register
|
|
665
|
+
_es EQU ; ES and DS are the same in 32 bit PM
|
|
666
|
+
typedef UCHAR BYTE ; Size of a character
|
|
667
|
+
typedef USHORT WORD ; Size of a short
|
|
668
|
+
typedef UINT DWORD ; Size of an integer
|
|
669
|
+
typedef ULONG DWORD ; Size of a long
|
|
670
|
+
typedef BOOL DWORD ; Size of a boolean
|
|
671
|
+
typedef DPTR DWORD ; Size of a data pointer
|
|
672
|
+
typedef FDPTR FWORD ; Size of a far data pointer
|
|
673
|
+
typedef NDPTR DWORD ; Size of a near data pointer
|
|
674
|
+
typedef CPTR DWORD ; Size of a code pointer
|
|
675
|
+
typedef FCPTR FWORD ; Size of a far code pointer
|
|
676
|
+
typedef NCPTR DWORD ; Size of a near code pointer
|
|
677
|
+
typedef DUINT DWORD ; Declare a integer variable
|
|
678
|
+
FPTR EQU NEAR ; Distance for function pointers
|
|
679
|
+
intsize = 4 ; Size of an integer
|
|
680
|
+
flatmodel = 1 ; This is a flat memory model
|
|
681
|
+
P386 ; Turn on 386 code generation
|
|
682
|
+
MODEL FLAT ; Set up for 32 bit simplified FLAT model
|
|
683
|
+
else
|
|
684
|
+
_ax EQU ax ; AX is used for accumulator
|
|
685
|
+
_bx EQU bx ; BX is used for accumulator
|
|
686
|
+
_cx EQU cx ; CX is used for looping
|
|
687
|
+
_dx EQU dx ; DX is used for data register
|
|
688
|
+
_si EQU si ; SI is the source index register
|
|
689
|
+
_di EQU di ; DI is the destination index register
|
|
690
|
+
_bp EQU bp ; BP is used for base pointer register
|
|
691
|
+
_sp EQU sp ; SP is used for stack pointer register
|
|
692
|
+
_es EQU es: ; ES is used for segment override
|
|
693
|
+
typedef UCHAR BYTE ; Size of a character
|
|
694
|
+
typedef USHORT WORD ; Size of a short
|
|
695
|
+
typedef UINT WORD ; Size of an integer
|
|
696
|
+
typedef ULONG DWORD ; Size of a long
|
|
697
|
+
typedef BOOL WORD ; Size of a boolean
|
|
698
|
+
typedef DPTR DWORD ; Size of a data pointer
|
|
699
|
+
typedef FDPTR DWORD ; Size of a far data pointer
|
|
700
|
+
typedef NDPTR WORD ; Size of a near data pointer
|
|
701
|
+
typedef CPTR DWORD ; Size of a code pointer
|
|
702
|
+
typedef FCPTR DWORD ; Size of a far code pointer
|
|
703
|
+
typedef NCPTR WORD ; Size of a near code pointer
|
|
704
|
+
typedef DUINT WORD ; Declare a integer variable
|
|
705
|
+
FPTR EQU FAR ; Distance for function pointers
|
|
706
|
+
intsize = 2 ; Size of an integer
|
|
707
|
+
P386 ; Turn on 386 code generation
|
|
708
|
+
endif
|
|
709
|
+
invert EQU not
|
|
710
|
+
|
|
711
|
+
; Provide a typedef for real floating point numbers
|
|
712
|
+
|
|
713
|
+
ifdef DOUBLE
|
|
714
|
+
typedef REAL QWORD
|
|
715
|
+
typedef DREAL QWORD
|
|
716
|
+
else
|
|
717
|
+
typedef REAL DWORD
|
|
718
|
+
typedef DREAL DWORD
|
|
719
|
+
endif
|
|
720
|
+
|
|
721
|
+
; Macros to access the floating point stack registers to convert them
|
|
722
|
+
; from NASM style to TASM style
|
|
723
|
+
|
|
724
|
+
st0 EQU st(0)
|
|
725
|
+
st1 EQU st(1)
|
|
726
|
+
st2 EQU st(2)
|
|
727
|
+
st3 EQU st(3)
|
|
728
|
+
st4 EQU st(4)
|
|
729
|
+
st5 EQU st(5)
|
|
730
|
+
st6 EQU st(6)
|
|
731
|
+
st7 EQU st(7)
|
|
732
|
+
st8 EQU st(8)
|
|
733
|
+
|
|
734
|
+
; Boolean truth values (same as those in debug.h)
|
|
735
|
+
|
|
736
|
+
ifndef __VXD__
|
|
737
|
+
False = 0
|
|
738
|
+
True = 1
|
|
739
|
+
No = 0
|
|
740
|
+
Yes = 1
|
|
741
|
+
Yes = 1
|
|
742
|
+
endif
|
|
743
|
+
|
|
744
|
+
; Macros for the _DATA data segment. This segment contains initialised data.
|
|
745
|
+
|
|
746
|
+
MACRO begdataseg name
|
|
747
|
+
ifdef __VXD__
|
|
748
|
+
MASM
|
|
749
|
+
VXD_LOCKED_DATA_SEG
|
|
750
|
+
IDEAL
|
|
751
|
+
else
|
|
752
|
+
ifdef flatmodel
|
|
753
|
+
DATASEG
|
|
754
|
+
else
|
|
755
|
+
SEGMENT _DATA DWORD PUBLIC USE16 'DATA'
|
|
756
|
+
endif
|
|
757
|
+
endif
|
|
758
|
+
ENDM
|
|
759
|
+
|
|
760
|
+
MACRO enddataseg name
|
|
761
|
+
ifdef __VXD__
|
|
762
|
+
MASM
|
|
763
|
+
VXD_LOCKED_DATA_ENDS
|
|
764
|
+
IDEAL
|
|
765
|
+
else
|
|
766
|
+
ifndef flatmodel
|
|
767
|
+
ENDS _DATA
|
|
768
|
+
endif
|
|
769
|
+
endif
|
|
770
|
+
ENDM
|
|
771
|
+
|
|
772
|
+
; Macro for the main code segment.
|
|
773
|
+
|
|
774
|
+
MACRO begcodeseg name
|
|
775
|
+
ifdef __VXD__
|
|
776
|
+
MASM
|
|
777
|
+
VXD_LOCKED_CODE_SEG
|
|
778
|
+
IDEAL
|
|
779
|
+
else
|
|
780
|
+
ifdef flatmodel
|
|
781
|
+
CODESEG
|
|
782
|
+
ASSUME CS:FLAT,DS:FLAT,SS:FLAT
|
|
783
|
+
else
|
|
784
|
+
SEGMENT &name&_TEXT PARA PUBLIC USE16 'CODE'
|
|
785
|
+
ASSUME CS:&name&_TEXT,DS:_DATA
|
|
786
|
+
endif
|
|
787
|
+
endif
|
|
788
|
+
ENDM
|
|
789
|
+
|
|
790
|
+
; Macro for a near code segment
|
|
791
|
+
|
|
792
|
+
MACRO begcodeseg_near
|
|
793
|
+
ifdef flatmodel
|
|
794
|
+
CODESEG
|
|
795
|
+
ASSUME CS:FLAT,DS:FLAT,SS:FLAT
|
|
796
|
+
else
|
|
797
|
+
SEGMENT _TEXT PARA PUBLIC USE16 'CODE'
|
|
798
|
+
ASSUME CS:_TEXT,DS:_DATA
|
|
799
|
+
endif
|
|
800
|
+
ENDM
|
|
801
|
+
|
|
802
|
+
MACRO endcodeseg name
|
|
803
|
+
ifdef __VXD__
|
|
804
|
+
MASM
|
|
805
|
+
VXD_LOCKED_CODE_ENDS
|
|
806
|
+
IDEAL
|
|
807
|
+
else
|
|
808
|
+
ifndef flatmodel
|
|
809
|
+
ENDS &name&_TEXT
|
|
810
|
+
endif
|
|
811
|
+
endif
|
|
812
|
+
ENDM
|
|
813
|
+
|
|
814
|
+
MACRO endcodeseg_near
|
|
815
|
+
ifndef flatmodel
|
|
816
|
+
ENDS _TEXT
|
|
817
|
+
endif
|
|
818
|
+
ENDM
|
|
819
|
+
|
|
820
|
+
; Macro to be invoked at the start of all modules to set up segments for
|
|
821
|
+
; later use.
|
|
822
|
+
|
|
823
|
+
MACRO header name
|
|
824
|
+
begdataseg name
|
|
825
|
+
enddataseg name
|
|
826
|
+
ENDM
|
|
827
|
+
|
|
828
|
+
; Macro for an extern C symbol. If the C compiler requires leading
|
|
829
|
+
; underscores, then the underscores are added to the symbol names, otherwise
|
|
830
|
+
; they are left off. The symbol name is referenced in the assembler code
|
|
831
|
+
; using the non-underscored symbol name.
|
|
832
|
+
|
|
833
|
+
MACRO cextern name,size
|
|
834
|
+
ifdef __NOU_VAR__
|
|
835
|
+
EXTRN name:size
|
|
836
|
+
else
|
|
837
|
+
EXTRN _&name&:size
|
|
838
|
+
name EQU _&name&
|
|
839
|
+
endif
|
|
840
|
+
ENDM
|
|
841
|
+
|
|
842
|
+
MACRO cexternfunc name,size
|
|
843
|
+
ifdef __NOU__
|
|
844
|
+
EXTRN name:size
|
|
845
|
+
else
|
|
846
|
+
EXTRN _&name&:size
|
|
847
|
+
name EQU _&name&
|
|
848
|
+
endif
|
|
849
|
+
ENDM
|
|
850
|
+
|
|
851
|
+
MACRO stdexternfunc name,args,size
|
|
852
|
+
ifdef STDCALL_MANGLE
|
|
853
|
+
EXTRN _&name&@&num_args&:size
|
|
854
|
+
name EQU _&name&@&num_args
|
|
855
|
+
else
|
|
856
|
+
EXTRN name:size
|
|
857
|
+
endif
|
|
858
|
+
ENDM
|
|
859
|
+
|
|
860
|
+
; Macro for a public C symbol. If the C compiler requires leading
|
|
861
|
+
; underscores, then the underscores are added to the symbol names, otherwise
|
|
862
|
+
; they are left off. The symbol name is referenced in the assembler code
|
|
863
|
+
; using the non-underscored symbol name.
|
|
864
|
+
|
|
865
|
+
MACRO cpublic name
|
|
866
|
+
ifdef __NOU_VAR__
|
|
867
|
+
name:
|
|
868
|
+
PUBLIC name
|
|
869
|
+
else
|
|
870
|
+
_&name&:
|
|
871
|
+
PUBLIC _&name&
|
|
872
|
+
name EQU _&name&
|
|
873
|
+
endif
|
|
874
|
+
ENDM
|
|
875
|
+
|
|
876
|
+
; Macro for an global C symbol. If the C compiler requires leading
|
|
877
|
+
; underscores, then the underscores are added to the symbol names, otherwise
|
|
878
|
+
; they are left off. The symbol name is referenced in the assembler code
|
|
879
|
+
; using the non-underscored symbol name.
|
|
880
|
+
|
|
881
|
+
MACRO cglobal name
|
|
882
|
+
ifdef __NOU_VAR__
|
|
883
|
+
PUBLIC name
|
|
884
|
+
else
|
|
885
|
+
PUBLIC _&name&
|
|
886
|
+
name EQU _&name&
|
|
887
|
+
endif
|
|
888
|
+
ENDM
|
|
889
|
+
|
|
890
|
+
; Macro for an global C function symbol. If the C compiler requires leading
|
|
891
|
+
; underscores, then the underscores are added to the symbol names, otherwise
|
|
892
|
+
; they are left off. The symbol name is referenced in the assembler code
|
|
893
|
+
; using the non-underscored symbol name.
|
|
894
|
+
|
|
895
|
+
MACRO cglobalfunc name
|
|
896
|
+
ifdef __NOU__
|
|
897
|
+
PUBLIC name
|
|
898
|
+
else
|
|
899
|
+
PUBLIC _&name&
|
|
900
|
+
name EQU _&name&
|
|
901
|
+
endif
|
|
902
|
+
ENDM
|
|
903
|
+
|
|
904
|
+
; Macro to start a C callable function. This will be a far function for
|
|
905
|
+
; 16-bit code, and a near function for 32-bit code.
|
|
906
|
+
|
|
907
|
+
MACRO cprocstatic name ; Set up model independant private proc
|
|
908
|
+
ifdef flatmodel
|
|
909
|
+
PROC name NEAR
|
|
910
|
+
else
|
|
911
|
+
PROC name FAR
|
|
912
|
+
endif
|
|
913
|
+
LocalSize = 0
|
|
914
|
+
ENDM
|
|
915
|
+
|
|
916
|
+
MACRO cprocstart name ; Set up model independant proc
|
|
917
|
+
ifdef flatmodel
|
|
918
|
+
ifdef __NOU__
|
|
919
|
+
PROC name NEAR
|
|
920
|
+
else
|
|
921
|
+
PROC _&name& NEAR
|
|
922
|
+
endif
|
|
923
|
+
else
|
|
924
|
+
ifdef __NOU__
|
|
925
|
+
PROC name FAR
|
|
926
|
+
else
|
|
927
|
+
PROC _&name& FAR
|
|
928
|
+
endif
|
|
929
|
+
endif
|
|
930
|
+
LocalSize = 0
|
|
931
|
+
cglobalfunc name
|
|
932
|
+
ENDM
|
|
933
|
+
|
|
934
|
+
MACRO cprocnear name ; Set up near proc
|
|
935
|
+
ifdef __NOU__
|
|
936
|
+
PROC name NEAR
|
|
937
|
+
else
|
|
938
|
+
PROC _&name& NEAR
|
|
939
|
+
endif
|
|
940
|
+
LocalSize = 0
|
|
941
|
+
cglobalfunc name
|
|
942
|
+
ENDM
|
|
943
|
+
|
|
944
|
+
MACRO cprocfar name ; Set up far proc
|
|
945
|
+
ifdef __NOU__
|
|
946
|
+
PROC name FAR
|
|
947
|
+
else
|
|
948
|
+
PROC _&name& FAR
|
|
949
|
+
endif
|
|
950
|
+
LocalSize = 0
|
|
951
|
+
cglobalfunc name
|
|
952
|
+
ENDM
|
|
953
|
+
|
|
954
|
+
MACRO cprocend ; End procedure macro
|
|
955
|
+
ENDP
|
|
956
|
+
ENDM
|
|
957
|
+
|
|
958
|
+
; This macro sets up a procedure to be exported from a 16 bit DLL. Since the
|
|
959
|
+
; calling conventions are always _far _pascal for 16 bit DLL's, we actually
|
|
960
|
+
; rename this routine with an extra underscore with 'C' calling conventions
|
|
961
|
+
; and a small DLL stub will be provided by the high level code to call the
|
|
962
|
+
; assembler routine.
|
|
963
|
+
|
|
964
|
+
MACRO cprocstartdll16 name
|
|
965
|
+
ifdef __WINDOWS16__
|
|
966
|
+
cprocstart _&name&
|
|
967
|
+
else
|
|
968
|
+
cprocstart name
|
|
969
|
+
endif
|
|
970
|
+
ENDM
|
|
971
|
+
|
|
972
|
+
; Macros for entering and exiting C callable functions. Note that we must
|
|
973
|
+
; always save and restore the SI and DI registers for C functions, and for
|
|
974
|
+
; 32 bit C functions we also need to save and restore EBX and clear the
|
|
975
|
+
; direction flag.
|
|
976
|
+
|
|
977
|
+
MACRO save_c_regs
|
|
978
|
+
ifdef flatmodel
|
|
979
|
+
push ebx
|
|
980
|
+
endif
|
|
981
|
+
push _si
|
|
982
|
+
push _di
|
|
983
|
+
ENDM
|
|
984
|
+
|
|
985
|
+
MACRO enter_c
|
|
986
|
+
push _bp
|
|
987
|
+
mov _bp,_sp
|
|
988
|
+
IFDIFI <LocalSize>,<0>
|
|
989
|
+
sub _sp,LocalSize
|
|
990
|
+
ENDIF
|
|
991
|
+
save_c_regs
|
|
992
|
+
ENDM
|
|
993
|
+
|
|
994
|
+
MACRO restore_c_regs
|
|
995
|
+
pop _di
|
|
996
|
+
pop _si
|
|
997
|
+
ifdef flatmodel
|
|
998
|
+
pop ebx
|
|
999
|
+
endif
|
|
1000
|
+
ENDM
|
|
1001
|
+
|
|
1002
|
+
MACRO leave_c
|
|
1003
|
+
restore_c_regs
|
|
1004
|
+
cld
|
|
1005
|
+
IFDIFI <LocalSize>,<0>
|
|
1006
|
+
mov _sp,_bp
|
|
1007
|
+
ENDIF
|
|
1008
|
+
pop _bp
|
|
1009
|
+
ENDM
|
|
1010
|
+
|
|
1011
|
+
MACRO use_ebx
|
|
1012
|
+
ifdef flatmodel
|
|
1013
|
+
push ebx
|
|
1014
|
+
endif
|
|
1015
|
+
ENDM
|
|
1016
|
+
|
|
1017
|
+
MACRO unuse_ebx
|
|
1018
|
+
ifdef flatmodel
|
|
1019
|
+
pop ebx
|
|
1020
|
+
endif
|
|
1021
|
+
ENDM
|
|
1022
|
+
|
|
1023
|
+
; Macros for saving and restoring the value of DS,ES,FS,GS when it is to
|
|
1024
|
+
; be used in assembly routines. This evaluates to nothing in the flat memory
|
|
1025
|
+
; model, but is saves and restores DS in the large memory model.
|
|
1026
|
+
|
|
1027
|
+
MACRO use_ds
|
|
1028
|
+
ifndef flatmodel
|
|
1029
|
+
push ds
|
|
1030
|
+
endif
|
|
1031
|
+
ENDM
|
|
1032
|
+
|
|
1033
|
+
MACRO unuse_ds
|
|
1034
|
+
ifndef flatmodel
|
|
1035
|
+
pop ds
|
|
1036
|
+
endif
|
|
1037
|
+
ENDM
|
|
1038
|
+
|
|
1039
|
+
MACRO use_es
|
|
1040
|
+
ifndef flatmodel
|
|
1041
|
+
push es
|
|
1042
|
+
endif
|
|
1043
|
+
ENDM
|
|
1044
|
+
|
|
1045
|
+
MACRO unuse_es
|
|
1046
|
+
ifndef flatmodel
|
|
1047
|
+
pop es
|
|
1048
|
+
endif
|
|
1049
|
+
ENDM
|
|
1050
|
+
|
|
1051
|
+
; Macros for loading the address of a data pointer into a segment and
|
|
1052
|
+
; index register pair. The macro explicitly loads DS or ES in the 16 bit
|
|
1053
|
+
; memory model, or it simply loads the offset into the register in the flat
|
|
1054
|
+
; memory model since DS and ES always point to all addressable memory. You
|
|
1055
|
+
; must use the correct _REG (ie: _BX) macros for documentation purposes.
|
|
1056
|
+
|
|
1057
|
+
MACRO _lds reg, addr
|
|
1058
|
+
ifdef flatmodel
|
|
1059
|
+
mov reg,addr
|
|
1060
|
+
else
|
|
1061
|
+
lds reg,addr
|
|
1062
|
+
endif
|
|
1063
|
+
ENDM
|
|
1064
|
+
|
|
1065
|
+
MACRO _les reg, addr
|
|
1066
|
+
ifdef flatmodel
|
|
1067
|
+
mov reg,addr
|
|
1068
|
+
else
|
|
1069
|
+
les reg,addr
|
|
1070
|
+
endif
|
|
1071
|
+
ENDM
|
|
1072
|
+
|
|
1073
|
+
; Macros for adding and subtracting a value from registers. Two value are
|
|
1074
|
+
; provided, one for 16 bit modes and another for 32 bit modes (the extended
|
|
1075
|
+
; register is used in 32 bit modes).
|
|
1076
|
+
|
|
1077
|
+
MACRO _add reg, val16, val32
|
|
1078
|
+
ifdef flatmodel
|
|
1079
|
+
add e®&, val32
|
|
1080
|
+
else
|
|
1081
|
+
add reg, val16
|
|
1082
|
+
endif
|
|
1083
|
+
ENDM
|
|
1084
|
+
|
|
1085
|
+
MACRO _sub reg, val16, val32
|
|
1086
|
+
ifdef flatmodel
|
|
1087
|
+
sub e®&, val32
|
|
1088
|
+
else
|
|
1089
|
+
sub reg, val16
|
|
1090
|
+
endif
|
|
1091
|
+
ENDM
|
|
1092
|
+
|
|
1093
|
+
; Macro to clear the high order word for the 32 bit extended registers.
|
|
1094
|
+
; This is used to convert an unsigned 16 bit value to an unsigned 32 bit
|
|
1095
|
+
; value, and will evaluate to nothing in 16 bit modes.
|
|
1096
|
+
|
|
1097
|
+
MACRO clrhi reg
|
|
1098
|
+
ifdef flatmodel
|
|
1099
|
+
movzx e®&,reg
|
|
1100
|
+
endif
|
|
1101
|
+
ENDM
|
|
1102
|
+
|
|
1103
|
+
MACRO sgnhi reg
|
|
1104
|
+
ifdef flatmodel
|
|
1105
|
+
movsx e®&,reg
|
|
1106
|
+
endif
|
|
1107
|
+
ENDM
|
|
1108
|
+
|
|
1109
|
+
; Macro to load an extended register with an integer value in either mode
|
|
1110
|
+
|
|
1111
|
+
MACRO loadint reg,val
|
|
1112
|
+
ifdef flatmodel
|
|
1113
|
+
mov e®&,val
|
|
1114
|
+
else
|
|
1115
|
+
xor e®&,e®&
|
|
1116
|
+
mov reg,val
|
|
1117
|
+
endif
|
|
1118
|
+
ENDM
|
|
1119
|
+
|
|
1120
|
+
; Macros to load and store integer values with string instructions
|
|
1121
|
+
|
|
1122
|
+
MACRO LODSINT
|
|
1123
|
+
ifdef flatmodel
|
|
1124
|
+
lodsd
|
|
1125
|
+
else
|
|
1126
|
+
lodsw
|
|
1127
|
+
endif
|
|
1128
|
+
ENDM
|
|
1129
|
+
|
|
1130
|
+
MACRO STOSINT
|
|
1131
|
+
ifdef flatmodel
|
|
1132
|
+
stosd
|
|
1133
|
+
else
|
|
1134
|
+
stosw
|
|
1135
|
+
endif
|
|
1136
|
+
ENDM
|
|
1137
|
+
|
|
1138
|
+
; Macros to provide resb, resw, resd compatibility with NASM
|
|
1139
|
+
|
|
1140
|
+
MACRO dclb count
|
|
1141
|
+
db count dup (0)
|
|
1142
|
+
ENDM
|
|
1143
|
+
|
|
1144
|
+
MACRO dclw count
|
|
1145
|
+
dw count dup (0)
|
|
1146
|
+
ENDM
|
|
1147
|
+
|
|
1148
|
+
MACRO dcld count
|
|
1149
|
+
dd count dup (0)
|
|
1150
|
+
ENDM
|
|
1151
|
+
|
|
1152
|
+
; Macros to provide resb, resw, resd compatibility with NASM
|
|
1153
|
+
|
|
1154
|
+
MACRO resb count
|
|
1155
|
+
db count dup (?)
|
|
1156
|
+
ENDM
|
|
1157
|
+
|
|
1158
|
+
MACRO resw count
|
|
1159
|
+
dw count dup (?)
|
|
1160
|
+
ENDM
|
|
1161
|
+
|
|
1162
|
+
MACRO resd count
|
|
1163
|
+
dd count dup (?)
|
|
1164
|
+
ENDM
|
|
1165
|
+
|
|
1166
|
+
; Macros to declare assembler stubs for function structures
|
|
1167
|
+
|
|
1168
|
+
MACRO BEGIN_STUBS_DEF name, firstOffset
|
|
1169
|
+
begdataseg _STUBS
|
|
1170
|
+
ifdef __NOU_VAR__
|
|
1171
|
+
EXTRN name:DWORD
|
|
1172
|
+
STUBS_START = name
|
|
1173
|
+
else
|
|
1174
|
+
EXTRN _&name&:DWORD
|
|
1175
|
+
name EQU _&name&
|
|
1176
|
+
STUBS_START = _&name
|
|
1177
|
+
endif
|
|
1178
|
+
enddataseg _STUBS
|
|
1179
|
+
begcodeseg _STUBS
|
|
1180
|
+
off = firstOffset
|
|
1181
|
+
ENDM
|
|
1182
|
+
|
|
1183
|
+
MACRO DECLARE_STUB name
|
|
1184
|
+
ifdef __NOU__
|
|
1185
|
+
name:
|
|
1186
|
+
PUBLIC name
|
|
1187
|
+
else
|
|
1188
|
+
_&name:
|
|
1189
|
+
PUBLIC _&name
|
|
1190
|
+
endif
|
|
1191
|
+
jmp [DWORD STUBS_START+off]
|
|
1192
|
+
off = off + 4
|
|
1193
|
+
ENDM
|
|
1194
|
+
|
|
1195
|
+
MACRO DECLARE_STDCALL name,num_args
|
|
1196
|
+
ifdef STDCALL_MANGLE
|
|
1197
|
+
_&name&@&num_args&:
|
|
1198
|
+
PUBLIC _&name&@&num_args&
|
|
1199
|
+
else
|
|
1200
|
+
name:
|
|
1201
|
+
PUBLIC name
|
|
1202
|
+
endif
|
|
1203
|
+
jmp [DWORD STUBS_START+off]
|
|
1204
|
+
off = off + 4
|
|
1205
|
+
ENDM
|
|
1206
|
+
|
|
1207
|
+
MACRO END_STUBS_DEF
|
|
1208
|
+
endcodeseg _STUBS
|
|
1209
|
+
ENDM
|
|
1210
|
+
|
|
1211
|
+
MACRO BEGIN_IMPORTS_DEF name
|
|
1212
|
+
BEGIN_STUBS_DEF name,4
|
|
1213
|
+
ENDM
|
|
1214
|
+
|
|
1215
|
+
MACRO DECLARE_IMP name
|
|
1216
|
+
DECLARE_STUB name
|
|
1217
|
+
ENDM
|
|
1218
|
+
|
|
1219
|
+
MACRO END_IMPORTS_DEF
|
|
1220
|
+
END_STUBS_DEF
|
|
1221
|
+
ENDM
|
|
1222
|
+
|
|
1223
|
+
endif
|