5 ms·
This is a project I'd definitely be interested in. I am a webdev by day (Python/Django) but recently started learning x86 assembly at home (after which I can p
by krmboya 13y ago
This is a project I'd definitely be interested in.
I am a webdev by day (Python/Django) but recently started learning x86 assembly at home (after which I can pick off from where I left in C at college).
Some of my colleagues think I'm crazy, but I find I'm learning a lot about how a computer really works (and I'm also beginning to understand why the great old 'real programmers' spent hours upon hours on the damn machine :-))
- joezydeco 13y agoI'd say learning assembly by starting with x86 is indeed a bit crazy. =) If you want easy training wheels, try 6502 or 6809. If you want more relevant skills, go to a recent ARM instruction set like v6 or v7.
- justin66 13y ago> I'd say learning assembly by starting with x86 is indeed a bit crazy. I've heard this said before. Having had basic exposure to both MIPS and x86 assembly in school, I'm not really clear on WHY people say this. Assembly seems equally unforgiving and obnoxious either way.
- joezydeco 13y agoMy personal reason is because X86 just handles memory segmentation in an awkward manner. Assembly is unforgiving, but some processors are gentler on the programmer than others. If I was trying to teach someone the basics of register indexing and indirect indexing, I'd rather do it on a 6809 than an x86.
- userbinator 13y agoYou don't have to care about segmentation if your program is less than 64K (fits in a single segment), and 64K is far more than enough for doing a lot of interesting things in Asm. A basic "Hello world" that runs in DOS is less than 20 bytes. (Contrast this with using a C compiler on Windows, where "Hello world" compiled with default settings is usually beyond 10KB already.)
- spc476 13y agoStarting with the 8086, it has 14 registers. Four of which are actually eight more registers (AX is AH and AL; BX is BH and BL; CX is CH and CL; DX is DH and DL). Each of these registers has a special purpose (BX can be used to index memory, the rest can't; CX is used in some instructions as a count; AX is your accumulator, and DX is ... just there). There are four more special purpose index registers, SI, DI, BP and SP. SI and DI support post-index and post-decrement indexing mode, but you need to set a flag in another register (CF register) to indicate you want the post-increment mode OR the post-decrement mode. SP is the stack register, but you can't use it as an index register (you can starting with the 80386). You can use the BP register as an index register, but it always takes an offset (there is no special mode for a 0 index). Then you get to the segment registers. As if things weren't bad enough. There are four, CS to point to code, DS and ES for data, and SS for the stack. You see, the 8086 can address 1MB of memory (20 bits), but it's a 16bit instruction set. So the segment registers contain not the upper 4-bits of the address, but the physical address divided by 16 (or, shifted right four bits). A physical address is formed by SEGMENTx16+OFFSET, giving you 20 bits of address. Most instructions and addressing modes use DS, except if you use BP, which defaults to SS, and the store-post-increment/decrement instructions, which must use ES:DI (DI is incremented---ES doesn't). You can override the segment register for most instructions, but not all (the string instructions, which give you the post-increment/decrement addressing modes are the exception). And because of these segment registers, you can have 16 or 32 bit function pointers, 16 or 32 bit data pointers, and 16 or 32 bit stack pointers. So what you have is an instruction set that is almost, but not entirely consistently inconsistent. The 80186 gives you a few more instructions. The 80286 adds protected mode (with four levels of protection) with a change of how the segment registers work (in protected mode---they're now indexes into a table of physical addresses for each segment, each of which can only be 64K in size), and the 80386, which extends all the registers to 32 bits in size (except for the segment registers---they're still only 16 bits long), adds new registers only available in the highest protection ring, and paged memory, in addition to keeping the segmented memory, plus allowing all the registers to more general purpose, in addition to keeping the old instruction set. I'm really hard pressed to come up with a more convoluted architecture than the x86.
- metaobject 13y ago
- luto 13y agoor try yasp! :D
- voidlogic 13y agoI started with PDP-11 (MACRO-11), then MIPS, and that was a great way to start for me. Both easy, one CISC, one RISC.