开发者

Assembly Programming on Mac

开发者 https://www.devze.com 2022-12-27 09:41 出处:网络
I am on a Mac with Snow Leopard (10.6.3).I hear that the assembly language I work with has to be valid with the chipset that you use.I am completely new to this I开发者_如何学JAVA have a basic backgro

I am on a Mac with Snow Leopard (10.6.3). I hear that the assembly language I work with has to be valid with the chipset that you use. I am completely new to this I开发者_如何学JAVA have a basic background in C and Objective-C programming and an almost strong background in PHP. I have always wanted to see what assembly is all about.

The tutorial I'll be looking at is by VTC [link].

What I want to know is: are the tutorials that I'm about to do compatible with the assembly version on the Mac that I have?

I am completely new to this language although I do recall studying some of it way, way back in the day. I do have Xcode and what I'm wondering is what kind of document would I open in Xcode to work with assembly and does the Mac have a built in hex editor (when it comes time to needing it)?


The assembly language you use is not dependent on your OS but rather your CPU's instruction set. Judging by your Mac version, I'd say you are using an Intel processor - so you would want to learn x86 or amd64 assembly.


A good way to pick up assembly is to get yourself an embedded device to play with.

TI has some nice, inexpensive devkits to play with. I've poked around with the Chronos kit ($50) which has digital watch with a programmable MSP430 microcontroller with a wireless link to your computer. It's pretty sweet.

Update: I forgot to mention the Arduino. It's a pretty nifty open platform with tons of interesting peripherals and projects online.


An assembly language is instruction architecture specific. Chips are an instantiation of an instruction architecture.

In my opinion, you are best served by getting TextWrangler and directly compiling with gcc.

The file extension you are looking for is .s.


Assembly, for any processor, will be more or less the same in concept. However, the complexity varies between processors. From what I see in your site, you'd be doing x86 assembler, (x86 being the instruction set all consumer-line Intel processors use, which recent Macs and all PCs use) which can turn out to be fairly complex, but not overwhelming if you learn by steps.

XCode works with plain text files, I believe. Hex Fiend for your hex editing needs, if you come across them.

Do keep in mind, Assembly is extremely low-level. No ifs, whiles, or in fact any control loop save for "do operation and GOTO if results in (not) zero/equal" (unless your assembler provides them as syntactic sugar, which kind of beats the purpose, in my opinion). PHP knowledge will be at most tangentially useful. You C knowledge should serve you well, though.


The linked tutorials look like they use NASM, which is included with Macs. However, system calls are usually different on different platforms (they're very different between Mac and Linux), and without seeing the tutorials, it's hard to know whether they'll target different platforms (I'd guess not, though). A better bet might be to install SPIM and to learn MIPS assembly, which is more straightforward than x86 anyways.

0

精彩评论

暂无评论...
验证码 换一张
取 消