Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Programming the Z80 - lack of resources a barrier to newbies?

Reply to topic
Author Message
  • Joined: 21 Apr 2000
  • Posts: 598
  • Location: Newcastle upon Tyne, England
Reply with quote
Programming the Z80 - lack of resources a barrier to newbies?
Post Posted: Fri Feb 09, 2001 9:13 am
Here's a quote from a post I made in the main forum - I thought it would be more relevant here:



Mike's point about learning Z80 got me thinking, though. Where does one find a good set of resources and tutorials on Z80 assembly? There are a lot of very good reference documents on opcodes and addressing modes (such as those in the Dev section and on Thomas Scherrer's Z80 Home Page), but they don't actually teach you Z80 assembler as such.

It's becoming very difficult now to find actual books on the Z80 (the Zaks book, which everyone recommends, is long out of print), so a series of decent online tutorials would be very valuable for those looking to learn Z80 assembly from scratch.




I think this fits in with Eric's point about the lack of available resources and tools being a barrier to new developers, and Charles's suggestion of a development FAQ for newbies. Any thoughts?

Mike
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14749
  • Location: London
Reply with quote
Post Posted: Fri Feb 09, 2001 7:44 pm
Quote
> I think this fits in with Eric's point about the lack of available resources and tools being a barrier to new developers, and Charles's suggestion of a development FAQ for newbies. Any thoughts?

Well, I have a feeling it'd be a good idea to learn some well-documented asm before trying to learn Z80, but I personally find it too daunting to try, much as I'd like to.

If it'd be a good idea to go learn "normal" (ie. i386 or whatever it is) assembler first, someone say so... I'd find that useful too. Maybe I'll invest in my first ever programming textbook..?

Maxim

(posting from his TV and making his eyes hurt)
  View user's profile Send private message Visit poster's website
  • Joined: 18 Sep 1999
  • Posts: 498
  • Location: Portland, Oregon USA
Reply with quote
Post Posted: Fri Feb 09, 2001 8:06 pm
Quote
> > I think this fits in with Eric's point about the lack of
> > available resources and tools being a barrier to new
> > developers, and Charles's suggestion of a development FAQ
> > for newbies. Any thoughts?

> Well, I have a feeling it'd be a good idea to learn some well-
> documented asm before trying to learn Z80, but I personally
> find it too daunting to try, much as I'd like to.


> If it'd be a good idea to go learn "normal" (ie. i386 or
> whatever it is) assembler first, someone say so... I'd find
> that useful too. Maybe I'll invest in my first ever
> programming textbook..?

I'll say so. Once you learn the concepts of assembly language for any processor it is fairly easy to migrate to another, as long as you have a reference handy (and there are several good Z80 references available, some are even on this site). And, of course, this messageboard is home to several skilled assembly-language programmers (both x86 and Z80), so you can ask questions here.

I'd recommend picking up an x86 assembler textbook for two reasons:

1.) They're fairly common, so there's bound to be some good ones.

2.) Both the Z80 and the 8086 were based on the 8085. So there will be *some* similarities between the two processors.

Good luck.

--
Eric Quinn
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
my own experience
Post Posted: Fri Feb 09, 2001 8:53 pm
Quote
> > > I think this fits in with Eric's point about the lack of
> > > available resources and tools being a barrier to new
> > > developers, and Charles's suggestion of a development FAQ
> > > for newbies. Any thoughts?

Yeah, I've been intending to write one for quite some time, but I haven't been able to budget the time for it, as I'm still behind on other projects.

Quote
> > Well, I have a feeling it'd be a good idea to learn some well-
> > documented asm before trying to learn Z80, but I personally
> > find it too daunting to try, much as I'd like to.
> > If it'd be a good idea to go learn "normal" (ie. i386 or
> > whatever it is) assembler first, someone say so... I'd find
> > that useful too. Maybe I'll invest in my first ever
> > programming textbook..?

I've tried to get people into SMS programming before, but it always gets cut short when they ask, "What's a good way to learn Z80 programming?"
The thing is, I never formally sat down and learned it myself. I 'learned' it through viewing source code (generally not SMS specific) and mostly through reference tables and such, borrowing on general understanding of assemblers and CPU's I've picked up over the last ten or so years of 6502, 68000, and x86 assembler I have used. And trial and error.
So I can't really point to any one guide to learn it, though I'm sure some university libraries (and maybe some public ones) still have z80 manuals.

Most of the tutorials I have come across on the net are TI-Calc specific, maybe a couple refer to CPM.

The problem, as I see it, is that to learn SMS programming you have to learn many things at once. Not only do you have to learn Z80, you have to learn how to access the hardware itself, learn some low-level features of compuer architecture, the host of idosyncracies that the SMS brings you...

'Hello World' is a staple of programming tutorials. For the SMS, however, you need to practice a number of basic SMS disciplines (initializing the VDP regs, clearing VRAM, loading vram with tiles, writing to the name table, writing only when the screen isn't drawing, setting the palette, etc etc.)

I was thinking of writing a small, very basic SMS 'library' that a learning programmer could link with their own code to give some basic i/o and 'print functions', taking care of the low level details like interrupt handling, screen writing, all the crud I mentioned above. The student could focus on learning z80 assembler itself, focusing on logic, learning the important opcodes, common techniques, how to do everyday tasks, etc, before learning how to manipulate the hardware, layout a cartridge rom, engineer a game engine, etc.
  View user's profile Send private message Visit poster's website
Johannes Holmberg
  • Guest
Reply with quote
NOOOOO!
Post Posted: Fri Feb 09, 2001 10:22 pm
Quote
> If it'd be a good idea to go learn "normal" (ie. i386 or whatever it is) assembler first, someone say so...

Stay far, far away from the horror that is x86 asm!
Unless you really want to do pc stuff, that is... :)

Seriously, Z80 isn't that tricky to learn, but x86 is!
If you want something that is easier than Z80, try 6502.

/Johannes
 
Consolemu
  • Guest
Reply with quote
Re: NOOOOO!
Post Posted: Sat Feb 10, 2001 2:39 pm
There really isn't that much of a difference in my opinion. They both use input/output through ports, although the x86 has slightly different interrupt method and the segmented memory archetecture. But yes, the 6502 is excellent cakewalk for people like me.

Chris :o)
 
  • Joined: 10 Oct 1999
  • Posts: 211
  • Location: Lebanon, New Hampshire, USA
Reply with quote
Re: my own experience
Post Posted: Sun Feb 11, 2001 6:10 pm
Quote
> I was thinking of writing a small, very basic SMS 'library' that a learning programmer could link with their own code to give some basic i/o and 'print functions', taking care of the low level details like interrupt handling, screen writing, all the crud I mentioned above. The student could focus on learning z80 assembler itself, focusing on logic, learning the important opcodes, common techniques, how to do everyday tasks, etc, before learning how to manipulate the hardware, layout a cartridge rom, engineer a game engine, etc.

I would pledge my firstborn offspring to anyone who would make a library!!
  View user's profile Send private message Visit poster's website
memetic
  • Guest
Reply with quote
Re: NOOOOO!
Post Posted: Sun Feb 11, 2001 8:30 pm
Quote
> Seriously, Z80 isn't that tricky to learn, but x86 is!

come on! x86 asm is easier to lern than z80, I thought so anyway.. x86 is real simple. (Not the FPU for a beginner I think.)

oa
 
Johannes Holmberg
  • Guest
Reply with quote
Re: NOOOOO!
Post Posted: Sun Feb 11, 2001 9:45 pm
Quote
> > Seriously, Z80 isn't that tricky to learn, but x86 is!

> come on! x86 asm is easier to lern than z80, I thought so anyway.. x86 is real simple. (Not the FPU for a beginner I think.)

No! It's pure evil! With all the weird register names and insane amount of instructions! I hate it!
Er.. To be fair, the z80 has a whole lot of instructions too, and I don't know if it's more or less
than an x86... Maybe it depends on the "x"... Oh well, it's evil! EVIL!

/Johannes
 
Johannes Holmberg
  • Guest
Reply with quote
Re: NOOOOO!
Post Posted: Sun Feb 11, 2001 10:24 pm
Quote
> There really isn't that much of a difference in my opinion. They both use input/output through ports, although the x86 has slightly different interrupt method and the segmented memory archetecture. But yes, the 6502 is excellent cakewalk for people like me.

Indeed, they are quite similar, but the few differences are enough to qualify the x86 for the EVIL category!

/Johannes
 
Johannes Holmberg
  • Guest
Reply with quote
Re: my own experience
Post Posted: Sun Feb 11, 2001 10:51 pm
Quote
> I would pledge my firstborn offspring to anyone who would make a library!!

I wouldn't, but it sure would be swell if someone did (make a library, that is!)!
 
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
Re: my own experience
Post Posted: Mon Feb 12, 2001 2:30 am
Quote
> > I would pledge my firstborn offspring to anyone who would make a library!!

> I wouldn't, but it sure would be swell if someone did (make a library, that is!)!

Well, my idea is the library is the start up code and some basic display routines, which is intended to be used as training wheels while getting used to Z80 code, then abandoned when you're ready to learn the hardware architecture. It certainly wouldn't be too useful for any 'proper' games. If I write a library, it'll be something like that, to go along with a tutorial.
  View user's profile Send private message Visit poster's website
memetic
  • Guest
Reply with quote
Re: NOOOOO!
Post Posted: Tue Feb 13, 2001 6:12 pm
Quote
> No! It's pure evil! With all the weird register names and insane amount of instructions! I hate it!
> Er.. To be fair, the z80 has a whole lot of instructions too, and I don't know if it's more or less
> than an x86... Maybe it depends on the "x"... Oh well, it's evil! EVIL!

> /Johannes

=), The z80 has 158 instructions, do u use them all? No, I think not and it's the same on x86. Weird registernames? ax,bx,sp.. is it so diffrent the z80's a,b,sp.. ?? x86 asm with one segment and not using the fpu is real simple.. ;.)



oa / memetic
 
Johannes Holmberg
  • Guest
Reply with quote
Re: NOOOOO!
Post Posted: Wed Feb 14, 2001 10:17 pm
Quote
> > No! It's pure evil! With all the weird register names and insane amount of instructions! I hate it!
> > Er.. To be fair, the z80 has a whole lot of instructions too, and I don't know if it's more or less
> > than an x86... Maybe it depends on the "x"... Oh well, it's evil! EVIL!

> > /Johannes

> =), The z80 has 158 instructions, do u use them all?

I haven't really coded anything worth mentioning on the z80 yet! :)
I thought it was more than that though...

Quote
>No, I think not and it's the same on x86. Weird registernames? ax,bx,sp.. is it so diffrent the z80's a,b,sp.. ?? x86 asm with one segment and not using the fpu is real simple.. ;.)

What about the es register? :)
What makes it even more evil is the demonic pc hardware you're probably dealing with when coding x86. It' defies all logic!
Although the x86 should perhaps not be blamed for that, it does make x86 coding painful!

/Johannes
 
Johannes Holmberg
  • Guest
Reply with quote
Re: my own experience
Post Posted: Wed Feb 14, 2001 10:39 pm
Quote
> > > I would pledge my firstborn offspring to anyone who would make a library!!

> > I wouldn't, but it sure would be swell if someone did (make a library, that is!)!

> Well, my idea is the library is the start up code and some basic display routines, which is intended to be used as training wheels while getting used to Z80 code, then abandoned when you're ready to learn the hardware architecture. It certainly wouldn't be too useful for any 'proper' games. If I write a library, it'll be something like that, to go along with a tutorial.

Yeah, makes sense!
But I've been thinking, and in my case, the reason I'm not coding anything for the sms right now isn't really because there aren't enough documents/code examples. It's because I'm lazy. :(
This doesn't meant that I wouldn't find some basic sms-specific routines interesting thought :)

Now that was a piece of useful information!

/Johannes
 
Johannes Holmberg
  • Guest
Reply with quote
Crap! (This message is of no use to anyone!)
Post Posted: Wed Feb 14, 2001 10:48 pm
Quote
> interesting thought :)

That last 't' shouldn't be there!
I probably should have just kept my mouth shut, and no one would have noticed, but I go crazy when I do things like that!
 
Reply to topic



Back to the top of this page

Back to SMS Power!