1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-08-12 06:28:57 +00:00
6502bench/SourceGen/SGTestData/Source/2012-label-localizer.S
Andy McFadden 824add17e8 Remap labels that use opcode mnemonics
In a recent survey, three out of four cross assemblers surveyed
recommended not using opcode mnemonics to their patients who use
labels.  We now remap labels like "AND" and "jmp", using the label
map that's part of the label localizer.

We skip the step for Merlin 32, which is perfectly happy to assemble
"JMP JMP JMP".

Also, fixed a bug in MaskLeadingUnderscores that could hang the
source generator thread.
2019-09-20 15:29:34 -07:00

84 lines
2.7 KiB
ArmAsm

; Copyright 2018 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Assembler: Merlin 32
; NOTE: select CPU=65C02
EXTSYM equ $8888 ;EDIT: give this a long label
org $1000
nop
start lda :local1
lda nextglob
lda pastglob
lda :local2
:local1 nop
:local2 nop
nextglob nop ;EDIT: mark label as global
pastglob nop
lda nlocal
nlocal lda #$11 ;EDIT: mark label as global
reach1G nop ;EDIT: mark label as global
:local lda :local ;EDIT: edit operand to symbol=reach1G
lda reach4 ;EDIT: set operand to symbol=reach2; should stay local
reach2 nop
reach3G nop ;EDIT: mark label as global
reach4 nop
lda reach2 ;EDIT: edit operand to symbol=reach4; should stay local
lda $00
beq :local ;should be local
jsr reach4 ;should be local
jsr start ;should be global
:local lda #$22
lda gtest2
gtest1 nop ;EDIT: mark label as global
lda gtest3
gtest2 nop ;...which forces this to be global
gtest3 nop ;...and then this is forced to be global
lda #$33
lda midlocal ;EDIT: reformat as hex
topglob nop ;EDIT: mark label as global
lda farlocal ;should be local label ref
midlocal nop ;auto-label here should vanish
nop
farlocal nop
lda #$44
globalnm jsr :local2 ;EDIT: mark label as global
:local1 nop
:local2 nop
:local3 nop
nglobal nop ;should get marked as global
globlat jsr nglobal ;EDIT: mark label as global
bra cont
cont nop ;EDIT: mark label as global
lda EXTSYM
; test localizer uniquification
; only relevant for 64tass, which uses a leading '_' to indicate local labels
_uname nop
X_uname11 nop
X_uname1 nop
X_uname nop
; test labels with opcode names (not really a localization thing)
; EDIT: set these names, mark as global to prevent localization
lda #$00
ANDl bne ANDl ;leave label local
JMPg bne JMPg ;make label global
jmpg bne jmpg ;lower case name
TSBg bne TSBg
XCEg bne XCEg ;should be allowed
rts