65816 mode
@@ -456,6 +465,17 @@ mnemonics:
TSA is an alias for TSC
+The
+ mvn #^src, #^dst ; bank of src to bank of dst
+ mvn src, dst ; bank of src to bank of dst
+ mvp #$12, #$78 ; bank $12 to $78
+ mvp $123456, $789ABC ; bank $12 to $78
+
+
6502X mode
diff --git a/src/ca65/instr.c b/src/ca65/instr.c
index 745072a09..b72be6711 100644
--- a/src/ca65/instr.c
+++ b/src/ca65/instr.c
@@ -181,7 +181,7 @@ static const struct {
{ "BMI", 0x0020000, 0x30, 0, PutPCRel8 },
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
- { "BRK", 0x0000001, 0x00, 0, PutAll },
+ { "BRK", 0x0800005, 0x00, 6, PutAll },
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
{ "CLC", 0x0000001, 0x18, 0, PutAll },
@@ -252,7 +252,7 @@ static const struct {
{ "BMI", 0x0020000, 0x30, 0, PutPCRel8 },
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
- { "BRK", 0x0000001, 0x00, 0, PutAll },
+ { "BRK", 0x0800005, 0x00, 6, PutAll },
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
{ "CLC", 0x0000001, 0x18, 0, PutAll },
@@ -342,7 +342,7 @@ static const struct {
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
{ "BRA", 0x0020000, 0x12, 0, PutPCRel8 }, /* DTV */
- { "BRK", 0x0000001, 0x00, 0, PutAll },
+ { "BRK", 0x0800005, 0x00, 6, PutAll },
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
{ "CLC", 0x0000001, 0x18, 0, PutAll },
@@ -418,7 +418,7 @@ static const struct {
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
{ "BRA", 0x0020000, 0x80, 0, PutPCRel8 },
- { "BRK", 0x0000001, 0x00, 0, PutAll },
+ { "BRK", 0x0800005, 0x00, 6, PutAll },
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
{ "CLC", 0x0000001, 0x18, 0, PutAll },
@@ -510,7 +510,7 @@ static const struct {
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
{ "BRA", 0x0020000, 0x80, 0, PutPCRel8 },
- { "BRK", 0x0000001, 0x00, 0, PutAll },
+ { "BRK", 0x0800005, 0x00, 6, PutAll },
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
{ "CLC", 0x0000001, 0x18, 0, PutAll },
@@ -622,7 +622,7 @@ static const struct {
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
{ "BRA", 0x0020000, 0x80, 0, PutPCRel8 },
- { "BRK", 0x0000001, 0x00, 0, PutAll },
+ { "BRK", 0x0800005, 0x00, 6, PutAll },
{ "BSR", 0x0040000, 0x63, 0, PutPCRel4510 },
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
@@ -747,7 +747,7 @@ static const struct {
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
{ "BRA", 0x0020000, 0x80, 0, PutPCRel8 },
- { "BRK", 0x0000005, 0x00, 6, PutAll },
+ { "BRK", 0x0800005, 0x00, 6, PutAll },
{ "BRL", 0x0040000, 0x82, 0, PutPCRel16 },
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
@@ -756,7 +756,7 @@ static const struct {
{ "CLI", 0x0000001, 0x58, 0, PutAll },
{ "CLV", 0x0000001, 0xb8, 0, PutAll },
{ "CMP", 0x0b8f6fc, 0xc0, 0, PutAll },
- { "COP", 0x0000004, 0x02, 6, PutAll },
+ { "COP", 0x0800005, 0x02, 6, PutAll },
{ "CPA", 0x0b8f6fc, 0xc0, 0, PutAll }, /* == CMP */
{ "CPX", 0x0c0000c, 0xe0, 1, PutAll },
{ "CPY", 0x0c0000c, 0xc0, 1, PutAll },
@@ -833,7 +833,7 @@ static const struct {
{ "TYA", 0x0000001, 0x98, 0, PutAll },
{ "TYX", 0x0000001, 0xbb, 0, PutAll },
{ "WAI", 0x0000001, 0xcb, 0, PutAll },
- { "WDM", 0x0000004, 0x42, 6, PutAll },
+ { "WDM", 0x0800004, 0x42, 6, PutAll },
{ "XBA", 0x0000001, 0xeb, 0, PutAll },
{ "XCE", 0x0000001, 0xfb, 0, PutAll }
}
@@ -909,7 +909,7 @@ static const struct {
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
{ "BRA", 0x0020000, 0x80, 0, PutPCRel8 },
- { "BRK", 0x0000001, 0x00, 0, PutAll },
+ { "BRK", 0x0800005, 0x00, 6, PutAll },
{ "BSR", 0x0020000, 0x44, 0, PutPCRel8 },
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
diff --git a/test/asm/listing/109-brk-signature.s b/test/asm/listing/109-brk-signature.s
new file mode 100644
index 000000000..e9c23dd63
--- /dev/null
+++ b/test/asm/listing/109-brk-signature.s
@@ -0,0 +1,45 @@
+; test of optional signature byte for BRK on all 6502-derived CPUs
+; and also COP on 65C816
+
+.setcpu "6502"
+brk ; 1 byte
+brk 0 ; 2 bytes
+brk $60 ; 2 bytes
+brk #$60 ; 2 bytes
+
+.setcpu "6502X"
+brk
+brk $60
+brk #$60
+
+.setcpu "6502DTV"
+brk
+brk $60
+brk #$60
+
+.setcpu "65SC02"
+brk
+brk $60
+brk #$60
+
+.setcpu "65816"
+brk
+brk $60
+brk #$60
+cop
+cop $60
+cop #$60
+; WDM is a NOP that gives +2 PC, probably not useful to make its signature byte optional
+;wdm
+wdm $60
+wdm #$60
+
+.setcpu "4510"
+brk
+brk $60
+brk #$60
+
+.setcpu "HuC6280"
+brk
+brk $60
+brk #$60
diff --git a/test/asm/listing/ref/109-brk-signature.bin-ref b/test/asm/listing/ref/109-brk-signature.bin-ref
new file mode 100644
index 000000000..0eaa09faa
Binary files /dev/null and b/test/asm/listing/ref/109-brk-signature.bin-ref differ