I don't know anything about CBM Prog Studio, but I'm pretty sure that I see why the second one doesn't work.
It doesn't matter what's stored at char_p in the least, because your X is stored to whatever
address the label is defined as. You can confirm this by disassembling the code. For example, if that code started at $2000, it would look like this:
Code: Select all
., 2000 LDX #$01
., 2002 STX $2004 ; The address of char_p, NOT the contents of memory at char_p!
., 2004 BRK ; $00 from low byte of word at char_p
., 2005 ASL something,X ; $1E from high byte of word, and whatever's after it
., 2008 etc...
Instead of using char_p as a label to the address of a word, define char_p as a value in the assembler.
Update: I just looked this up, and its definition syntax is like that of other assemblers. You'd want to do