WIP - Walkabout (z88dk)

If you like transforming your statements into code, this is the place for you

Moderator: Programming Moderators

User avatar
bob_fossil
Posts: 30
Joined: Tue May 30, 2017 5:26 pm

Re: WIP - Walkabout (z88dk)

Post by bob_fossil » Thu Jun 08, 2017 8:39 pm

FrankT wrote:
Thu Jun 08, 2017 5:54 pm
bob_fossil wrote:
Wed Jun 07, 2017 10:13 pm
Any one fancy doing a loading screen or some nice AY music for this? :)
I'll have a go at some AY music.

I write AY using Vortex Tracker. I'll just submit the .pt3 files, for title music, ingame music.

I have to start writing something appropriate first. Something cheerful and jolly?

Let me know if you have a particular style of music you want.

Edit: I read on your Github that this game is "A ZX Spectrum port of an old PC game POD which had been ported to the Commodore Amiga.".

I can easily do a cover of the original music if you can provide a link to it. Or an evolution of the original music.
Thank you for offering. Yes something cheerful and jolly would be good as this is a cheery little puzzle game. I'm not that familiar with Vortex Tracker. I've included Sound Tracker music before but that had to be ran through the ST-Compiler to generate something that could be played back on interrupt. I'm guessing that's the case too with Vortex Tracker? I don't think the Amiga port had any sound and the DOS original is just speaker beeps.

If you could put together simple to start off with so I can test the code that would be great. I wouldn't want you to spend loads of time on this only to find I can't use it due to some technical issue between the player code and what I've written.

User avatar
FrankT
Posts: 9
Joined: Tue Jun 06, 2017 8:10 pm
Location: UK
Contact:

Re: WIP - Walkabout (z88dk)

Post by FrankT » Thu Jun 08, 2017 9:32 pm

bob_fossil wrote:
Thu Jun 08, 2017 8:39 pm

Thank you for offering. Yes something cheerful and jolly would be good as this is a cheery little puzzle game. I'm not that familiar with Vortex Tracker. I've included Sound Tracker music before but that had to be ran through the ST-Compiler to generate something that could be played back on interrupt. I'm guessing that's the case too with Vortex Tracker? I don't think the Amiga port had any sound and the DOS original is just speaker beeps.

If you could put together simple to start off with so I can test the code that would be great. I wouldn't want you to spend loads of time on this only to find I can't use it due to some technical issue between the player code and what I've written.
Here is an example snapshot for playing a pt3 tune. It uses the interrupt. NOTE: The music here is what I wrote for Carlos Michelis by worldxxisoft. Just an example to show it playing while basic is in use.
https://www.dropbox.com/s/7ylx7xaabl279 ... e.szx?dl=1
I test with SpecEmu emulator, but most emulators can open .szx snapshots.

Here is the source I compiled. CMTheme.bin is the .pt3 file from vortex tracker.
https://www.dropbox.com/s/fhcdvgz2r2qa1 ... e.zip?dl=1
Note: This is a rough example playing from RAM page 6. But this doesn't need 128 paging if you're targeting 48k as well. 48k users can play AY with an AY interface. You just need to check if it's present.

I can add it to your code as well. I'm fairly fluent in z80 assembly. I've forked your Github repo. Or if you prefer, I can just supply the pt3 music file and player, and let you handle the interrupt routine yourself.

User avatar
bob_fossil
Posts: 30
Joined: Tue May 30, 2017 5:26 pm

Re: WIP - Walkabout (z88dk)

Post by bob_fossil » Thu Jun 08, 2017 10:34 pm

FrankT wrote:
Thu Jun 08, 2017 9:32 pm

Here is an example snapshot for playing a pt3 tune. It uses the interrupt. NOTE: The music here is what I wrote for Carlos Michelis by worldxxisoft. Just an example to show it playing while basic is in use.
https://www.dropbox.com/s/7ylx7xaabl279 ... e.szx?dl=1
I test with SpecEmu emulator, but most emulators can open .szx snapshots.

Here is the source I compiled. CMTheme.bin is the .pt3 file from vortex tracker.
https://www.dropbox.com/s/fhcdvgz2r2qa1 ... e.zip?dl=1

I can add it to your code as well. I'm fairly fluent in z80 assembly. I've forked your Github repo. Or if you prefer, I can just supply the pt3 music file and player, and let you handle the interrupt routine yourself.
I am using im2 already. The interrupt function is provided in main.c by the M_BEGIN_ISR(isr) block so I'd like to slot playback into there. Worst case, I can do a call from there to the playback code. Interrupts are set up in interrupts() in main.c. You might need to shuffle some of my buffers around as I notice your example paged memory in and out inside the interrupt and my interrupt table is currently at $c5c5 - unsure if you can have the table above 49152 if you're paging memory?

User avatar
FrankT
Posts: 9
Joined: Tue Jun 06, 2017 8:10 pm
Location: UK
Contact:

Re: WIP - Walkabout (z88dk)

Post by FrankT » Thu Jun 08, 2017 10:38 pm

You can have it anywhere you want. And use your own im2 routine to call play or mute, select a different tune etc...
You don't need to use any paging either. This example was written a while ago for someone who had no memory left for a tune, so needed the player and music in a 128 bank.

Edit:
Get the source for PT3 player here:
http://bulba.untergrund.net/progr_e.htm
Download the PTxTools.7z archive.

Stefan123
Posts: 102
Joined: Mon Jun 05, 2017 9:38 pm

Re: WIP - Walkabout (z88dk)

Post by Stefan123 » Fri Jun 09, 2017 8:27 am

Hi,

I have created a C API wrapper for calling the Vortex Tracker II (VT) player and adapted it to the z80asm assembler syntax in z88dk. See my last comment in this thread at the z88dk forums: https://www.z88dk.org/forum/viewtopic.p ... 675#p14675

The z80asm-adapted VT player and the C API wrapper for calling it is located in the following files:
* vt_sound.h
* vt_sound.asm
* PT3PROM.asm

This is a simple example program demonstrating how to use all this:
* vt_demo.c
* vt_demo_module.asm

I can send you the proper files if you're interested.

Regards,
Stefan

User avatar
bob_fossil
Posts: 30
Joined: Tue May 30, 2017 5:26 pm

Re: WIP - Walkabout (z88dk)

Post by bob_fossil » Fri Jun 09, 2017 10:44 pm

FrankT wrote:
Thu Jun 08, 2017 10:38 pm
You can have it anywhere you want. And use your own im2 routine to call play or mute, select a different tune etc...
You don't need to use any paging either. This example was written a while ago for someone who had no memory left for a tune, so needed the player and music in a 128 bank.

Edit:
Get the source for PT3 player here:
http://bulba.untergrund.net/progr_e.htm
Download the PTxTools.7z archive.
After shuffling my interrupt table and scroll buffer around, I've got it working. You can find an intermediary build with it here:

https://www.dropbox.com/s/je5azpbctm7t4 ... y.zip?dl=0

Doesn't do anything clever like testing for 128k / AY yet. I'm guessing there's a z88dk function somewhere to do that though.

tamas_vandorffy
Posts: 14
Joined: Tue May 30, 2017 7:18 am

Re: WIP - Walkabout (z88dk)

Post by tamas_vandorffy » Sat Jun 10, 2017 7:05 pm

Hi,

First of all, thanks for showing us this ilittle game and also to share the source code!
This will help me greatly to learn how to work with z88dk and assembly.

I tried to compile your source and it seems that I bumped into two problems. I managed to make
it work but I am not sure if I did the right thing.

The first problem I found in levels.c in the function get_level_code line 435.
The compiler returned "sccz80:"levels.c" L:435 Error:#34:Illegal address"

The line in question was:
return(&levels[level].code);
The function's return type was a char *
I removed the '&' to make the error go away.

The second prolem was in menu.c on line 296:
char *descs[4] = {"UP", "DOWN", "LEFT", "RIGHT"};
I got a "sccz80:"menu.c" L:297 Error:#57:Cannot assign to compound auto variable 'descs'" message.
I had to make the variable static to make the problem go away.

After this the make was successful and the game started up.

I am new to speccy programming so I hope I did the right thing.

adam
Posts: 18
Joined: Wed May 31, 2017 5:08 am

Re: WIP - Walkabout (z88dk)

Post by adam » Sat Jun 10, 2017 7:51 pm

Yeah, when facing an unfamiliar SDK it's really great seeing a practical example of how the C&asm&tools fit together, let alone seeing actual game code!

User avatar
bob_fossil
Posts: 30
Joined: Tue May 30, 2017 5:26 pm

Re: WIP - Walkabout (z88dk)

Post by bob_fossil » Sat Jun 10, 2017 8:34 pm

tamas_vandorffy wrote:
Sat Jun 10, 2017 7:05 pm

The first problem I found in levels.c in the function get_level_code line 435.
The compiler returned "sccz80:"levels.c" L:435 Error:#34:Illegal address"

The line in question was:
return(&levels[level].code);
The function's return type was a char *
I removed the '&' to make the error go away.
& is the address of operator and levels[level].code is a char array so that should give you a char * pointer to that array. This doesn't generate an error on my setup.
The second prolem was in menu.c on line 296:
char *descs[4] = {"UP", "DOWN", "LEFT", "RIGHT"};
I got a "sccz80:"menu.c" L:297 Error:#57:Cannot assign to compound auto variable 'descs'" message.
I had to make the variable static to make the problem go away.

After this the make was successful and the game started up.
Again, I didn't encounter this problem on my setup. What version of zcc / sccz80 are you running (do 'zcc --version' or 'sccz80 --version' from the command line / terminal)? Both return 'Version: 20170525' for me.

Did the level code entry screen still work and did the keyboard descriptions still get shown correctly in the redefine keys screen?

tamas_vandorffy
Posts: 14
Joined: Tue May 30, 2017 7:18 am

Re: WIP - Walkabout (z88dk)

Post by tamas_vandorffy » Sat Jun 10, 2017 10:42 pm

My version is: "Version: 20170112".
So it seems that my setup is way older than yours. I will get a newer one and try again.
I checked the level code entry screen, I was able to enter a valid code and I got the appropriate level.
Also, he redefine keys function was working as it should.

Post Reply