Author Topic: "Binary" assembly?  (Read 1747 times)

Vortex

  • Member
  • *****
  • Posts: 2794
Re: "Binary" assembly?
« Reply #15 on: August 10, 2022, 06:34:22 AM »
Is that allowed in Win32 programs? Does the .code section allow writes?

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

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

quarantined

  • Guest
Re: "Binary" assembly?
« Reply #16 on: August 10, 2022, 06:40:13 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

  • Member
  • *****
  • Posts: 1124
Re: "Binary" assembly?
« Reply #17 on: August 10, 2022, 06:50:15 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 ...

daydreamer

  • Member
  • *****
  • Posts: 2399
  • my kind of REAL10 Blonde
Re: "Binary" assembly?
« Reply #18 on: August 10, 2022, 08:00:13 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
http://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

  • Member
  • *****
  • Posts: 1124
Re: "Binary" assembly?
« Reply #19 on: August 10, 2022, 08:32:25 AM »
... except that EAX didn't exist in 16-bit DOS days ...

jj2007

  • Member
  • *****
  • Posts: 13957
  • Assembly is fun ;-)
    • MasmBasic
Re: "Binary" assembly?
« Reply #20 on: August 10, 2022, 09:03:53 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

  • Member
  • *****
  • Posts: 1124
Re: "Binary" assembly?
« Reply #21 on: August 10, 2022, 09:28:16 AM »
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".

jj2007

  • Member
  • *****
  • Posts: 13957
  • Assembly is fun ;-)
    • MasmBasic
Re: "Binary" assembly?
« Reply #22 on: August 10, 2022, 09:53:23 AM »
I guess you could even handle code that's longer than 32 bits with multiple PUSHes, right?

Sure.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: "Binary" assembly?
« Reply #23 on: August 10, 2022, 10:51:45 AM »
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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

InfiniteLoop

  • Regular Member
  • *
  • Posts: 44
Re: "Binary" assembly?
« Reply #24 on: September 13, 2022, 10:37:19 AM »
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--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: "Binary" assembly?
« Reply #25 on: September 13, 2022, 12:07:45 PM »
 :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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy: