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.

Z80 C Compiler (compile as a intel hex?)

Status
Not open for further replies.

Marks256

New Member
Does anyone know of a C compiler for the Z80? I figure that since i am already learning C, i might as well keep at it, as assemlby scares me... :D

I would like it if the C compiler would compile the code into a HEX file so i can burn it to (EE)PROM.

I did find a few, but their links were dead, and the other one didn't work...
 
You should try using google sometime =)
https://www.bdsoft.com/resources/bdsc.html

Don't be afraid of assembly, it's not so difficult as all that it just takes a little time to get use to. If you intend on doing any highly efficient or heavy processing on a micro controller you're really going to want to learn assembly as a smart assembly routine can execute in significantly less time than a more generic multipurpose C routine.
 
I found that site about six or seven times while looking for one...

Ok, i have some questions about assembly, then.

1) How are variables assigned? Can you even assign variables, or do you have to know where you put it in memory?
2) How do you do conditionals (if...then...else)
3) are outputs as simple as using the "out" opcode?
4) on the same note, are inputs just as simple as the "inp" opcode?
5) How hard are float point variables?
 
1) Variables?! You get registers and memory. Keep in mind that variables are an abstraction that high level languages give you - they're actually some combination of registers and memory locations. Typically assemblers allow you to allocate static memory using some assembler directives (something like "db foo" to allocate a byte worth of memory, and name it "foo"). The other two ways to allocate memory are on the "stack", or to just dynamically allocate it from the main memory.
2) There are a bunch of status flags in status register which are usually named "zero", "negative", "carry", etc. These flags are set when you call a comparison op, or when you perform certain math ops. There is a set of conditional jumps which look at these status bits and do stuff like "jump to address x if zero flag is set".
3) yup.
4) yup.
5) very, if you don't have a library.
 
Yeah. ASM is a little daunting because you have to do it ALL. Floating point math is not something you want to do yourself. It's usually best to keep things in interger land. If you need to deal with really large and really small numbers at the same time frequently stick with C. As long as there isn't a huge variation in the range of numbers you need you can do quiet a bit of math using only intergers.
 
Floating point maths is only very rarely required, it's slow, takes lots of space, and is inaccurate - far better to use integers instead, which is often simple with a little thought. This also applies to PC's, never mind micro-controllers!.

If there is ever a need to use them?, it's reasonably simple in assembler - you just download some floating point routines. You simply load your values into variables, call the routine you want, and read the result back. This is just how a high level language would do the same job - it just hides it from you.

And all this fuss Marks256 has been making about Z80, now he's decided he only wants to write in C! - so what's the point of building a Z80 system?, C hides that fact from you - may as well just use a single chip PIC or AVR which will out perform a Z80 at a fraction of the cost.

BTW Marks256, - if assembler scares you, go for PIC rather than AVR (or Z80), it's generally considered the simplest to learn (hence the PIC's popularity).
 
Nigel Goodwin said:
And all this fuss Marks256 has been making about Z80, now he's decided he only wants to write in C! - so what's the point of building a Z80 system?, C hides that fact from you - may as well just use a single chip PIC or AVR which will out perform a Z80 at a fraction of the cost.

Nah. Tasm looks pretty promising... And the z80 looks cool...

Nigel Goodwin said:
BTW Marks256, - if assembler scares you, go for PIC rather than AVR (or Z80), it's generally considered the simplest to learn (hence the PIC's popularity).

I like to be scared.... :D
 
I came across that site when i was searching, but it was down when i found it... Thanks...
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top