Live data from Hacker News

Hello-World iOS App in Assembly

gist.github.com

41–50 of 62 posts

Re: Hello-World iOS App in Assembly

#41
post #39

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.

How would that impact the App Store approval? AFAIK they review binaries anyway…

They do, but ASM doesn't have the guardrails that the compiled languages have, so it's almost certain that private APIs would get accessed.

Re: Hello-World iOS App in Assembly

#42
post #31

Earlier quoted context omitted.

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.

The point is what is possible within the constrains of public APIs.

Is syscall a public API on iOS? In the end, you have to call that to get anything on the screen?

Looking at unistd.h, it seems marked as

  __OS_AVAILABILITY_MSG(ios,deprecated=10.0,"syscall(2) is unsupported; "
    "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
and syscall numbers seem wrapped by

  #ifdef __APPLE_API_PRIVATE
in *

Re: Hello-World iOS App in Assembly

#43
post #37
post #23

Earlier quoted context omitted.

<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€

Do you need to pay the license to keep your apps in store? Or did they deprecate some APIs and therefore removed your apps? Honestly wild if you need to upkeep the license just to have it in store once it is published.

Yes. I have a bike helmet with integrated cameras. The company (Cyclevision) that made it is gone. So no Apple account. So no app for my helmet anymore.

Re: Hello-World iOS App in Assembly

#45
When I was in second or third year of computer science in 1971 or '72, we (of course) learned IBM 360 assembler, but we also had to design a simple binary adder using AND OR and XOR gates. All on paper - no need for any soldering or electronics, which I regret. I cannot remember how many bits of input - probably 4 but may have been 6. But I did do quite a bit of asm programming, including a routine for calculating square roots using Chebyschev polynomials and newtons algorithm.

Re: Hello-World iOS App in Assembly

#46
post #42
post #31

Earlier quoted context omitted.

The point is what is possible within the constrains of public APIs.

Is syscall a public API on iOS? In the end, you have to call that to get anything on the screen? Looking at unistd.h , it seems marked as __OS_AVAILABILITY_MSG(ios,deprecated=10.0,"syscall(2) is unsupported; " "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().") and syscall numbers seem wrapped by #ifdef __APPLE_API_PRIVATE in *

Not at all, it is a Linux thing to keep applications doing syscalls, like back in MS-DOS interrupt days.

All other modern OSes give zero guarantees about syscalls.

Indeed, you have to call UI Kit, that is the public API for userspace applications.

Even if via OpenGL ES or Metal, you need a drawing context and a Window to render it.

Re: Hello-World iOS App in Assembly

#47

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.

Complete bogus. This is programmers machismo that's completely detached from reality.

Re: Hello-World iOS App in Assembly

#48
post #39

Earlier quoted context omitted.

How would that impact the App Store approval? AFAIK they review binaries anyway…

They do, but ASM doesn't have the guardrails that the compiled languages have, so it's almost certain that private APIs would get accessed.

What? That doesn’t make any sense. The only guard rails normal Obj-C has against calling private APIs is that they aren’t listed in the public headers, otherwise you can still easily call them. If you don’t explicitly make calls to private APIs from ASM, the won’t be called. I have no idea why you think “it’s almost certain that private APIs would get accessed.”

Re: Hello-World iOS App in Assembly

#50

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.

Complete bogus. This is programmers machismo that's completely detached from reality.

I'm not sure this is entirely fair though I think you're mostly right. The comment you're replying to is right in terms of the value of understanding one or more levels of abstraction below the one you're working in. Conversely you're right in that learning assembler isn't going to do much to help you debug a failing Flutter app. It's just attacking the abstraction stack in detail from the opposite end - equally myopic.

But none the less valuable because of the additional perspective it brings. That's the real point of it, another lens through which to view and understand the mechanics of the application.

Post reply on HN