Reassembly since 3.91/3.90?
Posted: Sat Oct 16, 2004 10:36 am
Is this the correct syntax to re-assemble a file:
And nothing else because it uses the PureBasic.asm file? I've tried it with the name of the original source file too, but no luck. Either I'm being a chump or something's broken because I get nothing out of the compiler after "Creating executable", but the file "Compilers\Linker.out" contains the following:
The original PB code was:
And the generated assembly output was:
Code: Select all
pbcompiler /REASM
Code: Select all
POLINK: error: Unresolved external symbol '_PB_InitSimpleList'.
POLINK: error: Unresolved external symbol '_PB_InitRequester'.
POLINK: error: Unresolved external symbol '_PB_MessageRequester2'.
POLINK: error: Unresolved external symbol '_PB_FreeSimpleLists'.
POLINK: fatal error: 4 unresolved external(s).
Code: Select all
MessageRequester("foo", "bar", #MB_OK)
End
Code: Select all
;
; PureBasic x86 v3.91 generated code
;
; (c) 2004 Fantaisie Software
;
; The header must remain intact for Re-Assembly
;
; Requester
; SimpleList
;
format MS COFF
;
extrn _ExitProcess@4
extrn _GetModuleFileNameA@12
extrn _GetModuleHandleA@4
extrn _HeapAlloc@12
extrn _HeapCreate@12
extrn _HeapDestroy@4
extrn _HeapFree@12
extrn _SetCurrentDirectoryA@4
;
extrn _PB_FreeSimpleLists@0
extrn _PB_InitRequester@0
extrn _PB_InitSimpleList@0
extrn _PB_MessageRequester2@12
extrn _memset
extrn SYS_AllocateString
extrn SYS_FastAllocateString
extrn SYS_FastAllocateStringFree
extrn SYS_FreeString
extrn SYS_CopyString
extrn SYS_StringEqual
extrn SYS_StringSup
extrn SYS_StringInf
public PB_NullString
;
public _PB_Instance
public _PBV_ExecutableType
public _PB_FullPath
public _PB_MemoryBase
public PB_Instance
public PB_MemoryBase
public _PB_EndFunctions
public _PB_StringBase
public PB_StringBase
public _PB_DEBUGGER_LineNumber
public _PB_DEBUGGER_IncludedFiles
macro align value { rb (value-1) - ($-_PB_DataSection + value-1) mod value }
macro bssalign value { rb (value-1) - ($-_PB_BSSSection + value-1) mod value }
public _WinMain@16
;
section '.text' code readable executable
;
;
_WinMain@16:
;
PUSH dword I_BSSEnd-I_BSSStart
PUSH dword 0
PUSH dword I_BSSStart
CALL _memset
ADD esp,12
MOV eax,[esp+4]
MOV [_PB_Instance],eax
PUSH dword 0
PUSH dword 4000
PUSH dword 0
CALL _HeapCreate@12
MOV [PB_MemoryBase],eax
PUSH dword 500
PUSH dword _PB_FullPath
PUSH dword [_PB_Instance]
CALL _GetModuleFileNameA@12
MOV eax, _PB_FullPath
MOV ecx,eax
PB_GetPathLoop:
MOV dh,[eax]
INC eax
CMP dh,'\'
JNE PB_GetPathSkip
MOV ecx,eax
PB_GetPathSkip:
CMP dh,0
JNE PB_GetPathLoop
MOV byte [ecx],0
CALL _PB_InitSimpleList@0
CALL _PB_InitRequester@0
;
; InitString()
;
PUSH dword 64000
PUSH dword 8
PUSH dword [PB_MemoryBase]
CALL _HeapAlloc@12
MOV [PB_StringBase],eax
; :
; MessageRequester("foo", "bar", #MB_OK)
PUSH dword 0
PUSH dword _S1
PUSH dword _S2
CALL _PB_MessageRequester2@12
; End
JMP _PB_EOP_NoValue
;
; ExecutableFormat=Windows
; CursorPosition=2
; FirstLine=1
; EOF
_PB_EOP_NoValue:
PUSH dword 0
_PB_EOP:
CALL _PB_EndFunctions
PUSH dword [PB_MemoryBase]
CALL _HeapDestroy@4
CALL _ExitProcess@4
_PB_EndFunctions:
CALL _PB_FreeSimpleLists@0
RET
;
;
section '.data' Data readable writeable
;
_PB_DataSection:
_PB_DEBUGGER_LineNumber: dd -1
_PB_DEBUGGER_IncludedFiles: dd 0
_PBV_ExecutableType: dd 0
_S1: db "bar",0
_S2: db "foo",0
PB_NullString: db 0
;
section '.bss' readable writeable
_PB_BSSSection:
bssalign 4
;
I_BSSStart:
_PB_MemoryBase:
PB_MemoryBase: rd 1
_PB_StringBase:
PB_StringBase: rd 1
_PB_Instance:
PB_Instance: rd 1
_PB_FullPath: rb 500
;
bssalign 4
PB_DataPointer rd 1
bssalign 4
bssalign 4
bssalign 4
bssalign 4
I_BSSEnd:
section '.data' Data readable writeable
SYS_EndDataSection:
; ExecutableFormat=
; FirstLine=1
; EOF