Category Archives: Retrochallenge 2015

Retrochallenge… Final score.

As another Retrochallenge comes to an end it’s time to see how I got on.

Close but no cigar.

This last week has not seen a lot of progress. Plenty of things happened under the skin of CellarScramble but nothing that shows.

I have split the code out from its monolithic file into a number of modules and started using Monkey Studio IDE for editing the code.

I have functions for rooms and tiles as before. I have added provision for multiple sprites and added vSync detection for controlling the timing.

Rather enjoyed this. I may continue with it of perhaps leave it until RC2016/01. I’m not short of retro projects to get on with in the mean time.

CellarScramble. A bit of progress

CSWalkThroughThe story so far.

As we wizz through the half-way stage there has been some progress.

I have written code to handle a collection of upto 256 8×8 tiles. I also have structures that arrange tiles into upto 255 rooms of 4×3 tiles each and routines that can draw a room and tell me what room I’ll end up in if I leave the current one in any direction. This means I have a complete map of 30 rooms at the moment, interconnected.

Next up I have some routines that can handle my player sprite. I can read the screen memory below the sprite (so I can put it back later), draw a sprite and then put the ground back (told you I’d need it later).

The little GIF is a walk through of part of the cellar (click on it to see the animated version).

Currently there is no collision detection, baddies, goodies and there is no timing and video blanking type work. But, not bad so far.

 

 

Retrochallenge – CellarScramble. Moving along.

I have decided to try a game on the Sharp-MZ-700 and called it CellarScramble.

It’s a top down dungeon run and as the Sharp only has character based graphics I’ve gone the route of defining 8×8 tiles and making the rooms out of these tiles.

I’ve now defined a map of 30 rooms and the tiles that make them up. I’m not going to show you the map, that would spoil the surprise. 🙂

Now I need some coed to move sprites and check for collisions. Hmmm.

Retrochallenge – A bit of a plan.

In my first post of this season’s Retrochallenge I did a bit of experimenting around memory-mapped screen access on the Sharp MZ-700. I’ve decided to try and come up with something a bit like “Atic Atac” a splendid top-view runing about game for the spectrum.

The Sharp doesn’t have dot-addressable graphics like the Spectrum so everything is character based. So it’s going to be different but we’re working with the tools we have.

So far I have written some code to draw rooms using tiles and so far, I’ve got one room…

Screenshot from 2015-07-12 16:17:00Now I’ve got code to draw rooms and a pallet of tiles, I can build a dungeon.

Welcome to…

Cellar Scramble

Mwaa Ha Harrr.

Retrochallenge 2015 – Here we go.

We’re four days into retro challenge and I’ve finally got started.

My plan is to do “something programmy” on a Sharp MZ-700. I’ve set up my stall and now for the programming. I’ve not used C on a Z80 before nor anything beyond “Hello World” on an MZ-700 so I need to find out some basics.

First I’m going to output a character grid using memory mapping (rather than standard output – printf) because I get further, memory mapped screen access will be needed.

I’m using Z88DK to write in and MZ-700 emulator under DOSBOX to test. I’ll try it on a real MZ-700 before I’ve finished.

First, some code…

/*
 * charmap.c
 *
 * A simple memory mapped display of the character and colour map on
 *  the Sharp MZ-700.
 *
 * Andy Collins. July 4th 2015.
 *
 */

#include <stdio.h>
#include <stdint.h>
#include <string.h>

void main(void)
{
  u8_t  *screenRam = 0xD000;         // Start of screen memory. Top left.
  u8_t  *colourRam = 0xD800;         // Start of colour attribute memory. Top left.
  u8_t  xLoop = 0;
  u8_t  yLoop = 0;
  u8_t  currentChar = 0;
  const u8_t myChar = 0x41;

// Output a square with the complete character set.
  screenRam += 4 * 40 + 4;         // Move top left in a bit
  for(xLoop = 0; xLoop < 16; xLoop++)
  {
    for(yLoop = 0; yLoop < 16; yLoop++)
    {
      *screenRam++ = currentChar++;
    }
    
    screenRam += 24;
  }
    
// Now a square of the colour combinations
  screenRam = 0xD000 + 4 * 40 + 20;  // Start of colour square in screen RAM
  colourRam += 4 * 40 + 20;         // Move top left in a bit
  for(xLoop = 0; xLoop < 16; xLoop++)
  {
    for(yLoop = 0; yLoop < 16; yLoop++)
    {
      *colourRam++ = currentChar++;
      *screenRam++ = myChar;
    }
    
    colourRam += 24;
    screenRam += 24;
  }
    
  while(1)
  {
  }
}

And a screenshot…

Screenshot from 2015-07-04 11:44:43Tadaa :-).

 

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!