Skip to content

Commit

Permalink
Added BS
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Robson committed Apr 9, 2024
1 parent 5a49aa6 commit 0277523
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 2 deletions.
23 changes: 22 additions & 1 deletion basic/sources/assembler/sweet/opcodes.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion basic/test.bsc
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ for pass = 0 to 1
bnz p1
bm1 p1
bnm1 p1

bs p1
bs p2
.p2
next
47 changes: 47 additions & 0 deletions examples/basic/examples/mixedassembler.bsc
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0277523

Please sign in to comment.