6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Jun 03, 2024 11:09 pm

All times are UTC




Post new topic Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Sun Jul 29, 2018 11:09 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1933
Location: Sacramento, CA, USA
I support the notion that a BRK by itself should assemble to a $00 by itself, and a BRK #$EA should assemble to $00 $EA without complaint ... now I just need to write or modify an assembler to support that behavior, because expecting someone else to do it for me at this late date would be vainly optimistic.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 30, 2018 2:24 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8198
Location: Midwestern USA
Chromatix wrote:
BigDumbDinosaur wrote:
Chromatix wrote:
It would indeed be logical to assemble "BRK #0" as 00 00, and some assemblers accept that syntax, but that's not what was specified here. This difference from standard assembler behaviour could indeed be considered a bug.

In the case of the Kowalski assembler, it's not a bug. It's a design feature that gives the programmer the option to have any signature byte assembled after a BRK instruction. The default if this feature is enabled is to assemble $EA (NOP) as the signature byte. If this feature is disabled, only $00 will be assembled for a BRK instruction.

Except that that's demonstrably *not* what happens here, and it makes it *more* difficult to assemble an arbitrary desired trailing byte.

The code given was
Code:
BRK NOP NOP
and it assembled to
Code:
00 00 EA EA
According to your description, it should have assembled to
Code:
00 EA EA EA
According to every other assembler I know about, it would become
Code:
00 EA EA


I have no problem with
Code:
BRK #0
being assembled as
Code:
00 00
.

I just tested the Kowalski assembler with a BRK instruction and the signature byte option enabled. The code assembled was $00 $EA.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 30, 2018 7:51 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
You can set the BRK opcode behavior here:
Attachment:
Kowalski_set_BRK_behavior.png
Kowalski_set_BRK_behavior.png [ 13.78 KiB | Viewed 2133 times ]

barrym95838 wrote:
I support the notion that a BRK by itself should assemble to a $00 by itself, and a BRK #$EA should assemble to $00 $EA without complaint ... now I just need to write or modify an assembler to support that behavior, because expecting someone else to do it for me at this late date would be vainly optimistic.

This is what macros are for:
Code:
; BRK instruction to assemble with or without signature
;   no matter what the assembler thinks it should do
myBRK   .macro ...
        .db 0
        .if %0>0
               .db %1
        .endif
        .endm
   
; usage example
        *=$200

        myBRK                   ; native BRK
        myBRK $12               ; BRK with signature byte

        .end

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 30, 2018 10:38 am 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
Dev65 generates one byte unless an immediate operand is specified.
Code:
00:00C4' 00                :         BRK
00:00C5' 0011              :         BRK #$11

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 30, 2018 11:41 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10821
Location: England
Best of both worlds!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: