2019-11-16 02:51:30 +00:00
|
|
|
;lst off
|
2019-11-11 23:56:03 +00:00
|
|
|
*
|
|
|
|
* main.s
|
|
|
|
* Merlin32 Test
|
|
|
|
*
|
|
|
|
* Created by Lane Roathe on 8/26/19.
|
2019-11-16 00:15:58 +00:00
|
|
|
* Copyright B) 2019 Ideas From the Deep. All rights reserved.
|
2019-11-11 23:56:03 +00:00
|
|
|
*
|
2019-11-13 05:03:41 +00:00
|
|
|
//]XCODESTART ; Keep this at the start and put your code after this
|
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
xc off
|
|
|
|
xc
|
|
|
|
xc
|
|
|
|
mx %00
|
2019-11-11 23:56:03 +00:00
|
|
|
|
2019-11-17 03:33:22 +00:00
|
|
|
|
2019-11-11 23:56:03 +00:00
|
|
|
*==========================================================
|
|
|
|
* monitor addresses
|
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
TEXT = $FB39 ;Reset text window
|
|
|
|
TABV = $FB5B ;Complete vtab, using contents of 'A'
|
|
|
|
MONBELL = $FBE4 ;random bell noise!
|
|
|
|
HOME = $FC58 ;Clear text window
|
|
|
|
WAIT = $FCA8 ;delay routine
|
|
|
|
CROUT = $FD8E ;Print a CR
|
|
|
|
PRBYTE = $FDDA ;Print 'A' as a hex number
|
|
|
|
PRHEX = $FDE3 ;as above, but bits 0-3 only
|
|
|
|
COUT = $FDED ;Monitor char out
|
|
|
|
MOVE = $FE2C ;memory move routine
|
|
|
|
INVERSE = $FE80 ;Print in inverse
|
|
|
|
NORMAL = $FE84 ;Normal print
|
2019-11-11 23:56:03 +00:00
|
|
|
|
|
|
|
* Jump Vectors
|
2019-11-16 00:15:58 +00:00
|
|
|
CONNECT = $3EA ;Connect DOS
|
|
|
|
DOSWARM = $3D0 ;exit to DOS prompt
|
|
|
|
RSTVEC = $3F2 ;reset vector
|
2019-11-11 23:56:03 +00:00
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
TSTADDR = $1000 ;absolute address for testing
|
2019-11-11 23:56:03 +00:00
|
|
|
|
|
|
|
*==========================================================
|
|
|
|
* Data Index DUM section test
|
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
DUM 0
|
|
|
|
dum0 ds 1 ;fractional byte
|
|
|
|
dum1 ds 1
|
|
|
|
dumSize = *
|
|
|
|
DEND
|
|
|
|
;lst off
|
2019-11-11 23:56:03 +00:00
|
|
|
|
|
|
|
*==========================================================
|
|
|
|
* zero page (all zp var names are prefixed with _)
|
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
DUM 0
|
2019-11-11 23:56:03 +00:00
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
_ptr ds 2
|
|
|
|
_tmp ds 2
|
2019-11-11 23:56:03 +00:00
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
_num1 ds dumSize ;first and second operand values
|
2019-11-11 23:56:03 +00:00
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
; test ORG with DUM section
|
2019-11-11 23:56:03 +00:00
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
ORG $20
|
2019-11-11 23:56:03 +00:00
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
_LFT ds 1 ;Window edge 0..39
|
2019-11-11 23:56:03 +00:00
|
|
|
|
2019-11-16 00:15:58 +00:00
|
|
|
DEND
|
2019-11-11 23:56:03 +00:00
|
|
|
|
|
|
|
*==========================================================
|
|
|
|
* Program Entry
|
|
|
|
|
2020-01-15 00:49:48 +00:00
|
|
|
START
|
|
|
|
adc (0,x)
|
|
|
|
adc ($80,x)
|
2019-11-16 00:15:58 +00:00
|
|
|
adc (_tmp,x)
|
|
|
|
adc (_tmp+0,x)
|
|
|
|
adc (_tmp+$10,x)
|
|
|
|
adc ($10+_tmp,x)
|
|
|
|
adc (_tmp+dum0,x)
|
|
|
|
adc (_tmp+dum1,x)
|
|
|
|
adc (_tmp+dum1+1,x)
|
|
|
|
adc (_tmp+dum0+dum1,x)
|
|
|
|
|
|
|
|
adc 0
|
|
|
|
adc $80
|
|
|
|
adc _tmp
|
|
|
|
adc #0
|
|
|
|
adc #$1111
|
|
|
|
adc $1111
|
|
|
|
|
2020-01-15 00:49:48 +00:00
|
|
|
sta TSTADDR+dum0
|
2019-11-16 00:15:58 +00:00
|
|
|
sta TSTADDR+_num1+dum0
|
|
|
|
sta TSTADDR+_num1+dum0,x
|
|
|
|
|
|
|
|
lda _num1+dum0
|
|
|
|
adc _num1+dum1
|
|
|
|
sbc _num1+dum1
|
|
|
|
bit _num1+dum0
|
2019-11-20 18:38:23 +00:00
|
|
|
sta _num1+dum0 ;(FIXED): can't use sta _num1+dum0 '
|
2019-11-16 00:15:58 +00:00
|
|
|
stz _num1+dum0
|
|
|
|
|
|
|
|
lda _num1+dum0,x
|
|
|
|
adc _num1+dum0,x
|
|
|
|
sbc _num1+dum0,x
|
|
|
|
bit _num1+dum0,x
|
|
|
|
sta _num1+dum0,x
|
|
|
|
stz _num1+dum0,x
|
|
|
|
|
|
|
|
lda _num1+dum0,y ;these assemble to abs accesses: lda $00C0,y
|
|
|
|
adc _num1+dum0,y
|
|
|
|
sbc _num1+dum0,y
|
|
|
|
sta _num1+dum0,y
|
|
|
|
|
|
|
|
; Label & branching tests
|
|
|
|
GetKey ldx $C000
|
|
|
|
bpl GetKey
|
|
|
|
]loop
|
|
|
|
dex
|
|
|
|
bne ]loop
|
|
|
|
|
|
|
|
tya
|
|
|
|
and #1
|
|
|
|
beq :err
|
|
|
|
|
|
|
|
tya
|
|
|
|
and #1
|
|
|
|
bne :good
|
|
|
|
:err
|
|
|
|
lda #0
|
|
|
|
:good
|
|
|
|
bne myQuit
|
|
|
|
nop
|
|
|
|
hex 2C ;bit
|
|
|
|
lda #1
|
|
|
|
myQuit
|
|
|
|
jmp DOSWARM
|
|
|
|
|
2020-01-15 00:49:48 +00:00
|
|
|
org $2000
|
2019-11-16 00:15:58 +00:00
|
|
|
|
|
|
|
lda _LFT
|
|
|
|
ldx #_LFT
|
|
|
|
cpx #$20
|
|
|
|
|
|
|
|
org ;return to ongoing address
|
|
|
|
|
|
|
|
lda $FF
|
|
|
|
;Issue #16 (fadden) - Byte reference modifiers are ignored (no way to force DP)
|
|
|
|
lda <$fff0 ;zp
|
|
|
|
lda >$fff0 ;ABS (lo word)
|
|
|
|
lda ^$fff0 ;ABS (hi word)
|
|
|
|
lda |$fff0 ;ABS (long in 65816 mode)
|
|
|
|
|
|
|
|
lda $08
|
|
|
|
lda $0008
|
|
|
|
lda $FFFF-$FFF7
|
|
|
|
lda $FFF0+24
|
|
|
|
ldaz $FFF0+24 ; forced DP
|
|
|
|
|
|
|
|
|
|
|
|
ldaz $FFFF ; forced DP
|
2019-11-20 18:38:23 +00:00
|
|
|
lda: $FFFF ; forced ABS (any char but 'L', 'D', and 'Z'
|
2019-11-16 00:15:58 +00:00
|
|
|
ldal $FFFF ; forced long abs (3 byte address)
|
|
|
|
|
|
|
|
ldaz $05
|
|
|
|
lda: $05
|
|
|
|
ldal $05
|
|
|
|
|
|
|
|
lda $45
|
|
|
|
lda $2345
|
|
|
|
lda $012345
|
|
|
|
ldaz $2345
|
|
|
|
lda: $45
|
|
|
|
ldal $012345
|
|
|
|
ldal $2345
|
|
|
|
ldal $45
|
|
|
|
lda <$2345
|
|
|
|
lda >$2345
|
|
|
|
lda <$012345
|
|
|
|
lda >$012345
|
|
|
|
lda ^$012345
|
|
|
|
lda |$012345
|
|
|
|
|
|
|
|
ora $45
|
|
|
|
ora $2345
|
|
|
|
ora $012345
|
|
|
|
oraz $2345
|
|
|
|
ora: $45
|
|
|
|
oral $012345
|
|
|
|
oral $2345
|
|
|
|
oral $45
|
|
|
|
ora <$2345
|
|
|
|
ora >$2345
|
|
|
|
ora <$012345
|
|
|
|
ora >$012345
|
|
|
|
ora ^$012345
|
|
|
|
ora |$012345
|
|
|
|
|
|
|
|
and $45
|
|
|
|
and $2345
|
|
|
|
and $012345
|
|
|
|
andz $2345
|
|
|
|
and: $45
|
|
|
|
andl $012345
|
|
|
|
andl $2345
|
|
|
|
andl $45
|
|
|
|
and <$2345
|
|
|
|
and >$2345
|
|
|
|
and <$012345
|
|
|
|
and >$012345
|
|
|
|
and ^$012345
|
|
|
|
and |$012345
|
|
|
|
|
|
|
|
eor $45
|
|
|
|
eor $2345
|
|
|
|
eor $012345
|
|
|
|
eorz $2345
|
|
|
|
eor: $45
|
|
|
|
eorl $012345
|
|
|
|
eorl $2345
|
|
|
|
eorl $45
|
|
|
|
eor <$2345
|
|
|
|
eor >$2345
|
|
|
|
eor <$012345
|
|
|
|
eor >$012345
|
|
|
|
eor ^$012345
|
|
|
|
eor |$012345
|
|
|
|
|
|
|
|
adc $45
|
|
|
|
adc $2345
|
|
|
|
adc $012345
|
|
|
|
adcz $2345
|
|
|
|
adc: $45
|
|
|
|
adcl $012345
|
|
|
|
adcl $2345
|
|
|
|
adcl $45
|
|
|
|
adc <$2345
|
|
|
|
adc >$2345
|
|
|
|
adc <$012345
|
|
|
|
adc >$012345
|
|
|
|
adc ^$012345
|
|
|
|
adc |$012345
|
|
|
|
|
|
|
|
sta $45
|
|
|
|
sta $2345
|
|
|
|
sta $012345
|
|
|
|
staz $2345
|
|
|
|
sta: $45
|
|
|
|
stal $012345
|
|
|
|
stal $2345
|
|
|
|
stal $45
|
|
|
|
sta <$2345
|
|
|
|
sta >$2345
|
|
|
|
sta <$012345
|
|
|
|
sta >$012345
|
|
|
|
sta ^$012345
|
|
|
|
sta |$012345
|
|
|
|
|
|
|
|
cmp $45
|
|
|
|
cmp $2345
|
|
|
|
cmp $012345
|
|
|
|
cmpz $2345
|
|
|
|
cmp: $45
|
|
|
|
cmpl $012345
|
|
|
|
cmpl $2345
|
|
|
|
cmpl $45
|
|
|
|
cmp <$2345
|
|
|
|
cmp >$2345
|
|
|
|
cmp <$012345
|
|
|
|
cmp >$012345
|
|
|
|
cmp ^$012345
|
|
|
|
cmp |$012345
|
|
|
|
|
|
|
|
sbc $45
|
|
|
|
sbc $2345
|
|
|
|
sbc $012345
|
|
|
|
sbcz $2345
|
|
|
|
sbc: $45
|
|
|
|
sbcl $012345
|
|
|
|
sbcl $2345
|
|
|
|
sbcl $45
|
|
|
|
sbc <$2345
|
|
|
|
sbc >$2345
|
|
|
|
sbc <$012345
|
|
|
|
sbc >$012345
|
|
|
|
sbc ^$012345
|
|
|
|
sbc |$012345
|
|
|
|
|
2019-11-19 17:22:27 +00:00
|
|
|
;asll $1234
|
2019-11-16 00:15:58 +00:00
|
|
|
|
|
|
|
lda <$fff0+24 ;zp
|
|
|
|
lda >$fff0+24 ;ABS (lo word)
|
|
|
|
lda ^$fff0+24 ;ABS (hi word)
|
|
|
|
lda |$fff0+24 ;ABS (long in 65816 mode)
|
|
|
|
|
|
|
|
mx %11
|
|
|
|
|
|
|
|
lda #<$fff0+24 ;byte
|
|
|
|
lda #>$fff0+24 ;page
|
|
|
|
lda #^$fff0+24 ;bank
|
|
|
|
|
|
|
|
lda #<$1234 ;byte
|
|
|
|
lda #>$1234 ;page
|
|
|
|
lda #^$1234 ;bank
|
|
|
|
lda #^$A51234 ;bank
|
|
|
|
|
|
|
|
|
|
|
|
mx %00
|
|
|
|
|
|
|
|
lda #<$fff0+24 ;byte
|
|
|
|
lda #>$fff0+24 ;page
|
|
|
|
lda #^$fff0+24 ;bank
|
|
|
|
|
|
|
|
lda #<$1234 ;byte
|
|
|
|
lda #>$1234 ;page
|
|
|
|
lda #^$1234 ;bank
|
|
|
|
lda #^$A51234 ;bank
|
|
|
|
|
|
|
|
|
|
|
|
lda $0008 ;ZP
|
|
|
|
lda $08 ;ZP
|
|
|
|
lda $ffff-$fff7 ;ZP
|
|
|
|
lda $fff0+24 ;ABS (long in 65816 mode)
|
|
|
|
|
|
|
|
|
|
|
|
;Issue #8 fadden) - STX zp,y fails to assemble
|
|
|
|
org $bc
|
|
|
|
|
|
|
|
L00BC bit L00BC
|
|
|
|
|
|
|
|
org
|
|
|
|
|
|
|
|
stx $bc,y
|
|
|
|
|
|
|
|
ldx L00BC,y
|
|
|
|
stx L00BC,y
|
2019-11-11 23:56:03 +00:00
|
|
|
|
2019-11-15 01:04:35 +00:00
|
|
|
* Data Storage Tests
|
|
|
|
|
2019-11-18 00:14:01 +00:00
|
|
|
hex ;no error
|
2019-11-16 00:15:58 +00:00
|
|
|
hex 11,22,33,44,55,66,77,88,99
|
2019-11-20 18:38:23 +00:00
|
|
|
;hex 112233445566778899F
|
|
|
|
;hex 112233445I566778899FF
|
2019-11-16 00:15:58 +00:00
|
|
|
|
2019-11-18 00:14:01 +00:00
|
|
|
hex aabb,CC,0123456789abcdefABCDEF,ff
|
2019-11-16 00:15:58 +00:00
|
|
|
|
|
|
|
ds 36
|
|
|
|
da $A55A
|
|
|
|
da $A55A,$1234
|
|
|
|
dw $A55A
|
|
|
|
dw $A55A,$1234
|
|
|
|
ddb $A55A
|
|
|
|
ddb $A55A,$1234
|
|
|
|
dfb $A55A
|
|
|
|
dfb $A55A,$1234
|
|
|
|
db $A55A
|
|
|
|
db $A55A,$1234
|
|
|
|
adr $01A55A
|
|
|
|
adr $01A55A,$011234
|
|
|
|
adrl $01A55A
|
|
|
|
adrl $01A55A,$011234
|
|
|
|
|
|
|
|
dw >$01A55A,>$011234
|
|
|
|
dw <$01A55A,<$011234
|
|
|
|
dw ^$01A55A,^$011234
|
|
|
|
dw |$01A55A,|$011234
|
|
|
|
|
|
|
|
db >$01A55A,>$011234
|
|
|
|
db <$01A55A,<$011234
|
|
|
|
db ^$01A55A,^$011234
|
|
|
|
db |$01A55A,|$011234
|
|
|
|
|
2019-11-18 01:41:42 +00:00
|
|
|
asc 02,15,"123456"
|
|
|
|
asc 02,15,z123456z
|
|
|
|
asc 0215,"123456"
|
|
|
|
asc 02,15,'123456'
|
|
|
|
asc 02,15,!123456!
|
|
|
|
asc 02,15,@123456@
|
|
|
|
asc 02,15,#123456#
|
|
|
|
asc 02,15,$123456$
|
|
|
|
asc 02,15,%123456%
|
|
|
|
asc 02,15,^123456^
|
|
|
|
asc 02,15,&123456&
|
|
|
|
asc 02,15,*123456*
|
|
|
|
asc 02,15,(123456(
|
|
|
|
asc 02,15,)123456)
|
|
|
|
asc 02,15,/123456/
|
|
|
|
asc 02,15,?123456?
|
|
|
|
asc 02,15,>123456>
|
|
|
|
asc 02,15,<123456<
|
2019-11-19 17:22:27 +00:00
|
|
|
asc 02,15,05,"123456"
|
|
|
|
asc 02,15,"123456"
|
2019-11-18 01:41:42 +00:00
|
|
|
asc 0215"1234"1502
|
|
|
|
|
2019-11-18 20:45:52 +00:00
|
|
|
dci 8D,'Hello',8D,'there',8D
|
|
|
|
dci 8D,"Hello",8D,"there",8D
|
2019-11-15 13:09:41 +00:00
|
|
|
|
2019-11-16 02:30:12 +00:00
|
|
|
lst
|
|
|
|
lup_start:
|
2019-11-16 06:27:43 +00:00
|
|
|
lup 0
|
2019-11-16 02:51:30 +00:00
|
|
|
db 0 ; outside
|
2019-11-16 02:30:12 +00:00
|
|
|
--^
|
2019-11-15 07:35:04 +00:00
|
|
|
|
2019-11-15 01:04:35 +00:00
|
|
|
|
2019-11-19 19:27:17 +00:00
|
|
|
;lst off
|
2019-11-11 23:56:03 +00:00
|
|
|
//]XCODEEND ; Keep this at the end and put your code above this
|
2019-11-16 00:15:58 +00:00
|
|
|
;lst off
|
2019-11-13 14:54:48 +00:00
|
|
|
|