1
0
mirror of https://github.com/cc65/cc65.git synced 2026-01-22 17:16:21 +00:00

add sweet16 to the opcodes test as well

This commit is contained in:
mrdudz
2025-06-29 19:51:22 +02:00
parent a1a87f74a9
commit e85339dada
3 changed files with 35 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,34 @@
.setcpu "SWEET16"
RTN ; $00 Return to 6502 code.
BR LABEL ; $01 ea Unconditional Branch.
BNC LABEL ; $02 ea Branch if Carry=0.
BC LABEL ; $03 ea Branch if Carry=1.
BP LABEL ; $04 ea Branch if last result positive.
BM LABEL ; $0S ea Branch if last result negative.
BZ LABEL ; $06 ea Branch if last result zero.
BNZ LABEL ; $07 ea Branch if last result non-zero.
BM1 LABEL ; $08 ea Branch if last result = -1.
BNM1 LABEL ; $09 ea Branch if last result not -1.
BK ; $0A Execute 6502 BRK instruction.
RS ; $0B Return from SWEET-16 subroutine.
BS LABEL ; $0C ea Call SWEET-16 subroutine.
LABEL:
.repeat 16, count
SET count,$1234 ; $1n lo hi Rn <-- value.
LD count ; $2n R0 <-- (Rn).
ST count ; $3n Rn <-- (R0).
LD @count ; $4n MA = (Rn), ROL <-- (MA), Rn <-- MA+1, R0H <-- 0.
ST @count ; $5n MA = (Rn), MA <-- (R0L), Rn <-- MA+1.
LDD @count ; $6n MA = (Rn), R0 <-- (MA, MA+1), Rn <-- MA+2.
STD @count ; $7n MA = (Rn), MA,MA+l <-- (R0), Rn <-- MA+2.
POP @count ; $8n MA = (Rn)-1, R0L <-- (MA), R0H <-- 0, Rn <-- MA.
STP @count ; $9n MA <-- (Rn)-1, (MA) <-- R0L, Rn <-- MA.
ADD count ; $An R0 <-- (R0) + (Rn).
SUB count ; $Bn R0 <-- (R0) - (Rn).
POPD @count ; $Cn MA = (Rn)-2, MA,MA+l <-- R0, Rn <-- MA.
CPR count ; $Dn R13 <-- (R0) - (Rn), R14 <-- status flags.
INR count ; $En Rn <-- (Rn) + 1.
DCR count ; $Fn Rn <-- (Rn) - 1.
.endrepeat

View File

@@ -8,6 +8,7 @@
; "6502DTV"
; "65SC02"
; "65C02"
; "65CE02"
; "W65C02"
; "4510"
; "45GS02"