Setting up my stall for Retrochallenge. Hello World on the MZ-700.

It has become a regular occurance in my life… The twice yearly Retrochallenge comes along and I am ill prepared and can’t decide what to do or how to do it.

To quote from the website…

In a nutshell, the RetroChallenge is a loosely disorganised gathering of RetroComputing enthusiasts who collectively do stuff with old computers for a month.

This is one real world example of it not being about winning but taking part. Really, I’m not kidding. Well for me it’s the taking part. Or it would be about taking part it I did. Of course, your mileage may vary.

I tried a few years ago. I set up a web server on an Apple Newton and did have some success but things conspired against me and the machine kept dropping off the net for reasons unknown.

This year things could be different. Maybe.

Now it’s still a couple of weeks to kick off but I think I’ll set up my stall and try and get a plan.

Enter the Sharp MZ-700.

I’ve had my Sharp MZ-700 for a while now but haven’t really done much with it but a post on the UK Vintage radio repair and restoration website (vistit now, visit often) made me dust off the old thing and fire it up.

Having fired it up and fired off a response to the original poster I have decided to do “Something programmy” with it for Retrochallenge.

Short of “Hello World” in BASIC I haven’t programmed on the Sharp at all so this is going to be intersting.

Z88DK – The cross compiler.

My plan is to do my “Something programmy” in C and use a cross-compiler to build it for the Sharp. To be honest, I’m not sure if that’s allowed as I’ll be using a modern PC to type on and build but I’m writing it for the Sharp and running it on the Sharp. I’ll see what people think.

A Z80 cross compiler seems quite rare but I found Z88DK and decided to use that.

There is a great introduction to setting up Z88DK here and that’s what I have done. Be careful with some of the steps as the text formatting is a little off in places but the information is there.

Hello World.

Having set up the build environment I tried a “Hello World” program…

#include <stdio.h>

main()
{
  printf("Hello World\n");
  
  while(1)
  {
  }
}

Not exactly MISRA compliant but it builds.

$ zcc +mz -lm -ohello -create-app -Cz hello.c
cp /home/andy/z88dk/lib/mz_crt0.opt /tmp/tmpXX6cA7vl.opt
cp /tmp/tmpXX6cA7vl.opt /tmp/tmpXX6cA7vl.asm
zcpp -I. -DZ80 -DSMALL_C -DSHARPMZ -D__SHARPMZ__ -DSCCZ80 -I/home/andy/z88dk/include hello.c /tmp/tmpXXM4OudA.i
sccz80 /tmp/tmpXXM4OudA.i
copt /home/andy/z88dk/lib/z80rules.2 < /tmp/tmpXXM4OudA.asm > /tmp/tmpXXM4OudA.op1
copt /home/andy/z88dk/lib/z80rules.1 < /tmp/tmpXXM4OudA.op1 > /tmp/tmpXXM4OudA.opt
z80asm -eopt -ns -Mo -I/home/andy/z88dk/lib /tmp/tmpXXM4OudA.opt
z80asm -a -m -Mo -L/home/andy/z88dk/lib/clibs -I/home/andy/z88dk/lib -ohello -igen_math -indos -imz_clib -iz80_crt0 /tmp/tmpXX6cA7vl.opt /tmp/tmpXXM4OudA.o
appmake +mz -b hello -c /tmp/tmpXX6cA7vl

Now turn it into an audio file to play to th Sharp…

$ appmake +mz --dumb --audio -b hello.m12

Info: name found in header: HELLO

Info: file type:         1
Info: program location:  $1300
Info: binary block size: $352
Info: start address:     $1300

So now we have a .wav file or my hello world program. Pop in a cassette adapter and play the wav.

IMG_20150614_200225282A bit odd but wait a minute and look again. I said “Hello World\n” but forgot that the MZ-700 doesn’t have lower case. Let’s try again but upper case only and with a leading “\n”.

IMG_20150614_204250990Tadaaa!. My stall is set up. Roll on July!

Leave a Reply

Your email address will not be published. Required fields are marked *