🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #239

Re: writing an AVR disassembler

#239
From: albert
Date: Wed, 18 Nov 2026 19:52
41 lines
2601 bytes
In article <_9Chl2n-LnizheJe@violet.siamics.net>,
Ivan Shmakov  <ivan@siamics.netREMOVE.invalid> wrote:
<SNIP>
>       I mean, consider that you might want to adapt your as80.frt to
>       interoperate with an existing Z80 assembler, where the "PCHL"
>       instruction is spelled "JP (HL)".  Is it something that could
>       be done with ciasdis?

No, that doesn't work. The post-it fixup principle demands i.a.
that the mnemonic significant bits are known by a mask that identifies
them.
0 0 0 T!
08 07 8 1FAMILY, RLC RRC RAL RAR DAA CMA STC CMC
defines 07 0F 17 2F .. 4F.
During disassembly you match as a whole byte, because of the
0 passed to T!

More illustrative is the following.
00 00 38 T!
 08 00 8 xFAMILY| B'| C'| D'| E'| H'| L'| M'| A'| ( dst)
  01 04 2 1FAMILY, INR DCR       ( B'|)
For disassembling you erase the bits from 38 in the instruction
you want to disassemble. ( That are the bits filled in by B'| C'| etc.)
What is left, you match with the 04 05 of INR DCR.
If there is a bit outside of the 38 e.g. 14 then INR or
DCR is not a disassembly and you go on.
Otherwise you continue with matching the "fixups" B'| etc.

You cannot make this to work with an arbitrary prescribed assembler syntax.

The advantage is that the assembler disassembler works for all
processors. What remains is filling in tables. It is comparatively
easy to add a table for more instructions like an SSE set.
However filling in the tables has the difficulty that the instruction
must be hit in the right order, and before the fixup.

Groetjes Albert
-- 
The Chinese government is satisfied with its military superiority over USA.
The next 5 year plan has as primary goal to advance life expectancy
over 80 years, like Western Europe.
Technical Details
Message-ID: <nnd$0d07b87b$339a580b@2ae506648e7a3430>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!abo001.abavia.com!feed.abavia.com!abr003.abavia.com!abp004.abavia.com!reseller!not-for-mail
References: <UOSz15Vn9V7SG_X-@violet.siamics.net> <nnd$7db92bde$51dc9da3@1be066804088f8e4> <_9Chl2n-LnizheJe@violet.siamics.net>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.forth
References: <UOSz15Vn9V7SG_X-@violet.siamics.net> <nnd$7db92bde$51dc9da3@1be066804088f8e4> <_9Chl2n-LnizheJe@violet.siamics.net>
From: albert@spenarnc.xs4all.nl
Subject: Re: writing an AVR disassembler
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$0d07b87b$339a580b@2ae506648e7a3430>
Organization: www.abavia.com
Date: Wed, 18 Nov 2026 20:52:29 +0100
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!abo001.abavia.com!feed.abavia.com!abr003.abavia.com!abp004.abavia.com!reseller!not-for-mail
Lines: 42
Injection-Date: Wed, 18 Nov 2026 20:52:29 +0100
Injection-Info: reseller; mail-complaints-to="abuse@abavia.com"