06 November 2023, 19:41 | #1 |
Zone Friend
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 48
Posts: 344
|
Emulating the Nintendo Entertainment System
Since 1997 (every now and then) a friend and I coded on our NES emulator, A/NES, for Amiga. It has been fun (most of the time) but of course the biggest bottleneck is the graphics emulation which in many parts isn't really suitable for Amiga hardware.
Some days I think about how to improve the graphicsemulation (and speed) but it's quite complex but I'm after some ideas, perhaps someone here can think of something clever (assuming you understand my massive post..) Imagine this scenario (slightly simplied): * NES has 4 screens based of tiles (like the C64), 4*256x240 pixels in size but only two of them are unique, the other ones are mirrors of existing ones. The screens consists of of 4 bitplanes. * They are positioned like this: 2 3 0 1 Screens can be mirrored so 0-1/2-3 are duplicates (horizontal mirroring) or 2-0 and 3-1 (vertical mirroring). * The visible area could be any one of those 4 (+ scrolling information). Imagine horizontal mirroring is active and screen 1 is active and keeps scrolling horizontally (SMB for example), the visible area will wrap around to screen 0 again. I keep thinking of emulating this in the most efficient/simple way. In theory I only needs to be updating 2 screens but the difficult question remains, how to "glue" those screens together during scrolling in a fast way. Generating the final image, copying data using the blitter/CPU would greatly decrease performance (target computer is A1200/~68030+/FastRAM). Currently we are using "simple" Amiga hardware scrolling for this purpose but it introduces other problems aswell. To further add complexity, the graphics related to the tiles could be switched easily, so tile nr 1 could be a cloud or a tree depending on the current graphics-bank. Adding sprites then adds another layer of complexity, they can appear behind the background aswell.. Congratulations if you've read it all all the way down here. I'd appreciate some ideas concerning this. Last edited by oRBIT; 06 November 2023 at 21:07. |
06 November 2023, 22:31 | #2 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,809
|
No idea maybe try contacting doble07 directly or maybe NES emulator for Atari ST holds some answers.
|
06 November 2023, 22:33 | #3 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,360
|
when you draw/blit a tile, draw it twice in both mirrors. Then you can use hardware scrolling
I did that with Xevious port. It was vertical scrolling, but the wrap around was done like that. But I agree designing an emulator using amiga hardware features is a challenge. You want to handle the general case. If you want to make it AGA, you can also use AGA dual playfield and get 2 independant 16-color layers. Hardware sprites won't help a lot because of the size (but AGA can fix that) and mostly lack of colors I suppose. With AGA you have more possibilities: 8 sprites with 8 independent palettes and 64 bit wide. And blit the rest. I combined 4 sprites to create a 7 color huge space ship (Xevious Andor Genesis), and still had 4 sprites left, with any palette I'd choose. Just ideas... |
07 November 2023, 00:52 | #4 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,652
|
NES hardware is very simple, backwards, and alien. It ended up this way because of economic decisions.
The small thinking and small tiles makes it a half as good fit for the Blitter, but the visuals can be reproduced faithfully at full frame rate on an Amiga 500. The problem is that you're emulating, not reproducing the game. Because of this your emulator becomes an interpreter of how the software had to be written to even produce the standard we saw. I.e. the software looks up pre-mirrored tiles, you can pre-mirror the entire ROM in chip RAM and map the banks, render loop to fill a screen with tiles. And dual playfield solves all the sprites, and scrolling is not a problem. (I feel like I'm parroting jotd.) So it's more of a strategy how to do it (e.g. mirror the entire cart 4x and flip tiles while loading the cart). The tiles are flippable not because of performance but because of small ROM space. And it didn't update tiles anywhere near full frame rate or full screen, so neither do you. Just track the changes and make the updates needed. But you know all these things, it's just ideas. You must also be able to produce performant code to determine if any platform can do a specific thing or not. |
07 November 2023, 02:29 | #5 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,809
|
Last time I tried A/NES iirc it was pretty complete?
Speed? Maybe on a PiStorm it might be fast? |
07 November 2023, 06:52 | #6 |
Registered User
Join Date: Dec 2016
Location: Italy
Posts: 769
|
The best NES emulator I tested on Amiga is CoolNES and it works on a simple 68030.
It is far from perfect, but some games are playable, where the A/NES lacks... On Aminet A/NES 1.2 has been released, but it doesn't emulate even Super Mario Bros... Certainly a new emulator written specifically to make better use of the Amiga hardware is welcome. Last edited by DanyPPC; 07 November 2023 at 07:37. |
07 November 2023, 09:53 | #7 |
Registered User
Join Date: May 2023
Location: Norwich
Posts: 426
|
Well, kind of. There are mapper chips that can swap the entire set of tiles the VDP "sees" instantly, which would result in a change across the whole screen in a frame. Usually that was done on line interrupts to create extra effects (parallax scrolling for one but sometimes just to get more tiles on screen) - I imagine that could make tracking "dirty" rectangles a little bit trickier.
|
07 November 2023, 10:04 | #8 |
Senior Member
Join Date: Jun 2001
Location: Germany
Posts: 1,666
|
Then you do something wrong. Just tested - works and is playable with sound.
|
07 November 2023, 10:16 | #9 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,360
|
If you need an emulator just to run Super Mario Bros, transcode the game to 68000, implement the game requirements in terms of sprites / scrolling / etc as it's a single game, not the whole console, and you have Super Mario Bros for Amiga (like I would convert any arcade game)
Not sure how many other NES games are worth playing on Amiga nowadays... Also not sure if an emulator is needed for Amiga today. Wouldn't most people run it through WinUAE anyway? That and the performance issue on real hardware. I know. It's hard to emulate consoles in a generic way. Even the NES. |
07 November 2023, 11:12 | #10 | |
Registered User
Join Date: Dec 2016
Location: Italy
Posts: 769
|
Quote:
Yesterday when I tested the new 1.21 release something gone wrong, and sprites on screen weren't shown. Today I test again and surprisingly all is ok. Thanks for the advice. |
|
07 November 2023, 11:22 | #11 | |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,809
|
Looks like 1.19 is oRBIT's latest version of A/NES
"A/NES PRO v1.19 AmigaOS NES-emulator for classic Amigas (AGA and 68060+ highly recommended)." Quote:
|
|
07 November 2023, 11:29 | #12 |
Senior Member
Join Date: Jun 2001
Location: Germany
Posts: 1,666
|
A/NES Pro seems to have RTG support, A/NES does not. But A/NES is newer, he updated it just five days ago.
|
07 November 2023, 11:30 | #13 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,809
|
Ok, maybe he can clarify.
PiStorm supports RTG ? |
07 November 2023, 11:36 | #14 |
Senior Member
Join Date: Jun 2001
Location: Germany
Posts: 1,666
|
Yes, PiStorm does support RTG. But there's no reason not to use the normal, newer version instead of the older Pro.
This should run at full speed on any 060. Doubt a PiStorm is even needed. |
07 November 2023, 15:24 | #15 |
Zone Friend
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 48
Posts: 344
|
The original A/NES is the one that I'm currently working on (well, more or less, mostly less). Yes, A/NES PRO does a better job with the graphics but obviously requires a pretty powerful machine.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
New Vs. Nintendo System Homebrew | DamienD | Retrogaming General Discussion | 0 | 25 December 2020 02:17 |
Christmas entertainment for the family | jimbob | Retrogaming General Discussion | 5 | 23 December 2011 01:43 |
Hyperion Entertainment Announces The Amiga X1000 | Mangar | News | 1 | 07 January 2010 08:06 |
Workbench-Style GUI System for the Nintendo DS | ant512 | Retrogaming General Discussion | 5 | 21 April 2008 20:19 |
|
|