Re: 6502 stack register at reset

From: smf <smf_at_null.net>
Date: Sat, 25 Nov 2017 21:35:18 +0000
Message-ID: <acb540f6-a2b0-cf5e-6629-595c49641a3b@null.net>
On 25/11/2017 20:56, didier derny wrote:

> the problem occurred on a replica 1 (original apple  1 monitor)
>
> I checked the monitor code no initialization of the stack
>
> my code was working fine on commodore and on a sym 1
>
The world is full of code that worked on the programmers machine.

The stack pointer wraps, so technically you don't need to initialise it. 
I would hazzard a guess that the Apple 1 just isn't sensitive to the 
starting value, so they don't bother to initialise it. But your code for 
some reason is sensitive.

The commodore 64 kernal sets the stack pointer & they did a lot of 
rewriting to make it fit in the limited rom. So if it was unnecessary 
then it's 3 bytes they could have removed easily.

; RESET routine

FCE2   A2 FF      LDX #$FF
FCE4   78         SEI
FCE5   9A         TXS
FCE6   D8         CLD



       Message was sent through the cbm-hackers mailing list
Received on 2017-11-25 22:03:21

Archive generated by hypermail 2.2.0.