Shop OBEX P1 Docs P2 Docs Learn Events
Propeller assembler mnemonics — Parallax Forums

Propeller assembler mnemonics

KayjayKayjay Posts: 4
edited 2011-01-02 22:40 in Propeller 1
I'm a newbie to the Prop and I've been browsing the manual to get an idea of the architecture and instructions etc. I noticed that the mnemonics are quite similar to the Z80 and the 8080. My question is this:- are these similarities intentional or just coincidence.

Does anyone have any ideas on this? Are Parallax connected with Zilog at all?

Happy new year to all :thumb:

Keith

Comments

  • potatoheadpotatohead Posts: 10,261
    edited 2011-01-01 23:47
    I would say coincidence. The Propeller operates very differently from those processors.
  • KayjayKayjay Posts: 4
    edited 2011-01-02 00:03
    Thanks for that. As I said I'm a complete newbie to the Prop but have a lot of experience with the Z80 so I was fishing for a connection between Parallax and Zilog if anyone knew whether there was one. I suppose it would be a very big coincidence if they were linked.

    Anyway, back to the reading for me, the Prop is certainly a nice device and overtakes the PIC in a lot of ways but I can see there still being a place for both. It would be nice to combine them both in one project where the Prop handles the input and video and leaves the PIC to handle running the main part of the program. I guess that this has already been done but I'm just sat here with my head buzzing with ideas. I've found a new toy and I'm eager to play with it !!!

    Keith
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-01-02 00:15
    Pnemonics really are a subset of abbreviations. And so they are rather limited to what can represent what and still offer a clue. After all this time, anything new is likely to run into similarities with early hardware.

    But the Propeller is 32bit while what you refer to is 8bit. At some point, every microprocessor's quirks and realities need to be learned in order to succeed with it. Since the timing of instructions is nearly always 4 cycles and the memory is flat, I think you might find the Propeller actually easier than those oldies.
  • Heater.Heater. Posts: 21,230
    edited 2011-01-02 00:33
    Welcome to the forum KayJay,

    Most processors tend to have instructions for addition, subtraction, comparison etc operations so of course a lot or assemblers use ADD, SUB, CMP etc as mnemonics. Similarly for control flow CALL, RET, JMP etc.

    Do be sure to check the details though, how flags are set and when, how conditional execution is done, how subroutine calls/retrurns are handled an so on. Having the comfort of familiar instruction mnemonics can lead one into making wrong assumptions about things when moving from one CPU to another.

    Then of couse the Prop has a few instructions you won't find in many other machines. For example REV. So it' good to be familiar with all opcodes not just stick to that subset you are used to using elsewhere.

    I'm sure there is no connection between Zilog and Parallax. Apart from the Z80 emulators by myself an PullMoll:)
  • KayjayKayjay Posts: 4
    edited 2011-01-02 00:43
    I suppose you're right to an extent about the mnemonics being repeated on newer processors but the one that made me look at them a little deeper was DJNZ, rather an unusual instruction anyway, in the Z80 it applied to the B register only. I've worked with about 6 8bit processors during the late 70's and 80's and none of the others had an instruction that remotely resembled it. I then went deeper into the Prop's mnemonics and found other similarities some the same as Z80 and others like the 8080, of course these devices were made by different companies, Intel for the 8080 and Zilog for the Z80. Interestingly the 8080 carried on and grew up to be the early processors for the PC's that we know today and Zilog have continued to improve the Z80 with a series of 16 bit devices and also some microcontrollers too, I designed a car engine management system for a friends grass track racing car back in the late 90's, which, if memory serves me right, used the Z80200, it was either that or the Z80300 and had an onboard PIO and CTC and I think had an SIO too but I'm not 100% on that part, the years have faded my memory.

    One of the major points that the Propeller has is the way it's memory is laid out, I really like that. How many times have I had to debug a PIC because I haven't changed the bank over when reading data, so the flat memory makes it a massive step over the PIC and also as you say it has 4 cycles for the majority of instructions which makes the writing of timing routines a doddle. I can definitely seeing me having a love affair with the Prop ! It definitely has some features that are a big improvement over the PIC.

    Keith
  • KayjayKayjay Posts: 4
    edited 2011-01-02 00:51
    Heater. wrote: »
    I'm sure there is no connection between Zilog and Parallax. Apart from the Z80 emulators by myself an PullMoll:)

    It may be the references to the emulators that I've read about somewhere that have been making me think about the Z80 being linked with the Prop.

    Thanks for the tips about the flag settings etc, I'll work on pushing the Z80 out of my mind when I start to do some coding. I've never learnt C preferring to code in machine code which if I had would help with flags etc I assume.

    I'll make a point of reading through the instruction code list to familiarise myself with what is available and then time will make me remember the codes automatically.

    Keith
  • potatoheadpotatohead Posts: 10,261
    edited 2011-01-02 01:37
    One thing I believe you will find interesting is there are no registers in the traditional sense. There is a PC, and the flags, but all else operates memory to memory directly. Consider that and the conditional execution, and conditional results allow for some compact and powerful code. The other interesting thing is self-modify code is the norm for cog memory indexing. Addressing modes are simply direct or indirect. eg: jmp 5, loads PC with value contained in cog memory location 5, jmp #5 loads the value 5 into PC.

    Instructions are provided to modify source, destination, and instruction bit fields.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-01-02 03:59
    It may be the references to the emulators that I've read about somewhere that have been making me think about the Z80 being linked with the Prop.

    Oh no. What have we done?!

    I once read up the history of the Z80 and found it was a group of 8080 people who thought it was not being done right and went off and set up their own company http://en.wikipedia.org/wiki/Zilog_Z80. I like the Z80, and I never really cared much for 8080 mnemonics. Strange how DJNZ is still there. I spent a lot of time coding Z80 in the early 1980s. Then the Intel 80x86 chips took over with the complexities of banked memory and memory offset registers and I have to say that they lost me as an assembly programmer for 25 years.

    And then along comes the Propeller. A logical set of assembly commands. A flat memory map. A speed increase of around 20x. Perhaps a little confusing with the lack of registers, as Potatohead says, but Cluso99 set me right on that one and the lack of registers suddenly becomes a huge positive.

    And now I'm as happy as a pig in mud!

    http://smarthome.viviti.com/propeller for some photos of Pacman playing on the Propeller running a Z80 emulation. And it is still a little too fast.
    It would be nice to combine them both in one project where the Prop handles the input and video and leaves the PIC to handle running the main part of the program.

    Yes, I have a few hybrid designs. Then I found you could get the propeller to do it all. An amazing little chip really!
  • blittledblittled Posts: 681
    edited 2011-01-02 19:12
    KayJay, I did a lot of programming with Z80 and the PICs as well. I've been thinking on how to to interface a Propeller to a Z80. For interfacing the PIC to the Propeller look at the Chameleon PIC http://www.xgamestation.com/view_product.php?id=52 . I have one and it uses the Propeller for video, sound and keyboard or mouse with a PIC24 interfaced via SPI and is fun to work with!
  • kwinnkwinn Posts: 8,697
    edited 2011-01-02 22:13
    Most of the early computers used very similar mnemonics for their machine language assemblers. Not a surprise since those were the common short form of the actual function performed. Many of the arithmetic and logic units of those early computers were built around the 74181 4 bit alu chip, and most data sheets also used the same mnemonics. Even the later 2900 series of bit slice chips were basically enhanced versions of the 74181 and used the same mnemonics.

    Regarding potatoheads comment about the prop having no registers in the traditional sense, I think that depends on how you look at it. From the perspective of not having specific registers to store data for performing arithmetic and logic functions with he is correct. Another way to look at it is that it has 512 registers that can be used for arithmetic and logic functions as well as being used for storing executable instructions.

    Now those are truly general purpose registers.
  • potatoheadpotatohead Posts: 10,261
    edited 2011-01-02 22:40
    I prefer that model, as that's exactly how I think of them now. However, when somebody is trying to consider how Props do things, I find it easier to just start with memory to memory design. The bit of insight you just wrote doesn't take long after that.
Sign In or Register to comment.