self.data=[adr&0xff, (adr&0xff00)>>8];
self.writecmd(0x30,0x91, 2, self.data);
return ord(self.data[0]);
+ def CCpeekirambyte(self,adr):
+ """Read the contents of IRAM at an address."""
+ self.data=[adr&0xff];
+ self.writecmd(0x30,0x02, 1, self.data);
+ return ord(self.data[0]);
+ def CCpokeirambyte(self,adr,val):
+ """Write the contents of IRAM at an address."""
+ self.data=[adr&0xff, val&0xff];
+ self.writecmd(0x30,0x02, 2, self.data);
+ return ord(self.data[0]);
+
def CCpokedatabyte(self,adr,val):
"""Write a byte to data memory."""
self.data=[adr&0xff, (adr&0xff00)>>8, val];
while start<=stop:
print "%04x: %02x" % (start,client.CCpeekcodebyte(start));
start=start+1;
-
+if(sys.argv[1]=="peek"):
+ print "%02x" % client.CCpeekirambyte(int(sys.argv[2],16));
+if(sys.argv[1]=="poke"):
+ client.CCpokeirambyte(int(sys.argv[2],16),
+ int(sys.argv[3],16));
+if(sys.argv[1]=="randtest"):
+ print "coming soon"
if(sys.argv[1]=="config"):
print "Config is %02x" % client.CCrd_config();
switch(verb){
//CC_PEEK and CC_POKE will come later.
+ case PEEK:
+ cmddata[0]=cc_peekirambyte(cmddata[0]);
+ txdata(app,verb,1);
+ break;
+ case POKE:
+ cmddata[0]=cc_pokeirambyte(cmddata[0],cmddata[1]);
+ txdata(app,verb,0);
+ break;
case READ: //Write a command and return 1-byte reply.
cccmd(len);
ccread(1);
}
+//! Fetch a byte of IRAM.
+u8 cc_peekirambyte(u8 adr){
+ //MOV A, #iram
+ return cc_debug(3, 0xE5, adr, 0);
+}
+
+//! Write a byte of IRAM.
+u8 cc_pokeirambyte(u8 adr, u8 val){
+ //MOV #iram, #val
+ return cc_debug(3, 0x75, adr, val);
+}
+
+
unsigned char cc_peekcodebyte(unsigned long adr);
//!Read a byte of data memory.
unsigned char cc_peekdatabyte(unsigned int adr);
+//! Fetch a byte of IRAM.
+u8 cc_peekirambyte(u8 adr);
+//! Write a byte of IRAM.
+u8 cc_pokeirambyte(u8 adr, u8 val);
//! Set a byte of data memory.
unsigned char cc_pokedatabyte(unsigned int adr,
unsigned char val);