# Are questions about writing an assembler on-topic?

The question How is a two-pass assembler designed? can be seen as on- or off-topic.

On one hand, it's about tools that are pretty much exclusive to our site. On Stackoverflow, the call to as is implied by calls to GCC. Writing your own assembler for x86 would be mostly pointless. It's quite likely that users here are dealing with processors with tiny, tiny instruction sets and rudimentary tools, possibly even building their own on FPGAs. Writing assembly by hand and writing an assembler to put that code together seems perfectly normal.

On the other hand, it's about a programming concept. We're programmers too; it's OK to take a programming question to Stack Overflow. They've got tags like [avr], [pic], and [fpga], and they've got a fair amount of activity. Seems that at least a few people over there could help.

It would be awesome if we could get a concrete test to determine whether a question should be here or on Stack Overflow. I think that the reality is more likely to be a set of topics that fit on both places.

• I took that question to be more about wanting to understand two-pass assemblers to better use them than about writing your own assembler. – Olin Lathrop Feb 9 '12 at 15:36

I think there will always be some overlap between electrical engineering and computer science and software engineering. As such, some questions fit both sites and are probably best left wherever the OP asked. A concrete test would be great, but I just don't see how that is possible.

I am a full time professional electrical engineer, and probably spend at least half my time dealing with firmware as apposed to designing circuits, board layout, etc. That's the reality of the field nowadays. Of course sometimes I write host code too, but I wouldn't expect to talk about that here.

The line between firmware that a electrical engineer does as part of designing electronic thingies, and higher level software that a software engineer that doesn't need to know about electronics does is and always will be blurry. As a first approximation, I consider it part of electronics if the code runs on a small resource-limited system with no operating system. That means the code has to touch the hardware directly, which requires understanding of the hardware in the micro and the external circuit it is connected to. Even that definition is vague because "small" and "resource-limited" are judgement calls. It may be hard to define, but I think most of us know it when we see it. Assembler being used is another point in favor of belonging with electrical engineering. Not only does that require knowledge of the hardware, but demonstrates a higher willingness to learn about it and the answers can be more hardware-related. Generic C questions, for example, are still just that and don't belong here just because the code happens to run on a microcontroller. It requires a issue specific to the "small" or "resource-limited" or direct hardware access to qualify.

As for the specific question that brought this up, I felt it was on topic because

1. I didn't take it as asking how to write a assembler (that's a computer science question), but wanting to understand how the assembler works, which may allow one to use it better.

2. It was about assembler, not a high level language. That pushes more into electrical engineering because nowadays even device drivers are written in high level languages on general purpose systems.

All that said, I agree this question falls into the gray area and I can respect others' reactions that it should be elsewhere.

• I agree - it's hard to define exactly but I think small/resource limited, dealing with common uC peripherals in code, etc gets close. I think a reasonable indication it fits here is it it's something most folk over on Stack Overflow wouldn't be able to answer. – Oli Glaser Feb 9 '12 at 19:44
• I like your answer, but more than talking about size and resources (and I know that you were relatively speaking) I would focus on "programming with an eye on the hardware and one on the application"... – clabacchio Feb 10 '12 at 11:09
• I'd say programming questions only belong here if it's directly something to do with peripherals setup & readout, timing issues and other stuff that goes along datasheet of electronic components. (inter-chip/device communication for example) – Hans Feb 12 '12 at 0:17

Questions about Programming Tools are specifically on-topic at Stack Overflow, per the faq.

That said, it took me about 30 seconds of Googling to find this: http://en.wikipedia.org/wiki/Assembly_language#Number_of_passes

If the OP is asking someone to teach them how to write an assembler, the question is probably off-topic everywhere.

I vote to close. I don't see any electronics design going on here. Firmware written in assembler doesn't need that deep a knowledge of how an assembler works. Writing an assembler is a purely software task, so it belongs on StackOverflow, even if that's not currently attracting the relevant people who can answer it. The fact that assemblers are tools to electronic designers/firmware designers is insufficient to make it on topic here. Asking how an oscilloscope works would be on topic because its a piece of electronics itself; asking how to write a book on electronics would be off topic because books are not electronic (ok apart from ebooks, but that's again a software issue). So there is a limit to the information on tools and support items that we should provide.

Another example - how to use Eclipse with an embedded C toolchain would be on topic, but how to write a replacement IDE instead of Eclipse really belongs on SO.

I voted to close the question Kevin refers to. In a comment Kevin writes "we do support asking questions about tools, and if you need to write your own tool, it makes sense that we'd be able to help with that."
The assembler as a tool is only remotely related to electronics; we only suppose there's a relation because it's been posted here on electronics.stackexchange. Nothing in the question makes the link clear. It might as well be an assembler for a Pentium level CPU in a PC.
Even if it would be related to electronics it would only be about the software in an electronic product, not about the electronics itself. Like when you would need an enclosure for your electronic design, we are not going to accept questions about injection molding as on topic, are we?

So, I think questions about the design of an assembler are off topic. Questions about assembly code which is clearly hardware-related should be acceptable. Example: the code to initialize I/O ports on an ARM controller.