remix logo

Hacker Remix

Customasm – An assembler for custom, user-defined instruction sets

73 points by zdw 7 days ago | 17 comments

Grom_PE 4 days ago

flat assembler g (fasmg) does this. It has a powerful macro language, in which, among other architectures and formats, it implements x86 and ELF/PE/macho and is able to assemble itself.

I like to use it for scripting for turning binary formats to text and vice-versa.

Rohansi 4 days ago

It's also possible to use stock flat assembler (non-g) for this, to some extent. I've done it before here: https://github.com/Rohansi/FPCompo11/blob/master/Assembler/i...

IshKebab 4 days ago

This is very cool. On the topic of assembly, does anyone know of a language that is higher level than assembly, but retains the property that the output doesn't depend on the compiler or its flags?

I want it for low level CPU benchmarks and tests. Using C or assembly for those both suck.

I don't really know exactly how this would look (is the register allocator part of the spec?) but has anyone tried something like this?

giancarlostoro 4 days ago

There was a post on HN where someone implemented a new language compiler purely from Assembly, and shows you from nothing to the very end where it looked mostly like a LISP assembly language. It was really neat. Sadly I dont have the buzzwords for Google to find it anymore, used to be able to find the powerpoint slides for it.

I forgot about HLA (High Level Assembly) though I have not used it personally, there were also a few others like C-- as well:

https://en.wikipedia.org/wiki/High_Level_Assembly

Frenchgeek 4 days ago

asgeir 4 days ago

Have you tried looking into something like NASM's macro functionality?

actionfromafar 4 days ago

That sounds like a tall order. If you want it for CPU benchmarks, you presumably want to be able to use all real CPU machine instructions. Or a simpler language instruction set but with an optimizer, but it's hard to write an optimizer and then you could never change the optimizer.

pjmlp 4 days ago

Naturally, it is time for some Forth. :)

unquietwiki 4 days ago

The demo website at https://hlorenzi.github.io/customasm/web/ makes this even more accessible. I can actually follow along as to how this works.

westurner 3 days ago

Is there an ISA for WASM that's faster than RISC-V 64, which is currently 3x faster than x86_64 on x86_64 FWICS? https://github.com/ktock/container2wasm#emscripten-on-browse... demo: https://ktock.github.io/container2wasm-demo/