The z80 Processor

Feel like posting Off Topic? Do it here.

Moderator: MaxCoderz Staff

User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

The z80 Processor

Post by kalan_vod »

Well many know this already, for some it may be a refresher, and for others something interesting. I was browsing Wiki in my free time (doing some research), and came across a few things about the z80 processor created by Zilog here. It is a great read, and very interesting things have been made with the z80 as the core. Including things that we know of: mp3 players, calculator, game boys etc. But also in Arcade games that are newer ('99 and a few others). I just found it interesting, look at the links inside the article and see what else it was used for...besides Military applications! (look in the article >.>).
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

I knew that page, but never before did I notice the "C cross compiler" at sourceforge.net for z80's.

I'm currently seeing how good it is.

Edit: it is pretty damn good for a crosscompiler! Even allows for smooth grayscale and just about all shells! In fact it's worth downloading just for the math-library's which ofcourse have their source included ;) might give you some ideas..
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Yeah ive tried all of those cross compilers, even though it supports grayscale in an interrupt, the overall speed of the program itself is comparable to BASIC ... Plus the programs are bloatware. Still pretty neat though.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

No it's not really optimized.. maybe someone from MC should write a nice optimizer.. (I'll leave that to someone who can actually pull it off..)
I had some ideas about assembly-source-interpretators which keep track of RAM areas and registers.. but I know I can't do this.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Id just like to point out that the z80 is a small, low powered, easy to program for, efficient little microprocessor ... and its CHEAP! This is why you will find them everywhere. They have been in some of the best electronic devices ever made, man i love z80 :D.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

I've never understood why it's claimed that the Game Boy had a Z80 in it (it's a clone with, as mentioned, a different instruction set). Given that the Z80 took the 8080 design and added the index and shadow registers (amongst other things) and these were removed for the Game Boy's CPU, it seems more like an 8080 than a Z80. (Maybe someone could clear that up)?

The inclusion of it in the Mega Drive also meant that you could play SMS games on it. ;)
threefingeredguy
Calc King
Posts: 2195
Joined: Sun 27 Mar, 2005 4:06 am
Location: sleeping
Contact:

Post by threefingeredguy »

Well, what about bit, shift, and rotate instructions?
Image
User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

Post by Dwedit »

The Game boy's processor is much closer to a Z80 than an 8080. Most of the instructions even use the same opcodes, so when you see a C9 in a binary, you know it's a RET instruction in both Z80 and GBZ80.
You know your hexadecimal output routine is broken when it displays the character 'G'.
User avatar
Halifax
Sir Posts-A-Lot
Posts: 225
Joined: Mon 01 Jan, 2007 10:39 am
Location: Pennsylvania, US

Post by Halifax »

how do you work z88dk to make it make a .8xp out of .c?
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Write an example program, like this:

Code: Select all

#pragma string name Hello World

#include <stdio.h>

main()
{
	printf("Hello World!");
	getk();
	
}
Save it as HELLO.C, then you need to compile it with the tools found in the 'bin' directory. Something like:

Code: Select all

zcc +ti8x -o hello.bin hello.c
devpac83 hello
ren hello.83p hello.8xp
del zcc_opt.def
del hello.bin
Of course you should use devpac8x for 83+ but im not sure z88dk ships with it.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
Halifax
Sir Posts-A-Lot
Posts: 225
Joined: Mon 01 Jan, 2007 10:39 am
Location: Pennsylvania, US

Post by Halifax »

thanks tr1p1ea I was having the hardest time trying to get it to work and now it does

EDIT: Nvm it doesn't work in an emulator I get an ERR: INVALID
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

What emulator are you using? I just tested it and it works fine in PindurTI. Remeber that z88dk outputs ion compatible asm programs.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
Halifax
Sir Posts-A-Lot
Posts: 225
Joined: Mon 01 Jan, 2007 10:39 am
Location: Pennsylvania, US

Post by Halifax »

Oh yeah I tried it in PindurTI too. But it didn't show up in MOS.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

OK, you're right, there is a problem with MOS. I used ION to test it. Ill investigate ...

EDIT - MOS doesnt seem to like printf, test programs that dont use it run fine.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

To me it looks like its not placing $BB $6D in the bins. *cough* wabbitsign would warn of such a thing*cough*
Easily fixed, just alter the headers or add the bytes manually.
Image
Post Reply