Writing a (dis-)assembler for 8-bit code in D - blog posts

Brian bcallah at openbsd.org
Mon Apr 19 20:05:57 UTC 2021


Hello Dukc --

On Monday, 19 April 2021 at 15:01:07 UTC, Dukc wrote:
> You remember Brian Callahan, the one who finished OpenBSD 
> support for the D language? He has more posts that I think 
> people here might find interesting. He has written a 
> disassembler and an assembler for a Z80 processor in D.
>
> The main point in his articles is seemingly to demonstrate how 
> programs behave, choice of the language is an implementation 
> detail. His D is still rough, as it is for anyone new to the 
> language, but he knows a lot about low-level programming in 
> general. If you're thinking about low-level programming or 
> compiler technology, these are worth a look.
>
> https://briancallahan.net/blog/archive.html

I do exist in these parts and on this mailing list. :)
Turns out I have at least one more post in the series--I decided 
to make the parser match the CP/M assembler for strings after 
all. But most certainly fixed that in a "C" way. Guess which 
language I'm in my head mapping my D on top of.

And you are correct, choice of language is an implementation 
detail. It wasn't happenstance though. D has some nice facilities 
that, while perhaps not exclusive to D are nonetheless quite 
useful for achieving the goals of the dis/assembler. Also, 
perhaps people want to collect D tutorials for new D coders/new 
coders in general and this dis/assembler can eventually be a part 
of that.

But... that doesn't mean I can't or won't take constructive 
critiques. But perhaps some context on the blog series:
The whole point of the disassembler and assembler was to answer 
(for myself, really) if I could successfully teach someone with 
effectively no formal CS education how to write such tools. 
Imagine someone who never learned data structures wanting to 
write their own tools. You could hand them this dis/assembler, 
they could learn everything about them with just the code, the 
blog posts, and the skills they have now. And once they've done 
that, then you say "great, now go learn DS and algo and ..." So 
ways to make the code more readable to that target audience are 
appreciated and will almost certainly become the topic of their 
own post on the blog in that series.

I'll also take tips for better idiomatic D in general, for my own 
sake.

As an unrelated aside: I'm giving a talk about all the different 
languages I have helped port to OpenBSD (about 40 or so that I 
can remember as of now). It won't all be about D, but D will be 
an exclusive, highlighted, part of it. Humorously, everyone is 
going around calling it "the D on OpenBSD talk" because that one 
blog post really gained traction in the *BSD community too. 
Anyhow, it's May 5 at 18:45 NY time. Free and virtual (Zoom): 
https://www.nycbug.org/index?action=view&id=10683

~Brian


More information about the Digitalmars-d mailing list