Schol-R-LEA wrote:manhobby wrote:I want to learn machine code and assembly language programming as a hobby.
OK, then. Fair enough.
Now that we have that settled, which system do you mean to learn assembly (or machine code) for? Each processor family (x86, x86-64, ARM, MIPS, PowerPC, Itanium, AVR, 8051, 6502, etc.) has its own machine code and corresponding assembly language instructions, and different models within a family might not support everything that others in their family do (e.g., the current
Xeon Phi, and
Skylake-X CPUs have the
AVX-512 SIMD math instructions, but most of the other x86 CPUs don't, including the
Coffee Lake models released last fall, even though they came out a year after Skylake-X).
Also, writing assembly code that uses any kind of operating system facilities will depend on the OS it is written for, as well; an assembly program for Linux won't run on Windows, and vice versa, even when they are both running on the same hardware.
Conversely, if you intend to write for bare metal, either in the form of a self-booting PC program or something running bare on an
SBC such as a
Raspberry Pi,
Libre Renegade,
Imagination Creator Ci40,
Onion Omega2, or any of the myriad
Arduino systems (or retro-computing boards such as the
COSMAC Membership Card or the
PE6502), then you would have to write
everything yourself, and know enough about the hardware and firmware to do that
before you begin. For any sort of bare-metal programming, I would recommend using an
emulator or virtualizer when developing the program, and waiting until it works in the emulator before trying to run it on live hardware.
For some operating systems - including Windows and most Unix-like systems such as Linux or MacOS - writing machine code directly isn't really feasible at all, as the systems' program loaders will expect the program to be in a loadable
Executable Format such as ELF, PE, or Mach-O - and as complex as writing a program in raw machine code is, writing a loadable executable file in hex would be far worse. Machine code programming is really only something you would want to do on bare metal, if at all.
Finally, for assembly language, it will
depend on which assembler you are using - most of the common platforms have at least two or three different assemblers targeting them, and the syntax they accept can be very different from each other.
My recommendation is to settle on a specific hardware and software target, and development toolchain, before proceeding. You will probably want to find a book that covers those specifically, rather than trying to translate one book's information to a different system - and trust me, this is one topic you will want at least one good book on. For example, IMAO one of the best books for programming x86 assembly for Linux using the Netwide Assembler (
NASM) is Jeff Duntemann's
Assembly Language Step By Step, but it won't do you much good if you are targeting an
ODROID (which uses an ARM processor), or an x86 system that is running Windows, or even x86 Linux if you are using
GAS.
There are plenty of
online assembly language tutorials as well (such as
these ans
these), and even some for
machine code programming, but the quality of them is going to be more variable than that of the books - while terrible books can sometime slide by the editors, most online tutorials don't
have editors to fix the author's mistakes.
manhobby wrote:Who here who would help me with that?
Hmmmn... not sure, really. While most of the assembly programmers here are going to be focused on their OS dev projects, if you post
specific questions (not general, open-ended ones like you've been doing) or ask help in debugging something you wrote, I and several others will probably give what advice we can. I couldn't promise any specific individuals other than myself.
Machine code programming, meh, not many here or anywhere else will be able to help with that, really. If you ask a specific question about a specific problem, some of us might try to help, but it would be hit or miss.
manhobby wrote:Which are several more specialized message boards where they certainly would?
I don't know of any machine-code programming fora offhand, and I have no idea if there are any at all, but there are several for different assembly languages.
Let Me Google That For You... OK, here are a few I found. Now, most of these are specific to a particular system or assembler, but they might be a few places to try, depending on what you what to target.
Hope this helps.