Page 1 of 1

"Advanced" string mapping with asm6.. is it possible?

Posted: Sat Dec 05, 2020 9:58 pm
by frantik
So I know you can shift a whole string in Asm6 by performing arithmetic it, like so

Code: Select all

.macro text _string
	.db _string-"A"+#$0A

But this fails if you want to use anything besides letters in the string.. like text "SOME STRING123" doesn't work because the space character in ascii is far from the letters, and the numbers aren't in the same relative location either

So... is there a clean way to include complex ASCII strings in ASM6 code?

Re: "Advanced" string mapping with asm6.. is it possible?

Posted: Sun Dec 06, 2020 4:24 am
by frantik
I took a look at the readme and got a crazy idea.. it works, though it causes problems with X and Y if you write them like LDA $00, X in your code .. I don't... usually.. but the errors thrown determined I did use upper case once or twice.

first you define G-Z plus space.. if you need punctuation then you have to use longer symbol names

Code: Select all

G equ 10
H equ 11
I equ 12
J equ 13
K equ 14
L equ 15  
M equ 16
N equ 17
O equ 18
P equ 19
Q equ 1A
R equ 1B
S equ 1C
T equ 1D
U equ 1E
V equ 1F
W equ 20
X equ 21
Y equ 22
Z equ 23
_ equ 24
then you use hex to write the strings, taking advantage of the fact that it already expands single digits 0-F

Code: Select all

.hex S O M E _ S T R I N G 1 2 3
It's super hacky and interferes with code if you're not careful, but otherwise it's great and does produce much more readable code than

Code: Select all

text "SOME"
.db $24
text "STRING"
.hex 01 02 03