Problems with PUT statement with 20X2

BobWhite

New Member
Hi all,

I am fairly new to the picaxe and seem to not understand the PUT statement.

Why does this code not show all ones in the debugger?

Code:
	let w0 = 1
	put 1,word w0
	put 2,word w0
	put 3,word w0
	put 4,word w0
	
	get 1, word w1
	get 2, word w2
	get 3, word w3
	get 4, word w4

Main:

	debug	
goto Main
There should be an attachment of the debugger if I did it right!
 

Attachments

inglewoodpete

Senior Member
That result looks about right. The first "put" puts the bytes 01 and 00 into scratchpad locations 1 and 2, then 2 & 3 (overwriting 2), then 3 & 4 (overwriting 3) etc etc

The get statements do a similar thing, re-reading the 2nd, 3rd and 4th locations twice.

You should use Put 1 (then) Put 3, (then) Put 5 etc

Edit: Perhaps I should have said that "Put/Word" puts 2 bytes into the scratchpad. The scratchpad is a sequence of bytes.
 
Last edited:
Top