Best/Worst Assembly Language Instruction Set

Discussion in 'Game Development General Discussion' started by Piglet, Nov 5, 2008.

  1. Piglet

    Piglet Spirited Member

    Joined:
    May 28, 2008
    Messages:
    175
    Likes Received:
    0
    As the name suggests, for all you assembler fans, what's the best (most fun/most challanging) assembly language, which makes you cringe.

    I will go first since I can choose from about 30 different sets:

    Best: ARM - Not the most compact or efficient RISC language, but for things like the GBA where you can do self-modifying code, the execute allways/never instruction was cool for emulating the SNES HDMA system.

    Worst: Atari Jaguar: An in-house design which was, it seems, never finished. R30 & R31 were meant as index-registers but DIDN'T WORK! The pack/unpack command could be done faster with other instructions and it was a pig to optimize.

    Special mention for the 8080 in the GB/GBC - The simplest instruction set. Make your structures powers-of-two big so that the HL register can move around them more efficiently.
     
  2. Alchy

    Alchy Illustrious Member

    Joined:
    Apr 6, 2004
    Messages:
    6,216
    Likes Received:
    19
    My dad reminisces fondly about 6502 every now and again. I've never got into programming much, though.
     
    Last edited: Nov 5, 2008
  3. tomaitheous

    tomaitheous Spirited Member

    Joined:
    Jun 29, 2007
    Messages:
    100
    Likes Received:
    0
    Fav: HuC6280. Basically a 65CS02 set (Rockwell's added instructions). Optimizing is soo much fun. There are some super crazy optimizations for this style chip out there. I know people will fight to the death (or possibly argue) that it's not RISC, but it definitely had some precusor ideas of RISC. A very small, simple, but fast instruction set (hard coded, not microcoded), a large set of 128 16bit address registers (also halved as 256 8bit data registers). The immediate operand instructions are very fast and lend themselves perfectly for self modifying code. The downside is the small logical address range of the PC. All optimizations have to be made local and very specific. Look up tables (LUTs) need to be organized accordingly (and interleaved for 16bit and wider data elements). One thing I never understood is why they never implemented immediate operand opcodes as 1 cycle instead of 2, since the chip would perform a fetch cycle while operating an ALU operation on other opcodes. Same for implied instructions (flag changing).



    Worst: PIC chips. WTF?
     
  4. drx

    drx BLAST PROCESSING. SITE SUPPORTER 2015

    Joined:
    Jun 16, 2006
    Messages:
    509
    Likes Received:
    275
    My favourite... 680x0. Almost orthogonal, 32-bit registers in a wicked 16-bit world.

    I dislike the x86 architecture. It's a huge kludge of backwards compatibility, bleh!

    SHx allowed you to run two opcodes in "parallel", which is nice after you recover from the shock and understand what's going on.

    Not a huge fan of "load, store" architectures like Z80.

    There's a lot more, but most are just 'meh' =P
     
  5. TmEE

    TmEE Peppy Member

    Joined:
    Aug 13, 2008
    Messages:
    362
    Likes Received:
    1
    I have experience with 680x0, Zx80, 80x86 and SH-x

    1. 68K - this one programs itself !!!
    2. Z80 - better than x86 for me
    3. x86 - I need more regs
    4. SHx - my code is an ugly mess...

    So far I'm not fond of RISC CPUs. I've yet to try ARMx, but I don't think it would be any better.
     
  6. Piglet

    Piglet Spirited Member

    Joined:
    May 28, 2008
    Messages:
    175
    Likes Received:
    0
    I would be interested in knowing what instruction-sets everyone has worked on so that we can, maybe, get a fuller picture... Here I go:

    6502 (PET,commodore 64, Apple 2, NES)
    65816 (SNES)
    80X86 (PC/X-Box)
    680x0 (Amiga, ST, Jaguar, Neo Geo)
    8080 (Gameboy, Gameboy Color)
    Z80 (Master System, Megadrive)
    GPU (Jaguar)
    SHx (32X, Saturn)
    ARM x (3D0, GBA, DS, 3D0, Mobile-phones)
    MIPS Rxx00 (PSX, N64)
    PowerPC (Game Cube)

    I need to add some more when I finally make a fuller list of all the stuff I have worked on... getting old, memory BAD!
     
  7. kholdfuzion

    kholdfuzion I kill consoles

    Joined:
    Jan 25, 2005
    Messages:
    194
    Likes Received:
    3
    Even though I've never done any actual writing of my own code on it, my favorite to reverse is definately IBM PowerPC. Something about it just makes perfect sense in my head.
     
  8. DaMaul

    DaMaul Newly Registered

    Joined:
    Oct 26, 2008
    Messages:
    4
    Likes Received:
    0
    I've not a massive amount of experience compared to someone like piglet but here is my list in order of how much fun I found it to write:

    1) Arm 7 - mostly for mobile phone operating system level stuff but I found this to be the most fun, and easiest to learn
    2) Z80 - The first asm I learnt. Can't beat rewriting the keyboard routines on a ZX spectrum.
    3) 68000 - Like TmEE says, pretty much writes itself
    4) Everything I have tried on any MIPS processor - My brain hurts just thinking about it.
    5) x86 - Never again as long as I live unless its just a very small routine and even then I will swear a lot. :)
     
  9. Quzar

    Quzar Spirited Member

    Joined:
    Dec 10, 2006
    Messages:
    167
    Likes Received:
    1
    I've done SH4, x86 (general), 386, and x86-64.

    386 I could barely understand. Doing x86 with SSE(2 and 3) wasn't all that bad. Doing x86-64 was actually amazingly easy compared to x86 due to all the extra regs and not needing to mess with the stack as much.

    SH4 is fun, specifically attempting to optimize for the parallel execution of instructions. The only problem with that of course is that readability and speed end up being mutually exclusive to an extent =P
     
  10. tomaitheous

    tomaitheous Spirited Member

    Joined:
    Jun 29, 2007
    Messages:
    100
    Likes Received:
    0
    Nice list there Piglet :icon_bigg

    6280 - puts hair on your chest (PCE)
    6502 - the missing opcodes are a pain (NES)
    65816 - wtf. faster 16bit math, slower 8bit math. Not much of an upgrade.
    68000 - it's hard to write slow/bad code. Love the addressing modes and linear address range. (MD)
    8080 - or I should say the GB version. Easy to use instruction set, slow execution times. I had a blast coding for GB.
    V810 - not much experience with this (PCFX), but it felt comfortable from what little I did.
    x86 - 386/486 code. This was the first processor I learned assembly language on. I have to say it was fun.
     
  11. Piglet

    Piglet Spirited Member

    Joined:
    May 28, 2008
    Messages:
    175
    Likes Received:
    0
    A friend wants to learn to code in assembler and so I'm teaching him ARM. Someone mentioned that somewhere in the US, one professor is teaching his class assembly using the GB (8080) which makes sence (everyone can get one and cheap!).
    68000 was simple, but with no pipelining I found it rather slow. I had to write some code that would work anywhere in RAM without modification. That makes 680x0 a bit of a pain. If it just relocated once I could build up a table of locations to alter relative to PC but this moved all the time (sound for Mega CD) and it was a BIT grim.
    I actually HAD a Virtual Boy developement kit but other than reading the manuals, I never had chance to use it. I see it uses 16-bit instructions like the SH2 so does it fetch 2 instructions per cycle (rember on the SH2 that if you did a data fetch on a 32-bit boundry, it was faster because the machine wasn't trying to load instructions).
    Anyone else with unusual CPU experience... I'm dying to know!
     
  12. Piglet

    Piglet Spirited Member

    Joined:
    May 28, 2008
    Messages:
    175
    Likes Received:
    0
    Embedded Systems

    Anyone come across those 8-bit RISC designs? Very popular in embedded systems. Basically a 6502 with a few extra instructions & 16-bit arithmetic using AL & AH.

    Basically, anyone worked with embedded systems? Something I would like to do (like hide Tetris in your washing machine and so on).
     
  13. babu

    babu Mamihlapinatapai

    Joined:
    Apr 15, 2005
    Messages:
    2,945
    Likes Received:
    3
    Some of the stuff I've tinkered with
    6502/6510 (NES, C=64)
    65816 (SNES CPU)
    SPC700 (SNES SPU)
    ARM7/ARM9 (AGB/NDS - very little, just for some r.e. work)
    80x86 (and have tried some MMX, SSE, SSE2, ...)
    CELL (PPU side, mostly just checked through the opcodes :p)

    oh and I think AT&T-syntax looks awful, yay for intel-syntax ^_^
     
  14. ccovell

    ccovell Resolute Member

    Joined:
    Jan 29, 2005
    Messages:
    954
    Likes Received:
    10
    I'm not a professional, so I don't have much DEEP experience, but here's assembler as I learned it, in order:

    X86 (PC, obviously)
    6502 (NES, C-64, Supervision)
    65816 (SNES)
    6280 (PCE)
    Z-80 (SMS, GG)
    uPD7801 (Old NEC systems, Epoch systems)

    Favourite happens to be 6502/6280 -- Quite easy for beginners; the 6280 opcodes are really useful (but they could have added a few more...)

    Z-80 was a little hard to wrap my mind around, like any new language, since the syntax and concepts are backwards :)

    I never hated X86, but most of you guys do, so I'll keep quiet...

    What are the uPD78xx series? Well, they're more like microcontrollers than microprocessors, but their instruction set has a few good ideas... and a few bad ones... Some Russian ASM forum called this line of CPUs "hated" because of their instruction set.

    Some bonus info about one system that uses uPD: http://www.disgruntleddesigner.com/chrisc/GamePokekon/index.html
    And a quick link to its instruction set: http://www.disgruntleddesigner.com/chrisc/GamePokekon/files/uPD78c06_Instruction_Set.txt
     
  15. Calpis

    Calpis Champion of the Forum

    Joined:
    Mar 13, 2004
    Messages:
    5,906
    Likes Received:
    21
    Apart from Harvard MCU and DSPs, it's all pretty much all the same, not sure why this is debated so often.
     
  16. tomaitheous

    tomaitheous Spirited Member

    Joined:
    Jun 29, 2007
    Messages:
    100
    Likes Received:
    0
    I was looking over the SH2 opcode structure today. It's a really nice processor. Really a shame how they screwed up the 32x though with all that latency. 4-5 cycles to write to the frame buffer :/
     
  17. jonwil

    jonwil Robust Member

    Joined:
    Dec 16, 2005
    Messages:
    256
    Likes Received:
    21
    My favorite has to be the 68000, its so clean and simple without all the wierd stuff like the segment registers on x86.

    Also programmed x86 (in the 32-bit mode its not too bad unless you are writing an OS or other low level stuff and need to care about more than just a flat address space) and some 65816 (SNES).
     
  18. Piglet

    Piglet Spirited Member

    Joined:
    May 28, 2008
    Messages:
    175
    Likes Received:
    0
    Since the 32X has 2 caches (one per CPU) it's possible to avoid all wait-states to the screen. Unroll the draw-loop until it fills a cache line and write. The second CPU is 1/2 way through a cache line...
     
  19. Piglet

    Piglet Spirited Member

    Joined:
    May 28, 2008
    Messages:
    175
    Likes Received:
    0
    BTW- What useful instructions were lost on the NES 6502. I thiught it was just the BCD stuff i.e.

    BCD
    SED
    CLD

    I don't think I ever used those instructions. In any case, they can be replicated with a small table...

    SH2 was cool because it only had 16-bit instructions so if you did your memory-reads or memory-writes on the right boundrly, they took no cycles.
     
    Last edited: Nov 21, 2008
  20. tomaitheous

    tomaitheous Spirited Member

    Joined:
    Jun 29, 2007
    Messages:
    100
    Likes Received:
    0
    Me either. I don't think I've had a need for decimal support yet.

    Off the top of my head;

    PHX/PLX
    PHY/PLY
    BBRx/BBSx ZP (test bit and branch if)
    SMBx/RMBx ZP (reset/set specific bits in a ZP register)
    STZ <operand>
    JMP [$abcd, X]
    CLA/CLX/CLY (for tight code)

    Some additional addressing modes/combinations, but I don't remember which at the moment.



    Yeah. I like the code compression scheme they went with by using 16bit instructions. And the mechanism in the opcode for larger than 8bit immediates is pretty clever using an 8bit immediate part (word) as the displacement range for the larger immediate, instead of having it directly after the opcode.

    Yeah, but I mean the off screen buffer itself has a 3 (SH2 clock) cycle wait state per read/write. So a store instruction is 4(or 5) cycles long.
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page