You say you want pure or clean assembly, is this along those lines?
taken from The Assembly Programmers Master Book
language masm32
assembler,linker ml,link
source;
.586P
; Flat memory model
.MODEL FLAT, STDCALL
;---------------------------------------
; Data segment
_DATA SEGMENT
_DATA ENDS
; Code segment
_TEXT SEGMENT
START:
RET ; Exit
_TEXT ENDS
END START
assembly & linking;
ML /c /coff PROG1.ASM
LINK /SUBSYSTEM:WINDOWS PROG1.0BJ
This program was literally called "Do Nothing" but it is pure masm that just does nothing.
If you want to program in windows without the help of C you will have to program with the WIN32 api, you can find a reference to this api on the net called win.hlp
win32.hlp
, it would appear to be on this web-page
Perhaps a handy link -> MASM 6.1 Documentation
EDIT: Using as
(gas) & ld
;
.globl _start
_start: // ld looks for _start by default
movl $22, %eax // AT&T syntax
ret
compile;
c:\Users\James\Desktop\asm\>as file.s
c:\Users\James\Desktop\asm\>ld a.out
c:\Users\James\Desktop\asm\>a.exe
c:\Users\James\Desktop\asm\>echo %errorlevel%
22
Disassembly of section .text:
00401000 <_start>:
401000: b8 16 00 00 00 mov $0x16,%eax
401005: c3 ret
401006: 90 nop
401007: 90 nop
Simply putting ret
is not going to get you far, you can get the assembly listings of your c/c++ programs by compiling with the -S
flag (-masm=intel
gives you intels syntax).
That said you need to specify an entry point
for the linker to know where the code begins, you also need to create a text segment
for the code, here is a really really simple example that returns 1
;
.text
.intel_syntax noprefix
.globl _main
_main: // entry point!
mov eax, 1
ret
gcc [file].s
yeilds a.exe