Skip to content

Z80 V 1802: 1802 Wins the First Round

December 17, 2015

The first rule of winning a benchmark smackdown is that you have to be able to compile the code!

When I dug up the Dhrystone benchmark and compiled it using LCC1802 I was surprised at how easy it was to get working.  The only thing I had to do was get rid of operating system specific calls and all the code just compiled.  No such luck with SDCC and the Z80.  I’ve had to go through and take out all the old-style K&R definitions,  make a bunch of function prototypes, and various other thingies.  Also, SDCC can’t do structure assignments so i’m accommodating that.  I guess this reflects that SDCC is a more modern compiler while LCC1802 still has its dinosaur roots showing.

Once I got the errors mostly cleared I’ve tried running it but no output so far. Seems to be a problem in printf().  I’ll have to keep poking.


UPDATE: The problem is an error in one of my updates to the monitor.  I had made a message longer which messed up some addresses.

Pro-Tip: here’s a handy reference for the SDCC C library.

From → Olduino/Z

  1. You can check whether your results match ours.

    There’s also a source package downloadable from there that has had the necessary modifications done to be compilable with sdcc. printf was not a problem so it could be an error your mods.

    • Hey, excellent pointer. Thanks. I need to dig in to z88dk so this will be good impetus. I’m sure the issue’s not printf() as such, it’s just the first non-trivial routine called from main. something is munging memory and it could be hardware or software.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: