昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期一, 四月 29, 2013

Lc3 Assembly notes

LEA

Load the address (not the value) of a Label

LEA R0,Label1 ; Load the address of Label1

Label:

When you put a label, the label point to a memory address, The Label is pc offset, you can treat it a as memory address.

LD

Load the value from a label (addres)

LD R1, Label1 ; Load the value stored in Label1 address to R1

ST R2, Label1 ; Store the value of R1 into the address Label1

LDR

Load the value from a address, and the address is from a Register

LDR R1,R2,#0, Load the value from the memory where the R2's value pointing to

LD can be rewrite with LDR

For example

LD R1, Label1

=

LEA R2, Label1 ;store Label1's address to R2
LDR R1, R2, #0 ; Load Label1's value

ST and STR is similar to LD, and LDR


JSR is use to call function
Need to save and restore R7 to a label, then RET can work.

BRnzp ; Branch if last accessed register is negative, zero or positive (uncondition)
BRz ; Branch if last accessed register is zero.
BRzp ; Branch if last accessed register is zero or positive

for example
BRp Label2


.FILL

Assign a address to Label, reverse the address to this label, and initial the value

NINE .FILL #57

Allocate a memory address to NINE, and fill that address with the value 57

ZERO. FILL x0000


NAME    .STRINGZ "hello"

Allocate a address to NAME, and fill the memory with h e l l o , chars.

ARR .BLKW 20 ; assign a address to ARR, and reserve the following 20 address for it.












--
Feng

星期五, 四月 26, 2013

htc one x 解锁后无中文

解锁后没有了中文

搜了一下说是要安装区域软件

或者刷别的ROM

。。。

只是想拿ROOT, 懒得刷ROM。。。。

看看中文能不能正常显示, 正常输入,能就不折腾了。

--
Feng

第一次root android

机子是 htc one x, android 4.1.1, sense 4+

用的是公司的电脑,因为sdk 已经有了。 家里用mac, 连htc 驱动都没有。
用了一键root 工具,失败

failed to copy 'busybox' to '/data/local/busybox': Permission denied

根本就不能成功复制文件

后来就跟着这个教程做了

http://bbs.dospy.com/thread-14575412-1-624-1.html

总共三步

1. 解锁就是根着官方教程做了, 过程没啥风险。
2. 刷recovery, 和第一步差不多, 第一步是要下载官方发给你的bin 文件刷, 这步自己下载recover.img 来刷。
3. 用recovery 来刷supersu了, 我用的是英文界面, 论坛提供的是CHS, 刷进去后是英文的。。。

三步都要在 HTBOOT 里面做。 不过我有重启到正常, 因为第三步要把文件复制到SDCARD。



--
Feng

星期二, 四月 23, 2013

Fiddler 引用 C# dll

之前失败, 后来就莫名其妙的好了。 在现在也不知道缘由。

最开始是用.net 4.0 编译--


Script Failure
OK
Failed to load script.
 c:\Users\ydeng\Documents\Fiddler2\Scripts\ForFiddler.dll
System.BadImageFormatException: Could not load file or assembly 'file:///c:\Users\ydeng\Documents\Fiddler2\Scripts\ForFiddler.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'file:///c:\Users\ydeng\Documents\Fiddler2\Scripts\ForFiddler.dll'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Microsoft.JScript.VsaReference.Compile(Boolean throwOnFileNotFound)

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable  C:\Program Files (x86)\Fiddler2\Fiddler.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = CHECKFREE\ydeng
LOG: Where-ref bind. Location = c:\Users\ydeng\Documents\Fiddler2\Scripts\ForFiddler.dll
LOG: Appbase = file:///C:/Program Files (x86)/Fiddler2/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Program Files (x86)\Fiddler2\Fiddler.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: The same bind was seen before, and was failed with hr = 0x8013101b.
   at Microsoft.JScript.VsaReference.Compile(Boolean throwOnFileNotFound)
   at Microsoft.JScript.VsaReference.Compile()
   at Microsoft.JScript.Vsa.VsaEngine


出了以上错误, 于是改成 .net 2.0 编译, 还是一样。

于是注意到错误中有 Framework64 这个东西。 觉得奇怪, 32位的程序怎么找 Framework64的东西呢。

于是

在网上找了这样一行命令

"c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\CorFlags.exe" MyApplication.exe /32bit+

强制将FIDDLER 在32位执行。

于是得到这个错误, 错误变了:

Script Failure
OK
Failed to load script.
 c:\Users\ydeng\Documents\Fiddler2\Scripts\ForFiddler.dll
System.BadImageFormatException: Could not load file or assembly 'ForFiddler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'ForFiddler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Microsoft.JScript.VsaReference.Compile(Boolean throwOnFileNotFound)

   at Microsoft.JScript.VsaReference.Compile(Boolean throwOnFileNotFound)
   at Microsoft.JScript.VsaReference.Compile()
   at Microsoft.JScript.Vsa.VsaEngine.DoCompile()
   at Microsoft.Vsa.BaseVsaEngine.Compile()
   at Fiddler.FiddlerScript._LoadScript(String sScriptFilename, Boolean bPlaySounds)
   at Fiddler.FiddlerScript.LoadRulesScript(Boolean bPlaySounds)


其实这是更错。 后来把fiddler 关了, 再把备份的fiddler.exe 还原回去。 就突然可以了。

好像原因就是最之前没有.net 2.0 编译。 虽然后来改了过来了, 可是因为某些原因没有生效。

现在不管是用 x86, x64, any cpu 都不出错了。

Feng

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.