CROSS CHASE massively cross-platform 8-bit game

Discussion of development of software for any "obsolete" computer or video game system. See the WSdev wiki and ObscureDev wiki for more information on certain platforms.
Post Reply
Fabrizio Caruso
Posts: 5
Joined: Thu Nov 09, 2017 3:36 am

CROSS CHASE massively cross-platform 8-bit game

Post by Fabrizio Caruso »

Hi!

I am developing the massively cross-platform simple game CROSS CHASE written in ANSI C:
https://github.com/Fabrizio-Caruso/CROSS-CHASE

The game is supposed to run on ANY 8 bit computer/console/handheld from the 70s and 80s (using either the Motorola 6809, the MOS 6502, the Zilog Z80 or their derivatives). "ANY" = any system with enough memory and display size for which an ANSI C compiler exists.
It currently supports about 40 different systems and about 60 configurations (e.g., expanded memory, expanded display, etc.).
I am using CMOC/WinCMOC (6809), CC65 (6502), Z88DK (Z80) and lots of other tools.

REMARK: The project is not a collection of ports. All versions are supposed to be generated by the very same code except in some cases for a few bits for sound and graphics. This is achieved through abstractions and macros.

For the PCEngine I am blocked by the linker configuration in CC65 because I don't know how to configure the linker so that I can have more than 8k of available memory for my code. Who could help?? Should I open a thread somewhere else on this forum?

For the NES I have made a fully working and playable prototype, which is currently only using black and white because of lack of support in the conio library in CC65. I will have to use some lower level routines to produce better graphics.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: CROSS CHASE massively cross-platform 8-bit game

Post by tepples »

The license

The license of this repository is the license of zlib with an added non-commercial clause:
Permission is granted to anyone to use this software for non-commercial applications
[...]
If you use this software in a product
Apart from the belief among some analysts that noncommercial clauses are considered harmful (see opinion articles by Richard Stallman, Eric S. Raymond, Eric Moeller, Joris Pekel), this appears to contradict itself.

Your question: Memory mapping

I've never programmed for the TG16, but I have shipped a commercial game using (a clone of) MMC3. So what I'm about to write is extrapolation from how ld65 is used with NES mappers, combined with the article "PC Engine Memory Mapping".

Like the MMC3, FME-7, and VRC7 mappers on the NES, the HuC6280 CPU's built-in MMU divides the 64 KiB address space into 8 KiB windows. But unlike NES mappers, which fix particular windows to particular banks, the HuC6280 makes all eight windows switchable, calling them MPR0 through MPR7. They're mapped as follows:
  • MPR0 ($0000): I/O (bank $FF)
  • MPR1 ($2000): RAM (bank $F8)
  • MPR2 ($4000) through MPR6 ($C000): ROM (banks $01 through $F7)
  • MPR7 ($E000): ROM home bank (bank $00)
Perhaps the easiest way to proceed is to put your C code in $4000-$DFFF (40 KiB).

So here's an untested linker configuration file. It offers a fixed bank at $E000 (.segment "LOWCODE") for startup code and assembly language I/O routines, two 8 KiB banks at $4000 (.segment "BANK1" and .segment "BANK2") for things like tile data that only the I/O routines need to access, and a 40 KiB continuous area at $4000-$DFFF for your C code.

Code: Select all

# 512 kbit HuCard linker script
# Copyright 2017 Damian Yerrick
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty
# provided the copyright notice and this notice are preserved.
# This file is offered as-is, without any warranty.
#
MEMORY {
  ZP:     start = $10, size = $f0, type = rw;
  # use first $10 zeropage locations as locals
  HEADER: start = 0, size = $0010, type = ro, file = %O, fill=yes, fillval=$00;
  RAM:    start = $2200, size = $1E00, type = rw;
  ROM0:   start = $E000, size = $2000, type = ro, file = %O, fill=yes, fillval=$FF, bank=0;
  ROM1:   start = $4000, size = $2000, type = ro, file = %O, fill=yes, fillval=$FF, bank=1;
  ROM2:   start = $4000, size = $2000, type = ro, file = %O, fill=yes, fillval=$FF, bank=2;
  ROM37:  start = $4000, size = $A000, type = ro, file = %O, fill=yes, fillval=$FF, bank=3;
}

SEGMENTS {
  ZEROPAGE: load = ZP, type = zp;
  BSS:      load = RAM, type = bss, define = yes, align = $100;

  # Fixed bank segments
  LOWCODE:  load = ROM0, type = ro, align = $100;
  STARTUP:  load = ROM0, type = ro, align = $100, optional = yes;
  ONCE:     load = ROM0, type = ro, align = $100;
  VECTORS:  load = ROM0, type = ro, start = $FFF6;

  # Auxiliary segments
  BANK1:    load = ROM1, type = ro, align = $100, optional = yes;
  BANK2:    load = ROM2, type = ro, align = $100, optional = yes;

  # Main C code segments
  CODE:     load = ROM37, type = ro, align = $100;
  RODATA:   load = ROM37, type = ro, align = $100;
}

FILES {
  %O: format = bin;
}
The startup code is then responsible for setting the MPRs to [$FF, $F8, $03, $04, $05, $06, $07, $00] before the C code runs.
Fabrizio Caruso
Posts: 5
Joined: Thu Nov 09, 2017 3:36 am

Re: CROSS CHASE massively cross-platform 8-bit game

Post by Fabrizio Caruso »

Thanks for your reply!

Unfortunately my understanding of what I need to do other than just using your proposed cfg file is very limited.

Am I supposed to write some startup code myself? I have no idea how to select the banks.

Remark:
I only need 16k to get my game to work on the NES.

Why can't I just add

ROM37: start = $4000, size = $A000, type = ro, file = %O, fill=yes, fillval=$FF;

and

CODE: load = ROM37, type = ro;

What are the options bank=0/1/2/3 used for? Are they necessary?
User avatar
OmegaMax
Posts: 80
Joined: Wed Sep 21, 2016 8:55 am
Location: Calgary.Alberta,Canada

Re: CROSS CHASE massively cross-platform 8-bit game

Post by OmegaMax »

There is a pce development thread on these forums

http://www.pcenginefx.com/forums/index.php
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: CROSS CHASE massively cross-platform 8-bit game

Post by tepples »

From your link:
Only registered members are allowed to access this section.
Please login below or register an account with Pcenginefx.com.
From the registration form:
This connection is not secure. Logins entered
here could be compromised. Learn More
The registration form appears to display through HTTPS, but none of the theme graphics display. I wasn't able to verify that the form actually submits and allows me to register in the time that I had allotted to test the form.
ccovell
Posts: 1045
Joined: Sun Mar 19, 2006 9:44 pm
Location: Japan
Contact:

Re: CROSS CHASE massively cross-platform 8-bit game

Post by ccovell »

Yeah, that's one of the problems of the PCEnginefx forums: they can't even be read (or searched by Google) if you're not a member...
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: CROSS CHASE massively cross-platform 8-bit game

Post by Pokun »

Yeah and you can't log in securely without breaking the theme and all other images. I've filed a complaint about this on the forum.
Fabrizio Caruso
Posts: 5
Joined: Thu Nov 09, 2017 3:36 am

Re: CROSS CHASE massively cross-platform 8-bit game

Post by Fabrizio Caruso »

Hi!

I am still struggling to understand how to use CC65 to build functional roms for the PCE bigger than 8k.

I know how create the roms but they don't work if bigger than 8k. Some sort of bank activation seems necessary but I have no idea how to activate the banks and where to put this activation code.
Post Reply