If you want to dynamically modify a hex string in the AMOS source from within the program itself, you can try something like this:
' Hex string to be hacked (3 characters):
A$="ABC"
Print "A$="+Chr$(34)+A$+Chr$(34)
I=Val("$"+A$) : If I>=0 and I<4096 Then Colour 1,I Else Colour 1,$A40
' Hex value to A replace A$ (prompted for demonstration):
A=$DEF : Print "Enter a new HEX value without $ (ABC): "
Input "";HEXINPUT$ : A=Val("$"+HEXINPUT$) : If HEXINPUT$="" Then End
' Grab the hex string version of A (without $):
B$=Hex$(A) : B$=Right$(B$,Len(B$)-1)
' Test if the string A$ is large enough:
If Len(A$)<Len(B$) Then Print "Error: String A$ too small!" : Bell : End
' Poke the contents into the string A$ and append spaces:
For X=0 To Len(A$)-1
If X<Len(B$) Then P=Peek(Varptr(B$)+X) Else P=32
Poke Varptr(A$)+X,P
Next X
' Finally get the new value as an integer and display in hex:
A=Val("$"+A$) : Print "New value: "+Right$(Hex$(A),Len(Hex$(A))-1)
Print "A$="+Chr$(34)+A$+Chr$(34)
If A>=0 and A<4096 Then Colour 1,A Else Colour 1,$A40