3 ms·
Oh... indented assembly language. Is this, like, a 21st century thing? Everybody I know (including me) who started in the 20th century just naturally writes the
by to3m 15y ago
Oh... indented assembly language. Is this, like, a 21st century thing? Everybody I know (including me) who started in the 20th century just naturally writes their assembly language out at the same indentation. I'm rigorous about my C indentation, but it never occurred to me that it would be useful for assembly language too. (And in fact I'm not sure that it is :)
I'm not quite sure what this might mean.
Probably just that I'm old.
- edma2 15y agoMy intention was to show loops and jumps... YMMV
- Sodel 15y agoI think it's neat! At the very least, its easier to parse at a glance.
- mahmud 15y agoIt used to be called "Structured Assembly Language"; it had huge proponents in the 80s, even gurus who were trained in Pascal and Ada and wanted to take structure programming to the mainframe. On the PC, various assemblers added "high-level" macros; Turbo Assembler had .if, .while and .struct type macros. Even processor manufacturers where on the bandwagon; that's why the x86 has the ENTER and LEAVE instructions, to make function calls "trivial", at the risc of performance. In the 90s you had at least on academic (Randal Hyde) who wrote HLL, high-level assembly language, and along with it a very successful series of text-books on indented assembly. Anyhoo. On the x86 side at least, the Netwide Assembler was created by a bunch of volunteers, one of its initial goals was to remove high-level cruft and make assembly straightforward again. Personally, I think assembly is something best reserved for fun, one-off hacks, and inner-loops.
- aaronbrethorst 15y ago> at the risc of performance that's some good punning.
- sjs 15y agoThis is the first time I've seen it done but I haven't read a lot of assembly code or anything. > but it never occurred to me that it would be useful for assembly language too. (And in fact I'm not sure that it is :) Why not?
- to3m 15y agoI suppose I personally just never thought of assembly language code as having any nesting-like structure. It's just a list of individual instructions, to be executed one after the other, with the occasional conditional GOTO or subroutine call. Higher-level constructs just don't really spring to mind as I'm working in it. Then again, it's a while since I did a more than a short routine at a time of anything more complicated than 6502. (The 6502 is so basic, you have to think in the actual instructions directly. It would be odd if you didn't.) If I set to do a decent quantity of code working with something more modern, maybe I'd find my coding more coloured by my C experience than was the case last time.
- sjs 15y agoI've written more assembly for the M68HC11 than x86 so I can relate. Indenting it never even crossed my mind. x86 is an entirely different beast.
- timtadh 15y agoI actually wrote a macro pre-processor for MIPS when I was an undergrad which took this concept even farther. I added scope blocks so you could re-use label names and "register names". see https://github.com/timtadh/jist/blob/master/memory_manager.s#L491 https://github.com/timtadh/jist/blob/master/memory_manager.s...