Re: Question about 65816

From: Stephen Judd (judd_at_merle.acns.nwu.edu)
Date: 1998-07-09 21:53:58

Hi Ruud!

> ... in fact I hoped for a 'No' to the first question. The BRK
> instruction of the original 6502 is one byte long (At least I think).

Nope -- it is 2 bytes long.  That is, when a BRK occurs, PC+2 is placed
on the stack.  So there's no difference between emulation and native
mode (except that PBR or whatever is also placed on the stack in
native mode).

That's why Ethan was suggesting using the signature byte to implement
a 6502-based pseudo-bios-thing.

So, no matter what processor you are using, the code looks like

$C000	BRK
$C001   byte
$C002	program resumes here -- PC+2 is pushed on the stack

A little program on the 64, using the BRK vector at $03xx, will verify 
that $C002 is pushed on the stack, not $C001.

I don't know if there is an alternative BRK syntax, like BRK $01 or
whatnot.  At least, I did not implement it that way in jamaicamon;
it always assembles/disassembles BRK as a single byte.  I don't recall 
reading about such a syntax in the WDC notes (which isn't saying much,
considering my memory).

By the way, until I did jamaicamon I too had always thought of BRK as a 
single byte!  I based all the code on Supermon, and was quite mystified
as to why supermon was subtracting 2 from the PC on the stack.

-Steve
-
This message was sent through the cbm-hackers mailing list.
To unsubscribe: echo unsubscribe | mail cbm-hackers-request@dot.tcm.hut.fi.

Archive generated by hypermail 2.1.1.