{"id":909,"date":"2015-07-04T11:59:01","date_gmt":"2015-07-04T10:59:01","guid":{"rendered":"http:\/\/www.randomorbit.co.uk\/?p=909"},"modified":"2015-07-04T11:59:01","modified_gmt":"2015-07-04T10:59:01","slug":"retrochallenge-2015-here-we-go","status":"publish","type":"post","link":"https:\/\/www.randomorbit.co.uk\/?p=909","title":{"rendered":"Retrochallenge 2015 &#8211; Here we go."},"content":{"rendered":"<p>We&#8217;re four days into retro challenge and I&#8217;ve finally got started.<\/p>\n<p>My plan is to do &#8220;something programmy&#8221; on a Sharp MZ-700. I&#8217;ve set up my stall and now for the programming. I&#8217;ve not used C on a Z80 before nor anything beyond &#8220;Hello World&#8221; on an MZ-700 so I need to find out some basics.<\/p>\n<p>First I&#8217;m going to output a character grid using memory mapping (rather than standard output &#8211; printf) because I get further, memory mapped screen access will be needed.<\/p>\n<p>I&#8217;m using Z88DK to write in and MZ-700 emulator under DOSBOX to test. I&#8217;ll try it on a real MZ-700 before I&#8217;ve finished.<\/p>\n<p>First, some code&#8230;<\/p>\n<pre>\/*\r\n\u00a0* charmap.c\r\n\u00a0*\r\n\u00a0* A simple memory mapped display of the character and colour map on\r\n\u00a0*\u00a0 the Sharp MZ-700.\r\n\u00a0*\r\n\u00a0* Andy Collins. July 4th 2015.\r\n\u00a0*\r\n\u00a0*\/\r\n\r\n#include &lt;stdio.h&gt;\r\n#include &lt;stdint.h&gt;\r\n#include &lt;string.h&gt;\r\n\r\nvoid main(void)\r\n{\r\n\u00a0 u8_t\u00a0 *screenRam = 0xD000;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Start of screen memory. Top left.\r\n\u00a0 u8_t\u00a0 *colourRam = 0xD800;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Start of colour attribute memory. Top left.\r\n\u00a0 u8_t\u00a0 xLoop = 0;\r\n\u00a0 u8_t\u00a0 yLoop = 0;\r\n\u00a0 u8_t\u00a0 currentChar = 0;\r\n\u00a0 const u8_t myChar = 0x41;\r\n\r\n\/\/ Output a square with the complete character set.\r\n\u00a0 screenRam += 4 * 40 + 4;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Move top left in a bit\r\n\u00a0 for(xLoop = 0; xLoop &lt; 16; xLoop++)\r\n\u00a0 {\r\n\u00a0\u00a0\u00a0 for(yLoop = 0; yLoop &lt; 16; yLoop++)\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 *screenRam++ = currentChar++;\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0 \u00a0\r\n\u00a0\u00a0\u00a0 screenRam += 24;\r\n\u00a0 }\r\n\u00a0\u00a0 \u00a0\r\n\/\/ Now a square of the colour combinations\r\n\u00a0 screenRam = 0xD000 + 4 * 40 + 20;\u00a0 \/\/ Start of colour square in screen RAM\r\n\u00a0 colourRam += 4 * 40 + 20;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Move top left in a bit\r\n\u00a0 for(xLoop = 0; xLoop &lt; 16; xLoop++)\r\n\u00a0 {\r\n\u00a0\u00a0\u00a0 for(yLoop = 0; yLoop &lt; 16; yLoop++)\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 *colourRam++ = currentChar++;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 *screenRam++ = myChar;\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0 \u00a0\r\n\u00a0\u00a0\u00a0 colourRam += 24;\r\n\u00a0\u00a0\u00a0 screenRam += 24;\r\n\u00a0 }\r\n\u00a0\u00a0 \u00a0\r\n\u00a0 while(1)\r\n\u00a0 {\r\n\u00a0 }\r\n}\r\n\r\n<\/pre>\n<p>And a screenshot&#8230;<\/p>\n<p><a href=\"http:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/07\/Screenshot-from-2015-07-04-114443.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-911\" src=\"http:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/07\/Screenshot-from-2015-07-04-114443-300x201.png\" alt=\"Screenshot from 2015-07-04 11:44:43\" width=\"300\" height=\"201\" srcset=\"https:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/07\/Screenshot-from-2015-07-04-114443-300x201.png 300w, https:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2015\/07\/Screenshot-from-2015-07-04-114443.png 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Tadaa :-).<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;re four days into retro challenge and I&#8217;ve finally got started. My plan is to do &#8220;something programmy&#8221; on a Sharp MZ-700. I&#8217;ve set up my stall and now for the programming. I&#8217;ve not used C on a Z80 before nor anything beyond &#8220;Hello World&#8221; on an MZ-700 so I need to find out some &hellip; <a href=\"https:\/\/www.randomorbit.co.uk\/?p=909\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Retrochallenge 2015 &#8211; Here we go.<\/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],"tags":[],"class_list":["post-909","post","type-post","status-publish","format-standard","hentry","category-retrochallenge","category-retrochallenge-2015"],"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\/909","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=909"}],"version-history":[{"count":2,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/909\/revisions"}],"predecessor-version":[{"id":912,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/909\/revisions\/912"}],"wp:attachment":[{"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}