diff --git a/basic/sources/assembler/sweet/opcodes.asm b/basic/sources/assembler/sweet/opcodes.asm index ac8c065c..f3c19fd7 100644 --- a/basic/sources/assembler/sweet/opcodes.asm +++ b/basic/sources/assembler/sweet/opcodes.asm @@ -194,7 +194,28 @@ ShortBranchCommon: SweetAsm_BS: ;; [BS] .sweetopc $0D ; subroutine call - .byte 3 + + ldx #0 ; target address + jsr EXPEvalInteger16 + + sec ; calculate target - P + lda XSNumber0 + sbc VariableP + pha + lda XSNumber1 + sbc VariableP+1 + tax + pla ; in X:A + + sec ; sub 2, 2 further back to allow for operand. + sbc #2 + php + jsr AssemblerWriteByte ; low offset + plp + txa + sbc #0 + jsr AssemblerWriteByte ; high offset + rts .send code diff --git a/basic/test.bsc b/basic/test.bsc index 1dc5bd53..75d228b6 100644 --- a/basic/test.bsc +++ b/basic/test.bsc @@ -36,5 +36,7 @@ for pass = 0 to 1 bnz p1 bm1 p1 bnm1 p1 - + bs p1 + bs p2 +.p2 next diff --git a/examples/basic/examples/mixedassembler.bsc b/examples/basic/examples/mixedassembler.bsc new file mode 100644 index 00000000..a91a04e1 --- /dev/null +++ b/examples/basic/examples/mixedassembler.bsc @@ -0,0 +1,47 @@ +' +' Assembler pair test +' +' Test of sweet 16 assembler, with a little 65C02 +' +mem = alloc(512) +for pass = 0 to 1 + p = mem + o = pass * 3 + + nop + + rs + rtn + + set 5,32767 + ld 11 + st 12 + ld @13 + st @14 + + ldd @1 + std @2 + pop @3 + stp @4 + add 5 + sub 6 + popd @10 + cpr 7 + inr 8 + dcr 9 + + br p1 + bnc p1 +.p1 + bc p1 + bp p1 + bm p1 + bz p1 + bnz p1 + bm1 p1 + bnm1 p1 + bs p1 + bs p2 +.p2 + nop +next