On Thu, 2005-09-01 at 09:28 -0500, David Kelly wrote: > On Thu, Sep 01, 2005 at 09:03:53AM -0500, Thomas Keller wrote: > > > > Now, perhaps itmight be argued that thery could have considered > > modifying the I/O addressing instructiosn to also access this > extended > > I/O space, but if I read the data sheet correctly, this would have > > involved making them take longer to execute (having to read an > > additional byte to obtain the longer addresses). > > To do so Atmel would have had to modify the instruction set. An opcode > on the AVR is 16 bits. The "argument" is embedded within those 16 bits > for SFR codes. > > Its not just a matter of an additional byte, all instructions are > multiples of 16 bits. Flash is actually 16 bits wide (page 16 of > ATmega64), but byte addressable. The program counter counts 16 bit > words, not bytes. If you look at a disassembly such as generated by > avr-objdump byte addresses are listed. But look into the opcodes and > one > has to double the value to find the disassembled listed value. > > The 64 address range for SFRs is more heavily ingrained than you > suspected. Quite. I misspoke when I said additional byte. I should have said "additonal word." My bad, as the script kidiots would say. I do know this. As for your comment, yes, I agree. The 64 byte address range of the SFR instructions is heavily ingrained, and explains why, once Atmel realized the need for additional I/O registers, they opted for the mildly confusing solution they di. Much better than making all previously written code obsolete. One of the (many) joys of programming on AVRs is that, for the most part, code written on one AVR will run with few, if any, modification on ANY AVR (letting aside such things as the various ?MUL* instructions, which not all AVRs support, of course). Minor issues such as 16 bit as opposed to 8 bit interrupt vector tables are the "biggest" hurdle, and that is relatively easy to fix (indeed, it is even possible to easily use a tool like awk to automatically fix it). Tom Viva le AVR!
Message
Re: Re: [AVR-Chat] Errors in manuals ...
2005-09-01 by Thomas Keller
Attachments
- No local attachments were found for this message.