Вверх ↑
Ответов: 1429
Рейтинг: 50
#1: 2012-03-26 11:10:37 ЛС | профиль | цитата
1nd1g0, можно, просто я еще не посмотрел. Там нужно указать опцию, сохранять FASM код. Пока ищу ее.
------------ Дoбавленo в 10.11:
Нашел
Вот код для a=1+1 на чистом листе :


; 
; PureBasic 4.51 (Windows - x86) generated code
;
; (c) 2010 Fantaisie Software
;
; The header must remain intact for Re-Assembly
;
; Window
; Event
; Gadget
; Date
; 2DDrawing
; Image
; AlphaImage
; ImagePlugin
; Object
; SimpleList
; :System
; KERNEL32
; :Import
;
format MS COFF
;
extrn _ExitProcess@4
extrn _GetModuleHandleA@4
extrn _HeapCreate@12
extrn _HeapDestroy@4
;
extrn _PB_EndAlphaImage@0
extrn _PB_Event_Init@0
extrn _PB_FreeGadgets@0
extrn _PB_FreeImages@0
extrn _PB_FreeWindows@0
extrn _PB_Init2DDrawing@0
extrn _PB_InitAlphaImage@0
extrn _PB_InitGadget@0
extrn _PB_InitImage@0
extrn _PB_InitImageDecoder@0
extrn _PB_InitWindow@0
extrn _PB_OpenWindow2@28
extrn _PB_WaitWindowEvent@0
extrn _memset
extrn _PB_StringBase
extrn PB_StringBase
extrn _SYS_InitString@0
;
extrn _PB_StringBasePosition
public _PB_Instance
public _PB_ExecutableType
public _PB_MemoryBase
public PB_Instance
public PB_MemoryBase
public _PB_EndFunctions

macro pb_public symbol
{
public _#symbol
public symbol
_#symbol:
symbol:
}

macro pb_align value { rb (value-1) - ($-_PB_DataSection + value-1) mod value }
macro pb_bssalign value { rb (value-1) - ($-_PB_BSSSection + value-1) mod value }
extrn SYS_CpuID
public PureBasicStart
;
section '.code' code readable executable align 8
;
;
PureBasicStart:
;
PUSH dword I_BSSEnd-I_BSSStart
PUSH dword 0
PUSH dword I_BSSStart
CALL _memset
ADD esp,12
PUSH dword 0
CALL _GetModuleHandleA@4
MOV [_PB_Instance],eax
PUSH dword 0
PUSH dword 4096
PUSH dword 0
CALL _HeapCreate@12
MOV [PB_MemoryBase],eax
CALL SYS_CpuID
;
CALL _SYS_InitString@0
CALL _PB_InitImageDecoder@0
CALL _PB_InitAlphaImage@0
CALL _PB_InitImage@0
CALL _PB_Init2DDrawing@0
CALL _PB_InitGadget@0
CALL _PB_Event_Init@0
CALL _PB_InitWindow@0
;
; OpenWindow(0,0,0,332,219,"Form",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_ScreenCentered)
MOV dword [CLN],1
PUSH dword 13303809
PUSH dword _S1
PUSH dword 219
PUSH dword 332
PUSH dword 0
PUSH dword 0
PUSH dword 0
CALL _PB_OpenWindow2@28
;
;
; Repeat
_Repeat1:
MOV dword [CLN],4
; a1.i
MOV dword [CLN],5
; a=1+1
MOV dword [CLN],6
MOV dword [v_a],2
;
; Until WaitWindowEvent() = #PB_Event_CloseWindow : End
MOV dword [CLN],8
CALL _PB_WaitWindowEvent@0
MOV ebx,eax
CMP ebx,16
JNE _Repeat1
_Until1:
MOV dword [CLN],8
JMP _PB_EOP_NoValue
;
;
;
_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_FreeWindows@0
CALL _PB_FreeGadgets@0
CALL _PB_FreeImages@0
CALL _PB_EndAlphaImage@0
RET
;
;
section '.data' data readable writeable
;
_PB_DataSection:
CLN:
pb_public PB_DEBUGGER_LineNumber
dd 0
pb_public PB_DEBUGGER_FileName
db "C:\Program Files\HiAsm\Elements\PureBasic\code\Pure.pb",0
pb_public PB_DEBUGGER_NbIncludedFiles
dd 0
pb_public PB_DEBUGGER_IncludedFiles
_PB_ExecutableType: dd 0
;
; Dynamic functions jump table
;
public _SYS_StaticStringStart
_SYS_StaticStringStart:
_S1: db "Form",0
pb_public PB_NullString
db 0
public _SYS_StaticStringEnd
_SYS_StaticStringEnd:
align 4
align 4
s_s:
dd 0
dd -1
align 4
;
section '.bss' readable writeable
_PB_BSSSection:
align 4
;
I_BSSStart:
_PB_MemoryBase:
PB_MemoryBase: rd 1
_PB_Instance:
PB_Instance: rd 1
;
align 4
PB_DataPointer rd 1
v_a1 rd 1
v_a rd 1
align 4
align 4
align 4
align 4
I_BSSEnd:
section '.data' data readable writeable
SYS_EndDataSection:



ТОлько я не понимаю его
(нет это с 1 формой, на чистом листе пока не получается сделать, это надо в родной среде прописать ключ, а я не знаю где там его прописать)

да, тут не на что смотреть, это с дебагером, инлайном, формой и всяким бредом. Приложение без формы занимает 3 кб.
Надо будет как-то разобраться как его посмотреть.

Сделал:
Вот код:

#hws
x=1+1
x=2+2
x=3+3
x=4+4

Размер exe 2кб.


; 
; PureBasic 4.40 (Windows - x86) generated code
;
; (c) 2009 Fantaisie Software
;
; The header must remain intact for Re-Assembly
;
; :System
; KERNEL32
; :Import
;
format MS COFF
;
extrn _ExitProcess@4
extrn _GetModuleHandleA@4
extrn _HeapCreate@12
extrn _HeapDestroy@4
;
extrn _memset
public _PB_Instance
public _PB_ExecutableType
public _PB_MemoryBase
public PB_Instance
public PB_MemoryBase
public _PB_EndFunctions

macro pb_public symbol
{
public _#symbol
public symbol
_#symbol:
symbol:
}

macro pb_align value { rb (value-1) - ($-_PB_DataSection + value-1) mod value }
macro pb_bssalign value { rb (value-1) - ($-_PB_BSSSection + value-1) mod value }
public PureBasicStart
;
section '.code' code readable executable align 8
;
;
PureBasicStart:
;
PUSH dword I_BSSEnd-I_BSSStart
PUSH dword 0
PUSH dword I_BSSStart
CALL _memset
ADD esp,12
PUSH dword 0
CALL _GetModuleHandleA@4
MOV [_PB_Instance],eax
PUSH dword 0
PUSH dword 4096
PUSH dword 0
CALL _HeapCreate@12
MOV [PB_MemoryBase],eax
;
; x=1+1
MOV dword [v_x],2
; x=2+2
MOV dword [v_x],4
; x=3+3
MOV dword [v_x],6
; x=4+4
MOV dword [v_x],8
_PB_EOP_NoValue:
PUSH dword 0
_PB_EOP:
CALL _PB_EndFunctions
PUSH dword [PB_MemoryBase]
CALL _HeapDestroy@4
CALL _ExitProcess@4
_PB_EndFunctions:
RET
;
;
section '.data' data readable writeable
;
_PB_DataSection:
pb_public PB_DEBUGGER_LineNumber
dd -1
pb_public PB_DEBUGGER_IncludedFiles
dd 0
pb_public PB_DEBUGGER_FileName
db 0
_PB_ExecutableType: dd 0
align 4
align 4
s_s:
dd 0
dd -1
align 4
;
section '.bss' readable writeable
_PB_BSSSection:
align 4
;
I_BSSStart:
_PB_MemoryBase:
PB_MemoryBase: rd 1
_PB_Instance:
PB_Instance: rd 1
;
align 4
PB_DataPointer rd 1
v_x rd 1
align 4
align 4
align 4
align 4
I_BSSEnd:
section '.data' data readable writeable
SYS_EndDataSection:

------------ Дoбавленo в 11.10:
А вот код теста скорости темы топика, тот самый, который за 1 мс выполняется.


; 
; PureBasic 4.40 (Windows - x86) generated code
;
; (c) 2009 Fantaisie Software
;
; The header must remain intact for Re-Assembly
;
; Gadget
; Window
; 2DDrawing
; Image
; ImagePlugin
; Object
; SimpleList
; Date
; AlphaImage
; :System
; KERNEL32
; :Import
;
format MS COFF
;
extrn _ExitProcess@4
extrn _GetModuleHandleA@4
extrn _HeapCreate@12
extrn _HeapDestroy@4
extrn _QueryPerformanceCounter@4
;
extrn _PB_ButtonGadget@24
extrn _PB_EndAlphaImage@0
extrn _PB_EventGadget@0
extrn _PB_FreeGadgets@0
extrn _PB_FreeImages@0
extrn _PB_FreeWindows@0
extrn _PB_Init2DDrawing@0
extrn _PB_InitAlphaImage@0
extrn _PB_InitGadget@0
extrn _PB_InitImage@0
extrn _PB_InitImageDecoder@0
extrn _PB_InitWindow@0
extrn _PB_OpenWindow@24
extrn _PB_WaitWindowEvent@0
extrn _memset
extrn _PB_StringBase
extrn PB_StringBase
extrn _SYS_InitString@0
;
extrn _PB_StringBasePosition
public _PB_Instance
public _PB_ExecutableType
public _PB_MemoryBase
public PB_Instance
public PB_MemoryBase
public _PB_EndFunctions

macro pb_public symbol
{
public _#symbol
public symbol
_#symbol:
symbol:
}

macro pb_align value { rb (value-1) - ($-_PB_DataSection + value-1) mod value }
macro pb_bssalign value { rb (value-1) - ($-_PB_BSSSection + value-1) mod value }
public PureBasicStart
;
section '.code' code readable executable align 8
;
;
PureBasicStart:
;
PUSH dword I_BSSEnd-I_BSSStart
PUSH dword 0
PUSH dword I_BSSStart
CALL _memset
ADD esp,12
PUSH dword 0
CALL _GetModuleHandleA@4
MOV [_PB_Instance],eax
PUSH dword 0
PUSH dword 4096
PUSH dword 0
CALL _HeapCreate@12
MOV [PB_MemoryBase],eax
CALL _SYS_InitString@0
CALL _PB_InitAlphaImage@0
CALL _PB_InitImageDecoder@0
CALL _PB_InitImage@0
CALL _PB_Init2DDrawing@0
CALL _PB_InitWindow@0
CALL _PB_InitGadget@0
;
; QueryCount1.q
; QueryCount2.q
; HPB_For4i_pos.i
; HPB_For5i_pos.i
;
; OpenWindow(1, 0, 0, 390, 261, "pbtest")
PUSH dword _S1
PUSH dword 261
PUSH dword 390
PUSH dword 0
PUSH dword 0
PUSH dword 1
CALL _PB_OpenWindow@24
; ButtonGadget(2, 175, 110, 55, 20, "Push")
PUSH dword _S2
PUSH dword 20
PUSH dword 55
PUSH dword 110
PUSH dword 175
PUSH dword 2
CALL _PB_ButtonGadget@24
;
; Repeat
_Repeat1:
; EventID.l = WaitWindowEvent()
CALL _PB_WaitWindowEvent@0
MOV dword [v_EventID],eax
;
; If EventGadget() = 2
CALL _PB_EventGadget@0
MOV ebx,eax
CMP ebx,2
JNE _EndIf3
; QueryPerformanceCounter_(@QueryCount1)
PUSH dword v_QueryCount1
CALL _QueryPerformanceCounter@4
; For HPB_For4i_pos = 1 To 100000
MOV dword [v_HPB_For4i_pos],1
_For4:
MOV eax,100000
CMP eax,dword [v_HPB_For4i_pos]
JL _Next5
; For HPB_For5i_pos = 1 To 18
MOV dword [v_HPB_For5i_pos],1
_For6:
MOV eax,18
CMP eax,dword [v_HPB_For5i_pos]
JL _Next7
; If HPB_For5i_pos >= 11 And HPB_For5i_pos <= 16
MOV ebx,dword [v_HPB_For5i_pos]
CMP ebx,11
JL No0
MOV ebx,dword [v_HPB_For5i_pos]
CMP ebx,16
JG No0
Ok0:
MOV eax,1
JMP End0
No0:
XOR eax,eax
End0:
AND eax,eax
JE _EndIf9
; EmuleMem.b = 0
MOV byte [v_EmuleMem],0
; EndIf
_EndIf9:
; If HPB_For5i_pos = 17
MOV ebx,dword [v_HPB_For5i_pos]
CMP ebx,17
JNE _EndIf11
; EmuleMem.b = 1
MOV byte [v_EmuleMem],1
; EndIf
_EndIf11:
; Next
_NextContinue7:
INC dword [v_HPB_For5i_pos]
JNO _For6
_Next7:
; Next
_NextContinue5:
INC dword [v_HPB_For4i_pos]
JNO _For4
_Next5:
; QueryPerformanceCounter_(@QueryCount2)
PUSH dword v_QueryCount2
CALL _QueryPerformanceCounter@4
; Debug "Hardware Timer: "+Str((QueryCount2 - QueryCount1) / 1000000)
; EndIf
_EndIf3:
;
; If EventID = #PB_Event_CloseWindow : End : EndIf
MOV ebx,dword [v_EventID]
CMP ebx,16
JNE _EndIf13
JMP _PB_EOP_NoValue
_EndIf13:
; ForEver
JMP _Repeat1
_Until1:
;
;
_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_FreeGadgets@0
CALL _PB_FreeWindows@0
CALL _PB_FreeImages@0
CALL _PB_EndAlphaImage@0
RET
;
;
section '.data' data readable writeable
;
_PB_DataSection:
pb_public PB_DEBUGGER_LineNumber
dd -1
pb_public PB_DEBUGGER_IncludedFiles
dd 0
pb_public PB_DEBUGGER_FileName
db 0
_PB_ExecutableType: dd 0
public _SYS_StaticStringStart
_SYS_StaticStringStart:
_S2: db "Push",0
_S1: db "pbtest",0
pb_public PB_NullString
db 0
public _SYS_StaticStringEnd
_SYS_StaticStringEnd:
align 4
align 4
s_s:
dd 0
dd -1
align 4
;
section '.bss' readable writeable
_PB_BSSSection:
align 4
;
I_BSSStart:
_PB_MemoryBase:
PB_MemoryBase: rd 1
_PB_Instance:
PB_Instance: rd 1
;
align 4
v_QueryCount1 rq 1
v_QueryCount2 rq 1
PB_DataPointer rd 1
v_HPB_For4i_pos rd 1
v_HPB_For5i_pos rd 1
v_EventID rd 1
v_EmuleMem rb 1
align 4
align 4
align 4
align 4
I_BSSEnd:
section '.data' data readable writeable
SYS_EndDataSection:



карма: 0

0