Thinking about making an NES Z-Machine

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2032
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Thinking about making an NES Z-Machine

Post by FrankenGraphics » Tue Jan 29, 2019 9:10 am

btw, not that this is unique to the NES, but one of the design problems with keeping lots of text in a tile graphics game is that reading monospaced glyphs is fatiguing. But there's plenty of space to add adjusted small letters. This example only has a few common adjustments - i had another more worked-through proof of concept but it i can't find it for the time being. At least this shows that you can have a fairly detailed font and symbol set and still have room for decorative graphics, even without chr banking tricks.
Attachments
typography.png
http://www.frankengraphics.com - personal NES blog

tepples
Posts: 21841
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Thinking about making an NES Z-Machine

Post by tepples » Tue Jan 29, 2019 10:26 am

Years back, when tpw_rules was trying to make a Z-machine interpreter, I wrote a terminal library that uses interrupts and palette trickery to make a full-screen VWF plane. (See previous topic.) But if you're using one of the low-cost boards (UNROM 512 or GTROM), this won't work unless you're willing to do some deep DMC magic.

User avatar
zeroone
Posts: 929
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Thinking about making an NES Z-Machine

Post by zeroone » Tue Jan 29, 2019 11:36 am

Will this require the Subor keyboard?

User avatar
cpow
NESICIDE developer
Posts: 1092
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Re: Thinking about making an NES Z-Machine

Post by cpow » Tue Jan 29, 2019 12:23 pm

halkun wrote:Nesicide looks cool, but there isn't a Windows version. The download link is broken. Shame as that looks really promising!
Thanks for pointing that out!
I've been trying to get a Travis Windows CI deployment set up but it's new for them so isn't working just yet. In the excitement of it all I accidentally blew away the images I'd put up manually. I'm resurrecting my Windows VM now and should have a manual Windows build back online from that in a few hours.

halkun
Posts: 45
Joined: Mon Jul 18, 2011 10:04 pm

Re: Thinking about making an NES Z-Machine

Post by halkun » Tue Jan 29, 2019 7:20 pm

As a wait on the windows Nesticide upload, I'm still looking at the different mappers. MMC5 has banked switched RAM, but what other ones have that ability?
So looking around it appears I need a mapper that can.
1) Bank out one half of the ROM. One fixed bank for the Z-Machine Kernel and one bank for the story file.
2) The ability to bank out the 8K RAM - I need at least 16K, but I guess 32K would be great
3) The mapper needs to be supported by an emulator with a debugger

From the looks of it SXROM would be my best bet as it seems I can buy repo boards from infiniteneslives.com and it allows for 512KB of ROM and 32KB of RAM I'm checking the MMC1 page and it appears that actually doing the bank switching is a little strange, but I'm sure with a few experiments I'll figure it out.

Now I need to figure out how to make ld65 spit out a generic, empty SXROM image.

lidnariq
Posts: 9025
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Thinking about making an NES Z-Machine

Post by lidnariq » Tue Jan 29, 2019 7:29 pm

halkun wrote:MMC5 has banked switched RAM, but what other ones have that ability?
Commercially, it's only MMC5 and some MMC1 variants (SXROM , SOROM, SZROM ).

Recently we observed that FME-7 is physically capable of it, but emulator support isn't particularly widespread.

When/if you get as far as making hardware, we could design inexpensive things that would support multiple banks of PRG RAM.

User avatar
tokumaru
Posts: 11520
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Thinking about making an NES Z-Machine

Post by tokumaru » Tue Jan 29, 2019 7:34 pm

Using an MMC5 for text games seems like overkill to me...

tepples
Posts: 21841
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Thinking about making an NES Z-Machine

Post by tepples » Tue Jan 29, 2019 9:06 pm

halkun wrote:Now I need to figure out how to make ld65 spit out a generic, empty SXROM image.
snrom-template gets you halfway there; you just have to change the header to NES 2.0.

calima
Posts: 1056
Joined: Tue Oct 06, 2015 10:16 am

Re: Thinking about making an NES Z-Machine

Post by calima » Wed Jan 30, 2019 3:25 am

dougeff wrote:
The default is c64
No. The default is NULL, which indexes in the target enum to TGT_NONE, which sets target as "none" and target CPU as CPU_6502.... and sets the character map to "CTNone" which is the same character map that is set if NES is target.
https://github.com/cc65/cc65/blob/maste ... in.c#L1434

Apparently cl65 and cc65 have different defaults.

User avatar
dougeff
Posts: 2633
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Thinking about making an NES Z-Machine

Post by dougeff » Wed Jan 30, 2019 7:01 am

That, I didn't know.

This inconsistency seems like a bad idea, maybe someone should do a pull request?
nesdoug.com -- blog/tutorial on programming for the NES

halkun
Posts: 45
Joined: Mon Jul 18, 2011 10:04 pm

Re: Thinking about making an NES Z-Machine

Post by halkun » Wed Jan 30, 2019 7:57 am

tepples wrote:
halkun wrote:Now I need to figure out how to make ld65 spit out a generic, empty SXROM image.
snrom-template gets you halfway there; you just have to change the header to NES 2.0.
I wasn't able to get this to compile under Windows. I'll give it another shot and tell you the error I'm getting.

nocash
Posts: 1133
Joined: Fri Feb 24, 2012 12:09 pm
Contact:

Re: Thinking about making an NES Z-Machine

Post by nocash » Wed Jan 30, 2019 9:57 am

Good luck with the template. That looks huge. I've always manually defined the 16 header bytes.

Banked RAM might be required, especially if a game requires more than one bank for the current game state (without even thinking about save states). Using FLASH for savestates would be also fine - but you could think about that later.

Which mapper to use isn't so important, you could probably easily change it later once when the game is working. As long as you stick with a central bank switching function/macro, or at least use some symbolic constant for the mapper I/O registers.

MMC1 requires five writes to change a 5bit register. MMC5 needs only one write, so that would be faster. And MMC5 might be more common & more widely supported for large memory. But either one should be fine for getting started.

User avatar
cpow
NESICIDE developer
Posts: 1092
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Re: Thinking about making an NES Z-Machine

Post by cpow » Wed Jan 30, 2019 10:05 am

halkun wrote:As a wait on the windows Nesticide upload, I'm still...
:lol: I haven't had someone call it nesticide since a former coworker decided that was what I was saying. :lol:
I had some troubles with my Windows VM yesterday. So I'm currently attempting to build on a native Windows laptop.
WRT the SNROM template, I had put a nesicide project based on it up on my google site *long ago*.
I will try compiling that once I get a Windows build and report back.

tepples
Posts: 21841
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Thinking about making an NES Z-Machine

Post by tepples » Wed Jan 30, 2019 10:25 am

Looking at the makefile, I think I know what's wrong under Windows: the Python executable on the PATH is called py.exe, not python3.exe. When I discovered this, I changed the makefiles of a lot of my other projects to compensate for this using an ifdef COMSPEC clause to detect the host OS, but I had missed snrom-template. Commit 4f11fad should fix it.

User avatar
cpow
NESICIDE developer
Posts: 1092
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Re: Thinking about making an NES Z-Machine

Post by cpow » Wed Jan 30, 2019 11:44 am

tepples wrote:Looking at the makefile, I think I know what's wrong under Windows: the Python executable on the PATH is called py.exe, not python3.exe. When I discovered this, I changed the makefiles of a lot of my other projects to compensate for this using an ifdef COMSPEC clause to detect the host OS, but I had missed snrom-template. Commit 4f11fad should fix it.
I just googled for something equivalent to this and found:

Code: Select all

OSTYPE=`wmic os get osarchitecture`
if [[ $OSTYPE =~ .*64*. ]]; then
   ...
fi

Post Reply