1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-03 20:49:50 +00:00
6502bench/SourceGen/SGTestData/Expected/2022-extension-scripts_cc65.S
Andy McFadden dfd5bcab1b Optionally treat BRKs as two-byte instructions
Early data sheets listed BRK as one byte, but RTI after a BRK skips
the following byte, effectively making BRK a 2-byte instruction.
Sometimes, such as when diassembling Apple /// SOS code, it's handy
to treat it that way explicitly.

This change makes two-byte BRKs optional, controlled by a checkbox
in the project settings.  In the system definitions it defaults to
true for Apple ///, false for all others.

ACME doesn't allow BRK to have an arg, and cc65 only allows it for
65816 code (?), so it's emitted as a hex blob for those assemblers.
Anyone wishing to target those assemblers should stick to 1-byte mode.

Extension scripts have to switch between formatting one byte of
inline data and formatting an instruction with a one-byte operand.
A helper function has been added to the plugin Util class.

To get some regression test coverage, 2022-extension-scripts has
been configured to use two-byte BRK.

Also, added/corrected some SOS constants.

See also issue #44.
2019-10-09 14:55:56 -07:00

87 lines
1.9 KiB
ArmAsm

.setcpu "65816"
PrintInlineL1String = $011000
PrintInlineL2String = $012000
PrintInlineDciString = $013000
; .segment "SEG000"
.org $1000
.a8
.i8
clc
xce
sep #$30
jsr PrintInline8String
.byte "01234567"
jsr PrintInlineRev8String
.byte "76543210"
jsr PrintInlineNullString
.asciiz "null-term string"
jsl PrintInlineL1String
.byte $14,"string with length/1"
jsl PrintInlineL2String
.byte $14,$00,"string with length/2"
jsl PrintInlineDciString
.byte "DCI strin",$e7
jsr L10AB
jsr L110F
jsr L1108
.byte $00,$01
.word data01
.byte $00,$02
.word data02
rts
PrintInline8String: rts
PrintInlineRev8String: rts
PrintInlineNullString: rts
data01: .word 4386
.dbyt $3344
.dword $88776655
.byte $99,$88,$77,$66
.byte 'f'
.byte 'F' | $80
.byte $40
.byte $c1
.byte $42
.byte $c3
.byte $44
.byte $c5
.byte $46
.byte $c7
.faraddr PrintInlineL2String
.word data02
.byte $80
data02: .word data03
.byte $80
.macro HiAscii Arg
.repeat .strlen(Arg), I
.byte .strat(Arg, I) | $80
.endrep
.endmacro
data03: HiAscii "AllEight"
L10AB: jsr PrintInlineNullString
per $8023
rtl
.byte $65
.byte $6e
.byte $20
.byte $01
; .segment "SEG001"
.org $1100
.byte "string"
.byte $00
.byte $60
L1108: jsl PrintInlineL2String
asl A
.byte $00,$60
L110F: jsr PrintInlineNullString
adc $6e
.byte $64