65C02 assembler / trace

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

65C02 assembler / trace

Didier Derny
Any idea of an assembler supporting 6502 / 65C02 with a syntax very
close to commodore assembler ?

Actually I'm using  a65v106 / a65v106w  but it's limited and the 65C02
is not fully suppoted


I'm rewriting my own monitor...

any idea of the logic to use to trace 6502 instructions without hardware
help


thanks





Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

André Fachat


Am 29. September 2018 9:21:49 PM schrieb didier derny <[hidden email]>:

> Any idea of an assembler supporting 6502 / 65C02 with a syntax very
> close to commodore assembler ?

What are the actual specifics? What is not supported by ca65 or xa65?

André



Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

Didier Derny
no idea,  I used CA65 once I had to make a lot of modifications in the
source code
I never used XA65

I don't like assemblers using H or 0x like assembler for Z80
assemblers using non standard code in place of  <  and >  to extract the
low part or high part
or the assemblers needing a lot of declarations

mos technology syntax is simple you have do think about the code you are
writing and not
about many of directives needed to produce the right code

in short I would love an assembler like the one on the cbm 8032 but with
65c02 support and without the bugs...
I remember that in the eighties we had to patch the final code to fix
the "holes" let by the assembler


On 9/29/2018 11:25 PM, André Fachat wrote:

>
>
> Am 29. September 2018 9:21:49 PM schrieb didier derny <[hidden email]>:
>
>> Any idea of an assembler supporting 6502 / 65C02 with a syntax very
>> close to commodore assembler ?
>
> What are the actual specifics? What is not supported by ca65 or xa65?
>
> André
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

David Holz-2
In reply to this post by Didier Derny
On 09/29/2018 12:20 PM, didier derny wrote:
> I'm rewriting my own monitor...
>
> any idea of the logic to use to trace 6502 instructions without
> hardware help

If you mean single-stepping, and without modded hardware, two ideas come
to mind:

1) Use a timer to trigger an interrupt such that it will fire after you
RTI back into the "running" program, allowing 1 instruction to execute. 
Hope that the program/OS doesn't use that timer or SEI if it's not an NMI.

2) Temporarily place a BRK where the PC is going to be after the next
instruction runs.  You'd have to anticipate the destination of branches
and jmp/jmp()/jsr/rts/rti.  For all other cases, just the length of the
upcoming instruction is needed.  This can fail if an instruction is
selfmodding the next opcode, dealing with ROM, or doing memory bank
stuff, but can be friendly to interrupts running in the background.


Regarding a 65c02-supporting assembler, the NMOS 6502 is popular enough
to have its own dedicated tools.  Once you get into other variants,
you're going to be dealing with multi-target assemblers, which will have
broader semantics affecting its source code style.  That's just the
state of things.  I would say that it's beneficial to learn ca65, as
it's the most powerful one I know of.

Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

Francesco Messineo
In reply to this post by Didier Derny
On Sun, Sep 30, 2018 at 7:58 AM didier derny <[hidden email]> wrote:
>
> no idea,  I used CA65 once I had to make a lot of modifications in the
> source code
> I never used XA65

did you try AS?

http://john.ccac.rwth-aachen.de:8000/as/

Frank

Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

André Fachat
In reply to this post by Didier Derny


Am 30. September 2018 7:59:44 AM schrieb didier derny <[hidden email]>:

> no idea,  I used CA65 once I had to make a lot of modifications in the
> source code
> I never used XA65
>
> I don't like assemblers using H or 0x like assembler for Z80
> assemblers using non standard code in place of  <  and >  to extract the
> low part or high part
> or the assemblers needing a lot of declarations

Maybe then try xa65. I explicitly wrote it to understand "BASIC" listings
with "old style" assembler code, i.e. with (optional) line numbers, $ hex
values, and <> for lower/upper part of a word if that is all. You can even
have multiple statements in one line separated by colon, like in BASIC...

André



smf
Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

smf
In reply to this post by Didier Derny

On 29/09/2018 20:20, didier derny wrote:
>
> any idea of the logic to use to trace 6502 instructions without
> hardware help
>
This does it

https://github.com/jefftranter/6502/tree/master/asm/jmon



smf
Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

smf
In reply to this post by David Holz-2

On 30/09/2018 07:17, David Holz wrote:
>
> 2) Temporarily place a BRK where the PC is going to be after the next
> instruction runs.  You'd have to anticipate the destination of branches
> and jmp/jmp()/jsr/rts/rti.  For all other cases, just the length of the
> upcoming instruction is needed.  This can fail if an instruction is
> selfmodding the next opcode, dealing with ROM, or doing memory bank
> stuff, but can be friendly to interrupts running in the background.

3) emulate instructions which can change the program counter & copy code
into a buffer and put a jmp instruction after it. So you can trace rom.

https://github.com/jefftranter/6502/tree/master/asm/jmon


Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

Didier Derny
In reply to this post by smf
nice development

he also wrote a monitor for the replica 1

I'm also using this machine but instead for playing 2 hours you can't
really do anything usefull with this machine

the original monitor is broken and has no real functionalities


I converted my replica as a hardware development base for my 6502
developments for  my cbm 8000

(less risks to break something hard or impossible to repair)

I pushed it to 3Mhz and with my monitor I can upload  Intel hex,
motorola srecord or mos technology hex formats


I'll check CA65 and XA65....

thanks for the informations about the trace without hardware



On 9/30/2018 1:20 PM, smf wrote:

>
> On 29/09/2018 20:20, didier derny wrote:
>>
>> any idea of the logic to use to trace 6502 instructions without
>> hardware help
>>
> This does it
>
> https://github.com/jefftranter/6502/tree/master/asm/jmon
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

Rhialto
In reply to this post by David Holz-2
On Sat 29 Sep 2018 at 23:17:39 -0700, David Holz wrote:

> On 09/29/2018 12:20 PM, didier derny wrote:
> > I'm rewriting my own monitor...
> >
> > any idea of the logic to use to trace 6502 instructions without
> > hardware help
>
> If you mean single-stepping, and without modded hardware, two ideas come
> to mind:
>
> 1) Use a timer to trigger an interrupt such that it will fire after you
> RTI back into the "running" program, allowing 1 instruction to execute. 
> Hope that the program/OS doesn't use that timer or SEI if it's not an NMI.
This is I think what several existing monitors do. It isn't included in
my KosMon, it seems, so you'll have to look in MicroMon or some other
monitor for details.

-Olaf.
--
___ Olaf 'Rhialto' Seibert  -- "What good is a Ring of Power
\X/ rhialto/at/falu.nl      -- if you're unable...to Speak." - Agent Elrond

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

Konrad B
Gnome Kit has trace functionality as well. 

Regards, 
Konrad 

niedz., 30 wrz 2018, 16:27 użytkownik Rhialto <[hidden email]> napisał:
On Sat 29 Sep 2018 at 23:17:39 -0700, David Holz wrote:
> On 09/29/2018 12:20 PM, didier derny wrote:
> > I'm rewriting my own monitor...
> >
> > any idea of the logic to use to trace 6502 instructions without
> > hardware help
>
> If you mean single-stepping, and without modded hardware, two ideas come
> to mind:
>
> 1) Use a timer to trigger an interrupt such that it will fire after you
> RTI back into the "running" program, allowing 1 instruction to execute. 
> Hope that the program/OS doesn't use that timer or SEI if it's not an NMI.

This is I think what several existing monitors do. It isn't included in
my KosMon, it seems, so you'll have to look in MicroMon or some other
monitor for details.

-Olaf.
--
___ Olaf 'Rhialto' Seibert  -- "What good is a Ring of Power
\X/ rhialto/at/falu.nl      -- if you're unable...to Speak." - Agent Elrond
Reply | Threaded
Open this post in threaded view
|

Re: 65C02 assembler / trace

Nils Eilers
In reply to this post by Francesco Messineo
On Sun, 30 Sep 2018 08:59:21 +0200
Francesco Messineo <[hidden email]> wrote:

> did you try AS?
>
> http://john.ccac.rwth-aachen.de:8000/as/

Alfred Arnold's Macro Assembler is a huge, very powerful beast supporting myriads of exotic processors including the 65C02.

If you want to keep things simple and more Commore related, you may want to have a look at BSA as well, the Bit Shifter Assembler.
BSA does support a couple of 65xx CPUs and has some Commodore specific extensions. Documentation is included at the header of the source file bsa.c

https://github.com/Edilbert/BSA

Nils