[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SOS file system information



Linards Ticmanis <ticmanis@gmx.de> wrote:

> On 03/23/2011 09:33 PM, David Empson wrote:
> 
> > Early versions of ProDOS disk utilities write ProDOS boot code in block
> > 0 and SOS boot code in block 1, relying on the different entry points.
> > The Apple ][ expects byte 0 to be $01 and starts executing from byte 1.
> > The Apple /// starts executing from byte 0. The $01 byte is an illegal
> > opcode for the 6502, but it is parsed as if it is a three byte
> > instruction (if I remember right). With some careful coding, this allows
> > the initial sequence of instructions to diverge depending on whether you
> > started executing at offset 0 or 1.
> 
> Nitpick: $01 is actually a legal opcode, namely the seldom-used
> 
> ORA ($zp,X)

Oops. My memory isn't perfect. :-)

I realised it was a two byte instruction after I posted that but didn't
think it was worth posting a followup.

> Which is of course two bytes long. Effectively it will skip one byte on
> the Apple III, which contains a SEC command for the Apple II. Then a BCS
> happens, which will jump on the Apple II thanks to the preceding SEC.
> The BCS skips a JMP which happens only on the Apple III.
> 
> Obviously for this scheme to work, it must be true that the Apple III
> will always enter this code with the carry flag cleared, also the
> Accumulator value must be unimportant since the ORA will clobber it.

Indeed. Thanks for the details and the correction.
-- 
David Empson
dempson@actrix.gen.nz