Live data from Hacker News

Assembly Language Programming: Still Relevant Today (2015)

wilsonminesco.com

91–100 of 100 posts

Re: Assembly Language Programming: Still Relevant Today (2015)

#91
post #73

Earlier quoted context omitted.

Modern assembly is kind of...bad. I would recommend checking out an old book for an old mainframe's assembly language. They're usually much less mystic by virtue of being much less complex. IBM had some really nice manuals and books; no one ever got fired for buying IBM because an IBM machine could be programmed by a dog. Octal is where it's really at, though, if you get really into this. A fun weekend project is to…

> Octal is where it's really at Why octal, not hex?

Octal is easier to keep in your head while not sacrificing any efficiency.

Re: Assembly Language Programming: Still Relevant Today (2015)

#92
post #88

Earlier quoted context omitted.

It kinda does in this case. Don’t kid yourself. In real assembly, the really interesting part is how to use a finite register file. WebAssembly has an infinite slab of variables available, in the sense that you get to say how big it is. That fundamentally changes the game.

There are real CPUs that are just like that. In fact, most mainframes have always made use of microcoded CPUs, with Assembly being referred as bytecode on the programming manuals. You just need to dive into IBM and Xerox PARC manuals, for starters.

Yep. I feel like most of HN's readership's asm education begins and ends with their 6502 class at uni.

Re: Assembly Language Programming: Still Relevant Today (2015)

#93
post #88

Earlier quoted context omitted.

It kinda does in this case. Don’t kid yourself. In real assembly, the really interesting part is how to use a finite register file. WebAssembly has an infinite slab of variables available, in the sense that you get to say how big it is. That fundamentally changes the game.

There are real CPUs that are just like that. In fact, most mainframes have always made use of microcoded CPUs, with Assembly being referred as bytecode on the programming manuals. You just need to dive into IBM and Xerox PARC manuals, for starters.

Sounds like you’re saying those machines executed bytecode.

Otherwise there isn’t a great limiting principle to your logic. Just because someone once built hardware that executes such a high level assembly that the manual referred to it as bytecode doesn’t mean that all bytecode formats are assembly.

Re: Assembly Language Programming: Still Relevant Today (2015)

#94

Earlier quoted context omitted.

I actually want to learn it to work on reverse engineering projects. I just don’t know how to get started at all. I don’t know how people can reverse engineer a device that you don’t access to the running program to. How do you monitor and track all the bits being passed around to break back firmware? Specifically video game mods and hacks I wanted to dabble in since I find their programming fascinating and know I’d…

> video game mods and hacks I wanted to dabble in Not sure you need assembly for that. If you want to modify 3D rendered output, you normally need to adjust shaders, textures and such. For extreme cases, you can hook the entire Direct3D API adjusting how it works for the game. The only assembly you might need for that is shader assembly https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/... but not always ne…

Depends on the platform. Older platforms like the NES or SEGA Genesis often had software written in ARM - there are huge communities around modifying these games.

Re: Assembly Language Programming: Still Relevant Today (2015)

#95
post #88

Earlier quoted context omitted.

There are real CPUs that are just like that. In fact, most mainframes have always made use of microcoded CPUs, with Assembly being referred as bytecode on the programming manuals. You just need to dive into IBM and Xerox PARC manuals, for starters.

Sounds like you’re saying those machines executed bytecode. Otherwise there isn’t a great limiting principle to your logic. Just because someone once built hardware that executes such a high level assembly that the manual referred to it as bytecode doesn’t mean that all bytecode formats are assembly.

Indeed I am, the interpreter is the microcoded CPU.

Even modern 80x86 Assembly is a low level form of bytecode, given that the micro-ops that are processed by the microcoded CPU are completly unrelated to 80x86 Assembly opcodes.

Re: Assembly Language Programming: Still Relevant Today (2015)

#96

Earlier quoted context omitted.

I actually want to learn it to work on reverse engineering projects. I just don’t know how to get started at all. I don’t know how people can reverse engineer a device that you don’t access to the running program to. How do you monitor and track all the bits being passed around to break back firmware? Specifically video game mods and hacks I wanted to dabble in since I find their programming fascinating and know I’d…

> video game mods and hacks I wanted to dabble in Not sure you need assembly for that. If you want to modify 3D rendered output, you normally need to adjust shaders, textures and such. For extreme cases, you can hook the entire Direct3D API adjusting how it works for the game. The only assembly you might need for that is shader assembly https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/... but not always ne…

I know and understand C++ as it’s the main language I’ve been working in for some time.

How do I modify the code of that which I don’t have access to?

What reverse engineer projects are good for beginners? I see people post here their first project attempt to reverse an older gadget. I’d love to pick up an older gadget and try to reverse engineer it and make it do what I want it to.

Re: Assembly Language Programming: Still Relevant Today (2015)

#97

Earlier quoted context omitted.

> video game mods and hacks I wanted to dabble in Not sure you need assembly for that. If you want to modify 3D rendered output, you normally need to adjust shaders, textures and such. For extreme cases, you can hook the entire Direct3D API adjusting how it works for the game. The only assembly you might need for that is shader assembly https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/... but not always ne…

I know and understand C++ as it’s the main language I’ve been working in for some time. How do I modify the code of that which I don’t have access to? What reverse engineer projects are good for beginners? I see people post here their first project attempt to reverse an older gadget. I’d love to pick up an older gadget and try to reverse engineer it and make it do what I want it to.

> How do I modify the code of that which I don’t have access to?

Native code reverse engineering is very time consuming. It’s often possible to achieve similar results by focusing on the code which you have access to. You don’t have source code of Windows OS components, but you do have their APIs and debug symbols, and that’s much better than just binaries.

If you want to change what’s rendered, you can replace the GPU API with a wrapped version, like renderdoc does. If you want to change what’s loaded from disk, patch game files, or replace whatever OS file I/O APIs is used by the game (DLL injection, then MinHook or Detours).

Even when you do need to change game’s own native code, directly patching machine code is rarely a good idea, very hard to implement and especially debug. An easier way is replacing complete functions with API-compatible replacements implemented in your DLL library in C++. Again, use MinHook or Detours to replace the implementation. C++ allows unrestricted memory access so you can read and write everywhere, here’s working examples: https://github.com/Const-me/vis_avs_dx/blob/master/avs_dx/Dx... https://github.com/Const-me/vis_avs_dx/blob/master/avs_dx/Dx... I didn’t have source code of these C++ classes, but wanted their data regardless. Found the offsets by using VS debugger, these third-party DLLs include GUI to change the values, I compared memory before/after making changes.

> What reverse engineer projects are good for beginners?

In the context of modern Windows games, assuming you wanna change what’s rendered, a good start might be https://renderdoc.org/. Officially, the tool is only supported when you run your own code. Technically, it often works with retail games too, just don’t open issues about that, they’ll be closed as a not supported use case. As a nice side effect, you’ll learn a thing of 2 about Direct3D. The tool is open source with good license (MIT), so you can fork, disable their frame captures, and change their API wrappers to modify the output of some particular game.

One more thing, modern games use a lot of bytecodes. E.g. D3D shaders are byte code, search “3dmigoto decompiler” to decompile dxbc into HLSL. .NET is often byte code (Unity3D is based on .NET), use reflector to decompile into C#. Many games use custom VMs, sometimes modding community has decompilers for their custom byte code.

> I’d love to pick up an older gadget and try to reverse engineer it

What do you mean by “gadget”?

Re: Assembly Language Programming: Still Relevant Today (2015)

#98

Earlier quoted context omitted.

> video game mods and hacks I wanted to dabble in Not sure you need assembly for that. If you want to modify 3D rendered output, you normally need to adjust shaders, textures and such. For extreme cases, you can hook the entire Direct3D API adjusting how it works for the game. The only assembly you might need for that is shader assembly https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/... but not always ne…

Depends on the platform. Older platforms like the NES or SEGA Genesis often had software written in ARM - there are huge communities around modifying these games.

Good point. Yeah, for old games like NES, Genesis, or DOS, you don’t often have other choice.

Re: Assembly Language Programming: Still Relevant Today (2015)

#99

Earlier quoted context omitted.

Depends on the platform. Older platforms like the NES or SEGA Genesis often had software written in ARM - there are huge communities around modifying these games.

Good point. Yeah, for old games like NES, Genesis, or DOS, you don’t often have other choice.

I only say this because I myself am a girl who learned 68k ASM when I was ten or eleven through the Sonic ROM hacking scene :)

Re: Assembly Language Programming: Still Relevant Today (2015)

#100

There is many kind of assembly language, some for the actual computer hardware, some for VMs, and some used as both. I have used and sometimes still do use assembly language, including 6502 (specifically, NMOS 6502 without decimal arithmetic, including unofficial opcodes), and a little bit of x86 stuff (although the modern x86 is very messy, I think), but also Z-machine and Glulx. I have also used MIX and MMIX assemb…

He does touch on local labels briefly - he suggests (and I agree) that you can get the same effect, more maintainably, with macros.

Macros are good too, although I think both are useful.
Post reply on HN