What's a good place online to learn about assembly in a modern context? The places I found before seemed to be outdated.
Try The Art of Assembly Language Programming: http://webster.cs.ucr.edu/AoA/index.html
Are you learning assembly on some sane platform, or on x86?
What are the sane platforms??
RISC platforms with lots of registers, so you don't have to deal with too much memory management. I learned on SPARC.
Sane platforms? More like "platforms nobody uses", amirite?
If you dislike things that nobody uses, why are you learning assembly?
Silly rabbit, RISC is for compilers, not humans!
> Silly rabbit, RISC is for compilers, not humans!
How pleasent it would be if this was true. In the name of backward compatibility x86 wants CISC instructions that it translates itself to RISC before executing.
Assembly Language ia giving me a headache.
Would anyone happen to know if there's a "Assembly Language for Dummies" book?
No.
In case you're not actually an idiot, I've heard good things about Kip Irvine's book Assembly Language for Intel-Based Computers.
>Assembly Language for Dummies
>Assembly Language for Intel-Based Computers
lol
You should learn IA64 asm.
>>16
no one uses IA64...
you should learn 6502 assembly instead.
i actually have a book called "Programming a Microcomputer: 6502" that was published in 1978...
>>17
Didn't the NES use one of those?
>>18
http://en.wikipedia.org/wiki/6502
>One of the first "public" uses for the design was the Atari 2600 videogame console. The 2600 used an offshoot of the 6502 called the 6507, which had fewer pins and could address only 8 KB of RAM as a result. Millions would be sold in this form. The 6502 was next used in the Apple II family, and then quickly appeared in various Commodore and Atari home computers, the BBC Micro family, and a huge number of other designs now lost to history. The 6510, a direct successor to the 6502 with a digital I/O port and a tristate bus, was the CPU utilized in the extremely popular Commodore 64 home computer.
>Another important use of the 6502 was in the Nintendo Famicom, a Japanese video game console. Its North American and European equivalent, the Nintendo Entertainment System, also got the 6502. The 6502 used in the NES was a modified version (called 2A03 in NTSC consoles and 2A07 in PAL consoles, the difference being the clock divider ratio) that was produced solely for Nintendo. The custom NES processor lacked the 6502's decimal mode, but added 22 memory-mapped registers for sound generation, joypad reading, and sprite DMA.
if you're seriously going to try writing assembly for this architecture, you'll probably want to check out the section titled "Dubious features" in that article...
Assembly Language Step-by-Step:
>>17
No one uses it, but it's still great!
The 68000 was the processor I learned assembly on. I've also tried 6502 and x86, but neither of them are as fun to programme for as 68k processors.
Ah yeah, I've got a buddy I talk to online who's always telling me how great 68k assembly is. He sent me a C program once that was converted from 68k assembly. I bet he won't mind if I post it here:
/* 13371z3r written in "68000" */
#include <stdio.h>
char d0b;
char*a0b;
long d0l;
long*a0l;
long*a7l;
char status;
unsigned char mainmemory[1024]="leet TESTING string";
main()
{
a7l=1024+mainmemory; // movea.l #1024,a7
a0b=a0l=mainmemory; // move.l #mainmemory,a0
*(--a7l)=a0b=a0l; // movea.l a0,-(a7)
loop: status=d0b=*a0b; // loop: move.b (a0),d0
if(!status)goto finished; // beq finished
status=d0b-='A'; // subi.b #'A',d0b
if(status<0)goto quit2; // bmi quit2
status=d0b-=26; // subi.b #26,d0b
if(!(status<0))goto quit1; // bpl quit1
d0b+=('z'+1); // addi.b #'z'+1,d0b
goto go; // bra go
quit1: d0b+=27; // quit1: addi.b #27,d0b
quit2: d0b+='A'; // quit2: addi.b #'A',d0b
go: // go:
status=d0b-'t'; // cmpi.b #'t',d0
if(status)goto l2; // bne l2
*(a0b++)='7'; // move.b #'7',(a0)+
goto loop; // bra loop
l2: status=d0b-'l'; // l2 cmpi.b #'e',d0
if(status)goto l3; // bne l3
*(a0b++)='1'; // move.b #'3',(a0)+
goto loop; // bra loop
l3: status=d0b-'a'; // l3 cmpi.b #'e',d0
if(status)goto l4; // bne l4
*(a0b++)='4'; // move.b #'3',(a0)+
goto loop; // bra loop
l4: status=d0b-'b'; // l4 cmpi.b #'e',d0
if(status)goto l5; // bne l5
*(a0b++)='8'; // move.b #'3',(a0)+
goto loop; // bra loop
l5: status=d0b-'g'; // l5 cmpi.b #'e',d0
if(status)goto l6; // bne l6
*(a0b++)='6'; // move.b #'3',(a0)+
goto loop; // bra loop
l6: status=d0b-'j'; // l6 cmpi.b #'e',d0
if(status)goto l7; // bne l7
*(a0b++)='9'; // move.b #'3',(a0)+
goto loop; // bra loop
l7: status=d0b-'o'; // l7 cmpi.b #'e',d0
if(status)goto l8; // bne l8
*(a0b++)='0'; // move.b #'3',(a0)+
goto loop; // bra loop
l8: status=d0b-'s'; // l8 cmpi.b #'e',d0
if(status)goto l9; // bne l9
*(a0b++)='5'; // move.b #'3',(a0)+
goto loop; // bra loop
l9: status=d0b-'e'; // l9 cmpi.b #'e',d0
if(status)goto end; // bne end
*(a0b++)='3'; // move.b #'3',(a0)+
goto loop; // bra loop
end: // end:
a0b++; // addq.l #1,a0
goto loop; // bra loop
finished: d0l=0; // finished: moveq #0,d0
*(a0b++)=d0l; // move.b d0,(a0)+
*(a0b++)=d0l; // move.b d0,(a0)+
*(a0b++)=d0l; // move.b d0,(a0)+
*(a0b++)=d0l; // move.b d0,(a0)+
*(a0b++)=d0l; // move.b d0,(a0)+
*(a0b++)=d0l; // move.b d0,(a0)+
*(a0b++)=d0l; // move.b d0,(a0)+
*(a0b++)=d0l; // move.b d0,(a0)+
printstring(); // jsr printstring
return; // rts
}
printstring()
{
a0l=*(a7l++); // movea.l (a7)+,a0
// loop2: move.l (a0)+,(a1)
loop2: status=*a0l;fwrite(a0l++,4,1,stdout);
if(status)goto loop2; // bne loop2
return; // rts
}
By the way, my friend who wrote the program in >>23 goes by the name "Cyan Helkaraxe." He is insisting that I mention his name here.
As CISC architectures go, 68k is indeed one of the more pleasant ones to use.
Hah, assembly is so old school. Useful for quite a few things though. I saw 6502 mentioned earlier, I've been learning 65816 (SNES) assembly, I like it so far. Anyway, thanks for the links mentioned above.
Hah, assembly is so old school. Useful for quite a few things though. I saw 6502 mentioned earlier, I've been learning 65816 (SNES) assembly, I like it so far. Anyway, thanks for the links mentioned above.
Hah, assembly is so old school. Useful for quite a few things though. I saw 6502 mentioned earlier, I've been learning 65816 (SNES) assembly, I like it so far. Anyway, thanks for the links mentioned above.
C-C-COMBO BREAKER
>>29
lol'd
www.flatassembler.net
>>24
What your friend needs is a good kick in the ass.
The 65816 was also used on the Apple IIGS
68k was also used in the Genesis, Neo Geo, and as a sound processor in the Saturn
Then there's the Z80, which is a bigger pain in the ass than the 68k :)
So true about the Z80.
Then again, anything is a bigger pain in the ass than 68k. Well, apart from the address/data register split anyway, and the bizarre pairing rules for optimizing for a 68060, but anyway. Would likely be really good for learning, even though the architecture has been mostly only relevant for embedded targets (i.e. ColdFire and the like, and those are subsets of the 68k ISA anyway).
Z80 is cake. I can write z80 code with one hemisphere tied behind my back. Ditto m68k.
65816 is insane to debug because the length of certain instructions actually changes depending on the state of the CPU when they are executed. Gah. Still, it's not bad, for being such a blatant bag on the side of 6502.
x86 gives me an acute case of brain hives.
>>16
Damn, if programmers had horrible in-jokes, this would be one of them. Bloody hell, I mean. Just coming up with a code generator that works at all for IA64 is an EPIC task (pun intended, har dee har) and that's in a compiler environment. I can't imagine writing any but the most horribly inefficient code for IA64 by hand, and even then... I get nightmares just reading the shit, and I'm only talking about things that some (presumably) human wrote to do something like syscalls or interrupt handlers so it's not laden with fecking predicate registers and VLIW-enforced stop bits and goddamn nonobvious control flow!
For those who don't know what I'm talking about, I'll elucidate one fraction of the true horror. Think of predicate registers like the condition code register of the ARM. You know, using it to omit jumps here and there. Now think about juggling a whole bunch of them, far more than the condition register slices you get on a PowerPC, and consider that any instruction can be predicated by any of them. Now, consider this alongside things like pseudo-VLIW instruction slots and stop bits. Yeaaaaaah, ride the snake.
>>36
I found, way back when, that after some years of 6502 hand-coding, m68k suddenly felt like a processor for the kids in the neighbourhood who were a few years older and always had their toys which were somehow neater and more serious than those of us little kids. Just an anecdote, but... not like the OP is going to be writing any serious assembly, right? And an instruction set with a pretty nice set of rather orthogonal addressing modes (apart from the data/address register split) has to be nicer for learning than the "hi, I'm like a Z80 only I've got six accumulators!" pile of cr^W^W^Wproduct of hard economic realities most of us use today.
There is a book called "The Art of Assembly Language" available online... never read it myself, but have it sitting in my bookmarks for quiet some time... -> http://webster.cs.ucr.edu/AoA/Windows/HTML/AoATOC.html
You guys forget that there's also the 6809 vs the Z80 and the 68K vs the 65816. 6809 uses the same basic assembly used in the 68HC11 microcontrollers, and the 6809 was used in arcade games that were hard to program because of the raw power (Defender, Stargate, Robotron 2084, Etc) so mabe try that, then maybe move to 68000K as they are very alike. And to program the Z80,It's very unique as the register swapping between 8 and 16 bits is just wastefull sometimes (To me)....
Whatever floats your boat. Even if it may be a failboat....