{"id":900,"date":"2015-06-14T20:49:49","date_gmt":"2015-06-14T19:49:49","guid":{"rendered":"http:\/\/www.randomorbit.co.uk\/?p=900"},"modified":"2015-06-14T20:49:49","modified_gmt":"2015-06-14T19:49:49","slug":"setting-up-my-stall-for-retrochallenge-hello-world-on-the-mz-700","status":"publish","type":"post","link":"https:\/\/www.randomorbit.co.uk\/?p=900","title":{"rendered":"Setting up my stall for Retrochallenge. Hello World on the MZ-700."},"content":{"rendered":"<p>It has become a regular occurance in my life&#8230; The twice yearly <a href=\"http:\/\/www.wickensonline.co.uk\/retrochallenge-2012sc\/\">Retrochallenge<\/a> comes along and I am ill prepared and can&#8217;t decide what to do or how to do it.<\/p>\n<p>To quote from the website&#8230;<\/p>\n<blockquote><p>In a nutshell, the RetroChallenge is a loosely disorganised gathering of RetroComputing enthusiasts who collectively do stuff with old computers for a month.<\/p><\/blockquote>\n<p>This is one real world example of it not being about winning but taking part. Really, I&#8217;m not kidding. Well for me it&#8217;s the taking part. Or it would be about taking part it I did. Of course, your mileage may vary.<\/p>\n<p>I tried a few years ago. I set up a <a href=\"http:\/\/www.randomorbit.co.uk\/?p=43\">web server<\/a> on an <a href=\"https:\/\/en.wikipedia.org\/?title=Newton_%28platform%29\">Apple Newton<\/a> and did have some success but things conspired against me and the machine kept dropping off the net for reasons unknown.<\/p>\n<p>This year things could be different. Maybe.<\/p>\n<p>Now it&#8217;s still a couple of weeks to kick off but I think I&#8217;ll set up my stall and try and get a plan.<\/p>\n<h2>Enter the Sharp MZ-700.<\/h2>\n<p>I&#8217;ve had my <a href=\"http:\/\/www.randomorbit.co.uk\/?p=26\">Sharp MZ-700<\/a> for a while now but haven&#8217;t really done much with it but <a href=\"http:\/\/vintage-radio.net\/forum\/showthread.php?t=117012\">a post<\/a> on the <a href=\"http:\/\/vintage-radio.net\/forum\/index.php?\">UK Vintage radio repair and restoration<\/a> website (vistit now, visit often) made me dust off the old thing and fire it up.<\/p>\n<p>Having fired it up and fired off a response to the original poster I have decided to do &#8220;Something programmy&#8221; with it for Retrochallenge.<\/p>\n<p>Short of &#8220;Hello World&#8221; in BASIC I haven&#8217;t programmed on the Sharp at all so this is going to be intersting.<\/p>\n<h2>Z88DK &#8211; The cross compiler.<\/h2>\n<p>My plan is to do my &#8220;Something programmy&#8221; in C and use a cross-compiler to build it for the Sharp. To be honest, I&#8217;m not sure if that&#8217;s allowed as I&#8217;ll be using a modern PC to type on and build but I&#8217;m writing it for the Sharp and running it on the Sharp. I&#8217;ll see what people think.<\/p>\n<p>A Z80 cross compiler seems quite rare but I found <a href=\"http:\/\/www.z88dk.org\/forum\/\">Z88DK<\/a> and decided to use that.<\/p>\n<p>There is a great introduction to setting up Z88DK <a href=\"https:\/\/chuntey.wordpress.com\/2010\/02\/09\/introduction-to-z88dk-part-1-installation-compilation\/\">here<\/a> and that&#8217;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.<\/p>\n<h2>Hello World.<\/h2>\n<p>Having set up the build environment I tried a &#8220;Hello World&#8221; program&#8230;<\/p>\n<pre>#include &lt;stdio.h&gt;\r\n\r\nmain()\r\n{\r\n\u00a0 printf(\"Hello World\\n\");\r\n\u00a0 \r\n\u00a0 while(1)\r\n\u00a0 {\r\n\u00a0 }\r\n}\r\n<\/pre>\n<p>Not exactly <a href=\"https:\/\/en.wikipedia.org\/wiki\/MISRA_C\">MISRA<\/a> compliant but it builds.<\/p>\n<pre>$ zcc +mz -lm -ohello -create-app -Cz hello.c\r\ncp \/home\/andy\/z88dk\/lib\/mz_crt0.opt \/tmp\/tmpXX6cA7vl.opt\r\ncp \/tmp\/tmpXX6cA7vl.opt \/tmp\/tmpXX6cA7vl.asm\r\nzcpp -I. -DZ80 -DSMALL_C -DSHARPMZ -D__SHARPMZ__ -DSCCZ80 -I\/home\/andy\/z88dk\/include hello.c \/tmp\/tmpXXM4OudA.i\r\nsccz80 \/tmp\/tmpXXM4OudA.i\r\ncopt \/home\/andy\/z88dk\/lib\/z80rules.2 &lt; \/tmp\/tmpXXM4OudA.asm &gt; \/tmp\/tmpXXM4OudA.op1\r\ncopt \/home\/andy\/z88dk\/lib\/z80rules.1 &lt; \/tmp\/tmpXXM4OudA.op1 &gt; \/tmp\/tmpXXM4OudA.opt\r\nz80asm -eopt -ns -Mo -I\/home\/andy\/z88dk\/lib \/tmp\/tmpXXM4OudA.opt\r\nz80asm -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\r\nappmake +mz -b hello -c \/tmp\/tmpXX6cA7vl<\/pre>\n<p>Now turn it into an audio file to play to th Sharp&#8230;<\/p>\n<pre>$ appmake +mz --dumb --audio -b hello.m12\r\n\r\nInfo: name found in header: HELLO\r\n\r\nInfo: file type:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\r\nInfo: program location:\u00a0 $1300\r\nInfo: binary block size: $352\r\nInfo: start address:\u00a0\u00a0\u00a0\u00a0 $1300<\/pre>\n<p>So now we have a .wav file or my hello world program. Pop in a cassette adapter and play the wav.<\/p>\n<p><a href=\"http:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_20150614_200225282.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-901\" src=\"http:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_20150614_200225282-300x169.jpg\" alt=\"IMG_20150614_200225282\" width=\"300\" height=\"169\" srcset=\"https:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_20150614_200225282-300x169.jpg 300w, https:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_20150614_200225282-1024x575.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>A bit odd but wait a minute and look again. I said &#8220;Hello World\\n&#8221; but forgot that the MZ-700 doesn&#8217;t have lower case. Let&#8217;s try again but upper case only and with a leading &#8220;\\n&#8221;.<\/p>\n<p><a href=\"http:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_20150614_204250990.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-902\" src=\"http:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_20150614_204250990-300x169.jpg\" alt=\"IMG_20150614_204250990\" width=\"300\" height=\"169\" srcset=\"https:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_20150614_204250990-300x169.jpg 300w, https:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_20150614_204250990-1024x575.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Tadaaa!. My stall is set up. Roll on July!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It has become a regular occurance in my life&#8230; The twice yearly Retrochallenge comes along and I am ill prepared and can&#8217;t decide what to do or how to do it. To quote from the website&#8230; In a nutshell, the RetroChallenge is a loosely disorganised gathering of RetroComputing enthusiasts who collectively do stuff with old &hellip; <a href=\"https:\/\/www.randomorbit.co.uk\/?p=900\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Setting up my stall for Retrochallenge. Hello World on the MZ-700.<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[98,97,86,37],"tags":[],"class_list":["post-900","post","type-post","status-publish","format-standard","hentry","category-retrochallenge","category-retrochallenge-2015","category-sharp","category-c87-sharp-mz-700"],"featured_image_src":null,"author_info":{"display_name":"andy","author_link":"https:\/\/www.randomorbit.co.uk\/?author=1"},"_links":{"self":[{"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=900"}],"version-history":[{"count":1,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/900\/revisions"}],"predecessor-version":[{"id":903,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/900\/revisions\/903"}],"wp:attachment":[{"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}