It is currently Sun Dec 17, 2017 5:08 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Nov 09, 2017 7:19 am 
Offline

Joined: Thu Nov 09, 2017 3:36 am
Posts: 2
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.


Top
 Profile  
 
PostPosted: Thu Nov 09, 2017 8:42 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19353
Location: NE Indiana, USA (NTSC)
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:
# 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.


Top
 Profile  
 
PostPosted: Thu Nov 16, 2017 2:16 pm 
Offline

Joined: Thu Nov 09, 2017 3:36 am
Posts: 2
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?


Top
 Profile  
 
PostPosted: Sat Nov 18, 2017 11:37 am 
Offline
User avatar

Joined: Wed Sep 21, 2016 8:55 am
Posts: 59
Location: Calgary.Alberta,Canada
There is a pce development thread on these forums

http://www.pcenginefx.com/forums/index.php


Top
 Profile  
 
PostPosted: Sat Nov 18, 2017 1:22 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19353
Location: NE Indiana, USA (NTSC)
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.


Top
 Profile  
 
PostPosted: Wed Nov 22, 2017 5:56 am 
Offline

Joined: Sun Mar 19, 2006 9:44 pm
Posts: 924
Location: Japan
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...

_________________
http://www.chrismcovell.com


Top
 Profile  
 
PostPosted: Sun Nov 26, 2017 7:21 am 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 933
Location: Sweden
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group