看板Programming
标 题Re: [问题] 组语的问题…
发信站交大资科_BBS (Thu Jul 6 17:31:09 2006)
转信站ptt!ctu-reader!ctu-gate!news.nctu!news.ntu!news.ee.ttu!news.cis.nctu!c
我要赌本!! 提到:
> 是这样的,我看到有一段话是这样的:
>
> all JUMP and CALL target address are based on 16-bit word address,
> so you need to shift your 0xf70 by one to the right.
>
> 可是他这边并没有解释为什麽会因为这两个指令是based on 16-bit的word address,
> 所以真正要读入的位址必需要右旋1个bit。这边指的16bit和右旋1bit有什麽关系?
> 下面是个例子:
>
> 0000 1111 0111 0000 ( 0xf70 ) -> 0000 0111 1011 1000 ( 0x07b8 )
>
> 我用的是AVR-GCC。CPU是ATmega128。
> 任何资讯都好。谢谢。 >_<"
我没用过 ATmega128, 不过从你的问题看来, 我的猜想是:
1. 这个 cpu 的 JUMP 跟 CALL 的目的位址必须在 word boundary,
2. 这个 cpu 的 JUMP 跟 CALL 的目的位址是以 word 为单位计算。
(jump to address 12 要写成 jump to word 6)
3. 这个 cpu 除了 JUMP, CALL 之外, 骨子里似乎是以 byte 定址。
(也就是可以读取任意 address 的 byte/word data)
建议你先看 cpu structure and programming manual, 把 cpu 架构
先了解一下再用组合语言。
--
* Origin: ★ 交通大学资讯科学系 BBS ★ <bbs.cis.nctu.edu.tw: 140.113.23.3>