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.
CROSS CHASE massively cross-platform 8-bit game
-
- Posts: 5
- Joined: Thu Nov 09, 2017 3:36 am
Re: CROSS CHASE massively cross-platform 8-bit game
The license
The license of this repository is the license of zlib with an added non-commercial clause:
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:
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.
The startup code is then responsible for setting the MPRs to [$FF, $F8, $03, $04, $05, $06, $07, $00] before the C code runs.
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 applicationsApart 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.
[...]
If you use this software in a product
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)
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;
}
-
- Posts: 5
- Joined: Thu Nov 09, 2017 3:36 am
Re: CROSS CHASE massively cross-platform 8-bit game
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?
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?
Re: CROSS CHASE massively cross-platform 8-bit game
From your link:
Only registered members are allowed to access this section.From the registration form:
Please login below or register an account with Pcenginefx.com.
This connection is not secure. Logins enteredThe 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.
here could be compromised. Learn More
Re: CROSS CHASE massively cross-platform 8-bit game
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...
Re: CROSS CHASE massively cross-platform 8-bit game
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.
-
- Posts: 5
- Joined: Thu Nov 09, 2017 3:36 am
Re: CROSS CHASE massively cross-platform 8-bit game
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.
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.