CPCWiki forum

General Category => Games => Topic started by: Fabrizio on 11:01, 20 September 17

Title: CROSS CHASE: multi-system 8 bit game
Post by: Fabrizio on 11:01, 20 September 17
CROSS CHASE grows A LOT with lots of new targets including some initial prototypes for 8 bit consoles.
The CPC versions need some work. I need some help on how to redefine characters and improve the CPC version.

Now I provide 44 (FORTY-FOUR) different versions!
1. MSX is now fully playable (but no sound and no fancy graphics, yet).
2. CPC is playable (monochromatic version)
3. CPC playable slow prototype (color version)
4. Jupiter Ace playable prototype
5. ZX81 playable prototype
6. Spectravideo playable prototype
7. VZ200 playable prototype
8. Aquarius playable prototype
9. ZX80 sort of playable prototype (turn-based)
10. Atari 5200 console playable prototype
11. NES console sort of playable prototype Remark:
When the loading procedure is not obvious you can find some instructions in the HOW_TO_LOAD_THE_GAME.txt file.
MINIMAL = 16k or slightly less memory required
FULL = 24k or slightly less memory required
You find binaries and source code at
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases

(https://3.bp.blogspot.com/-B2xqycQ7jRc/WZsqCXP1kPI/AAAAAAAAAJ0/hvdZyXpYEdo8bESBkjBUknL07GtMc_VmwCLcBGAs/s1600/c64.jpg)

(https://2.bp.blogspot.com/-6TMT46BnbqQ/WZssopvhZYI/AAAAAAAAAKA/gxI35abnVWIRcZlQFmPBToHVSRg6L7SpgCLcBGAs/s1600/Vic20.jpg)
(https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases)
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: mr_lou on 12:15, 20 September 17
Nice project!
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: Geco on 15:28, 20 September 17
Quote from: Fabrizio on 11:01, 20 September 17
CROSS CHASE grows A LOT with lots of new targets including some initial prototypes for 8 bit consoles.
The CPC versions need some work. I need some help on how to redefine characters and improve the CPC version.
I am not a CPC expert, but CPC does not have character mode, so you can use your own character set which is loaded into the memory, as I see you use 4 colours in the game field therefore I would suggest to use 320x200 resolution with 4 colour i think it would look better than 160x200 with 16 colour.

Pixel setup in colour 4 mode, for 8 pixel you need 2 bytes definition.
pixel3   pixel2    pixel1    pixel0
b3,b7  |  b2,b6  |  b1,b5  |  b0,b4

So if you want setup colour 1 for pixel 3, and rest 0 you should enter 80h.

I can help you to convert eg C64 character set to CPC.

I did not check the game itself, but if the game using CPC ROM routines for print the characters, it could be speed up by eliminating using ROM routines.
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: Fabrizio on 16:03, 20 September 17
@Geco (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1605),

The game does not have to be converted or ported. It is already a CPC game along with lots of other computers.
The game code already supports (nearly) all 8-bit computers and even some 8-bit consoles: the VERY SAME code should generate the binaries for ALL 8-bit computers and some supported consoles.

I need to improve the very small part of CPC specific code (few lines in one file) so that CPC gets nicer graphics.

I need to understand how to redefine characters hopefully in C or (if strictly necessary) in Assembly.
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: Geco on 19:05, 20 September 17
yes, i know this game is already ported to cpc, i suggested to change to color four mode, because it would look much better, and i asked if you use rom routines, because if you do not use then you do not need to change character definition, just use your own by printing routine, i think cpc would require an assembly print routin, because it has only graphics mode. meanwhile i got to my mind a shorter solution for characters than what i mentioned last time, the same characterset could be used like on commodore, just using four conversion table for the four colors.
you mentioned that this game runs on nearly all eight bit machine, if you like an enterprise version would be appreciated also :)
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: arnoldemu on 19:47, 20 September 17
@Fabrizio: (http://www.cpcwiki.eu/forum/profile/?u=2277)

http://cpctech.cpc-live.com/source/charspr.asm (http://cpctech.cpc-live.com/source/charspr.asm)

This example shows how to use txt set matrix to redefine the characters.

this is the important bit:


ld hl,pixel_data          ;; location of character matrix data
ld a,248                  ;; id of first character matrix
ld b,8                    ;; number of characters to define matrix for
.sch
push af
push bc
push hl
call txt_set_matrix       ;; set character matrix
pop hl
ld bc,8                   ;; number of bytes per character matrix
add hl,bc
pop bc
pop af
inc a
djnz sch


pixel data is 8 bytes per char, 1 byte for each line, 1 bit per pixel.

So you will need to asm but you may be able to use z88dk's inline assembler.

EDIT: If you define the font this way then you will get 2 colours (background and foreground) for each character cell. If you want more you need to do the same as this example and set the mode in two ways (1 directly so that the firmware updates it's drawing functions and then direct to hardware to display the result in a different mode) - this fools the firmware and lets you have more colours per char.
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: arnoldemu on 20:05, 20 September 17
I think before writing a lot in assembler to speed it up, I think it would be good to

1) see if there is anything in your code you can change to speed it up (avoid copy by value - I don't know if you use this. Use pointers where you can. Maybe make some things const, reduce size of data values perhaps unsigned char instead of int, that kind of thing.

2) inspect the generated asm, see if you can re-write some of your c code to force the compiler to generate better code. I have done this and it does work.

3) inspect the ansi libraries you are using, perhaps they are not optimal and can be improved

4) finally re-write the character drawing functions in asm. The firmware functions will be a bit slow because
a) there is code to transition from ram to rom to call the functions in rom, then to transition back to ram
b) the code is generic for all modes. a function for mode 1 can be customised for your use and therefore made faster.

Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: arnoldemu on 20:13, 20 September 17
There is 1 more way which may be better than using asm:

http://cpctech.cpc-live.com/docs/manual/s158ap07.pdf


If you define a special string and print it, then hopefully the ansi functions use cpc firmware functions and will call this. If not use the cpclib and print the text.

The control codes are just character values below 32 and with that you can define the lines of a character and redefine characters :)
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: SRS on 21:16, 20 September 17
I'd say you need a ASM routine, too.

055   &BBA5   TXT GET MATRIX
       Action: Gets the address of a character matrix
       Entry:  A contains the character whose matrix is to be found
       Exit:   If it is a user-defined matrix,  then Carry is true; if
               it is in the lower ROM  then  Carry is false; in either
               event, HL contains the  address  of  the  matrix, A and
               other flags are corrupt, and others are preserved
       Notes:  The character matrix is  stored  in  8 bytes; the first
               byte is for the top row  of the character, and the last
               byte refers to the bottom  row  of the character; bit 7
               of a byte refers to the  leftmost  pixel of a line, and
               bit 0 refers to the rightmost pixel in Mode 2.

Smth like: (pseudocode)

ld a,'o'
ld hl,data
jp &bba5
data:
db 01111110
db 01011010
db 01011010
db 01011010
db 01011010
db 01011010
db 01011010
db 01111110


will change "o" to a token like above

Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: SRS on 21:23, 20 September 17
Or just use other standard CPC characters instead of "o" like you can find 'ere:

http://cpctech.cpc-live.com/docs/cpckybd.pdf

You may have a look for changing characters on CPC here: http://www.sean.co.uk/books/amstrad/amstrad4.shtm
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: AMSDOS on 11:51, 21 September 17
I wrote a routine for redefining the character set in Small-C, which uses the Control Code (25) followed by the 8 Lines of Data it needs for the Character:



   symbol(ch,p1,p2,p3,p4,p5,p6,p7,p8)
   int ch,p1,p2,p3,p4,p5,p6,p7,p8;
   {
    putchar(25);
    putchar(ch);
    putchar(p1);
    putchar(p2);
    putchar(p3);
    putchar(p4);
    putchar(p5);
    putchar(p6);
    putchar(p7);
    putchar(p8);
   }



So something like this should work:



   symbol(254,1,1,65,67,71,127,67,1);
   symbol(255,128,128,130,194,226,254,194,128);
   putchar(254);
   putchar(255);



Unfortunately my example doesn't extensively test how many characters can be redefined. In Locomotive BASIC the limit is 15 (or so I read somewhere), before a SYMBOL AFTER needs to be used, which means characters 240-255 can be redefined by default. The SYMBOL AFTER is the equivalent to the TXT SET M TABLE, which was mentioned in the other thread, unfortunately it doesn't exist as a Control code. In BASIC you cannot tell where you this TABLE with SYMBOL AFTER, though with TXT SET M TABLE the HL register can be used to point to an area in the central 32k of RAM, along with DE which represent the same figure found after a SYMBOL AFTER, the lower the number the more area gets allocated for the table, so whatever number of characters you need to redefine, I'd suggest keeping to that.
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: Fabrizio on 13:17, 24 April 18
This is just report some big progress in my project (https://github.com/Fabrizio-Caruso/CROSS-CHASE (https://github.com/Fabrizio-Caruso/CROSS-CHASE))

The game has many more features and it now runs on more than 100 different 8-bit systems.

The CPC version uses Z88DK version of CPCRSLIB. I am still working on it.

Disk image for the Amstrad  CPC version:
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc.dsk

Tape image for the Amstrad CPC version:
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc.cdt (https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc.cdt)

Rom image of the Amstrad NC 100 version:
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/LIGHT_nc100_sprites.rom (https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/LIGHT_nc100_sprites.rom)
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: Phantomz on 14:42, 24 April 18
Nice Project!  8)

I will check this out on real hardware when I get time.
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: Fabrizio on 20:34, 24 April 18
Hi everyone!

I have just managed to automatically create a disk image for the Amstrad CPC series:
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc.dsk
Title: Re: CROSS CHASE: multi-system 8 bit game
Post by: Fabrizio on 12:19, 25 April 18
I have managed to create a CPC+ version with digital joystick support thanks to a hint from @Phantomz (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1308)!
CPC tape & keyboard control
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc.cdt (https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc.cdt)

CPC disk & keyboard control
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc.dsk (https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc.dsk)

CPC tape and joystick control
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc_joystick.cdt (https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc_joystick.cdt)

CPC disk and joystick control
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc_joystick.dsk (https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_cpc_joystick.dsk)

GX4000 and CPC with joystick control
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_gx4000.cpr (https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/FULL_gx4000.cpr)

Amstrad NC 100: https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/LIGHT_nc100_sprites.rom (https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases/download/CPM/LIGHT_nc100_sprites.rom)
Powered by SMFPacks Menu Editor Mod