News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

"Binary" assembly?

Started by NoCforMe, August 10, 2022, 04:39:47 AM

Previous topic - Next topic

Vortex

Quote from: NoCforMe on August 10, 2022, 06:00:47 AM
Is that allowed in Win32 programs? Does the .code section allow writes?

You can mark the code section as executable, readable and writeable :

\masm32\bin\link.exe
.
.
/SECTION:name,[E][R][W][S][D][K][L][P][X]

quarantined

Quote from: NoCforMe on August 10, 2022, 06:00:47 AM
I hope I never have to do that in one of my programs ...

Comes in handy sometimes, but most AV software would screeeeam FOUL and not allow you to run it.

NoCforMe

Quote from: quarantined on August 10, 2022, 06:40:13 AM
Quote from: NoCforMe on August 10, 2022, 06:00:47 AM
I hope I never have to do that in one of my programs ...

Comes in handy sometimes, but most AV software would screeeeam FOUL and not allow you to run it.

Sheesh, I have enough goddamn trouble with AVG as it is.

A really annoying thing with AVG: if you download a zip file and copy an executable out of it to another folder and run it, no problemo. But if you try to run the .exe from the zip archive, AVG holds up execution and scrutinizes the code. Which takes a full minute or more, until it figures out that there's nothing malignant in the code ...
Assembly language programming should be fun. That's why I do it.

daydreamer

Quote from: NoCforMe on August 10, 2022, 06:21:26 AM
Well, so those are pretty much equivalent to the segment-override macros I posted here.
well one of these are good old prefix used for change mov ax,something to mov eax in 16bit Dos mode making it one byte bigger,while in 32bit mode its opposite mov eax,something to mov ax,
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

NoCforMe

... except that EAX didn't exist in 16-bit DOS days ...
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on August 10, 2022, 06:00:47 AM
Is that allowed in Win32 programs? Does the .code section allow writes?

I hope I never have to do that in one of my programs ...

Recent example

NoCforMe

So if I understand that example correctly, you're not actually writing anything into the code segment; you're pushing instructions on the stack and executing them there, right? So I guess it's self-modifying, but to me that's always meant actually modifying code in the code segment.

Anyhow, pretty clever there. I guess you could even handle code that's longer than 32 bits with multiple PUSHes, right? I'd call what you're doing here "on-the-fly stack subroutines".
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on August 10, 2022, 09:28:16 AMI guess you could even handle code that's longer than 32 bits with multiple PUSHes, right?

Sure.

hutch--

You can do it either way, .data section or local and load with mnemonics or even set BYTE arrays, depends what you want to do and personal preference.

InfiniteLoop

There is a reason why 64-bit binary is no good for MASM.
Visual Studio doesn't support more than thirty-something characters. It was having absolutely none of it and its extremely annoying. Binary is so much easier.

hutch--

 :biggrin:

The simple solution is to use something else. VS is basically for C/C++ but it does supply ML64.EXE. Use another editor for 64 bit assembler.

ML64.EXE is a bit "agricultural" but it is more than capable in producing 64 bit Windows portable executable code.