Страница 1 из 2
-
GeNeZiS
New Member
- Публикаций:
-
0
- Регистрация:
- 14 сен 2006
- Сообщения:
- 135
Доброго времени суток, уважаемые.
Интересует такой вопрос.
Как в FASMe при компиляции добавить к файлу информацию о версии, авторе и т.д. + иконку.
Благодарю за внимание. -
diamond
New Member
- Публикаций:
-
0
- Регистрация:
- 21 май 2004
- Сообщения:
- 507
- Адрес:
- Russia
RTFM
Конкретно: мануал по fasm’у, раздел 3.1.6 «Resources». -
GeNeZiS
New Member
- Публикаций:
-
0
- Регистрация:
- 14 сен 2006
- Сообщения:
- 135
Смотрю http://flatassembler.net/docs.php?article=manual
не могу найти такой раздел… что за мануал у вас? -
Shtirlitz1945
New Member
- Публикаций:
-
0
- Регистрация:
- 13 апр 2008
- Сообщения:
- 5
Можно так:
-
section ‘.data’ data readable writeable
-
section ‘.code’ code readable executable
-
invoke MessageBox,HWND_DESKTOP,cpt,msg,MB_OK
-
section ‘.idata’ import data readable writeable
-
library kernel32,’KERNEL32.DLL’,
-
include ‘apikernel32.inc’
-
section ‘.rsrc’ resource data readable
-
directory RT_ICON,icons,
-
RT_GROUP_ICON,group_icons,
-
17,LANG_NEUTRAL,main_icon
-
icon main_icon,icon_data,’1.ico’
-
versioninfo version,VOS__WINDOWS32,VFT_APP,VFT2_UNKNOWN,LANG_ENGLISH+SUBLANG_DEFAULT,0,
-
‘FileDescription’,’Hello World — example program’,
-
‘LegalCopyright’,’©Microsoft Corporation. No rights reserved.’,
-
‘CompanyName’,’Microsoft Corporation’,
-
‘ProductName’,’Hello World’,
-
‘OriginalFilename’,’HELLO.EXE’
но имхо проще отдельно ресурсы компилировать.
Мануал идёт в комплекте с компилятором. -
GeNeZiS
New Member
- Публикаций:
-
0
- Регистрация:
- 14 сен 2006
- Сообщения:
- 135
Все нашел. Всем спасибо. Разобрался
-
Loginanton
New Member
- Публикаций:
-
0
- Регистрация:
- 8 май 2008
- Сообщения:
- 74
А у меня такой вопрос: в каждой проге надо писать в конце импорт библиотек и функций win api. Можно это как то автоматизировать? А то это может и пол часа занять.
Я вот про что говорю:-
section ‘.idata’ import data readable writeable
-
library KERNEL32, ‘KERNEL32.DLL’,
-
GetModuleHandle, ‘GetModuleHandleA’,
-
ExitProcess, ‘ExitProcess’
-
RegisterClass, ‘RegisterClassA’,
-
CreateWindowEx, ‘CreateWindowExA’,
-
DefWindowProc, ‘DefWindowProcA’,
-
ShowWindow, ‘ShowWindow’,
-
LoadCursor, ‘LoadCursorA’,
-
BeginPaint, ‘BeginPaint’,
-
InvalidateRect, ‘InvalidateRect’,
-
GetMessage, ‘GetMessageA’,
-
TranslateMessage, ‘TranslateMessage’,
-
DispatchMessage, ‘DispatchMessageA’,
-
PostQuitMessage, ‘PostQuitMessage’
-
Asterix
New Member
- Публикаций:
-
0
- Регистрация:
- 25 фев 2003
- Сообщения:
- 3.576
можно так
-
section ‘.idata’ import data readable
-
library kernel32,’KERNEL32.DLL’,
-
include ‘%fasminc%APIAKERNEL32.INC’
-
include ‘%fasminc%APIAUSER32.INC’
-
leo
Active Member
- Публикаций:
-
0
- Регистрация:
- 4 авг 2004
- Сообщения:
- 2.542
- Адрес:
- Russia
При использовании win32ax.inc можно и в масмовском стиле:
-
.end start ;создает секцию импорта
-
Sol_Ksacap
Миша
- Публикаций:
-
0
- Регистрация:
- 6 мар 2008
- Сообщения:
- 623
Ещё можно заюзать Vortex’s scanПеред ассемблированием:
scan.exe source.asm -f -o:idata.inc
Scan находит все «invoke», «cinvoke» и создаёт файл idata.inc, в который прописывает весь импорт.
Для инклудов, сканить которые на наличие импорта не нужно, можно поставить коммент ;* -
GoldFinch
New Member
- Публикаций:
-
0
- Регистрация:
- 29 мар 2008
- Сообщения:
- 1.775
я юзаю макрос
-
common section ‘.idata’ import data readable writeable
-
forward dd 0,0,0,RVA name#_str,RVA name#_table
-
forward name#_str db `name#».DLL»,0
-
irp label,list {label dd RVA label#_str }
-
irp label,list {label#_str db 0,0,`label,0 } }
-
USED KERNEL32,<GetModuleHandleA,ExitProcess>,
-
USER32,<RegisterClassA,CreateWindowExA,…>,
-
Loginanton
New Member
- Публикаций:
-
0
- Регистрация:
- 8 май 2008
- Сообщения:
- 74
спасибо всем, мне больше всего способ Asterixа понравился
-
dgs
New Member
- Публикаций:
-
0
- Регистрация:
- 23 июн 2008
- Сообщения:
- 434
Еще интересный вариант:
-
section ‘.idata’ import data readable writeable
-
macro import lib,[functions]
-
{ common macro import_#lib { import lib,functions } }
-
{ common macro all_api { all_api
-
include ‘….includeapi/kernel32.inc’
-
include ‘….includeapi/user32.inc’
-
include ‘….includeapi/gdi32.inc’
-
include ‘….includeapi/advapi32.inc’
-
include ‘….includeapi/comctl32.inc’
-
include ‘….includeapi/comdlg32.inc’
-
include ‘….includeapi/shell32.inc’
-
include ‘….includeapi/wsock32.inc’
-
library kernel32,’KERNEL32.DLL’,
-
advapi32,’ADVAPI32.DLL’,
-
comctl32,’COMCTL32.DLL’,
-
comdlg32,’COMDLG32.DLL’,
И впихнуть это дело в файл к примеру Win32Api.inc и в каждый проект инклюдировать.
-
Loginanton
New Member
- Публикаций:
-
0
- Регистрация:
- 8 май 2008
- Сообщения:
- 74
Народ помогите пожалуйста. Вот код программы (сам писал):
-
include ‘includewin32a.inc’
-
section ‘data’ data readable writeable
-
_wName TCHAR ‘My Window :D’,0
-
section ‘code’ code readable executable
-
;===== берём хендлы всего что пригодится =====
-
invoke GetModuleHandle, 0
-
invoke LoadIcon, 0, IDI_APPLICATION
-
invoke LoadCursor, 0, IDC_ARROW
-
;===== регистрируем класс =====
-
mov [_wc.style], CS_HREDRAW+CS_VREDRAW
-
mov [_wc.lpfnWndProc], WindowProcess
-
mov [_wc.hInstance], _mHandle
-
mov [_wc.hIcon], _iHandle
-
mov [_wc.hCursor], _cHandle
-
mov [_wc.hbrBackground], COLOR_WINDOW
-
mov [_wc.lpszMenuName], 0
-
mov [_wc.lpszClassName], _cName
-
invoke RegisterClass, _wc
-
;===== создаём окно =====
-
invoke CreateWindowEx, 0, _cName, _wName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, _mHandle, 0
-
;===== показываем и обновляем =====
-
invoke ShowWindow, _wHandle, SW_NORMAL
-
invoke UpdateWindow, _wHandle
-
;===== бесконечный цикл =====
-
invoke GetMessage, _msg, 0, 0, 0
-
invoke TranslateMessage, _msg
-
invoke DispatchMessage, _msg
-
invoke ExitProcess, [_msg.wParam]
-
proc WindowProcess wHandle, msg, wparam, lparam
-
invoke DefWindowProc, [wHandle], [msg], [wparam], [lparam]
-
invoke PostQuitMessage, 0
-
section ‘idata’ import data readable
-
library kernel32, ‘KERNEL32.DLL’, user32, ‘USER32.DLL’, gdi32, ‘GDI32.DLL’
-
include ‘includeapikernel32.inc’
-
include ‘includeapiuser32.inc’
-
include ‘includeapigdi32.inc’
Собственно в чём проблема: пишет ошибку. Помогите пожалуйста найти ошибку в коде, а то я первый день кожу на фасме
Заранее спасибо! -
twgt
New Member
- Публикаций:
-
0
- Регистрация:
- 15 янв 2007
- Сообщения:
- 1.494
На вскидку — ret нужен
-
invoke PostQuitMessage, 0
Насколько я понял, процедура считается только до 1го ret’а
Поэтому в фасме лучше писать так:-
proc WindowProcess wHandle, msg, wparam, lparam
-
invoke DefWindowProc, [wHandle], [msg], [wparam], [lparam]
-
invoke PostQuitMessage, 0
Это необходимо по многим причинам, например для правильного восстановления стека.
-
Loginanton
New Member
- Публикаций:
-
0
- Регистрация:
- 8 май 2008
- Сообщения:
- 74
всё равно не компилится нормально
-
twgt
New Member
- Публикаций:
-
0
- Регистрация:
- 15 янв 2007
- Сообщения:
- 1.494
Loginanton
Какие сообщения об ошибках появляются? Я просто скопировал твой пример, он компилируется без ошибок, только со стеком были проблемы, где указал.Ошибка вознакает на
??
-
Loginanton
New Member
- Публикаций:
-
0
- Регистрация:
- 8 май 2008
- Сообщения:
- 74
error: write failed
-
include ‘includewin32a.inc’
-
section ‘data’ data readable writeable
-
_wName TCHAR ‘My Window :D’,0
-
section ‘code’ code readable executable
-
;===== берём хендлы всего что пригодится =====
-
invoke GetModuleHandle, 0
-
invoke LoadIcon, 0, IDI_APPLICATION
-
invoke LoadCursor, 0, IDC_ARROW
-
;===== регистрируем класс =====
-
mov [_wc.style], CS_HREDRAW+CS_VREDRAW
-
mov [_wc.lpfnWndProc], WindowProcess
-
mov [_wc.hInstance], _mHandle
-
mov [_wc.hIcon], _iHandle
-
mov [_wc.hCursor], _cHandle
-
mov [_wc.hbrBackground], COLOR_WINDOW
-
mov [_wc.lpszMenuName], 0
-
mov [_wc.lpszClassName], _cName
-
invoke RegisterClass, _wc
-
;===== создаём окно =====
-
invoke CreateWindowEx, 0, _cName, _wName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, [_mHandle], 0
-
;===== показываем и обновляем =====
-
invoke ShowWindow, [_wHandle], SW_SHOW
-
invoke UpdateWindow, [_wHandle]
-
;===== бесконечный цикл =====
-
invoke GetMessage, _msg, 0, 0, 0
-
invoke TranslateMessage, _msg
-
invoke DispatchMessage, _msg
-
invoke ExitProcess, [_msg.wParam]
-
proc WindowProcess wHandle, msg, wparam, lparam
-
invoke DefWindowProc, [wHandle], [msg], [wparam], [lparam]
-
invoke PostQuitMessage, 0
-
section ‘idata’ import data readable
-
library kernel32, ‘KERNEL32.DLL’, user32, ‘USER32.DLL’, gdi32, ‘GDI32.DLL’
-
include ‘includeapikernel32.inc’
-
include ‘includeapiuser32.inc’
-
include ‘includeapigdi32.inc’
-
twgt
New Member
- Публикаций:
-
0
- Регистрация:
- 15 янв 2007
- Сообщения:
- 1.494
Это значит что fasm не может записать в exe файл данные. Т.е. этот exe в памяти висит. Ctrl+Alt+Del и убей процесс.
-
Loginanton
New Member
- Публикаций:
-
0
- Регистрация:
- 8 май 2008
- Сообщения:
- 74
twgt точняк
а я пытался после того как убил несколько прахов, висящих в памяти, просто запустить prax.exe снова
Спасибо большое за помощь!
P.S. прога действительно работает! Правда с курсором чё то не то
А вот такой вопрос:
будет ли разница между-
_wName TCHAR ‘My Window :D’,0
и
-
_wName db ‘My Window :D’,0
-
zet
New Member
- Публикаций:
-
0
- Регистрация:
- 15 окт 2007
- Сообщения:
- 121
Будет если заменить include ‘includewin32a.inc’ на include ‘includewin32w.inc’
Страница 1 из 2
-
srvaldez
- Posts: 3106
- Joined: Sep 25, 2005 21:54
need help with FasmDLL
I am trying out the fasm DLL found here http://board.flatassembler.net/topic.php?t=6239
but can’t get it to work, the stack seems to get messed up, hope you can help.
Code: Select all
#Include "Windows.Bi"
#Include "Crt.Bi"
' the following structure resides at the beginning of memory block provided
' to the fasm_assemble function. the condition field contains the same value
' as the one returned by function.
' when function returns fasm_ok condition, the output_length and
' output_data fields are filled - with pointer to generated output
' (somewhere within the provided memory block) and the count of bytes stored
' there.
' when function returns fasm_error, the error_code is filled with the
' code of specific error that happened and error_line is a pointer to the
' line_header structure, providing information about the line that caused
' the error.
Type Fasm_State
As Integer Condition
Union
As Integer Output_Length
As Integer Error_Code
End Union
Union
As Any Ptr Output_Data
As Any Ptr Error_Line
End Union
End Type
' the following structure has two variants - it either defines the line
' that was loaded directly from source, or the line that was generated by
' macroinstruction. first case has the highest bit of line_number set to 0,
' while the second case has this bit set.
' in the first case, the file_path field contains pointer to the path of
' source file (empty string if it's the source that was provided directly to
' fasm_assemble function), the line_number is the number of line within
' that file (starting from 1) and the file_offset field contains the offset
' within the file where the line starts.
' in the second case the macro_calling_line field contains the pointer to
' line_header structure for the line which called the macroinstruction, and
' the macro_line field contains the pointer to line_header structure for the
' line within the definition of macroinstruction, which generated this one.
Type Line_Header
As Integer File_Path
As Integer Line_Number
Union
As Integer File_Offset
As Integer Macro_Calling_Line
End Union
As Integer Macro_Line
End Type
' General Errors And Conditions
Function Fasm_Error(Byval Error_Code As Integer) As String
Select Case Error_Code
Case 0
Return "Fasm Ok"
Case 1
Return "Fasm Working"
Case 2
Return "Fasm Error"
Case -1
Return "Fasm Invalid Parameter"
Case -2
Return "Fasm Out Of Memory"
Case -3
Return "Fasm Stack Overflow"
Case -4
Return "Fasm Source Not Found"
Case -5
Return "Fasm Unexpected End Of Source"
Case -6
Return "Fasm Cannot Generate Code"
Case -7
Return "Fasm Format Limitations Excedded"
Case -8
Return "Fasm Write Failed"
' Error Codes For Fasm Error Condition
Case -101
Return "Fasm error: File Not Found"
Case -102
Return "Fasm error: Error Reading File"
Case -103
Return "Fasm error: Invalid File Format"
Case -104
Return "Fasm error: Invalid Macro Arguments"
Case -105
Return "Fasm error: Incomplete Macro"
Case -106
Return "Fasm error: Unexpected Characters"
Case -107
Return "Fasm error: Invalid Argument"
Case -108
Return "Fasm error: Illegal Instruction"
Case -109
Return "Fasm error: Invalid Operand"
Case -110
Return "Fasm error: Invalid Operand Size"
Case -111
Return "Fasm error: Operand Size Not Specified"
Case -112
Return "Fasm error: Operand Sizes Do Not Match"
Case -113
Return "Fasm error: Invalid Address Size"
Case -114
Return "Fasm error: Address Sizes Do Not Agree"
Case -115
Return "Fasm error: Disallowed Combination Of Registers"
Case -116
Return "Fasm error: Long Immediate Not Encodable"
Case -117
Return "Fasm error: Relative Jump Out Of Range"
Case -118
Return "Fasm error: Invalid Expression"
Case -119
Return "Fasm error: Invalid Address"
Case -120
Return "Fasm error: Invalid Value"
Case -121
Return "Fasm error: Value Out Of Range"
Case -122
Return "Fasm error: Undefined Symbol"
Case -123
Return "Fasm error: Invalid Use Of Symbol"
Case -124
Return "Fasm error: Name Too Long"
Case -125
Return "Fasm error: Invalid Name"
Case -126
Return "Fasm error: Reserved Word Used As Symbol"
Case -127
Return "Fasm error: Symbol Already Defined"
Case -128
Return "Fasm error: Missing End Quote"
Case -129
Return "Fasm error: Missing End Directive"
Case -130
Return "Fasm error: Unexpected Instruction"
Case -131
Return "Fasm error: Extra Characters On Line"
Case -132
Return "Fasm error: Section Not Aligned Enough"
Case -133
Return "Fasm error: Setting Already Specified"
Case -134
Return "Fasm error: Data Already Defined"
Case -135
Return "Fasm error: Too Many Repeats"
Case -136
Return "Fasm error: Symbol Out Of Scope"
Case -140
Return "Fasm error: User Error"
Case -141
Return "Fasm error: Assertion Failed"
End Select
End Function
#Define Lf Chr(10)
#Define Cr Chr(13)
Dim Fasm_Getversion As Function Stdcall () As Integer
Dim Fasm_Assemble As Function Stdcall _
(Byval Lpsource As Any Ptr, _
Byval Lpmemory As Any Ptr, _
Byval Cbmemorysize As Integer, _
Byval Npasslimit As Integer, _
Byval Hdisplaypipe As Any Ptr ) As Integer
Dim Fasm_Assemblefile As Function Stdcall _
(Byval Lpsourcefile As Any Ptr, _
Byval Lpmemory As Any Ptr, _
Byval Cbmemorysize As Integer, _
Byval Npasslimit As Integer, _
Byval Hdisplaypipe As Any Ptr ) As Integer
Dim As Any Ptr Library
Library = Dylibload( "C:Program FilesFreeBASICexamplesFasm" )
If( Library = 0 ) Then
Print "Cannot Load The Fasm Dynamic Library, Aborting Program..."
Print "Press Return To End ";
Sleep
Else
Fasm_Getversion = Dylibsymbol( Library, "fasm_GetVersion")
If Fasm_Getversion = 0 Then
Print "Cannot Get Fasm_Getversion Function Address From Fasm Library, Aborting Program..."
Print "Press Return To End ";
Sleep
End 1
End If
Fasm_Assemble = Dylibsymbol( Library, "fasm_Assemble")
If Fasm_Assemble = 0 Then
Print "Cannot Get Fasm_Assemble Function Address From Fasm Library, Aborting Program..."
Print "Press Return To End ";
Sleep
End 1
End If
Fasm_Assemblefile = Dylibsymbol( Library, "fasm_AssembleFile")
If Fasm_Assemblefile = 0 Then
Print "Cannot Get Fasm_Assemblefile Function Address From Fasm Library, Aborting Program..."
Print "Press Return To End ";
Sleep
End 1
End If
End If
Dim Asm_Source As Zstring Ptr = Allocate(1024)
Dim Buffer As Fasm_State Ptr = Allocate(8388608)
Dim Line_Error As Line_Header Ptr
Dim Machine_Code As Any Ptr
Dim As Integer Result
Dim As Integer I
Dim Myfunction As Function Cdecl() As Integer
*Asm_Source="use32"+Lf
*Asm_Source+="Org 100H"+Lf
*Asm_Source+=Lf
*Asm_Source+="Mov Eax,100"+Lf
*Asm_Source+="Add Eax,20"+Lf
'*Asm_Source+="Fldpi"+Lf 'If This Line Is Uncommented And The Return Type
*Asm_Source+="Ret"+Lf 'Of Myfunction Is Changed To Double Then It Returns Pi
Result=Fasm_Assemble(Asm_Source, Buffer,8388608,100,0)
Print "Buffer->Condition = ";Buffer->Condition
If Buffer->Condition=0 Then
Print "Buffer->Output_Length = ";Buffer->Output_Length
End If
If Result=0 Then
Machine_Code=Virtualalloc(Null, Buffer->Output_Length, Mem_Commit, Page_Execute_Readwrite)
Memcpy(Machine_Code, Buffer->Output_Data, Buffer->Output_Length)
Print
Print "Asm Source"
Print *Asm_Source
Print "Machine Code ";
For I=0 To Buffer->Output_Length-1
Print Hex(Peek(Ubyte,Machine_Code+I),2);" ";
Next
Print
Print
Myfunction=Machine_Code
Print "Result Of Myfunction = ";
Print Myfunction()
End If
If Buffer->Condition=2 Then
Line_Error=Buffer->Error_Line
Print Fasm_Error(Buffer->Error_Code);" In Line ";Line_Error->Line_Number
End If
'Another Way Of Calling The Asm Code
I=0
If Buffer->Condition=0 Then
Asm
Call [Machine_Code]
Mov [I],Eax
End Asm
End If
Print "Result From Calling Machine Code = ";I
Deallocate(Buffer)
Deallocate(Asm_Source)
Virtualfree(Machine_Code,0,Mem_Release)
Dylibfree(Library)
Print "Press Return To End ";
Sleep
Last edited by srvaldez on Sep 06, 2012 4:38, edited 4 times in total.
-
Gonzo
- Posts: 722
- Joined: Dec 11, 2005 22:46
Re: need help with FasmDLL
Post
by Gonzo » Sep 05, 2012 21:26
did you try cdecl instead of stdcall ? it doesnt say anything in the small documentation
wrong calling conventions tend to break the stack, same if you provide a different number of arguments than what is expected
-
srvaldez
- Posts: 3106
- Joined: Sep 25, 2005 21:54
Re: need help with FasmDLL
Post
by srvaldez » Sep 05, 2012 21:37
changing the fasm functions to cdecl only makes it worse an changing myFunction to cdecl makes no difference,
I can understand why print myFunction() would not work as I expect but this should work
Code: Select all
i=0
if buffer->condition=0 then
asm
call [machine_code]
mov [i],eax
end asm
end if
print i
-
MichaelW
- Posts: 3500
- Joined: May 16, 2006 22:34
- Location: USA
Re: need help with FasmDLL
Post
by MichaelW » Sep 06, 2012 1:36
The provided example and your source both assemble 16-bit code, which generally is not be callable from 32-bit code. There may be a way to direct FASM to assemble 32-bit code, but I have no idea how to do that.
-
Summary
-
Files
-
Reviews
-
Support
-
Donate
-
Mailing Lists
Menu
▾
▴
fasm-help
— Here you can ask questions concerning fasm.
You can subscribe to this list here.
2002 |
Jan |
Feb |
Mar |
Apr |
May |
Jun (1) |
Jul (10) |
Aug (11) |
Sep (4) |
Oct (3) |
Nov (34) |
Dec (2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan (12) |
Feb (2) |
Mar |
Apr (1) |
May |
Jun (2) |
Jul (1) |
Aug |
Sep |
Oct |
Nov |
Dec |
From: Tomasz Grysztar <fa…@me…> — 2002-11-10 23:26:22 |
The website has been updated with the small layout changes and the new releases of flat assembler - final console version 1.41 and also a pre-release of version for the Win32 GUI. Please test it. -- Tomasz |
From: doz.me <do…@ho…> — 2002-11-06 13:12:49 |
Hello, there is pair of questions: 1) How to connect in fASM resource RCDATA ? is not present in macros ? 2) And if it is possible to receive more any _fASM_ source codes or where they can be downloaded? Thanks. All boons to you %-) november 6rd 2002 / 17:32 / doz.me do...@ho... |
From: Tomasz Grysztar <fa…@me…> — 2002-11-06 08:47:51 |
> How to define local variables in subroutines in FASM? > in MASM it's done like following: > test proc ArgNum:DWORD, test:DWORD > LOCAL testlocal1 :DWORD > push esi > push edi > ... > pop edi > pop esi > ret > I'd like to know how this will be in FASM proc test ArgNum,test testlocal1 dd ? enter push esi push edi ;... pop edi pop edi return -- Tomasz |
From: Andrey Ch <so…@ma…> — 2002-11-06 07:21:50 |
hi, fasm-help. How to define local variables in subroutines in FASM? in MASM it's done like following: test proc ArgNum:DWORD, test:DWORD LOCAL testlocal1 :DWORD push esi push edi ... pop edi pop esi ret I'd like to know how this will be in FASM Thanks a lot! --- Origin: music Andrey mailto:so...@ma... Sources pascal http://pascal.vov.ru/ |
From: Vitalij Dodonov <dream…@la…> — 2002-10-11 09:59:38 |
Здравствуйте, Степанов. Вы писали 11 октября 2002 г., 13:18:16: СБА> HELP Ты чего? Тут же только на англицком... -+- CUL Степанов -+- С уважением, Vitalij@Work mailto:dream...@la... 2:5030/1416.222 |
From: Tomasz Grysztar <fa…@me…> — 2002-09-19 07:18:07 |
> Maybe your text editor put only a Lf at the end of line, instead of CrLf. That would not be a problem for fasm. Maybe that vmware doesn't emulate frm correctly? -- Tomasz |
From: Michael Pruitt <eet_1…@ho…> — 2002-09-19 07:08:10 |
Maybe your text editor put only a Lf at the end of line, instead of CrLf. ----Original Message Follows---- From: Juan Carlos Sanchez Polar <jcsan...@pu...> Reply-To: fasm-...@li... To: fasm-...@li... Subject: [fasm-help] newbie Date: Tue, 17 Sep 2002 19:04:48 -0500 (PET) MIME-Version: 1.0 Received: from usw-sf-list2.sourceforge.net ([216.136.171.252]) by mc4-f20.law16.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Tue, 17 Sep 2002 17:13:15 -0700 Received: from usw-sf-list1-b.sourceforge.net ([10.3.1.13] helo=usw-sf-list1.sourceforge.net)by usw-sf-list2.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian))id 17rSSl-0006Hg-00; Tue, 17 Sep 2002 17:13:03 -0700 Received: from macareo.pucp.edu.pe ([200.4.255.12])by usw-sf-list1.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian))id 17rSRg-0000eY-00for <fasm-...@li...>; Tue, 17 Sep 2002 17:11:56 -0700 Received: by macareo.pucp.edu.pe (Postfix, from userid 54143)id 8F0A7152ADD; Tue, 17 Sep 2002 19:04:48 -0500 (PET) Received: from localhost (localhost [127.0.0.1])by macareo.pucp.edu.pe (Postfix) with ESMTP id 8B044152AD5for <fasm-...@li...>; Tue, 17 Sep 2002 19:04:48 -0500 (PET) Message-ID: <Pine....@ma...> Sender: fasm-...@li... Errors-To: fasm-...@li... X-BeenThere: fasm-...@li... X-Mailman-Version: 2.0.9-sf.net Precedence: bulk List-Help: <mailto:fasm-...@li...?subject=help> List-Post: <mailto:fasm-...@li...> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/fasm-help>,<mailto:fasm-...@li...?subject=subscribe> List-Id: <fasm-help.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/fasm-help>,<mailto:fasm-...@li...?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchives/forum.php?forum=fasm-help> Return-Path: fasm-...@li... X-OriginalArrivalTime: 18 Sep 2002 00:13:16.0046 (UTC) FILETIME=[2F467AE0:01C25EA8] Hi, I'm trying to compile the following program inside a win98 vmware virtual machine: org 100h use16 mov ah,02 mov dl,'A' int 21h int 20h but I got this error: flar assembler version 1.40 test.asm [1]: org 100h error: name too long. ---- what's wrong? Thanks JC ------------------------------------------------------- This SF.NET email is sponsored by: AMD - Your access to the experts on Hammer Technology! Open Source & Linux Developers, register now for the AMD Developer Symposium. Code: EX8664 http://www.developwithamd.com/developerlab _______________________________________________ Fasm-help mailing list Fasm-...@li... https://lists.sourceforge.net/lists/listinfo/fasm-help _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |
From: Juan Carlos Sanchez Polar <jcsan…@pu…> — 2002-09-18 00:12:03 |
Hi, I'm trying to compile the following program inside a win98 vmware virtual machine: org 100h use16 mov ah,02 mov dl,'A' int 21h int 20h but I got this error: flar assembler version 1.40 test.asm [1]: org 100h error: name too long. ---- what's wrong? Thanks JC |
From: Tomasz Grysztar <fa…@me…> — 2002-08-31 08:48:08 |
1) There was a bug with invoke macro that caused local labels to not work. Make sure you have the latest version this thread (look in replies): http://board.win32asmcommunity.net/showthread.php?s=&threadid=7468 2) There's a big difference between local variables for procedure (which are defined by macros) and the local labels. You can use both these features, or only one of them. Look in the docs - there's explained how the local labels (with dot at the beginning) work. You can name the local variable with local label, so it won't be assesible after first non-local label in your proc, but it's a good solution if you use only local labels inside the proc. You can also name local variable with global label (without a dot at the beginning), but you won't be able to define it twice in two different procedures. You can even define local variables with both those names (as it's in your example), but it can lead to mistakes, look at the example: proc ShowMessageOne, ptrMsg .dummy dd ? ; defines ShowMessageOn.dummy variable dummy dd ? ; defines global dummy variable, new prefix for ; local labels is used enter mov eax,[.dummy] ; now it tries to read from [dummy.dummy], ; causes an error return -- Tomasz |
From: webmaster <wm…@sc…> — 2002-08-31 07:03:48 |
hi, please have a look at the modified example.asm: include '%include%/win32a.inc' .data caption db "Win32 Assembly",0 message db "Hi! I'm the example program!",0 .code start: stdcall ShowMessageOne,message stdcall ShowMessageTwo,message invoke MessageBox,HWND_DESKTOP,message,caption,MB_OK invoke ExitProcess,0 proc ShowMessageOne,ptrMsg dummy dd ? ; dummy doesn't work as local - .dummy does work as local .dummy dd ? enter mov eax,[dummy] jmp xskip ; .skip doesn't work invoke MessageBox,HWND_DESKTOP,[ptrMsg],caption,MB_OK xskip: ; .skip: doesn't work return proc ShowMessageTwo,ptrMsg ; shouldn't ptrMsg be a local variable? .ptrMsg dd ? ; no complaint about this! .dummy dd ? .rc POINT enter mov eax,[.dummy] mov eax,[.rc.x] push caption pop [.ptrMsg] mov eax,[.ptrMsg] invoke MessageBox,HWND_DESKTOP,eax,caption,MB_OK return .end start ----------------------------------------- I now started using the asmwork IDE - in general I like it very much. Two points seem to be considerable for me: - (asmwork.asm) label wait_for_compiler: after #SetCursor...# I inserted #invoke Sleep,10#. Otherwise compiling takes 100% of both processors on my dual board. It might be even useful to spend the compilation process an own thread which notifies the windowproc when finished. - perhaps it is possible that the asm-file which is loaded first is always preselected as file to compile. So in the settings there would be a input and an output setting. That would make compilation handling easier when you correct mistakes in an included asm-file and then try to compile it again (now you first have to select the main file again before you can compile). wolfgang |
From: Luis Alonso Murillo Murillo <alons…@ra…> — 2002-08-27 04:08:18 |
Hi, Tomas By any change can tell me how to get the size of a variable? Thanks for all your help! PS. Did you ever got my Superclass zip file? Is it ok? Sincerely, Alonso Murillo. |
From: Brian C. Becker <brian…@ho…> — 2002-08-21 18:37:29 |
Hi Tomasz, > The the official fasm 1.40 has been finally releaded: > http://fasm.metro-nt.pl/ > http://fasm.sourceforge.net/ Neat, I am downloading it now! > This list had badly configured "Reply-To" address, the replies to emails > from this list didn't go back here by default, I have just fixed it. Yes, I noticed that...thanks for fixing it. > When we had a list a Yahoo! I had sent once small tutorial about adding > a custom instructions to fasm. unfortunately I've lost that archived > messages. If anybody has a copy of that tutorial, please send me it. I have just about every message still saved in Outlook, so if you can describe it a bit more (or give me keywords that it contains that sets it apart from other messages), I am pretty confident that I can find it and send it to you. Actually, I just found it (I think, let me know if it isn't the one or if you need a different message). I'm copy & pasting it here for you: --------------------------------------------------------------------- Because my fasmGuide project won't probably be finished soon due to my general lack of time, I'll at least send you some tips, how you can add your custom instructions to flat assembler. Example 1 - simple approach --------------------------- Consider we want to have the "bignop" instruction, without any arguments, which will generate 7 bytes of value 90h. First step: add this name to the table, so fasm will recognize this instruction. This name is 6 bytes long, so you should find instructions_6 table and put there two new lines (remember to keep the alphabetical order!): db 'bignop',0 dw bignop_instruction-assembler This will define our new instruction, saying the handler procedure is bignop_instruction, and the additional parameter is zero. Now, when fasm meets this instruction in preprocessed and parsed source, it will jump to your handler (the bignop_instruction label), with the additional parameter in AL register. So the only thing left to do is to write this instruction handler. You may add it to "assemble.inc", but the best solution is to create new "custom.inc" file, and put "include 'custom.inc'" at the end of "assemble.inc" file. If your editor can't handle text files larger than 64k, just write the following command at the DOS prompt: echo include 'custom.inc' >> assemble.inc Now create the "custom.inc" file, and put the bignop_instruction handler there: bignop_instruction: mov al,90h mov ecx,7 rep stos byte [edi] jmp instruction_assembled This handler will just generate 7 bytes of code, without reading any arguments, and then pass the control back to assembler. Every instruction handler should be ended with this jump. Now recompile the fasm and try the new instruction! ;) Example 2 - argument processing ------------------------------- Now we will add the "varnop" instruction, wchich will expect an argument being a number specifying the length of the instruction. The instruction handler is: varnop_instruction: lods byte [esi] cmp al,'(' jne invalid_argument cmp byte [esi],'.' je invalid_value call get_dword_value mov ecx,eax mov al,90h rep stos byte [edi] jmp instruction_assembled This handler expects the number at ESI, so it loads a byte and checks if it is a number expression (marked by a "(" byte). If it isn't, jumps to the error handler (look at "errors.inc" to see what errors can be handler, you can also add your own - it's simple). Also, if the second byte is "." it means this is floating point number, and we don't want it. Then we can call the "get_dword_value" procedure with esi pointing to the first byte after "(" character, and the whole expression is processed, the result number is stored in EAX register. Now handler generates this count of NOPs and exits. There are many procedures that will process arguments for you, here is the list of the most useful of them: 1. When argument is a number, call one of the following procedures with ESI pointing to the first byte after "(": get_byte_value - returns number in AL get_word_value - returns number in AX get_dword_value - returns number in EAX get_pword_value - returns number in DX:EAX get_qword_value - returns number in EDX:EAX get_value - converts number of any type and returns it in EDX:EAX 2. When argument is a register, the first byte at ESI was 10h, load the second byte to AL and call: convert_register - accepts only general purpose registers, sets the AH to size of register (1, 2 or 4) and AL to the register code number convert_mmx_register - accepts only MMX registers, AH is set to the register size (8 or 16) and AL to the register code number These procedures set also the [argument_size] variable to the same value as AH register. If the [argument_size] is already set to something but 0, and sizes don't match, the error handler is called. You can also process the second byte manually, you can see the possible second byte values looking at the "symbols" table in "tables.inc" file. 3. To process size overrides, after loading the first byte of an argument into AL call get_size_operator procedure. If there is a size override, it set the [argument_size] to proper value, and loads the first byte of next symbol into AL, otherwise it does nothing. 4. When argument is the memory (the first byte is "["), call the get_address procedure with ESI pointing to the first byte after "[". It will return an address value in EDX, base register code in BH, index register code in BL, index scale in CL, address size override in CH and the segment register code in [segment_register] variable. You can just pass the unchanged BX, CX and EDX registers to the store_instruction procedure, with [base_code] set to instruction code and [postbyte_register] set to the register code or instruction extension - the whole opcode will be generated then and stored at EDI. If [base_code] is set to 0Fh, the [extended_code] should contain the value of second opcode byte. To make 16-bit version of instruction (regardless the "use16" or "use32" setting), call the operand_16bit_prefix procedure before generation an opcode. To make 32-bit version, call the operand_32bit_prefix. Please look at the various instruction handlers in "assemble.inc" for the more complex examples. Example 3 - common handler -------------------------- We can make the common handler for the both of above instructions, using the additional parameter field: in "tables.inc": db 'bignop',7 dw bignop_instruction-assembler and db 'varnop',0 dw bignop_instruction-assembler in "custom.inc": bignop_instruction: xor ecx,ecx or cl,al jnz .store lods byte [esi] cmp al,'(' jne invalid_argument cmp byte [esi],'.' je invalid_value call get_dword_value mov ecx,eax .store: mov al,90h rep stos byte [edi] jmp instruction_assembled If the additional parameter is 0, it reads the count argument, otherwise it uses the AL as a count. Have a nice customizing! -- Tomasz Grysztar --------------------------------------------------------------------- Sincerely, Brian Becker Shall we accept good from God, and not trouble? --- Outgoing mail is certified Virus Free by AVG Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 |
From: Tomasz Grysztar <fa…@me…> — 2002-08-21 13:17:04 |
The the official fasm 1.40 has been finally releaded: http://fasm.metro-nt.pl/ http://fasm.sourceforge.net/ The documentation is still not finished, and won't be finished soon, so I have decided to release it in the current state, it has it's own version numbering, so you'll know when it's modified. If someone wants to help finishing the sections about FPU/MMX instructions, he's welcome to. There were some people offering help but I haven't got more response from them. This list had badly configured "Reply-To" address, the replies to emails from this list didn't go back here by default, I have just fixed it. When we had a list a Yahoo! I had sent once small tutorial about adding a custom instructions to fasm. unfortunately I've lost that archived messages. If anybody has a copy of that tutorial, please send me it. -- Tomasz |
From: Tomasz Grysztar <fa…@me…> — 2002-08-21 13:13:19 |
> section '.data' data readable writeable > numberone dt ? > numbertwo dt ? > section '.code' code readable executable > mov [numberone],125.236 The size of tword data is 10 bytes, there is no mov instruction that can transef 10 bytes. But you can use floating point values of smaller sizes (dword, qword): numberone dd ? mov [numerone],125.236 -- Tomasz |
From: Brian C. Becker <brian…@ho…> — 2002-08-20 20:51:52 |
Hi Alsono, > Greetings to every body in FASM group, can some body help me, > i wrote the following code: I can try if you don't mind me being wrong every once in a while (mabye more often!). > section '.data' data readable writeable > > numberone dt ? > numbertwo dt ? > > section '.code' code readable executable > > mov [numberone],125.236 > But on this last line of code i get an invalid size of operand > error when i try to assign a value to the floating point > variable, can any body tell me what i am doing wrong! I know exactly how you feel. I wanted to do this quite a while ago and spent several hours searching online for a solution. The only thing I came up was to store each new number in the '.data' section of the program, like so: section '.data' data readable writeable numberone dt ? numbertwo dt ? TempNumber1 dt 125.236 section '.code' code readable executable FINIT FLD tword[TempNumber1] FSTP tword[numberone] Alternatively, you can probably make a macro that does this automatically (I've seen some macros for MASM that do such a thing). That's about the extent of my knowledge; perhaps somebody else can prove me wrong and tell you a better way (which would be nice). Sincerely, Brian Becker Shall we accept good from God, and not trouble? --- Outgoing mail is certified Virus Free by AVG Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 |
From: Luis Alonso Murillo Murillo <alons…@ra…> — 2002-08-20 14:22:01 |
Greetings to every body in FASM group, can some body help me, i wrote the following code: section '.data' data readable writeable numberone dt ? numbertwo dt ? section '.code' code readable executable mov [numberone],125.236 But on this last line of code i get an invalid size of operand error when i try to assign a value to the floating point variable, can any body tell me what i am doing wrong! Thanks! Sincerely, Alonso Murillo |
From: <Viita…@ao…> — 2002-08-14 16:18:29 |
Does anyone have an example of a Windows DLL that has exports? Also, how do you call _cdecl DLLs in Fasm? |
From: <Viita…@ao…> — 2002-08-13 19:40:35 |
How do you sendmessages to a listbox, in c++ you have to use (LPARAM)string to send it, but how can I do that in Fasm? |
From: Fabio Bizzetti <bizze…@li…> — 2002-08-06 16:50:40 |
Hi Tomasz, I have symbols like this: MOV P32 [SIGNAL.TYPE],.MSG.NOTMAPPED .._IMPORT_SIGNAL_051 = $-8 MOV P32 [SIGNAL.CNT],ECX .._IMPORT_SIGNAL_063 = $-4 When I have few tens of such symbols (differing only in the terminating part), FAsm says: --- flat assembler version 1.39 error: code cannot be generated. --- After some experimenting, I found this even more weird fix: MOV P32 [SIGNAL.TYPE],.MSG.NOTMAPPED .._IMPORT_SIGNAL_051 = $-8 .._IMPORT_SIGNAL_051 = .._IMPORT_SIGNAL_051 MOV P32 [SIGNAL.CNT],ECX .._IMPORT_SIGNAL_063 = $-4 .._IMPORT_SIGNAL_063 = .._IMPORT_SIGNAL_063 --- Q1: Will the above produce correct code at least? Q2: Is there a real fix for this problem? --- PS: I played a bit more and found the error: there's a limit ( = 100 ) in the maximum number of passes of ASSEMBLE.INC. I increased it to 255 (because it's stored in a byte.. I didn't remove the limit check code because the variable is referenced elsewhere, so it may not work anyway) and reassembled the FAsm source. Tomasz: it appears unnecessary to add passes for things like the above.. as also proven by the fix of the extra "symbol = symbol" solution. Nor it would be wise to limit the maximum number of *practically* usable symbols. I can imagine that equ may require additional passes in such cases.. but "=" should really not, in my understanding of how FAsm internally works. Please don't limit FAsm in such ways. Greets, Fabio |
From: Tomasz Grysztar <fa…@me…> — 2002-07-15 18:43:57 |
> See my little dummy prog > org 100h > use16 > ;In this line I've got "Value out of range" > ;why? > display kk > blad: > mov ah,4ch > int 21h > macro display slowo > { > mov ah,9eh > mov dx,slowo > int 21h > } > error db 'Error Ocurred$' > kk db 'Hi!$' > Where is the problem? You should define macro before you use it. "display kk" is here interpreted as a built-in "display" directive, which needs bytes or string as an arguments, and the kk is larger than byte (because it's above 100h due to the "org" directive) that's why you've got "value out of range" error. If the kk was less than 100h, you'd have simply this byte displayed at compile time and no code generated before "mov ah,4ch". To do what you wanted, simply move the macro definition to the beginning of your source. This happens only with preprocessor symbols (macros and equ's), labels and constants can be accessed from anywhere. -- Tomasz |
From: Micha³ Joachimiak <mijoa…@o2…> — 2002-07-15 18:19:29 |
Hi! See my little dummy prog org 100h use16 ;In this line I've got "Value out of range" ;why? display kk blad: mov ah,4ch int 21h macro display slowo { mov ah,9eh mov dx,slowo int 21h } error db 'Error Ocurred$' kk db 'Hi!$' Where is the problem? Bye. |
From: Fabio Bizzetti <bizze…@li…> — 2002-07-10 14:00:28 |
It would be nice if one could use inside INCLUDE's filenames an environment variable. For example, if we know that the environment variable FAsm is set to E:CodingFAsm, it would be nice to be able to do: INCLUDE "%FAsm%MyEquatesAndSymbols.INC" and/or to be able to specify at the command line (e.g. from a batch file) an extra file to be included before the source. Greets, Fabio |