Skip to content

Commit

Permalink
clean-up overall mnemonic-testcase, missing opcodes added
Browse files Browse the repository at this point in the history
(cherry picked from commit db41882)
  • Loading branch information
thomas374b authored and dionoid committed Oct 17, 2020
1 parent 0eaedb9 commit a65bba3
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 92 deletions.
129 changes: 73 additions & 56 deletions test/suite68hc908.asm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
.PROCESSOR 68hc908

PTB .EQU 1
PTC .EQU 2
DDRB .EQU 5

FIVE .EQU 5
Expand All @@ -26,102 +27,116 @@ RAM_START .EQU 0x40
.byte 0xba,0xdc,0x0d,0xe0

adc #6
adc.b RAM_START
adc RAM_START
adc [X+7]
adc constant0
adc [X+0x300]
adc ,X
adc [SP+5]
adc [SP+500]
; adc.w [SP+500] ; doesnt work
; adc.w 500,SP

add #6
add.b RAM_START
add RAM_START
add 7,X
add constant0
add 0x300,X
add ,X
add FIVE,SP
add.w [SP+FIVE_HUNDRED]
add [SP+FIVE_HUNDRED]

aiS #5
aiX #6
and #6
and.b RAM_START
and RAM_START
and 7,X
and constant0
; and.w [X+0x300] ; doesnt work
and [X+0x300]
and ,X
and 5,SP
and FIVE_HUNDRED,SP ; doesnt work
; and.w FIVE_HUNDRED,SP ; must force addressing mode
and FIVE_HUNDRED,SP

asl RAM_START
asl 3,X
asl ,X
asl 5,SP
aslA
aslA
aslX

asr RAM_START
asr 3,X
asr ,X
asr 5,SP
asrA
asrX
asrA
asrX

bcc frontLoop
bcc frontLoop
bcs frontLoop
beq frontLoop
bhcc frontLoop
bhcs frontLoop
beq frontLoop
bhcc frontLoop
bhcs frontLoop
bhi frontLoop
bhs frontLoop
bih frontLoop
bil frontLoop
bhs frontLoop
bih frontLoop
bil frontLoop

bit #6
bit.b RAM_START
bit RAM_START
bit 7,X
bit constant0
bit 0x300,X
bit ,X
bit 5,SP
bit.w 500,SP
bit 500,SP
blo frontLoop
blo frontLoop
bls frontLoop
bmc frontLoop
bmi frontLoop
bms frontLoop
bne frontLoop
bpl frontLoop
bra frontLoop
brn frontLoop
bmc frontLoop
bmi frontLoop
bms frontLoop
bne frontLoop
bpl frontLoop
bra frontLoop
brn frontLoop

subRoutine:
rts

brset 0,PTB,frontLoop
brclr 0,PTC,subRoutine
brset 1,PTB,frontLoop
brclr 1,PTC,subRoutine
brset 2,PTB,frontLoop
brclr 2,PTC,subRoutine
brset 3,PTB,frontLoop
brclr 3,PTC,subRoutine
brset 4,PTB,frontLoop
brclr 4,PTC,subRoutine
brset 5,PTB,frontLoop
brclr 5,PTC,subRoutine
brset 6,PTB,frontLoop
brclr 6,PTC,subRoutine
brset 7,PTB,frontLoop
brclr 7,PTC,subRoutine

frontLoop:

bset 0,PTB
bclr 0,PTC
bset 1,PTB
bclr 1,PTC
bset 2,PTB
bclr 2,PTC
bset 3,PTB
bclr 3,PTC
bset 4,PTB
bclr 4,PTC
bset 5,PTB
bclr 5,PTC
bset 6,PTB
bclr 6,PTC
bset 7,PTB
bclr 7,PTC

bsr subRoutine

Expand All @@ -134,7 +149,7 @@ subRoutine:

clc
cli
frontLoop:
;frontLoop:

clr RAM_START
clr 3,X
Expand All @@ -145,13 +160,13 @@ frontLoop:
clrX
cmp #6
cmp.b RAM_START
cmp RAM_START
cmp 7,X
cmp constant0
cmp 0x300,X
cmp ,X
cmp 5,SP
cmp.w 500,SP
cmp 500,SP

com RAM_START
com 3,X
Expand All @@ -164,26 +179,28 @@ frontLoop:
cpHX #constant0

cpX #6
cpX.b RAM_START
cpX RAM_START
cpX 7,X
cpX constant0
cpX 0x300,X
cpX ,X
cpX 5,SP
cpX.w FIVE_HUNDRED,SP

cpX FIVE_HUNDRED,SP

daa ; decimal adjust after BCD calculation

backLoop:
dbnzA backLoop
dbnz 4,backLoop
dbnz [X+5],backLoop
dbnz [SP+6],backLoop
dbnz.ix 0,backLoop ; must add forced-address-mode extension and dummy 0 to get opcode 0x7B
dbnzX backLoop
dbnzX backLoop

dec RAM_START
dec 3,X
dec ,X
dec 5,SP
dec 5,SP
decA
decX

Expand All @@ -199,13 +216,13 @@ backLoop:
stop

eor #6
eor.b RAM_START
eor RAM_START
eor 7,X
eor constant0
eor 0x300,X
eor ,X
eor 5,SP
eor.w 500,SP
eor 500,SP

inc RAM_START
inc 3,X
Expand All @@ -214,38 +231,38 @@ backLoop:
incA
incX

jmp.8 RAM_START
jmp RAM_START
jmp vector0
jmp 3,X
jmp $300,X
jmp ,X

jsr.8 RAM_START
jsr RAM_START
jsr vector0
jsr 3,X
jsr 0x300,X
jsr ,X

ldA #6
ldA.b RAM_START
ldA RAM_START
ldA 7,X
ldA constant0
ldA 0x300,X
ldA ,X
ldA 5,SP
ldA.w 500,SP
ldA 500,SP
ldHX #500
ldHX RAM_START

ldX #55
ldX.b RAM_START
ldX RAM_START
ldX 7,X
ldX constant0
ldX 0x300,X
ldX ,X
ldX 5,SP
ldX.w 500,SP
ldX 500,SP
lsl RAM_START
lsl 3,X
Expand Down Expand Up @@ -277,13 +294,13 @@ backLoop:
nop
orA #6
orA.b RAM_START
orA RAM_START
orA 7,X
orA constant0
orA 0x300,X
orA ,X
orA 5,SP
orA.w 500,SP
orA 500,SP
pshA
pshH
Expand Down Expand Up @@ -312,43 +329,43 @@ dummyISR:
rti
sbc #6
sbc.b RAM_START
sbc RAM_START
sbc 7,X
sbc constant0
sbc 0x300,X
sbc ,X
sbc 5,SP
sbc.w 500,SP
sbc 500,SP
sec
sei

stA.b RAM_START
stA RAM_START
stA 7,X
stA constant0
stA 0x300,X
stA ,X
stA 5,SP
stA.w 500,SP
stA 500,SP
stHX RAM_START
stX.b RAM_START
stX RAM_START
stX 7,X
stX constant0
stX 0x300,X
stX ,X
stX 5,SP
stX.w 500,SP
stX 500,SP

sub #6
sub.b RAM_START
sub RAM_START
sub 7,X
sub constant0
sub 0x300,X
sub ,X
sub 5,SP
sub.w 500,SP
sub 500,SP

swi
tAP
Expand All @@ -357,7 +374,7 @@ dummyISR:
tPA
tSHX

tst.8 RAM_START
tst RAM_START
tst 3,X
tst ,X
tst 4,SP
Expand Down
Binary file modified test/suite68hc908.bin.ref
Binary file not shown.
Loading

0 comments on commit a65bba3

Please sign in to comment.