Assembly For My Mac - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Programming Languages & Scripting (/forum-8.html)
+--- Thread: Assembly For My Mac (/thread-4817.html)
Assembly For My Mac - Jordan - Nov 10, 2005 11:10 AM
As strange as it may seem to some, I am interested in learing some assembly language for my iBook G4. The documentation provided with XCode is difficult for someone who knows next to nothing about assembly language and processor terminology.
I just bought an excellent book called: THE DEFINITIVE GUIDE TO HOW COMPUTERS DO MATH, FEATURING THE VIRTUAL DIY CALCULATOR. I have to say it is on the top three list of best written computer programming books I've come across, but I'm memorizing functions for a virtual computer, instead of investing time with the computer I love.
Where can I find a good beginner book on Assembly for the Mac?
Assembly For My Mac - AnotherJake - Nov 10, 2005 12:22 PM
Learning assembly on the PPC isn't a very popular endeavor and there aren't many books on it. Optimizing PowerPC Code by Gary Kacmarcik is still the only one I know of besides some online resources. You can also download the Motorola and IBM PowerPC manuals. Assembly programming on the Mac is mostly a waste of time nowadays if you ask me unless you're really pushing the limits of your curiosity. With the newer Macs coming out with Intel processors soon there is even more reason NOT to learn PPC assembly now. That said, here's a good link:
Assembly For My Mac - Carlos Camacho - Nov 10, 2005 06:29 PM
>With the newer Macs coming out with Intel processors soon there is even more reason >NOT to learn PPC assembly now
That is what crossed my mind as well.
BTW, Fantasm (PPC assemler) was open sourced long ago but I don't think it made it to modern Mac OS X version.
>Learning assembly on the PPC isn't a very popular endeavor
Actually, I think would be true for desktop machines that use PPC, while the embedded market surely has a need for PPC coders, since PPC chips are in many many devices. (Well, last time I read.) You might want to look at Motorola or IBM's PPC pages for added info.
BTW, I was wondering if the learning curve would be a bit easier by learning ASM on an 8-bit emulator, for a chip like the 6809. Maybe even Z80 or whatever those old arcade machines once used.
Assembly For My Mac - AnotherJake - Nov 10, 2005 06:48 PM
Carlos Camacho Wrote:...the embedded market surely has a need for PPC coders, since PPC chips are in many many devices. (Well, last time I read.)That's a good point. The same could be said for learning assembly for other microcontrollers like the popular pic or maybe even some usb microcontrollers. Probably more than a trivial task to do that from the confines of a Mac though since most electronics interfacing hardware and programming software is made for WinTel.
Assembly For My Mac - Ingemar - Nov 12, 2005 02:34 PM
Carlos Camacho Wrote:BTW, I was wondering if the learning curve would be a bit easier by learning ASM on an 8-bit emulator, for a chip like the 6809. Maybe even Z80 or whatever those old arcade machines once used.I say yes. I used to program a lot in 6809 (entire games) and 68000 assembler (optimized blitters), and even touched upon Z80. 6809 was nice and easy. Z80 was far worse. 68000 quite OK.
A few years ago, I tried learning PPC assembler, because I wanted to write my own code generator. It was like a brick wall in comparison. It was obvious to me that 6809 and 68000 were designed to be human programmable on low level, while the PPC is ment to be optimized by machine and programmed in a higher-level language.
Taste varies, but I'd say that you will have a much better time with 6809 or 68000. Go for 68000, pick up an old 68k Mac, find some assembler, or C compiler that supports inline assebly, and have fun! (Or if you like, run the 68k programs on a PPC Mac, even under Classic under OSX. After all, 68k emulation is built-in.) Brian Barnes wrote his first games in 68000 assembler, so he might have a comment on this.
Assembly For My Mac - Steven - Nov 13, 2005 12:45 AM
I've had good results using Microchip's PIC line of chips. Easy assembler, many good resources. Only drawback is that you're likely going to have to use a Windows or Linux machine to program it. I think it cost me less than a hundred to get going...
I got free samples from Microchip (you can order something like eight or nine, and they even ship it for free). I picked up a $10 Olimex (http://www.olimex.com/) programmer (PIC-PG1B, if my memory serves right) and some stuff from my local electronics store. You're going to need a bit of a crash course in electronics if you use the bare PIC, though... might be better to invest in a development board (too expensive for cheap 'ol me...)
Assembly For My Mac - Dan Potter - Nov 13, 2005 09:17 AM
Dreamcast has an SH-4, which is fun to code for in assembly. The only equipment you'll need is a ~$30 used DC and a ~$15 "coders' cable" from Lik Sang. Homebrew software works on a Mac, and there's plenty of examples (and it's very easy to see quick results, with e.g. drawing in the frame buffer).
Assembly For My Mac - unknown - Nov 13, 2005 10:05 AM
I was trying to learn assembly but Its not really meant to be, people dont like it because its far less portable.
gcc file.c -S -o file.s
gives you the assembly code for a c file, and you can gcc the .s file and get a binary that run, but coding that stuff, its not really somthing I think is possible.
also you could always write an assembly interpreter in c,
Assembly For My Mac - Dan Potter - Nov 13, 2005 05:12 PM
unknown Wrote:but coding that stuff, its not really somthing I think is possible.
Would your head explode if I told you I've written whole graphics/music demos in Intel assembly? Or that OS/2 (the IBM OS) has vast tracts of Intel assembly in it?
Assembly For My Mac - unknown - Nov 14, 2005 02:18 AM
My head asplode!!
Assembly For My Mac - TomorrowPlusX - Nov 16, 2005 05:35 PM
It was ten years ago, but I wrote an IR remote control input system in asm for a prototype digital set top box running a 68000. Not very much, mind you, just enough to capture the input and forward it to my own C routines. I must have written 10, 20 kloc of C for that box, however.
Assembly For My Mac - psyba - Nov 24, 2005 06:37 PM
http://timestocome.com/personal/mac.html has some good examples and links.
I have two small programs I wrote on my website @ http://cs.usm.maine.edu/~aubut . I think one is a comp vs comp tic tac toe simulator that uses altivec to check all 8 winning board states in just a couple of instructions.
I like PPC assembly language a lot better then CISC based instruction sets that have only a few registers like the stack pointer, accumulator, etc. I also like the MIPS Arch which is also a RISC based based instruction set. Look for the Mach-O File Format that is on Apple's Dev Site some place. It details which registers are used for what.
I think there is more altivec assembly code out there then anything. There is a cool command line app that comes with the Dev tools or CHUD Tools called Sim G4/G5 that shows you exactly how the machine is executing the code cycle by cycle. You will have to know about execution pipelines and superscalar execution to understand the output. http://www.simdtech.org/home has a nice e-mail list archive where I got my start doing altivec assembly. I got the instruction set manuals for both the PPC and Altivec Instruction Sets for free from Motorola (IBM may have it too) on their site if you wanted to pick that up. I'm not sure if they still do that. Intel stopped when I requested some updated manuals and they just sent me a CD.
Assembly For My Mac - zKing - Dec 9, 2005 11:15 PM
Back when I was in the video game biz I wrote a lot of code for Game Gear and Game Boy... all of it Z80 asm. One title was a port from a Genesis release, so we got all the 68000 code to work from. It was fun (for the most part) and I think I'm a better developer from having served time "where the tires meet the road", but there's less and less of a reason to do it anymore unless you are in a very specialized embedded field.
I've been doing mobile devices for about five years now and even the small low level devices have C compilers (usually GCC of course.) Good powerful chips w/a C compiler are cheap. Although I did hear a rumor that due to all the electronics in cars, dishwashers, etc. the Z80 still outsells the Intel desktop chips by an order of magnitude if not more. But who wants a job programming a dishwasher?
*No offense intended to any dishwasher programmers on this board.*
Assembly For My Mac - ggadwa - Dec 9, 2005 11:50 PM
Ingemar Wrote:Brian Barnes wrote his first games in 68000 assembler, so he might have a comment on this.
Scruffy and Scruffy ][ were written completely in 68K assembly ... and not only that, but the actual graphics were in assembled text files as series of bytes (I actually had pascal code that would convert graphics to text files that I'd run through the assembler.)
I jumped right from coding games in 6502 to 68K, so I didn't even know about nice features like the resource manager. I was hard-core anti anything but drawing directly to the screen. The graphics on both scruffy games are actually compiled into the code resource.
I obviously stopped doing that
Assembly For My Mac - Jones - Jan 6, 2006 05:56 PM
Excuse my noobieness, but am I correct in assuming that assembly is the "art" or "task" of writing base code for a machine? Something that won't need an operating system, or be dependant on frameworks?
For example, you would start an Operating System from scrath using assembly programming, right?