iOS版装配code [英] iOS assembly code

查看:244
本文介绍了iOS版装配code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试一些ARM汇编code。与苹果iOS只为教育目的。我想开始与一些X $ C $内c线code。
我的理解是,我需要编译的iOS设备,例如我的iPhone,这意味着我需要支付每年$ 99 /会员资格。
我不认为我可以使用电子装配code与iOS手机模拟器。
我有在与iPhone X $ C $çENV上的ARM汇编code发现的例子,书籍或文档中的一个困难时期。
我这样做不对吗?也许iOS版是不是最用户友好的环境中学习ARM汇编。

I would like to try some ARM assembly code with apple iOS just for educational purpose. I would like to start with some in line code within Xcode. My understanding is that I need to compile for a iOS device, for example for my iPhone, which means that I need to pay $99/year for membership. I don't think I can use ASM assembly code with a iOS phone simulator. I am having an hard time on finding examples, books or documentation on ARM assembly code in Xcode env with an iPhone. Am I doing this wrong? Maybe iOS is not the most user friendly environment to learn ARM Assembly.

推荐答案

备份...

什么是你想学什么? ARM汇编或iOS编程?选择一个...

What are you trying to learn? Arm assembly or iOS programming? Pick one...

你有什么装配经验?

这是什么,你以为你是想在臂总成学习呢?跳,并写一些完全成熟的GUI应用程序?你需要学会把立即数寄存器在寄存器中添加和或和XOR和保存的答案。然后读写某些内存位置。了解如何使用堆栈,拨打电话等,然后用C或任何与使用ASM的应用程序的手工调节或使用您的ASM技能调试编译器和或code。在ASM编写的应用程序或操作系统等是谁想要作出声明,或有特殊原因,不是为了教育目的乡亲。

What is it you think you are wanting to learn in arm assembly? Jump in and write some full blown gui applications? You need to learn to put immediates in registers add and or and xor and save answers in registers. then read and write some memory locations. Learn to use the stack, make calls, etc. Then write your applications in C or whatever and use asm for hand tuning or use your asm skills to debug the compiler and or code. Writing applications or operating systems, etc in asm is for folks who want to make a statement, or have a specific reason, not for educational purposes.

给这个几分钟或者半个小时,如果你是认真的它不应该需要很长的打通,也许一个晚上。

Give this a few minutes or maybe half an hour, it shouldnt take very long to get through, maybe an evening if you are serious about it.

http://github.com/dwelch67/lsasim
看learnasm.txt文件。

http://github.com/dwelch67/lsasim look at the learnasm.txt file.

这是免费的,开源的,应该工作最多的地方(的Linux,UNIX,Windows和等具有C编译器),如果你是不是已经一个程序员,不具备基本的编译工具和编程技能,然后去学几语言(看看蟒蛇艰难地 http://learnpythonthehardway.org/ ),当然C和回来的汇编工作。上述lsasim的事情是不是ARM,但有很多熟悉的功能。让我知道如何好或坏的工作,我做的。

It is free, open source, should work most places (linux, unix, windows, etc with a C compiler), if you are not already a programmer and dont have basic compiler tools or programming skills, then go learn a few languages (check out python the hard way http://learnpythonthehardway.org/), C of course, and come back to work on assembler. The lsasim thing above is NOT AN ARM, but has a lot of familiar features. Let me know how good or bad of a job I did.

现在,这是ARM但Thumb指令集:​​

Now this IS ARM but the thumb instruction set:

https://github.com/dwelch67/thumbulator

不是一个教程,但一个普通的,简单的,指令集仿真器。它应该是显而易见的是什么你可以添加/修改模拟器/无论你想看到以帮助调试打印回事。你可以让你的脚湿嵌入式,拇指,Cortex-M的像,ARM寄存器,使用gcc,GNU汇编程序和/或LLVM铛交叉编译器。就拿其中一个例子是,然后开始对其进行修改。

Not a tutorial but a plain, simple, instruction set simulator. It should be obvious what is going on in the simulator you can add/modify/print whatever you want to see to help with debugging. You can get your feet wet with embedded, thumb, cortex-m like, ARM registers, using gcc, gnu assembler, and/or llvm clang as cross compilers. Take one of the examples as-is then start to modify it.

有一些对上基于ARM内核和基于thumb2工作的核心都统一ARM汇编语言倾斜。不是所有需要的汇编语言,但对于您可能要编写code的一个模块,而不是必须有很多,如果大拇指别人的乱抛垃圾的code的地方。你当然可以让你的脚湿,在这里,并采取了一些code直满32位ARM指令的其他一些平台。 thumbulator是拇指只,共有指令的基于ARM内核和thumb2基于内核之间设置,基本上是便携式ARM指令集,写code一次,它几乎适用于所有的核心。

There is some leaning toward a unified ARM assembly language that works both on the ARM based cores and the thumb2 based cores. Not for all of the assembly language needed but for places where you might want to write a module of code and not have to have a lot of if thumb elses littering the code. You can certainly get your feet wet with that here and take some of that code straight to full 32 bit ARM instructions on some other platform. thumbulator is thumb only, the common instruction set between the ARM based cores and the thumb2 based cores, basically it is the portable ARM instruction set, write the code once, it works on almost all of their cores.

您将在github上看到我有很多其他项目有与汇编开始,然后进入许多但不是所有基于ARM汇编启动code领先进入C.样品。从$ 10到50 $左右的硬件成本。例如,您可以看一下yagbat的事情,并得到免费的Visual Boy Advance的模拟器和模拟32位ARM指令或16位Thumb或什么的,并有模拟显示器等,或者如果你有GAMEBOY硬件或NDS或NDS Lite和正确的墨盒,您可以运行在真正的硬件方案。

You will see at github I have a number of other projects with samples that start with assembler then get into asm boot code leading into C. Many but not all ARM based. The hardware costs from $10 to $50 or so. You can for example look at the yagbat thing and get the free visual boy advance simulator and simulate 32 bit arm instructions or 16 bit thumb or whatever, and have a simulated display, etc. Or if you have the gameboy hardware or an nds or nds lite and the right cartridges you can run programs on the real hardware.

所有的我把在那里的东西是有乡亲学习借鉴。克服试图嵌入首次恐惧的东西,不知道如何交叉编译,等我从许多其他类似的例子教训,我只是在讨回公道。

All of the stuff I put out there is there for folks to learn from. Overcoming fears of trying something embedded for the first time, not knowing how to cross compile, etc. I learned from many other similar examples and am just returning the favor.

如果你的目标是学习的iOS程序设计,获得该套件或任何学习使用任何语言,他们想让你学习,在那得到精通,学会的API等,然后如果你做一些东西,汇编上方,然后你可以开始考虑让到asm函数或内联汇编等电话,从您的iOS程序。多少汇编,你的选择。我不会希望看到用汇编语言编写针对该平台的应用我反而寻求如何从我的IOS应用程序或我该怎么做内联汇编调用此组件code。 (不要学内嵌汇编,直到你擅长真正的组装)。

If your goal is to learn iOS programming, get the kit or whatever and learn using whatever language they want you to learn, get proficient at that, learn the apis, etc. Then if you do some of the assembler stuff above then you can start to think about making calls to asm functions or inline assembler, etc, from your iOS programs. How much assembler, your choice. I wouldnt expect to see applications written in assembler for that platform I would instead search for how do I call this assembly code from my ios application or how do I do inline assembly. (dont learn inline assembly until you are good at real assembly).

有是没有理由要访问一个模拟器,还有很多很多的手臂模拟器在那里,一个在MAME,武器GDB等地ARMulator目录下面,一些GameBoy Advance的和任天堂的DS simultators等,等等,等等。当然还有QEMU臂。有更多的模拟器比你可能愿意采取尝试的时候,我是大约10年左右的时间把它自己,而不是尝试所有这些。

There is no reason at all to pay for access to a simulator, there are many many arm simulators out there, one in mame, arms armulator in gdb and other places, a number of gameboy advance and nintendo ds simultators, etc, etc, etc. Of course there is qemu-arm. there are more simulators than you probably are willing to take the time to try, i am about 10 years or so into it myself and not tried them all.

学习组件不像C或Python或Java中,我会写一个扫雷游戏来学习这门语言。您正在学习走动位,小步,不写使用的应用程序的机制。例如使用16位处理器增加了两个128位的数字是一个值得汇编语言项目。两个数相乘,任意大小,与处理器没有乘法指令,这是另一种类型的汇编学习项目。是的,我同意您可以通过从iOS应用程序调用ASM学习这些东西,但如果你不已经有iOS开发套件和知道如何编写iOS应用程序,你有很多学习你开始思考汇编之前做的。

learning assembly is not like C or python or java, I will write a minesweeper game to learn this language. You are learning the mechanics of moving the bits around, small steps, not writing usable applications. For example adding two 128 bit numbers using a 16 bit processor is a worthy assembly language project. Multiplying two numbers, any size, with a processor without a multiply instruction, that is another assembler type learning project. yes, I agree you CAN learn those things by calling asm from an iOS application, but if you dont already have the iOS developers kit and know how to write iOS applications, you have a lot of learning to do before you start thinking about assembler.

如果我的路要走与你问什么标记,没问题,我会很高兴地删除这个答案......

If I am way off the mark with what you were asking, no problem I will gladly remove this answer...

这篇关于iOS版装配code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆