5 ms·
And I asked about this just a few days ago! https://news.ycombinator.com/item?id=10239000 https://news.ycombinator.com/item?id=10239000 Do you use it? Is anyon
by Keyframe 11y ago
And I asked about this just a few days ago! https://news.ycombinator.com/item?id=10239000 https://news.ycombinator.com/item?id=10239000
Do you use it? Is anyone aware of a python way of this?
- rayiner 11y agoJust a weekend hack, alas. But it generates identical code to NASM for the subset of x86 it handles, so the basic mechanics should be correct.
- tptacek 11y agoI wrote a programmable assembler in Python on a consulting project (I needed to write a debugger that used only direct memory access and no other debugger hooks). It wasn't difficult. Later, we did one in Ruby, which allowed our assembler syntax to almost mirror AT&T assembler while still being pure Ruby. These are easy libraries to write; people should just write them themselves.
- Keyframe 11y agoThese are easy libraries to write; people should just write them themselves. Well, if you say so! Seriously though, isn't x86/64 opcode set gargantuan in size? Not to mention the maintenance and what to do with parallel constructs. It doesn't sound easy to me, apart from trivial text emit experiments. I haven't tried writing one though, so I wouldn't know. Also, what's easy for someone isn't easy for others. I find image processing and rendering relatively easy for example.
- tptacek 11y ago(a) No. (b) You don't need even most of the instructions to get to a useful, fun place. I was surprised by how easy it was to get to that place. Take my word for this. Read this: http://reocities.com/SiliconValley/heights/7052/opcode.txt http://reocities.com/SiliconValley/heights/7052/opcode.txt and just start coding.
- Keyframe 11y agoOk, thanks for the tip and link. Weekend here I come!