CPCWiki forum

General Category => Programming => Topic started by: mr_lou on 15:38, 29 July 19

Title: Abandoned BASIC game project
Post by: mr_lou on 15:38, 29 July 19
For a long time I'd wanted to make a 100% pure BASIC game, and have started several attempts. But there's just never any time for anything, so I never get far before I end up never working on the project again.

Here's one of those projects that I'm posting here in case someone wants to take over. As mentioned, I never get far. This is only a simple title screen and some intro music with a tiny man walking.
If anyone wants to take over, feel free. But post here if you do, to avoid two people working on the same.
Title: Re: Abandoned BASIC game project
Post by: skylas on 11:39, 25 September 20
The music is great!
Title: Re: Abandoned BASIC game project
Post by: mv on 11:50, 11 October 20
That's tricky!
Printing MODE 1 bitmaps in MODE 2 and view them in MODE 1.

I tried to implement this feature in CPCBasic, but its internal pixel buffer does not use the screen memory architecture from the CPC (that's just a simulation for PEEK&POKE).
And changing all the screen drawing routines...
So I put in a compromize:
CALL &BD1C,1 will convert the screen memory to MODE 1.
Calling &BD1C again will convert the whole screen again, so we cannot use it for the moving man.
You can check it here:
https://benchmarko.github.io/CPCBasic/cpcbasic.html?database=apps&example=demo/basworld
(Poking the color also does not work.)

I also like the music!
Title: Re: Abandoned BASIC game project
Post by: AMSDOS on 09:29, 27 October 20
Quote from: mv on 11:50, 11 October 20
That's tricky!
Printing MODE 1 bitmaps in MODE 2 and view them in MODE 1.

I tried to implement this feature in CPCBasic, but its internal pixel buffer does not use the screen memory architecture from the CPC (that's just a simulation for PEEK&POKE).
And changing all the screen drawing routines...
So I put in a compromize:
CALL &BD1C,1 will convert the screen memory to MODE 1.
Calling &BD1C again will convert the whole screen again, so we cannot use it for the moving man.


I'm not liking these Firmware Calls from BASIC which use the extra parameters, especially after the Warzone game I converted to run on the 464 the other day won't work on a 664 because of statements like CALL &BC06,&C0 and CALL &BC06,&40.
It's possible switching screens using OUT statements, so perhaps that would be the best course of action, though I'm unsure if &BD1C is available from an OUT statement.
Title: Re: Abandoned BASIC game project
Post by: mv on 22:19, 27 October 20
Quote from: AMSDOS on 09:29, 27 October 20I'm not liking these Firmware Calls from BASIC which use the extra parameters, especially after the Warzone game I converted to run on the 464 the other day won't work on a 664 because of statements like CALL &BC06,&C0 and CALL &BC06,&40.
It's possible switching screens using OUT statements, so perhaps that would be the best course of action, though I'm unsure if &BD1C is available from an OUT statement.
Good point! I never tried CALL &BC06 on a CPC 664... I see... not good to modify register SP.
Hmm, we could memorize the byte at &BC06, set to e.g. zero, CALL it and restore. Or even better, use CALL &BC07! Who came up with &BC06?

CALL &BD1C is different. You can try to set the mode with OUT &7Fxx but this is not permanent. You have to modify register BC' as well. Luckily, the CALL is the same on all CPC 464/664/6128. And isn't it a nice trick to set register A with the number of arguments?
Title: Re: Abandoned BASIC game project
Post by: AMSDOS on 09:40, 28 October 20
Quote from: mv on 22:19, 27 October 20
Good point! I never tried CALL &BC06 on a CPC 664... I see... not good to modify register SP.
Hmm, we could memorize the byte at &BC06, set to e.g. zero, CALL it and restore. Or even better, use CALL &BC07! Who came up with &BC06?

The author of Warzone, Richard Shephard was using these, the original game was written using BASIC 1.1 and published in AA68 in 1991, so it could have been written on a 6128 or Plus.


QuoteCALL &BD1C is different. You can try to set the mode with OUT &7Fxx but this is not permanent. You have to modify register BC' as well. Luckily, the CALL is the same on all CPC 464/664/6128. And isn't it a nice trick to set register A with the number of arguments?


Okay, well I never meddle with the Alternative Register Set, I tried it on the 2 Emulators I have on this Mac, but  it didn't seem to do anything and just thought better stop before I have a Busted Mac too.
Why not just a short MC subroutine, do things proper without a catch-22:


a$="3e00cd08bcc9":c=0:for p=1 to 11 step 2:poke &160+c,val("&"+mid$(a$,p,2)):c=c+1:next
poke &161,&40:call &160
poke &161,&C0:call &160
Powered by SMFPacks Menu Editor Mod