Return-Path: <craig@sbc-85.com>
Delivered-To: craig@sbc-85.com
Received: from gator4254.hostgator.com
	by gator4254.hostgator.com with LMTP
	id kPdGEzqitGhQ+AAAcizydQ
	(envelope-from <craig@sbc-85.com>)
	for <craig@sbc-85.com>; Sun, 31 Aug 2025 14:27:54 -0500
Return-path: <craig@sbc-85.com>
Envelope-to: 052922@sbc-85.com
Delivery-date: Sun, 31 Aug 2025 14:27:54 -0500
Received: from c-73-240-244-150.hsd1.wa.comcast.net ([73.240.244.150]:58211 helo=BasementDesk)
	by gator4254.hostgator.com with esmtpsa  (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
	(Exim 4.98.1)
	(envelope-from <craig@sbc-85.com>)
	id 1usniU-00000000GtF-0E12;
	Sun, 31 Aug 2025 14:27:54 -0500
From: <craig@sbc-85.com>
To: =?utf-8?Q?'Sigur=C3=B0ur_=C3=81sgeirsson'?= <siggi@sort.is>
Cc: <052922@sbc-85.com>
References: <CACtr8n1pgt+J7LSu7xL9Ehf9demxNbiB==YtyLMAzV0t3t-nTg@mail.gmail.com> <2acd01dc16b5$e6b27920$b4176b60$@sbc-85.com> <CACtr8n2E_FZ_dQF4ZYqa_4+_FgieZWWTvXgpO3Ghs=qs0rDXEg@mail.gmail.com>
In-Reply-To: <CACtr8n2E_FZ_dQF4ZYqa_4+_FgieZWWTvXgpO3Ghs=qs0rDXEg@mail.gmail.com>
Subject: RE: Ghidra disassembler for SC/MP
Date: Sun, 31 Aug 2025 12:27:53 -0700
Message-ID: <2e3301dc1aad$5930b160$0b921420$@sbc-85.com>
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_2E34_01DC1A72.ACD29CB0"
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQIowkLBtNLZ0Wq7e5VK+2cQ6wLy5wJ5Xlz5AcHKRbCzwfvwcA==
Content-Language: en-us

This is a multipart message in MIME format.

------=_NextPart_000_2E34_01DC1A72.ACD29CB0
Content-Type: text/plain;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hi Siggi,

=20

I agree that the sc/mp documentation leaves much to be desired when =
compared to intel or others.  They rarely say how things are left after =
certain instructions execute.

=20

I am new to the SC/MP and am just learning assembly myself.  I can try =
these things when I get there but right now I am hand assembling.  I =
think the UK vintage sc/mp is where most of the knowledge base is.  =
Especially phil G who is maintaining the PIC SC/MP emulator code.

=20

Right now I found another bug in NIBL that I am trying to fix so it may =
be a couple of days until I can get to your questions.

=20

Regards

craig

=20

From: Sigur=C3=B0ur =C3=81sgeirsson <siggi@sort.is>=20
Sent: Sunday, August 31, 2025 5:47 AM
To: craig@sbc-85.com
Cc: 052922@sbc-85.com
Subject: Re: Ghidra disassembler for SC/MP

=20

Hey Craig,

=20

I've just about completed the language spec, only there are a couple of =
questions outstanding.
The processor manual is essentially silent on these two points:

1.	Auto-indexing with E.
Auto-indexing is documented to pre-decrement and post-increment =
depending on the displacement. It's not clear to me how it behaves when =
the displacement is E, however.
So it's not clear to me which memory locations this code touches:
LDI 0x10
XAE
LDI 0xAA
ST @E(P2)
LDI 0xF0
XAE
LDI 0x55
ST @E(P2)
2.	Is there a JMP E?
The addressing form used for ILD/DLD/JMP et al is very similar to the EA =
form, but it's not clear whether a displacement of 0x80 implies E, or =
just -128. I rather think the latter, but it would be good to know for =
sure.

Since you have hardware, I wonder if you could test these cases?

=20

I also had a surprise with the XPPC instruction, which doesn't behave at =
all like what I expected. Looking at existing code, though, it's clear =
that the PC is incremented after the register swap, so the destination =
pointer register must always be loaded with the destination less one :).

=20

Lastly I had a momentary kerfuffle regarding interrupts. Since the =
processor has no RETI, it's necessary to use at least two instructions =
to return from interrupt, namely:

  IEN

  XPPC P3

=20

but what if an interrupt is taken right after IEN? In this case P3 would =
take the value of the PC in the interrupt handler, and the original PC =
would be lost.

The manual does address this, however, mentioning that interrupts are =
not in fact enabled until one instruction past the IEN. So the =
instruction sequence above is pretty much mandatory for returning from =
interrupt :).=20

=20

Thanks,

Siggi

=20

On Tue, Aug 26, 2025 at 2:19=E2=80=AFPM <craig@sbc-85.com =
<mailto:craig@sbc-85.com> > wrote:

Hi Siggi,

=20

Thanks for letting me know about your C compiler thoughts and initial =
work with the disassembler.  The most active SC/MP group is in the UK =
vintage radio repair forum.  Here are links to a couple of threads that =
have most of the SC/MP crowd.

=20

Anyone heard of the  =
<https://www.vintage-radio.net/forum/showthread.php?t=3D220843&page=3D2> =
"Nibbler" by Digi-Key around 1978? - Page 2 - UK Vintage Radio Repair =
and Restoration Discussion Forum

=20

Compiling a list of SC/MP Project Boards - UK Vintage Radio Repair and =
Restoration Discussion Forum =
<https://www.vintage-radio.net/forum/showthread.php?t=3D221696>=20

=20

=20

Regards,

craig

=20

=20

From: Sigur=C3=B0ur =C3=81sgeirsson <siggi@sort.is =
<mailto:siggi@sort.is> >=20
Sent: Tuesday, August 26, 2025 6:45 AM
To: 052922@sbc-85.com <mailto:052922@sbc-85.com>=20
Subject: Ghidra disassembler for SC/MP

=20

Hey there,

=20

I saw your videos about the Nibbler, and it piqued my curiosity about =
the SC/MP processor. The instruction and register sets are pretty unique =
to my eye, though in a way much better put together than the initial =
MC6800 instruction set =
<https://sigurasg.github.io/reversing-the-2465/2024/06/18/mc6800-limitati=
ons.html> . The SC/MP will have no problem with reentrant programming =
and it should be relatively easy to e.g. write a C compiler for it.

 =20

In any case, to understand the processor better, I wrote a Ghidra/Sleigh =
language spec <https://github.com/sigurasg/GhidraSCMP>  for it. This is =
very early stage code, but the spec does seem to disassemble SC/MP code =
without issue.

As I haven't implemented the semantics for most of the instructions, the =
Ghidra decompiler is still pretty useless. I'm not sure how good it will =
ever do, as the SC/MP instruction set is somewhat unorthodox. My =
GhidraMC6800 language spec does quite well with the MC6800, so perhaps =
Ghidra will figure it out...

=20

Is there some kind of forum or mailing list you know of where SC/MP =
nerds who might appreciate this and/or might be willing to help hang =
out?

=20

Siggi


------=_NextPart_000_2E34_01DC1A72.ACD29CB0
Content-Type: text/html;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta =
http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8"><meta =
name=3DGenerator content=3D"Microsoft Word 15 (filtered =
medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	font-size:12.0pt;
	font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
span.EmailStyle18
	{mso-style-type:personal-reply;
	font-family:"Aptos",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:11.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
/* List Definitions */
@list l0
	{mso-list-id:1266112668;
	mso-list-template-ids:1074325866;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-US link=3Dblue =
vlink=3Dpurple style=3D'word-wrap:break-word'><div =
class=3DWordSection1><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>Hi Siggi,<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>I agree that the =
sc/mp documentation leaves much to be desired when compared to intel or =
others.=C2=A0 They rarely say how things are left after certain =
instructions execute.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>I am new to the SC/MP =
and am just learning assembly myself.=C2=A0 I can try these things when =
I get there but right now I am hand assembling.=C2=A0 I think the UK =
vintage sc/mp is where most of the knowledge base is.=C2=A0 Especially =
phil G who is maintaining the PIC SC/MP emulator =
code.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>Right now I found =
another bug in NIBL that I am trying to fix so it may be a couple of =
days until I can get to your questions.<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>Regards<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>craig<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><div =
style=3D'border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in =
0in 0in'><p class=3DMsoNormal><b><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span><=
/b><span style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'> =
Sigur=C3=B0ur =C3=81sgeirsson &lt;siggi@sort.is&gt; <br><b>Sent:</b> =
Sunday, August 31, 2025 5:47 AM<br><b>To:</b> =
craig@sbc-85.com<br><b>Cc:</b> 052922@sbc-85.com<br><b>Subject:</b> Re: =
Ghidra disassembler for SC/MP<o:p></o:p></span></p></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><div><p class=3DMsoNormal>Hey =
Craig,<o:p></o:p></p><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>I've just about completed the language spec, only =
there are a couple of questions outstanding.<br>The processor manual is =
essentially silent on these two points:<o:p></o:p></p></div><div><ol =
start=3D1 type=3D1><li class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 =
level1 lfo1'>Auto-indexing with E.<br>Auto-indexing is documented to =
pre-decrement and post-increment depending on the displacement. It's not =
clear to me how it behaves when the displacement is E, however.<br>So =
it's not clear to me which memory locations this code touches:<br>LDI =
0x10<br>XAE<br>LDI 0xAA<br>ST @E(P2)<br>LDI 0xF0<br>XAE<br>LDI =
0x55<br>ST @E(P2)<o:p></o:p></li><li class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 =
level1 lfo1'>Is there a JMP E?<br>The addressing form used for =
ILD/DLD/JMP et al is very similar to the EA form, but it's not clear =
whether a displacement of 0x80 implies E, or just -128. I rather think =
the latter, but it would be good to know for =
sure.<o:p></o:p></li></ol><div><p class=3DMsoNormal>Since you have =
hardware, I wonder if you could test these =
cases?<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=3DMsoNormal>I =
also had a surprise with the XPPC instruction, which doesn't behave at =
all like what I expected. Looking at existing code, though, it's clear =
that the PC is incremented <b>after</b> the register swap, so the =
destination pointer register must always be loaded with the destination =
less one :).<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=3DMsoNormal =
style=3D'margin-bottom:12.0pt'>Lastly I had a momentary kerfuffle =
regarding interrupts. Since the processor has no RETI, it's necessary to =
use at least two instructions to return from interrupt, =
namely:<o:p></o:p></p></div><div><p class=3DMsoNormal>&nbsp; =
IEN<o:p></o:p></p></div><div><p class=3DMsoNormal>&nbsp; XPPC =
P3<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>but what if an interrupt is taken right after IEN? In =
this case P3 would take the value of the PC in the interrupt handler, =
and the original PC would be lost.<o:p></o:p></p></div><div><p =
class=3DMsoNormal>The manual does address this, however, mentioning that =
interrupts are not in fact&nbsp;enabled until one instruction past the =
IEN. So the instruction sequence above is pretty much mandatory for =
returning from interrupt :).&nbsp;<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>Thanks,<o:p></o:p></p></div><div><p =
class=3DMsoNormal>Siggi<o:p></o:p></p></div></div></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><div><div><p class=3DMsoNormal>On =
Tue, Aug 26, 2025 at 2:19<span =
style=3D'font-family:"Arial",sans-serif'>=E2=80=AF</span>PM &lt;<a =
href=3D"mailto:craig@sbc-85.com">craig@sbc-85.com</a>&gt; =
wrote:<o:p></o:p></p></div><blockquote =
style=3D'border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in =
6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><div><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>Hi Siggi,</span><o:p></o:p></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>Thanks for letting me know about your C =
compiler thoughts and initial work with the disassembler.&nbsp; The most =
active SC/MP group is in the UK vintage radio repair forum.&nbsp; Here =
are links to a couple of threads that have most of the SC/MP =
crowd.</span><o:p></o:p></p><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'><a =
href=3D"https://www.vintage-radio.net/forum/showthread.php?t=3D220843&amp=
;page=3D2" target=3D"_blank">Anyone heard of the &quot;Nibbler&quot; by =
Digi-Key around 1978? - Page 2 - UK Vintage Radio Repair and Restoration =
Discussion Forum</a></span><o:p></o:p></p><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'><a =
href=3D"https://www.vintage-radio.net/forum/showthread.php?t=3D221696" =
target=3D"_blank">Compiling a list of SC/MP Project Boards - UK Vintage =
Radio Repair and Restoration Discussion =
Forum</a></span><o:p></o:p></p><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>Regards,</span><o:p></o:p></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>craig</span><o:p></o:p></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p><div =
style=3D'border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in =
0in 0in'><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span><=
/b><span style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'> =
Sigur=C3=B0ur =C3=81sgeirsson &lt;<a href=3D"mailto:siggi@sort.is" =
target=3D"_blank">siggi@sort.is</a>&gt; <br><b>Sent:</b> Tuesday, August =
26, 2025 6:45 AM<br><b>To:</b> <a href=3D"mailto:052922@sbc-85.com" =
target=3D"_blank">052922@sbc-85.com</a><br><b>Subject:</b> Ghidra =
disassembler for SC/MP</span><o:p></o:p></p></div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p><=
/o:p></p><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hey =
there,<o:p></o:p></p><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p><=
/o:p></p></div><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I saw your =
videos about the Nibbler, and it piqued my curiosity about the SC/MP =
processor. The instruction and register sets are pretty unique to my =
eye, though in a way much better put together than the <a =
href=3D"https://sigurasg.github.io/reversing-the-2465/2024/06/18/mc6800-l=
imitations.html" target=3D"_blank">initial MC6800 instruction set</a>. =
The SC/MP will have no problem with reentrant programming and it should =
be relatively easy to e.g. write a C compiler for =
it.<o:p></o:p></p></div><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;&nbsp;=
<o:p></o:p></p></div><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>In any =
case, to understand the processor better, I wrote a <a =
href=3D"https://github.com/sigurasg/GhidraSCMP" =
target=3D"_blank">Ghidra/Sleigh language spec</a> for it. This is very =
early stage code, but the spec does seem to disassemble SC/MP code =
without issue.<o:p></o:p></p></div><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>As I =
haven't implemented the semantics for most of the instructions, the =
Ghidra decompiler is still pretty useless. I'm not sure how good it will =
ever do, as the SC/MP instruction set is somewhat unorthodox. My =
GhidraMC6800 language spec does quite well with the MC6800, so perhaps =
Ghidra will figure it out...<o:p></o:p></p></div><div><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p><=
/o:p></p></div><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Is there =
some kind of forum or mailing list you know of where SC/MP nerds who =
might appreciate this and/or might be willing to help hang =
out?<o:p></o:p></p></div><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p><=
/o:p></p></div><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Siggi<o:p></=
o:p></p></div></div></div></div></div></blockquote></div></div></body></h=
tml>
------=_NextPart_000_2E34_01DC1A72.ACD29CB0--

