Live data from Hacker News

Hello-World iOS App in Assembly

gist.github.com

21–30 of 62 posts

Re: Hello-World iOS App in Assembly

#21
post #18

Earlier quoted context omitted.

xcrun -sdk iphoneos clang yellow.asm, pack it into an IPA and sign it

Hmm doesn't work. Here's the error log (I'm on Mac M2): https://gist.github.com/anta40/60f62c803a091ad0415d60f8cac55...

Maybe throw in a -framework CoreFoundation

Re: Hello-World iOS App in Assembly

#22

This kind of thing is how you actually learn what's under the hood. Everyone's building with React Native and Flutter, which is fine until something breaks. Then you're stuck Googling black magic. Starting from assembly teaches you the real cost of abstraction.

All this teaches is how to put parameters on stack, pass them to functions and use the results. It is pretty much a transliteration of what you would do in C.

Re: Hello-World iOS App in Assembly

#23

There is also an iOS app implemented in C here: https://stackoverflow.com/a/10290255/8427

snibbetracker is an example of a C/SDL iOS app. https://apps.apple.com/de/app/snibbetracker/id1065797528

<1MB is also relatively easy to reach with swiftui apps. I had two fully working ones in the app store below 1MB. They are removed now since I didnt pay the yearly 100€

Re: Hello-World iOS App in Assembly

#24

This kind of thing is how you actually learn what's under the hood. Everyone's building with React Native and Flutter, which is fine until something breaks. Then you're stuck Googling black magic. Starting from assembly teaches you the real cost of abstraction.

This is an excellent argument for not using assembly, actually

It's still very educational. It shows how ObjC method calls work under the hood, because even calling objc_msgSend() from plain C involves a certain amount of non-obvious magic (because of the variable argument list and return types).

And tbh I'm kinda surprised how little assembly code it is, less than most UI framework hello-worlds in high level languages ;)

Re: Hello-World iOS App in Assembly

#25
Very cool, if impractical (it’s likely that you’d never get an ASM app through the App Store Approval process).

ARM Assembly is a much more Byzantine creature, than the old 8- and 16-bit versions I used, way back in the Pleistocene.

I’m always a fan of starting from the “bare metal,” to learn, but these days, it’s a long trip. When I was just a wee sprog, it was only a couple of steps away.

Re: Hello-World iOS App in Assembly

#26

Very cool, if impractical (it’s likely that you’d never get an ASM app through the App Store Approval process). ARM Assembly is a much more Byzantine creature, than the old 8- and 16-bit versions I used, way back in the Pleistocene. I’m always a fan of starting from the “bare metal,” to learn, but these days, it’s a long trip. When I was just a wee sprog, it was only a couple of steps away.

It's likely in future, you won't need app store approval process. I hope that EU will nuke Apple with some huge fines.

And there will be corporate tax per each EU country, it's ridiculous corporates are raking huge money here and paying basically nothing on taxes, well only in Ireland and they're having party.

Anyway, asm is great if you are using iOS emulator and need to do something and since you have root there, well :) (not apple meme simulator)

Re: Hello-World iOS App in Assembly

#27
post #26

Very cool, if impractical (it’s likely that you’d never get an ASM app through the App Store Approval process). ARM Assembly is a much more Byzantine creature, than the old 8- and 16-bit versions I used, way back in the Pleistocene. I’m always a fan of starting from the “bare metal,” to learn, but these days, it’s a long trip. When I was just a wee sprog, it was only a couple of steps away.

It's likely in future, you won't need app store approval process. I hope that EU will nuke Apple with some huge fines. And there will be corporate tax per each EU country, it's ridiculous corporates are raking huge money here and paying basically nothing on taxes, well only in Ireland and they're having party. Anyway, asm is great if you are using iOS emulator and need to do something and since you have root there, w…

You can already deploy apps on alternative stores inside of the EU. Apple has some bullshit fee but Epic has promised to cover that for AltStore.

Re: Hello-World iOS App in Assembly

#28

This kind of thing is how you actually learn what's under the hood. Everyone's building with React Native and Flutter, which is fine until something breaks. Then you're stuck Googling black magic. Starting from assembly teaches you the real cost of abstraction.

Is this really low level though? Because its hooking UIKit which is very high level relative to ASM. I'd be really curious to see an app draw on iOS without UIKit. I don't know if thats possible.

You can write directly to the frame buffer, like a video game. You still need the UIKit import to publish, because it has to be bundled into a .ipa which requires an AppDelegate, a UIBundle, among other things.

If you want to “technically” avoid UIKit, you can drop one step lower. UIKit is implemented on CoreAnimation. A bare UIView is nearly a pass through wrapper around CALayer. It wouldn’t be hard to build your own custom UI on CALayers. The old CA tutorials for implementing a ScrollView from the ground up are still floating around out there.

Re: Hello-World iOS App in Assembly

#30
post #19

Earlier quoted context omitted.

Of course it is. You just have to reimplement UIKit in ASM, no big deal…

And even that won't do it, because within the constraints of iOS, eventually that framebuffer with software rendering has to be displayed on the screen via an OS API, which is UI Kit.

It should be possible.

If you enable the JIT entitlement for personal development, then bundle a mach-o into an entitled app. Or compile it directly on the app and mprotect-x to execute it. Is there something else you can’t do that I’m not considering? I might give this a try.

Post reply on HN