use LD A, (data,X) The [xx.w] version refers to a 16 bit address location in zero space memory. The programming manual available from the download section of this site covers this very well. ensure there is no space between the , and the X on all instructions regards, Simon
I just read it again. sorry...... declare it in RAM: segment 'ram0' .data ds.w Hello segment 'rom' .Hello DC.B ''Hye'',0 ... .main ld A,([data.w],X) You can then change the ram locations to point to different arrays/strings and scan through the string using X Simon
You are not setting up your pointer, try this segment 'ram0' .data DS.W 1 WORDS segment 'rom' .HELLO DC.B ''hello'',0 ld A, #HELLO.h ld data, A ld A, #HELLO.l ld {data+1}, A ; setup pointer to our data clr X ld A, ([data.w],X) ; A holds first char of data do you need tio use a pointer you could do: clr X ld A, (HELLO,X) ; without a pointer Hope this helps SJO
You have received that warning because you used WORDS rather than BYTES eg.
BYTES .pointer DS.W 1 ; WORDS segment 'rom' .HELLO DC.B ''Bonjour'',0 ld A,#HELLO.h ld pointer,A ld A,#HELLO.l ld {pointer+1},A ; setup pointer to our data clr X ld A,([pointer.w],X) ; A holds first char of data Regards SJO