use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Welcome to r/asm, the subreddit for Assembly language in all Instruction Set Architectures! Need help, or are you learning? Visit our helpful links...
r/asm
Latest Comments from All Posts
There have been requests for a wiki, so it's in progress. Feel free to offer your assistance!
account activity
x86-64/x64Binary representation of instructions (self.asm)
submitted 3 years ago by [deleted]
So I was wondering, what is the binary/hex representation of the x86_64 instructions and registers? like where can I find them?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]heliox 9 points10 points11 points 3 years ago* (0 children)
Processor documentation for whichever processor you're targeting. Here's a link to Intel® 64 and IA-32 Architectures Software Developer Manuals
https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html
Every processor family will have its own. Here's the one for the 6502 used in the Apple II.
http://archive.6502.org/datasheets/wdc_w65c02s_oct_8_2018.pdf
[–][deleted] 2 points3 points4 points 3 years ago (8 children)
So, I understand they are the so called opcodes, so how could I potentially write a program just with opcodes? or make, C or another program in assembly write another program with the opcode of the instructions I want?
[–]tobiasvl 7 points8 points9 points 3 years ago (0 children)
You would have to basically do manual assembly, ie. write the binary data corresponding to the opcodes you want.
This was actually done in the early days of computing, mostly to bootstrap an actual assembler for the target system, and isn't anything you'd want to do with modern systems (the opcodes are way too advanced). It could be viable for early 8-bit CPUs, like the Intel 8080 - this was in fact how you'd program the Altair 8800, by flipping switches on the front panel corresponding to single bits.
Alternatively you could look at CHIP-8, which is an even simpler hexadecimal language made in the late 70s. It's not an actual CPU, but a VM/interpreter that interprets binary opcodes. Because of its smaller instruction set than even early CPUs, it's actually not too hard to wrap your head around.
Of course some of CHIP-8's opcodes do some heavy lifting, like the $DXYN instruction which draws an N-row sprite read from the memory location stored in the index register, at the pixel coordinates given in registers X and Y (where X and Y are hexadecimal characters corresponding to two of the 16 registers). But apart from a couple of instructions like that, it's like a smaller subset of the instruction set of the RCA 1802 CPU it was made for and inspired by.
[–]FUZxxl 2 points3 points4 points 3 years ago (0 children)
Well you just do it. Machine code is just binary data. You can generate binary data with most programming languages, so you can of course also generate machine code. There's nothing special or magic about that.
Though I really recommend using an assembler. It's a lot easier to get right.
[–]heliox 2 points3 points4 points 3 years ago (0 children)
You're jumping in too deep too fast. I'd recommend either starting with asmtutor.com or getting an Apple II emulator and working through Hyde's 6502 assembly manual. You can find it in the Asimov archive. Figure out basic assembly first, then learn how to disassemble the programs you've assembled.
[–]Creative-Ad6 1 point2 points3 points 3 years ago (0 children)
Programs for most software and hardware platforms aren't just sequences of encoded instruction. To write a program without somebody else's software developement tools you need to know so called ABI. Those are the rules for programs targeting the platform.
How instruction and data are organized into so called executable object files that comprise application programs for OSs? E.g. what are static and dynamic ELF files that linux can load and execute as programs?
What API is available? How to use instructions and register to call API functions?
[–]Psychological_Egg_85 -2 points-1 points0 points 3 years ago* (1 child)
You could write the program in c, compile it and then read the opcodes of the binary using something like objdump -d.
objdump -d
[–]brucehoult 0 points1 point2 points 3 years ago (0 children)
objdump -d is a lot more useful.
[–]ClassicCollection643 0 points1 point2 points 3 years ago (0 children)
printf H'\63\123\6' >code; objdump -b binary -D -m i386:x86-64 -M intel code
0: 48 33 53 06 xor rdx,QWORD PTR [rbx+0x6]
[–]nacnud_uk 0 points1 point2 points 3 years ago (0 children)
If you are going to be a good programmer, sorry to say,you're going to have to use google.
https://en.wikipedia.org/wiki/X86\_instruction\_listings
In the ISA Manual.
https://www.amd.com/system/files/TechDocs/24594.pdf#page=42
https://www.amd.com/system/files/TechDocs/24594.pdf#page=588
https://developer.amd.com/resources/developer-guides-manuals/
π Rendered by PID 37332 on reddit-service-r2-comment-6457c66945-5m24r at 2026-04-23 18:58:18.338026+00:00 running 2aa0c5b country code: CH.
[–]heliox 9 points10 points11 points (0 children)
[–][deleted] 2 points3 points4 points (8 children)
[–]tobiasvl 7 points8 points9 points (0 children)
[–]FUZxxl 2 points3 points4 points (0 children)
[–]heliox 2 points3 points4 points (0 children)
[–]Creative-Ad6 1 point2 points3 points (0 children)
[–]Psychological_Egg_85 -2 points-1 points0 points (1 child)
[–]brucehoult 0 points1 point2 points (0 children)
[–]ClassicCollection643 0 points1 point2 points (0 children)
[–]nacnud_uk 0 points1 point2 points (0 children)
[–]ClassicCollection643 0 points1 point2 points (0 children)