1
0
mirror of https://github.com/fadden/6502bench.git synced 2026-04-22 01:16:42 +00:00

Correctly handle embedded instruction edge case

This began with a change to support "BRK <operand>" in cc65.  The
assembler only supports this for 65816 projects, so we detect that
and enable it when available.

While fiddling with some test code an assertion fired.  This
revealed a minor issue in the code analyzer: when overwriting inline
data with instructions, we weren't resetting the format descriptor.

The code that exercises it, which requires two-byte BRKs and an
inline BRK handler in an extension script, has been added to test
2022-extension-scripts.

The new regression test revealed a flaw in the 64tass code
generator's character encoding scanner that caused it to hang.
Fixed.
This commit is contained in:
Andy McFadden
2019-10-19 16:23:42 -07:00
parent e5da5ced95
commit b6e571afc2
14 changed files with 134 additions and 35 deletions
@@ -25,13 +25,20 @@ PrintInlineDciString = $013000
.text $14,$00,"string with length/2"
jsl PrintInlineDciString
.shift "DCI string"
jsr L10AB
jsr L10B5
jsr L110F
jsr L1108
brk #$01
.word data01
brk #$02
.word data02
nop
jsr L1085
.byte $24
L1085 .byte $a9
.byte $00
sta $ff
.byte $ea
rts
PrintInline8String rts
@@ -62,8 +69,8 @@ data02 .word data03
.enc sg_hiascii
data03 .text "AllEight"
L10AB jsr PrintInlineNullString
per $8023
L10B5 jsr PrintInlineNullString ;split across address change
per $802d
rtl
.byte $65
@@ -18,13 +18,20 @@ PrintInlineDciString equ $013000
strl 'string with length/2'
jsl PrintInlineDciString
dci 'DCI string'
jsr L10AB
jsr L10B5
jsr L110F
jsr L1108
brk $01
dw data01
brk $02
dw data02
nop
jsr L1085
dfb $24
L1085 dfb $a9
dfb $00
sta $ff
dfb $ea
rts
PrintInline8String rts
@@ -54,8 +61,8 @@ data02 dw data03
dfb $80
data03 asc "AllEight"
L10AB jsr PrintInlineNullString
per $8023
L10B5 jsr PrintInlineNullString ;split across address change
per $802d
rtl
dfb $65
@@ -21,13 +21,20 @@ PrintInlineDciString = $013000
!text $14,$00,"string with length/2"
jsl PrintInlineDciString
!text "DCI strin",$e7
jsr L10AB
jsr L10B5
jsr L110F
jsr L1108
!byte $00,$01
!word data01
!byte $00,$02
!word data02
nop
jsr L1085
!byte $24
L1085 !byte $a9
!byte $00
sta $ff
!byte $ea
rts
PrintInline8String rts
@@ -59,8 +66,8 @@ data02 !word data03
data03 !text "AllEight"
}
L10AB jsr PrintInlineNullString
per $8023
L10B5 jsr PrintInlineNullString ;split across address change
per $802d
rtl
!byte $65
@@ -22,13 +22,20 @@ PrintInlineDciString = $013000
.byte $14,$00,"string with length/2"
jsl PrintInlineDciString
.byte "DCI strin",$e7
jsr L10AB
jsr L10B5
jsr L110F
jsr L1108
.byte $00,$01
brk $01
.word data01
.byte $00,$02
brk $02
.word data02
nop
jsr L1085
.byte $24
L1085: .byte $a9
.byte $00
sta $ff
.byte $ea
rts
PrintInline8String: rts
@@ -63,8 +70,8 @@ data02: .word data03
.endmacro
data03: HiAscii "AllEight"
L10AB: jsr PrintInlineNullString
per $8023
L10B5: jsr PrintInlineNullString ;split across address change
per $802d
rtl
.byte $65
@@ -79,7 +86,7 @@ L10AB: jsr PrintInlineNullString
L1108: jsl PrintInlineL2String
asl A
.byte $00,$60
brk $60
L110F: jsr PrintInlineNullString
adc $6e
@@ -1,7 +1,7 @@
# 6502bench SourceGen generated linker script for 2022-extension-scripts
MEMORY {
MAIN: file=%O, start=%S, size=65536;
# MEM000: file=%O, start=$1000, size=182;
# MEM000: file=%O, start=$1000, size=192;
# MEM001: file=%O, start=$1100, size=21;
}
SEGMENTS {