Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Just Say No." - Nancy Reagan "No." - Ronald Reagan


computers / comp.sys.apple2 / 6502Workbench triangles in opcode

SubjectAuthor
* 6502Workbench triangles in opcodeAndrew Roughan
+- Re: 6502Workbench triangles in opcodeEnrico
`* Re: 6502Workbench triangles in opcodefadden
 `* Re: 6502Workbench triangles in opcodeAndrew Roughan
  `- Re: 6502Workbench triangles in opcodefadden

1
6502Workbench triangles in opcode

<sh1c3o$k5k$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=3635&group=comp.sys.apple2#3635

  copy link   Newsgroups: comp.sys.apple2
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no_em...@invalid.invalid (Andrew Roughan)
Newsgroups: comp.sys.apple2
Subject: 6502Workbench triangles in opcode
Date: Sun, 5 Sep 2021 03:04:24 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <sh1c3o$k5k$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 5 Sep 2021 03:04:24 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b8109a251ae2d516786d2a154621e06c";
logging-data="20660"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Vb43Wk5pRX/qondGUbOoRUhI3sMVdomo="
User-Agent: NewsTap/5.5 (iPhone/iPod Touch)
Cancel-Lock: sha1:UDZV3Uy3c1OSEvrJth8q7zsRUNY=
sha1:L+KOH4o3wKgJew8tpiIgmPgeSnw=
 by: Andrew Roughan - Sun, 5 Sep 2021 03:04 UTC

I have been using 6502Workbench to investigate code and I don’t understand
why it appears to be consistent.
Some parts of the code are cleanly disassembled, others are not (Eg after a
jmp) but later portions are cleanly disassembled again - why doesn’t it do
the lot?. I can get through this by manually ‘hint’ing at code for clean
disassembly.
But then sometimes after I ‘hint’ at code the opcodes have triangles (see
picture) and the lines on the left are bytes and the code is not clean.
What is going on? How do I fix this?

https://www.flickr.com/photos/10917598@N06/51425367908

Thanks
Andrew

Re: 6502Workbench triangles in opcode

<30f16ec1-6223-4e03-85ec-8c6c534d9553n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=3636&group=comp.sys.apple2#3636

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a37:ea16:: with SMTP id t22mr6341710qkj.507.1630834490511;
Sun, 05 Sep 2021 02:34:50 -0700 (PDT)
X-Received: by 2002:a0c:8064:: with SMTP id 91mr7166319qva.66.1630834490209;
Sun, 05 Sep 2021 02:34:50 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Sun, 5 Sep 2021 02:34:49 -0700 (PDT)
In-Reply-To: <sh1c3o$k5k$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=151.57.158.3; posting-account=QzAJCwoAAAC6OlGOAR7kcjrdGEj9YpS-
NNTP-Posting-Host: 151.57.158.3
References: <sh1c3o$k5k$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <30f16ec1-6223-4e03-85ec-8c6c534d9553n@googlegroups.com>
Subject: Re: 6502Workbench triangles in opcode
From: ero...@gmail.com (Enrico)
Injection-Date: Sun, 05 Sep 2021 09:34:50 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 0
 by: Enrico - Sun, 5 Sep 2021 09:34 UTC

Are you sure that it's code that you're manually forcing 6502bench to disassemble? Perhaps it's just data?

Re: 6502Workbench triangles in opcode

<eb0e8663-5c69-47c2-ae75-71212768663an@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=3637&group=comp.sys.apple2#3637

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a37:9586:: with SMTP id x128mr7529227qkd.49.1630853449685;
Sun, 05 Sep 2021 07:50:49 -0700 (PDT)
X-Received: by 2002:a05:622a:1a24:: with SMTP id f36mr7407601qtb.294.1630853449487;
Sun, 05 Sep 2021 07:50:49 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Sun, 5 Sep 2021 07:50:49 -0700 (PDT)
In-Reply-To: <sh1c3o$k5k$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=24.130.68.111; posting-account=UAtoeQoAAADrX7T-MHdWWRC4Fzf0dsLP
NNTP-Posting-Host: 24.130.68.111
References: <sh1c3o$k5k$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <eb0e8663-5c69-47c2-ae75-71212768663an@googlegroups.com>
Subject: Re: 6502Workbench triangles in opcode
From: thefad...@gmail.com (fadden)
Injection-Date: Sun, 05 Sep 2021 14:50:49 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 43
 by: fadden - Sun, 5 Sep 2021 14:50 UTC

On Saturday, September 4, 2021 at 8:04:26 PM UTC-7, Andrew Roughan wrote:
> But then sometimes after I ‘hint’ at code the opcodes have triangles (see
> picture) and the lines on the left are bytes and the code is not clean.
> What is going on? How do I fix this?

Bear in mind that SourceGen is a code-tracing disassembler. It starts from "code start" points, and traces code as far as it can go. For simple programs this will cleanly separate code and data. For programs with indirect jumps and inline data elements, you will need to explicitly mark the places where execution starts or that hold inline data following a JSR. (There are features for formatting jump tables and common inline data formats that make those easy.)

Looking at the attributes column, you have put "code start point" tags on every byte. SourceGen did what you told it to and made EVERY BYTE a place where execution starts, including the bytes in the middle of earlier instructions.

Code often does this deliberately. For example, in Applesoft at https://6502disassembly.com/a2-rom/Applesoft.html#SymPOP :

d979: a2 16 ldx #ERR_NOGOSUB
d97b: 2c bit ▼ $5aa2 ;fake: BIT xxxx skips ahead to JMP ERROR
d97c: a2 5a UNDERR ldx #ERR_UNDEFSTAT

Code executing straight through will LDX #$16 and then BIT $5AA2, but code branching into the middle of the instruction will do LDX #$5A. SourceGen shows both paths, alerting you to the presence of an embedded instruction by showing a triangle next to the opcode. The above code doesn't use any attributes, because the code tracer identified both execution paths automatically. (The triangle bit is explained in the tutorial: https://6502bench.com/sgtutorial/odds-ends.html .)

What you need to do is select all of the code in that picture, Ctrl+H Ctrl+R to remove the tags, and then put a code start attribute ONLY on the place where the code starts.

Code start attributes are meant to be applied sparingly. Assuming you're using a recent version (currently v1.7.5), you should have received a warning when you applied the hint that what you were attempting (adding the tags to multiple bytes) was rarely a good idea.

Re: 6502Workbench triangles in opcode

<sh55of$5pd$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=3639&group=comp.sys.apple2#3639

  copy link   Newsgroups: comp.sys.apple2
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no_em...@invalid.invalid (Andrew Roughan)
Newsgroups: comp.sys.apple2
Subject: Re: 6502Workbench triangles in opcode
Date: Mon, 6 Sep 2021 13:40:31 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <sh55of$5pd$1@dont-email.me>
References: <sh1c3o$k5k$1@dont-email.me>
<eb0e8663-5c69-47c2-ae75-71212768663an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 6 Sep 2021 13:40:31 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="0d712464d43b9e09054d2959432cd02f";
logging-data="5933"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kgcPxC9pWQVhEmazLOEFirsQj9KiKFbE="
User-Agent: NewsTap/5.5 (iPhone/iPod Touch)
Cancel-Lock: sha1:4y5UWHISFVDkywtoQ9LP36s2wh0=
sha1:gYZ7OEuedi1mUDHlcZnqNY+6woE=
 by: Andrew Roughan - Mon, 6 Sep 2021 13:40 UTC

fadden <thefadden@gmail.com> wrote:
> (The triangle bit is explained in the tutorial:
> https://6502bench.com/sgtutorial/odds-ends.html .)
>
> What you need to do is select all of the code in that picture, Ctrl+H
> Ctrl+R to remove the tags, and then put a code start attribute ONLY on
> the place where the code starts.
>
> Code start attributes are meant to be applied sparingly.

Thanks Andy for the comprehensive explanation.
I did seek in tutorial but it’s not there in my local version. I am using
1.6.0 - time to upgrade.
I assumed code hint needed to be used on a block. It was certainly quicker
to mark all code as code than to have to mark each start point as code. But
now I understand what’s going on better.

Thanks,
Andrew

Re: 6502Workbench triangles in opcode

<eb7719ee-b3e1-4eb0-8e32-1771b66df63fn@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=3640&group=comp.sys.apple2#3640

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a37:8287:: with SMTP id e129mr11531634qkd.415.1630940440044;
Mon, 06 Sep 2021 08:00:40 -0700 (PDT)
X-Received: by 2002:ac8:544e:: with SMTP id d14mr11138697qtq.133.1630940439836;
Mon, 06 Sep 2021 08:00:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Mon, 6 Sep 2021 08:00:39 -0700 (PDT)
In-Reply-To: <sh55of$5pd$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=24.130.68.111; posting-account=UAtoeQoAAADrX7T-MHdWWRC4Fzf0dsLP
NNTP-Posting-Host: 24.130.68.111
References: <sh1c3o$k5k$1@dont-email.me> <eb0e8663-5c69-47c2-ae75-71212768663an@googlegroups.com>
<sh55of$5pd$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <eb7719ee-b3e1-4eb0-8e32-1771b66df63fn@googlegroups.com>
Subject: Re: 6502Workbench triangles in opcode
From: thefad...@gmail.com (fadden)
Injection-Date: Mon, 06 Sep 2021 15:00:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2518
 by: fadden - Mon, 6 Sep 2021 15:00 UTC

On Monday, September 6, 2021 at 6:40:33 AM UTC-7, Andrew Roughan wrote:
> I assumed code hint needed to be used on a block.

A couple of versions back I stopped calling them "hints", because pretty much everybody who used the program made similar assumptions. "Code start point" more accurately describes their purpose. You don't need to identify the end of the code section or any bytes between because the computer can do that for you.

> It was certainly quicker
to mark all code as code than to have to mark each start point as code.

The SourceGen approach is to assume that everything it can't explicitly reach is data. I think a lot of people are used to simple disassemblers (e.g. the system monitor) that assume everything is code until you tell it otherwise, and expect to manually exclude data areas. It's a question of building up the code areas rather than stripping out the data.

My experience so far has been that SourceGen finds all the code without any help except when (1) JSRs are followed by inline data, or (2) there's a jump table of some sort (usually LDA/PHA/LDA/PHA/RTS, sometimes indirect JMP, but generally easy to spot). The former can be automated and the latter can be formatted with a single command that will apply the code start tags for you.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor