帮我看看这个小问题啊。关于赋值的事。

zhgwbzhd 2010-08-27 11:09:47
这几天比较缺觉,自己感觉也比较愚钝。
弄不明白为什么会这样。

.....//有代码

mov al,'1'
mov ah,'_';ax='_1'
shl eax,16;
mov ax,'_S'//我觉得关键是这里啊。ax=0x5F 53吗???????????
//请问此时eax是多少?在内存中保存的数据是怎样的???
cmp [si],eax


我觉得上面的eax='_1_S'=0x5F 31 5F 53。对吧。

'_'=0x5F,'0'=0x30,'S'=53

这里要和[si]对比。
那si指向的内存存储应该是 53 5F 31 5F 才能和eax想等吧。
...全文
63 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
pandazhong 2010-08-27
  • 打赏
  • 举报
回复
跟踪下,应该找不到 _Sn_,可以找到S_1_。感觉程序要是真是找_Sn_的话那就有问题了。
zhgwbzhd 2010-08-27
  • 打赏
  • 举报
回复
中文的,和那些样例数据,是我在本机测试添加上去的。
small_dsdt:
mov cx,ax ; scan size CX=AX=2087 该段数据长度
mov al,'1' ; AL='1'=31H
mov di,s1mode
push cx
call find_Sn ; find \_S1_ (standby), store s1mode

。。。。。。。。。。。


find_Sn: ; find _S?_ (\_S?_ before 8/2006) in CX size thebuffer
; with ? being AL from user. Store first 2 byte items to var at DI...
; _Sn info block: (if size were > 3F, it would use n-byte encoding)
; 08 (DefName) "\_Sn_" 12 (PackageOp) nn (size) 02 (item count)
; ITEM ITEM, where ITEM can be: 0, 1, -1 constants or 0A xx for
; "byte xx" (0B xxxx / 0C xxxxxxxx would be word/dword...)
; Norbert Remmel has a DSDT which omits the \ before the _Sn_ :-p
push cx ;cx保存这段数据的长度
push si
push eax
mov si,thebuffer+24h ; base (header skipped) SI=805B
sub cx,24h+10 ; consider header and target size cx=8027
jc no_Sn
mov ah,'_' ; al is the '?' variable from the caller '_'=5F '0'=30 'S'=53
shl eax,16 ; 左移16位,就是 5F310000
mov ax,'_S' ; EAX is "_Sn_" now
scan_S: cmp [si],eax
jz maybe_Sn
half_Sn:
inc si
loop scan_S
jmp short no_Sn
pandazhong 2010-08-27
  • 打赏
  • 举报
回复
给出完整代码吧,不然没办法理解。
zhgwbzhd 2010-08-27
  • 打赏
  • 举报
回复
是啊。
如果我的理解没错的话

人家的源码里面的解释是这样的。 n 代表那个数啊。

mov ax,'_S' ; EAX is "_Sn_" now
pandazhong 2010-08-27
  • 打赏
  • 举报
回复
刚在VC6下跟踪过,无误!
pandazhong 2010-08-27
  • 打赏
  • 举报
回复
恩,楼主所有的结论都是对的!

21,453

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧