1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-04 15:05:03 +00:00
6502bench/SourceGen/SGTestData/Source/20020-operand-formats.S
Andy McFadden b43fd07688 Split 2002x-operand-formats test
My original goal was to add a sign-extended decimal format, but that
turned out to be awkward.  It works for data items and instructions
with immediate operands (e.g. "LDA #-1"), but is either wrong or
useless for address operands, since most assemblers treat integers
as 32-bit values.  (LDA -1 is not LDA $FFFF, it's LDA $FFFFFFFF,
which is not useful unless your asm is doing an implicit mod.)

There's also a bit of variability in how assemblers treat negative
values, so I'm shelving the idea for now.  I'm keeping the updated
tests, which are now split into 6502 / 65816 parts.

Also, updated the formatter to output all decimal values as unsigned.
Most assemblers were fine with negative values, but 64tass .dword
insists on positive.  Rather than make the opcode conditional on the
value's range, we now just always output unsigned decimal, which
all current assemblers accept.
2020-06-08 17:47:26 -07:00

100 lines
2.1 KiB
ArmAsm

; Copyright 2018 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Basic tests for 6502.
;
; Assembler: Merlin 32
org $1000
; Basic operand formats. Show first set as hex, second as decimal,
; third as sign-extended decimal, fourth as binary.
lda $01
lda $0102
lda $fe
lda $feff
lda $01
lda $0102
lda $fe
lda $feff
lda $01
lda $0102
lda $fe
lda $feff
lda $01
lda $0102
lda $fe
lda $feff
jmp :skipdata
; Now hex/decimal/sdec/binary, each with .dd1/.dd2/.dd3/.dd4
hex 01010201020301020304
hex 01010201020301020304
hex 01010201020301020304
hex 01010201020301020304
; bonus round for sdec
hex fffffefffefdfffefdfc
:skipdata
; Convert these to ASCII; requires editing file. The code generator
; should display some of these as hex.
lda #$68
lda $68
lda: $0068
lda #$1f
lda #$20
lda #$22
lda #$27
lda #$7e
lda #$7f
lda #$80
lda #$9f
lda #$a0
lda #$a2
lda #$a7
lda #$fe
lda #$ff
jmp end
; Continuing with ASCII
:ascii
dfb $68
dfb $80
dw $6868
dfb $80
; Format first set as address, second set as symbol.
dw :skipdata
adr :skipdata
dfb >:skipdata,:skipdata ;format as big-endian address
dfb :ascii
dfb >:ascii
dw :ascii
adr :ascii
adrl :ascii
dfb >:ascii,:ascii ;format as big-endian symbol
; Merlin 1.0 has trouble with "DFB '{'". Test it and the neighbors.
dfb '['
dfb $7b
dfb $7c
dfb $7d
dfb ','
dfb "["
dfb $fb
dfb $fc
dfb $fd
dfb ","
end rts