Page 3 of 3
Re: Macroassembler by Michal Kowalski, syntacs question
Posted: Sun Jul 29, 2018 11:09 pm
by barrym95838
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.
Re: Macroassembler by Michal Kowalski, syntacs question
Posted: Mon Jul 30, 2018 2:24 am
by BigDumbDinosaur
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
and it assembled to
According to your description, it should have assembled to
According to every other assembler I know about, it would become
I have no problem with
being assembled as
.
I just tested the Kowalski assembler with a
BRK instruction and the signature byte option enabled. The code assembled was
$00 $EA.
Re: Macroassembler by Michal Kowalski, syntacs question
Posted: Mon Jul 30, 2018 7:51 am
by Klaus2m5
You can set the BRK opcode behavior here:

- Kowalski_set_BRK_behavior.png (13.78 KiB) Viewed 2285 times
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: Select all
; 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
Re: Macroassembler by Michal Kowalski, syntacs question
Posted: Mon Jul 30, 2018 10:38 am
by BitWise
Dev65 generates one byte unless an immediate operand is specified.
Code: Select all
00:00C4' 00 : BRK
00:00C5' 0011 : BRK #$11
Re: Macroassembler by Michal Kowalski, syntacs question
Posted: Mon Jul 30, 2018 11:41 am
by BigEd
Best of both worlds!