
Досовские и виндовые версии качать отсюда:
https://sourceforge.net/projects/nasm/
P.S. Если кому надо наипоследнейшее, то отсюда:
http://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D
Moderator: Shaos
Code: Select all
org 100h
section .text
start:
ret
section .data
mydata db 0
section .bss
uninit resb 1
Code: Select all
nasm test1.asm -fbin -o test1.com
8.1.2 Using the bin Format To Generate .EXE Files
The .EXE file format is simple enough that it's possible to build a .EXE file by writing a pure-binary program and sticking a 32-byte header on the front. This header is simple enough that it can be generated using DB and DW commands by NASM itself, so that you can use the bin output format to directly generate .EXE files.
Included in the NASM archives, in the misc subdirectory, is a file exebin.mac of macros. It defines three macros: EXE_begin, EXE_stack and EXE_end.
To produce a .EXE file using this method, you should start by using %include to load the exebin.mac macro package into your source file. You should then issue the EXE_begin macro call (which takes no arguments) to generate the file header data. Then write code as normal for the bin format - you can use all three standard sections .text, .data and .bss. At the end of the file you should call the EXE_end macro (again, no arguments), which defines some symbols to mark section sizes, and these symbols are referred to in the header code generated by EXE_begin.
In this model, the code you end up writing starts at 0x100, just like a .COM file - in fact, if you strip off the 32-byte header from the resulting .EXE file, you will have a valid .COM program. All the segment bases are the same, so you are limited to a 64K program, again just like a .COM file. Note that an ORG directive is issued by the EXE_begin macro, so you should not explicitly issue one of your own.
You can't directly refer to your segment base value, unfortunately, since this would require a relocation in the header, and things would get a lot more complicated. So you should get your segment base by copying it out of CS instead.
On entry to your .EXE file, SS:SP are already set up to point to the top of a 2Kb stack. You can adjust the default stack size of 2Kb by calling the EXE_stack macro. For example, to change the stack size of your program to 64 bytes, you would call EXE_stack 64.
A sample program which generates a .EXE file in this way is given in the test subdirectory of the NASM archive, as binexe.asm.
[в порядке брюзжания]Shaos wrote: Досовские и виндовые версии качать отсюда:
https://sourceforge.net/projects/nasm/
Intel придумал новые мнемоники для 8086/8088 в последние годы?angry_troll wrote:[в порядке брюзжания]Shaos wrote: Досовские и виндовые версии качать отсюда:
https://sourceforge.net/projects/nasm/
"THIS PAGE IS OUT OF DATE; we no longer use any Sourceforge services other than mailing lists."
"We are gradually moving services away from Sourceforge to this page."
http://www.nasm.us же!
SSEIntel придумал новые мнемоники для 8086/8088 в последние годы?
И все это добро волшебным образом появилось в 8086/8088?Vic3Dexe wrote:SSEIntel придумал новые мнемоники для 8086/8088 в последние годы?
AES
AVX/AVX2
FMA
и много чего еще.
О применимости всего это можно спорить, просто для галочки - да, Intel придумал.
Так я думал речь об архитектуре идетТам даже MMX-инструкции были
Ну в 1998 я был на гребне волны, а щас так - ретро баловствоVic3Dexe wrote:Так я думал речь об архитектуре идетТам даже MMX-инструкции были
По-моему ересь высшей пробы, потому что создаются exe с возможностями хуже чем com. Может если покопать дальше и разобраться то там можно таким способом "руками" создавать "exe" любой сложности, но тут явно нужно быть экспертом в этих DOS loader-ах и memory manager-ах. Может тогда проще накидать свой загружчик в com который обеспечит подгрузку и диспечеризацию любого количества 64кб оверлеев.Shaos wrote:P.S. А вот так предполагается создавать простые EXE-файлы:8.1.2 Using the bin Format To Generate .EXE Files
Code: Select all
mov ax,[bx]
Code: Select all
mov ax,a
a dw 0
Code: Select all
mov ax,ds:[0]
Code: Select all
mov ax,[bx]
mov ax,[a]
mov ax,[1234h]