Hallo helpy,
nun hats geklappt. FolgendenPB-Code habe ich umgewandelt.
Code: Alles auswählen
StartTime = ElapsedMilliseconds()
For i = 1 To 100000000
k = 27.3*3.33333
k = 27.3*3.33333
Next i
Time = ElapsedMilliseconds() - StartTime
MessageRequester("Information", Str(Time))
Und hier ist das Ergebnis: Doch wenn ich den ASM-Code mit PB wieder in ein ausführbares Programm erstellen will (vor die erste Zeile habe ich enableasm und hinter die letzte Zeile disableasm eingefügt) kommt ein syntaxfehler für die Zeile format MS COFF.
Ich möchte nur mal schauen was der PB-Compiler aus einer Schleife macht und in die Schleife mal den ein oder anderen Assemblerbefehl einbauen.
Code: Alles auswählen
;
; PureBasic 5.30 Beta 6 (Windows - x86) generated code
;
; (c) 2014 Fantaisie Software
;
; The header must remain intact for Re-Assembly
;
; System
; String
; Requester
; FileSystem
; Date
; Object
; SimpleList
; :System
; KERNEL32
; :Import
;
format MS COFF
;
;
extrn _PB_ElapsedMilliseconds@0
extrn _PB_FreeFileSystem@0
extrn _PB_InitRequester@0
extrn _PB_MessageRequester@8
extrn _PB_Str@12
extrn _ExitProcess@4
extrn _GetModuleHandleA@4
extrn _HeapCreate@12
extrn _HeapDestroy@4
extrn _memset
extrn PB_StringBase
extrn _SYS_InitString@0
extrn _SYS_FreeStrings@0
;
extrn _PB_StringBasePosition
public _PB_Instance
public _PB_ExecutableType
public _PB_OpenGLSubsystem
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 4096
;
;
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_InitRequester@0
; StartTime = ElapsedMilliseconds()
CALL _PB_ElapsedMilliseconds@0
MOV dword [v_StartTime],eax
;
; For i = 1 To 100000000
MOV dword [v_i],1
_For1:
MOV eax,100000000
CMP eax,dword [v_i]
JL _Next2
; k = 27.3*3.33333
MOV dword [v_k],91
; k = 27.3*3.33333
MOV dword [v_k],91
; Next i
_NextContinue2:
INC dword [v_i]
JNO _For1
_Next2:
; Time = ElapsedMilliseconds() - StartTime
CALL _PB_ElapsedMilliseconds@0
MOV ebx,eax
SUB ebx,dword [v_StartTime]
MOV dword [v_Time],ebx
; MessageRequester("Information", Str(Time))
MOV edx,[_PB_StringBasePosition]
PUSH edx
PUSH edx
PUSH dword [_PB_StringBasePosition]
MOV eax,dword [v_Time]
CDQ
PUSH edx
PUSH eax
CALL _PB_Str@12
INC dword [_PB_StringBasePosition]
PUSH dword _S1
MOV edx,[PB_StringBase]
ADD [esp+4],edx
CALL _PB_MessageRequester@8
POP dword [_PB_StringBasePosition]
_PB_EOP_NoValue:
PUSH dword 0
_PB_EOP:
CALL _PB_EndFunctions
CALL _SYS_FreeStrings@0
PUSH dword [PB_MemoryBase]
CALL _HeapDestroy@4
CALL _ExitProcess@4
_PB_EndFunctions:
CALL _PB_FreeFileSystem@0
RET
;
;
section '.data' data readable writeable
;
_PB_DataSection:
_PB_OpenGLSubsystem: db 0
pb_public PB_DEBUGGER_LineNumber
dd -1
pb_public PB_DEBUGGER_IncludedFiles
dd 0
pb_public PB_DEBUGGER_FileName
db 0
pb_public PB_Compiler_Unicode
dd 0
pb_public PB_Compiler_Thread
dd 0
pb_public PB_Compiler_Purifier
dd 0
pb_public PB_Compiler_Debugger
dd 0
_PB_ExecutableType: dd 0
public _SYS_StaticStringStart
_SYS_StaticStringStart:
_S1: db "Information",0
pb_public PB_NullString
db 0
public _SYS_StaticStringEnd
_SYS_StaticStringEnd:
align 4
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_i rd 1
v_k rd 1
v_Time rd 1
v_StartTime rd 1
align 4
align 4
align 4
align 4
I_BSSEnd:
section '.code' code readable executable align 4096
section '.data' data readable writeable
SYS_EndDataSection: