Re: BRK opcode

From: Steve Judd (sjudd_at_ffd2.com)
Date: 2003-11-05 03:59:32

Hola Nathan,

Yes, it is actually a two-byte opcode -- the PC counter goes to PC+2.
But nothing is actually done with the second byte; if it were e.g. pushed
onto the stack it might have been useful as a software interrupt.

There's no real reason to assemble it (or disassemble it) as two bytes.  I
think that in Sirius I actually do assemble it as two bytes if a second
argument is given (just for the heck of it), but I don't really remember
anymore.

I think you can answer your question by just asking what the purpose of
the BRK opcode is, ever.  Software interrupts only have a few uses; as the
BRK opcode is implemented, the only intentional use on the 64 is, of
course, to enter a monitor.  Given that, it makes more sense to assemble
(and disassemble) BRK as a single byte.

I've always guessed that BRK was only half thought-through -- that it was
possible to imagine wanting an extra byte, and there was some vague idea
of using the PC on the stack to fetch the byte, but it wasn't appreciated
that this was effectively useless (you know... hardware guys vs. software
guys thinking... :).  Maybe someone here knows for sure though.

-Steve


On Wed, 5 Nov 2003, Nathan Smith wrote:

> Everywhere I look (almost everywhere then) it lists BRK as a single
> byte opcode but in operation it is 2. Is there some official
> explaination? I notice most assemblers treat it as a single byte and
> maybe causing headaches for many users.
> 
> 
> 
>        Message was sent through the cbm-hackers mailing list
> 


       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.