Simplest subset of 6502

Let's talk about anything related to the 6502 microprocessor.
Squonk
Posts: 68
Joined: 11 Apr 2017

Re: Simplest subset of 6502

Post by Squonk »

Removed by author
Last edited by Squonk on Tue Oct 03, 2023 7:29 pm, edited 1 time in total.
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Re: Simplest subset of 6502

Post by Arlet »

Squonk wrote:
With only absolute addressing, one would need to pass arguments to subroutine by reserving some fixed memory.
With only absolute addressing, you would not be able to pass arguments on the stack anyway.
Squonk
Posts: 68
Joined: 11 Apr 2017

Re: Simplest subset of 6502

Post by Squonk »

Removed by author
Last edited by Squonk on Tue Oct 03, 2023 7:29 pm, edited 1 time in total.
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Re: Simplest subset of 6502

Post by Arlet »

Squonk wrote:
Actually, with only absolute addressing, self-modifying code and access to the stack pointer, it is indeed possible (although not trivial!).
If you permit self modifying code, you could build your own data stack in data memory, and then you wouldn't need TSX/TXS at all.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Simplest subset of 6502

Post by BigEd »

The thing to bear in mind about this topic
Quote:
What's the simplest subset of the 6502 architecture that could still be reasonably useful?
is that it always is going to be a tradeoff, landing somewhere in between a very-nearly-6502 and a single instruction tarpit.

(Each of us will be inclined to place that tradeoff at a different place. It's all very interesting, but not a good basis to argue over.)
Squonk
Posts: 68
Joined: 11 Apr 2017

Re: Simplest subset of 6502

Post by Squonk »

Removed by author
Last edited by Squonk on Tue Oct 03, 2023 7:29 pm, edited 1 time in total.
Squonk
Posts: 68
Joined: 11 Apr 2017

Re: Simplest subset of 6502

Post by Squonk »

Removed by author
Last edited by Squonk on Tue Oct 03, 2023 7:29 pm, edited 1 time in total.
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Re: Simplest subset of 6502

Post by Arlet »

Squonk wrote:
Even with self-modifying code, you need TXS to initialize the call stack.
No, that was my point. You can start the stack at any random point, and it will just wrap around the page boundary, giving you 256 usable bytes.
Squonk
Posts: 68
Joined: 11 Apr 2017

Re: Simplest subset of 6502

Post by Squonk »

Removed by author
Last edited by Squonk on Tue Oct 03, 2023 7:30 pm, edited 1 time in total.
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: Simplest subset of 6502

Post by barnacle »

But you can set the stack pointer to 0x1ff (well, 0xff) at reset, through hardware. Doesn't need a dedicated instruction unless you're going to get exciting in the program.

Neil
Squonk
Posts: 68
Joined: 11 Apr 2017

Re: Simplest subset of 6502

Post by Squonk »

Removed by author
Last edited by Squonk on Tue Oct 03, 2023 7:30 pm, edited 1 time in total.
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: Simplest subset of 6502

Post by barnacle »

Well I'm kind of assuming you're emulating|designing|building a complete but minimal processor here, so it would seem that it's just a question of setting a register as part of the reset initialisation: to get the initial reset vector you have to jam the $fffc address onto the bus and then increment it after reading the value into the address register low and high. I don't know what mechanism you would choose to do that, but one could (e.g.)
- tick 0, issue a reset to a register counter
- tick 1, issue a decrement to it
and I feel these could happen in parallel with other required operations for the reset so wouldn't occupy any more time/ticks.

Neil
Post Reply