1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-11 17:29:29 +00:00
6502bench/SourceGen/SGTestData/Source/2022-extension-scripts.S
Andy McFadden 28eafef27c Expand the set of things SetInlineDataFormat accepts
Extension scripts (a/k/a "plugins") can now apply any data format
supported by FormatDescriptor to inline data.  In particular, it can
now handle variable-length inline strings.  The code analyzer
verifies the string structure (e.g. null-terminated strings have
exactly one null byte, at the very end).

Added PluginException to carry an exception back to the plugin code,
for occasions when they're doing something so wrong that we just
want to smack them.

Added test 2022-extension-scripts to exercise the feature.
2019-10-05 19:51:34 -07:00

62 lines
1.6 KiB
ArmAsm

; Copyright 2019 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Assembler: Merlin 32
; EDIT: the project must include the platform symbol file and extension script
PrintInlineL1String equ $011000
PrintInlineL2String equ $012000
PrintInlineDciString equ $013000 ;EDIT: add to project symbols
org $1000
clc
xce
sep #$30
mx %11
; check basics
jsr Print8String
asc '01234567'
jsr PrintRev8String
asc '76543210'
jsr PrintInlineNullString
asc 'null-term string',00
jsl PrintInlineL1String
str 'string with length/1'
jsl PrintInlineL2String
strl 'string with length/2'
jsl PrintInlineDciString
dci 'DCI string'
; check errors
jsr broken
jsr off_end
jsr too_long
rts
PrintInline8String rts ;EDIT: set label
PrintInlineRev8String rts ;EDIT: set label
PrintInlineNullString rts ;EDIT: set label
; check address split across string
broken jsr PrintInlineNullString
asc 'broken ',01
org $1100 ;EDIT: split address
asc 'string',00
rts
too_long jsl PrintInlineL2String
dw END-*+1 ;should be 1 byte over; want it to be rejected by
rts ; function in .cs (otherwise code overlap race)
; MUST be last
off_end jsr PrintInlineNullString
nonterm asc 'end'
END equ *