added pseudocommands for branch word-relative instructions

This commit is contained in:
FeralChild64 committed 2019-10-11 19:56:34 +02:00
1 parent e9dd7ad7bc
commit a64da02dad
1 file changed
+102
+102
View File
@@ -47,3 +47,105 @@
tay
#endif
}
//
// Branches with far offsets, substitutes by Bxx + JMP for CPUs not supporting the instruction
//
.pseudocommand bcs_far dst
{
#if CONFIG_CPU_CSG_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000)
.byte $B3, mod(offset, $100), floor(offset / $100)
#else
bcc __l
jmp dst
__l:
#endif
}
.pseudocommand bcc_far dst
{
#if CONFIG_CPU_CSG_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000)
.byte $93, mod(offset, $100), floor(offset / $100)
#else
bcs __l
jmp dst
__l:
#endif
}
.pseudocommand beq_far dst
{
#if CONFIG_CPU_CSG_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000)
.byte $F3, mod(offset, $100), floor(offset / $100)
#else
bne __l
jmp dst
__l:
#endif
}
.pseudocommand bne_far dst
{
#if CONFIG_CPU_CSG_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000)
.byte $D3, mod(offset, $100), floor(offset / $100)
#else
beq __l
jmp dst
__l:
#endif
}
.pseudocommand bmi_far dst
{
#if CONFIG_CPU_CSG_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000)
.byte $33, mod(offset, $100), floor(offset / $100)
#else
bpl __l
jmp dst
__l:
#endif
}
.pseudocommand bpl_far dst
{
#if CONFIG_CPU_CSG_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000)
.byte $13, mod(offset, $100), floor(offset / $100)
#else
bmi __l
jmp dst
__l:
#endif
}
.pseudocommand bvc_far dst
{
#if CONFIG_CPU_CSG_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000)
.byte $53, mod(offset, $100), floor(offset / $100)
#else
bvs __l
jmp dst
__l:
#endif
}
.pseudocommand bvs_far dst
{
#if CONFIG_CPU_CSG_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000)
.byte $73, mod(offset, $100), floor(offset / $100)
#else
bvc __l
jmp dst
__l:
#endif
}