Re: 65C02 assembler / trace

From: David Holz <david.holz_at_grindwork.com>
Date: Sat, 29 Sep 2018 23:17:39 -0700
Message-ID: <09024708-cee8-5554-9523-d31e84721184@grindwork.com>
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.
Received on 2018-09-30 09:00:05

Archive generated by hypermail 2.2.0.