Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Assembly?

Status
Not open for further replies.

Marks256

New Member
Ok, just for the record, i did read the sticky at the top of the forum. And, one more thing for the record, i have had past programming experiances. I know QBasic by heart, and i know a little VBasic, and i have used C++, but i hated it.

Now, i would like to learn assembly. I have a few questions before i learn it;

1) Is all assembly the same?
-> If i learned assembly, would i beable to use what i learned for a microcontroller on a PC(Debug.exe). Like is the assembly for microcontrollers the same for a PC, or just a plain CPU? I want to beable to use assembly for a PC and a microcontroller.

2) Is assembly simple?
-> When i was a kid, i saw some assembly code, and thought it was very confusing. Now, i look at assembly, and now that i know alittle of it's structure, it seems fairly simple. Is it easy to learn?

3) Is it compact?
-> Does it take alot of space on ROM?

Thanks!

-Marks256-
 
Marks256 said:
Now, i would like to learn assembly. I have a few questions before i learn it;

1) Is all assembly the same?
-> If i learned assembly, would i beable to use what i learned for a microcontroller on a PC(Debug.exe). Like is the assembly for microcontrollers the same for a PC, or just a plain CPU? I want to beable to use assembly for a PC and a microcontroller.

All assembly is different. However, I equate learning assembler to learning to read, you only need do it once. You can then go on to learn other languages which in assembler only have a few words and so can be learned quickly.

From your previous experience, you already know the various structures used. The way you use loops, conditions, addressing modes etc stay fairly constant between processors.

2) Is assembly simple?
-> When i was a kid, i saw some assembly code, and thought it was very confusing. Now, i look at assembly, and now that i know alittle of it's structure, it seems fairly simple. Is it easy to learn?

The PIC chips that are very popular with most enthusiasts have only 35 instructions.

3) Is it compact?
-> Does it take alot of space on ROM?

Yes, it's very compact. I would be very surprised if anyone here (not professional) has written more that 2K of assembler unless a large proportion of it was data.

The thing that is difficult with microcontrollers, is becoming familiar with all the hardware/peripherals that are built in. However, this is the same problem whichever language you choose to code in.

Mike.
 
Oh, ok. I see now. Is there one type of assembly that is the basic of basic? What should i start using assembly for? On a PC, or should i get a microcontroller and start programming?
 
As a way to get started, may I suggest downloading **broken link removed**. This is a complete development system for the PIC chips and includes an emulator so you can actually run code without any hardware. You will of course be limited to operations that just manipulate memory but a lot can be learned from that and to then build a little circuit and get it working is a logical next step.

You should also have a look at the various online tutorials that are listed in the sticky.

Mike.
 
I am downloading MPLAB right now. I was looking at some of the commands. It doesn't look like asebly to me. Are they acutal assembly commands? I was expecting commands like; Mov, INT, CMP, JB, etc... What happend to these? I wan't to learn "Hardcore" assembly.
 
I'm not sure what you are looking at.

This is typical PIC assembly.
Code:
SendHex		movwf	HexTemp
		swapf	HexTemp,W
		call	WriteLoNibble
		movfw	HexTemp
WriteLoNibble	andlw	0fh
		addlw	256-10 ; 		if a-f then carry set
		btfsc	STATUS,C
		addlw	7
		addlw	'0'+10
		goto	SendByte

The above is a binary to hex conversion subroutine.

Mike.
 
Mark,

Each microcontroller families instruction set (PIC, AVR, Motorola, etc.) uses different assembler nemonics so it takes a while to learn and get used to them.

I came from a 6502 background and found moving to the Motorola 68HC11 and 68HC12 a breeze as the instructions and addressing modes were very similar. Unfortunately that's not the case when I moved to PIC. Once you get used to them however I think you'll find they become very intuitive.

Good luck. Regards, Mike
 
Marks256 said:
1) Is all assembly the same?
-> If i learned assembly, would i beable to use what i learned for a microcontroller on a PC(Debug.exe). Like is the assembly for microcontrollers the same for a PC, or just a plain CPU? I want to beable to use assembly for a PC and a microcontroller.
no each type of processor has different mneumonnics , while addressing/data access methods 'may' be similar . and u have to know ALL the details(memory/banks/hardware/timing) of the micro.for simple micros that won't be a problem , but as the functionality goes up complexity and development time also goes up . and this is where higher languages like C comes in.
2) Is assembly simple?
-> When i was a kid, i saw some assembly code, and thought it was very confusing. Now, i look at assembly, and now that i know alittle of it's structure, it seems fairly simple. Is it easy to learn?
3) Is it compact?
-> Does it take alot of space on ROM?
depends on the processor type
assembly in the next higher level to binary , and can produce the most tightly packed program.
 
Are all the commands the same?

I just desoldered a Z80. Would this be a good microprocesser to start with? I know i i will need to add memory and what not, but is it simple? I don't think there are any mulitplexed outputs, so i will beable to interface it.
 
A Z80 is a really old microprocessor, and requires a LOT of support components to do anything. The point of micro-controllers is that a single chip is the entire computer, and almost nothing else is required.

Check my PIC tutorials for how simple it is, the PIC's small instruction set also makes it easier to learn (only 35 instructions, some of which you hardly ever use anyway).

For an example of 'minimum' components required, a simple LED flasher would require:

1) A PIC.
2) An LED.
3) A series resistor for the LED.
4) Three AA batteries in series to power it.
5) Optional - a capacitor across the batteries.

Be interesting to compare that component count to a Z80 doing the same task? - although you couldn't even really run a Z80 off 3 AA's.

BTW, to answer your other question, commands are NOT the same, they vary from processor to processor, with some having no resemblance to others - the PIC is a little like that?, as it's a RISC device that use Harvard architecture.
 
I do know the difference between a microprocesser, and a microcontroller. :)
What type of aux things does the z80 need, besides memory?
 
Marks256 said:
I do know the difference between a microprocesser, and a microcontroller. :)
What type of aux things does the z80 need, besides memory?

You need, as an absolute minimum:

RAM
ROM
I/O Port
Clock oscillator
Regulated power supply
Capacitors, resistors etc.

Then, obviously, hundreds of interconnections, this assumes really rough and crude memory addressing, which you can get away with for a minimal system.

Do you know how to program a Z80?, if you do I can understand a slight preference for it.
 
No, i do not. I am learning starting to learn assembly. I understand all of the RAM/ROM, and the other things, but what is memory addressing like? I don't need a detailed description(like schematics, or step by step), i just want to know how addressing works? I don't understand how multipul things can be run, off of just a few ports. How does this work?

Oh, i leave for vacation tommorow at about 5am, so i won't beable to check my things for a week. Unless i am able to hit a wireless acces point there. So, please don't feal offended if i don't reply back.
 
then it is better to to startoff with a microcontroller like PIC . it has all the things inside and requires a bare minimum components, easy to get started , i recommend 16f628a . to start with, visit Nigel's tutorials.
but don't forget that the assembly u study will apply ONLY for the PIC series
 
Marks256 said:
No, i do not. I am learning starting to learn assembly. I understand all of the RAM/ROM, and the other things, but what is memory addressing like? I don't need a detailed description(like schematics, or step by step), i just want to know how addressing works? I don't understand how multipul things can be run, off of just a few ports. How does this work?

A Z80 doesn't have 'ports', because it's a microprocessor - generally micro-controllers have 'ports', microprocessors have address and data lines, these connect to all the external chips - including ones that provide the ports for the system.

You really don't want to be starting messing with a Z80 in the 21st century, is really has very little relevence - except as an example of how things were 30 years ago.
 
I vote for MPlab (and PIC) for the reasons already mentioned.
If you want a REAL challenge start with an 8051. It is a whole lot more complicated than a PIC with 200+ instructions and some really interesting forms of addressing.
Either way the microcontroller`s data sheet is your best friend.
 
Yes. I am going to install MPLab in a few minutes, see how i like it. If i like it, then i will get a few PIC's. I wan't to use the Z80 because of i want build that computer arround a processer(not a pic). I will learn how to use microcontrollers for sure, but i also want to learn processers. I will probley lear microcontrollers first, then move on to processers. Thanks.
 
Marks256 said:
Yes. I am going to install MPLab in a few minutes, see how i like it. If i like it, then i will get a few PIC's. I wan't to use the Z80 because of i want build that computer arround a processer(not a pic). I will learn how to use microcontrollers for sure, but i also want to learn processers. I will probley lear microcontrollers first, then move on to processers. Thanks.

Although I can understand your desire to build a computer, it ceased to be a practical project many years ago! - you can buy modern computer boards and components so cheaply it's just pointless spending a lot more money building something that's going to have less than 1% of the performance.

Microcontrollers have taken over most other uses of microprocessors, at a tiny fraction of the cost, and usually with higher performance!.
 
One more thing- I personally use Mikrobasic asslembler. It allows the use of asm, is easier to use than MPlab ( doesnt have all the bells and whistles of MPLab) but allows 2k of code in the free version and has a decent enough debugger. They also sell an in circuit USB programmer that works on eeproms,pic,atmel, and most anything else for $100 or so. as does Presto in the UK, among others. The Microchip programmers are WAY overpriced.
 
Status
Not open for further replies.

Latest threads

Back
Top