iOS 汇编代码 [英] iOS assembly code

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

问题描述

我想在苹果 iOS 上尝试一些 ARM 汇编代码,仅用于教育目的.我想从 Xcode 中的一些内嵌代码开始.我的理解是我需要为 iOS 设备编译,例如我的 iPhone,这意味着我需要支付 99 美元/年的会员费.我不认为我可以在 iOS 手机模拟器中使用 ASM 汇编代码.我很难用 iPhone 在 Xcode env 中找到有关 ARM 汇编代码的示例、书籍或文档.我这样做错了吗?也许 iOS 不是学习 ARM Assembly 的最友好的环境.

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 应用程序?您需要学习将立即数放入寄存器 add 和 or 和 xor 并将答案保存在寄存器中.然后读写一些内存位置.学习使用堆栈、进行调用等.然后用 C 或其他语言编写您的应用程序,并使用 asm 进行手动调整或使用您的 asm 技能来调试编译器和/或代码.在 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.

有些人倾向于使用统一的 ARM 汇编语言,该语言既适用于基于 ARM 的内核,也适用于基于拇指 2 的内核.不是针对所有需要的汇编语言,而是针对您可能想要编写代码模块的地方,而不必有很多 if 大拇指其他乱七八糟的代码.您当然可以在这里了解一下,并将其中的一些代码直接转换为其他平台上的完整 32 位 ARM 指令.thumbulator只是thumb,是基于ARM的内核和基于thumb2的内核之间的通用指令集,基本上是可移植的ARM指令集,编写一次代码,几乎可以在它们的所有内核上运行.

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.

如果您的目标是学习 iOS 编程,请获取工具包或其他任何东西,并使用他们希望您学习的任何语言进行学习,精通该语言,学习 apis 等.然后如果您执行上面的一些汇编程序,那么您可以开始考虑从 iOS 程序调用 asm 函数或内联汇编器等.多少汇编,你的选择.我不希望看到为该平台用汇编程序编写的应用程序,而是搜索如何从我的 ios 应用程序调用此汇编代码或如何进行内联汇编.(在你擅长真正的汇编之前不要学习内联汇编).

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).

完全没有理由为访问模拟器付费,那里有很多arm模拟器,mame一个,gdb和其他地方的armulator,一些gameboy Advance和nintendo ds模拟器等,等等等等.当然还有qemu-arm.模拟器的数量可能比您愿意花时间尝试的要多,我自己大约 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 汇编代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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