BITS 32
ORG  0

GetStdHandle equ 0x7D4EFBC2
WriteFile    equ 0x7D4EAAE9
BaseAddress  equ 0x00400000

	dw "MZ"
hello:	db "Hello, world!", 0
entry:	push -11
	mov  eax, GetStdHandle
	call eax
	push 0
	push 0
	push 13
	push BaseAddress+hello
	push eax
	mov  eax, WriteFile
	call eax
	ret

	align 8, db 0

pe_hdr:	db "PE", 0, 0	; Magic
	dw 0x014C	; CPU i386
	dw 1		; Number of Sections
	dd 0
	dd pe_hdr
	dd 0
	dw sectbl-4-$	; SectionTable Offset
	dw 0x0103	; Flags
sectbl:	dw 0x010B	; Reserved
	dw 0
	dd 0
	dd 0
	dd 0x1000
	dd entry	; Entry Point
	dd 0
	dd 0
	dd BaseAddress	; Base Address
	dd 0x1000	; Section Align
	dd 0x0200	; File Align
	dd 0
	dd 0
	dw 4		; Subsys Major Ver
	dw 0
	dd 0
	dd 0x2000	; Size Of Image
	dd 0x0100	; Size Of Headers
	dd 0
	db 3		; Subsystem:console
