flat assembler
Message board for the users of flat assembler.
Index
> Windows > Creating a batch file using FASM? |
Author |
|
ssjcoder 03 Dec 2018, 17:48
Do you mean like a ".bat"/".cmd" file?
Because if that's what you mean, you can probably use some kind of file-writing command to write to a text file & put all the commands into the file, and give it the ".bat"/".cmd" extension I could give you a basic example (for windows 7 32-bit) if this is the case (should work on win 10 too) |
|||
03 Dec 2018, 17:48 |
|
Archvile 04 Dec 2018, 01:10
ssjcoder wrote: Do you mean like a ".bat"/".cmd" file? Yes, that is exactly what I was thinking about! I would love to read your example if you could give me some quick insight on the syntaxis you will use. Also, what are some big/important differences between Windows 7 32-bit and 64-bit for assembler? _________________ Mind over matter. |
|||
04 Dec 2018, 01:10 |
|
ssjcoder 05 Dec 2018, 01:55
Code: ;***; Format ;***; format PE console entry _main ;***; Includes ;***; include 'import32.inc' ;***; Data ;***; section 'data' data readable writeable Path db 'out.cmd', 0 Cmmd1 db '<first command>', 0 Cmmd2 db '<second command>', 0 _endl db 0xD, 0xA, 0 _bwr dd 0 FileHandle dd 0 ;***; Code ;***; section 'code' code readable executable _main: ; clear file push Path call [W32_FileDelete] ; open file push 0 push 0x80 push 1 push 0 push 0 push 0x40000000 push Path call [W32_FileOpen] mov [FileHandle], eax ; reset 'bytes written' mov dword [_bwr], 0 ; write first command push 0 push _bwr push 15 ; write size push Cmmd1 push [FileHandle] call [W32_FileWrite] ; reset 'bytes written' mov dword [_bwr], 0 ; write end of the line push 0 push _bwr push 2 ; write size push _endl push [FileHandle] call [W32_FileWrite] ; reset 'bytes written' mov dword [_bwr], 0 ; write second command push 0 push _bwr push 16 ; write size push Cmmd2 push [FileHandle] call [W32_FileWrite] ; close file push [FileHandle] call [W32_FileClose] ; close .quit: push 0 call [CS_Close] ;***; Import ;***; section 'impr' import data readable writeable library\ L_msvcrt, 'msvcrt.dll',\ L_kernel32, 'kernel32.dll' import L_msvcrt,\ CS_System, 'system',\ CS_Close, 'exit' import L_kernel32,\ W32_FileWrite, 'WriteFile',\ W32_FileClose, 'CloseHandle',\ W32_FileOpen, 'CreateFileA',\ W32_FileDelete, 'DeleteFileA' The program above will create a file called 'out.cmd' and write two commands (well they're not really commands in this case), <first command> and <second command>. However this program is very specifically written such that if you change the commands you have to also change the "write size" of every write call in order to write the correct number of characters, and uses the Windows API (https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/) to perform file writing calls. --- A major difference between 32-bit and 64-bit is that 32-bit uses 32-bit wide memory operations, 64-bit uses 64. Also, 64-bit computers can run 32-bit programs, but 32-bit computers can't run 64-bit programs, so you should release both instead of just 64-bit if you want to maximize compatibility. Due to being unfamiliar with programming in 64-bit mode I can't tell you much else on that matter. --- I'm making a video to introduce assembly to people who are new and have no idea how assembly works, will post it here once I upload it to youtube (hopefully it will help clear things up for you) |
|||
05 Dec 2018, 01:55 |
|
ssjcoder 05 Dec 2018, 02:32
|
|||
05 Dec 2018, 02:32 |
|
DimonSoft 05 Dec 2018, 05:53
ssjcoder wrote: Also, 64-bit computers can run 32-bit programs, but 32-bit computers can't run 64-bit programs, so you should release both instead of just 64-bit if you want to maximize compatibility. Or you can stick with 32-bit programs for the next 10 years unless you require some very specific 64-bit feature ’cause users don’t care whether it is 32- or 64-bit and 32-bit programs, theoretically, run everywhere from Windows 95 till Windows 10 v1809. Besides, if you write assembly code the calling conventions are more assembly programmer friendly with 32 bits. |
|||
05 Dec 2018, 05:53 |
|
Archvile 06 Dec 2018, 21:40
ssjcoder wrote:
ssjcoder wrote: Here's the video: Thank you very much for that explanation. Very insightful and useful for me. I'll make sure to look into the code and make the best of it, perhaprs rewrite it a little so it can suit my purposes. I will take a look at that video as soon as I can. I repeat, thank you very much! DimonSoft wrote:
I didn't know that. Thanks for letting me know. _________________ Mind over matter. |
|||
06 Dec 2018, 21:40 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.