Re: [vcf-midatlantic] Assembler, continued
William Dudley via vcf-midatlantic writes:
IMHO, the difficult bit with assembly language is that you have to keep track of all the "book keeping" needed by your algorithm. If you need 10 variables, and array of 100 integers, and pointers to subroutines, then you have to keep track of all this stuff yourself. This means that you have to start planning on paper long before you write your first opcode. Of course, it also means that you have to be familiar with the machine architecture, how many registers it has, how much stack, etc, so that you can figure out WHERE you are going to store all the stuff you need.
First, that's one of the reasons that assemblers accept human assigned names for routines and fixed data location -- so you don't have to keep track of a routine or data pointer. Local data? Carve up the stack. Arrays? Machines with indexing make this much simpler that those without. If you really want a challenge, try writting assembly on a machine that doesn't possess branch instructions and executes multiple operations at one time! ;)
On 01/18/2017 12:34 PM, Brian Schenkenberger via vcf-midatlantic wrote:
William Dudley via vcf-midatlantic writes:
IMHO, the difficult bit with assembly language is that you have to keep track of all the "book keeping" needed by your algorithm. If you need 10 variables, and array of 100 integers, and pointers to subroutines, then you have to keep track of all this stuff yourself. This means that you have to start planning on paper long before you write your first opcode. Of course, it also means that you have to be familiar with the machine architecture, how many registers it has, how much stack, etc, so that you can figure out WHERE you are going to store all the stuff you need.
First, that's one of the reasons that assemblers accept human assigned names for routines and fixed data location -- so you don't have to keep track of a routine or data pointer. Local data? Carve up the stack. Arrays? Machines with indexing make this much simpler that those without.
Of course know thy (CPU) limitations. The 6502 has a stack that's stuck on Page 0 and only has 256 bytes. I don't remember the rest of the 6502's idiosyncrasies but there are a few. If one keeps the push and pull of variables on/off the stack short and avoid recursion one can pretty much deal with mild to moderate complex JSRs. The assembler is more work than a high level language but I've never really found it too bad. Of course I have done anything as complex as networking in assembler.
... If you really want a challenge, try writting assembly on a machine that doesn't possess branch instructions and executes multiple operations at one time! ;)
Or CPUs that execute both halves of a condition (that one just hurts my brain). I think the Microchip PIC32s are bringing multicore to the embedded world so I might see more 'weirdness' now. Of course I'm seeing more high level languages in my embedded stuff (MicroPython, Lua, etc.) -- Linux Home Automation Neil Cherry ncherry@linuxha.com http://www.linuxha.com/ Main site http://linuxha.blogspot.com/ My HA Blog Author of: Linux Smart Homes For Dummies
The 6502 has a stack that's stuck on Page 0 and only has 256 bytes.
Stack is page 1, zero page is its own special thing and many instructions can operate on it, resulting in fewer bytes per instruction.
I think the Microchip PIC32s are bringing multicore to the embedded world so I might see more 'weirdness' now. Of course I'm seeing more high level languages in my embedded stuff (MicroPython, Lua, etc.)
PIC32s are MIPS 32, pretty cool! I've got a Fubarino dev board for PIC32, but haven't gotten around to hacking on it. Someone's got 2.11BSD running on them. Thanks, Jonathan
On 01/18/2017 01:19 PM, Systems Glitch via vcf-midatlantic wrote:
The 6502 has a stack that's stuck on Page 0 and only has 256 bytes.
Stack is page 1, zero page is its own special thing and many instructions can operate on it, resulting in fewer bytes per instruction.
Oops, yes sorry.
I think the Microchip PIC32s are bringing multicore to the embedded world so I might see more 'weirdness' now. Of course I'm seeing more high level languages in my embedded stuff (MicroPython, Lua, etc.)
PIC32s are MIPS 32, pretty cool! I've got a Fubarino dev board for PIC32, but haven't gotten around to hacking on it. Someone's got 2.11BSD running on them.
A friend of mine worked on the Arduino port to the PIC32 and it works well (I just hate the Arduino env). The port has support for parallel functions (nice). -- Linux Home Automation Neil Cherry ncherry@linuxha.com http://www.linuxha.com/ Main site http://linuxha.blogspot.com/ My HA Blog Author of: Linux Smart Homes For Dummies
participants (3)
-
Neil Cherry -
Systems Glitch -
VAXman@tmesis.org