Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Most 8-bit machines are historical and suffered from the technological limitation of its time, they usually have few registers, an accumulator-based architecture, no multiplication/division instructions, limited addressing mode (especially, no efficient base+addr). So in general, they are not suitable for compiled languages, and hand-tuned assembly is required for good performance. But it actually makes sense for mass-produced applications when simplicity and cost are important. On the other hand, I believe the AVR is one of the only major 8-bit architectures designed using a modern approach, specially optimized for modern C-based programming.


STM8 is a fairly new design although with some similarities to the 6502 and 6800. It does have multiply and divide instructions. It also has a plethora of addressing modes:

    ld a, #42        ; immediate. C constants
    ld a, var        ; direct. C globals and statics
    ld a, (sp, 4)    ; sp relative. C locals and arguments
    ld a, (x)        ; indirect. C *ptr (ptr in register)
    ld a, (x, 42)    ; indexed indirect. C ptr->foo (ptr in register)
    ld a, [ptr]      ; memory indirect. C *ptr (ptr in memory)
    ld a, ([ptr],x)  ; indexed memory indirect. C ptr->foo (ptr in memory)
There are more, but mainly variations in width and PC relative jumps.


Thanks for the correction.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: