gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

OffTopic > Emulating Commodore 64 on Nintendo DS?

#39795 - ampz - Tue Apr 12, 2005 11:17 am

Should be doable... There are open source sid players and C64 emulators available.
However, I'd much rather see a C64 emulator for GBA than just a SID player. Do that and I will kiss your feet. :)

The C64 resolution (320*200) does not quite fit the GBA screen, but NES could be scaled without too visible artefacts, so I guess the same should be doable with C64. Should actually be a bit easier since the NES I think has a troublesome resolution of 256*256.

320/240 = 4/3 = 1.33
200/160 = 5/4 = 1.25

Seems to me like scaling factor 4/3 would be appropriate for both the horizontal and vertical since this would leave a few pixels at the top and bottom to show the C64 screen border.

#39835 - Quirky - Tue Apr 12, 2005 8:56 pm

ampz wrote:
Should actually be a bit easier since the NES I think has a troublesome resolution of 256*256.


The NES can make use of tile modes, the C64 would have to use somekind of "bitmap" I imagine. The extra overhead interpretting the screen might be a bit of a problem?

Also, Splam released a SID player a few years ago for the GBA. Have a skeet on http://www.gbadev.org/demos.php

#39846 - ampz - Tue Apr 12, 2005 10:16 pm

Quirky wrote:
The NES can make use of tile modes, the C64 would have to use somekind of "bitmap" I imagine. The extra overhead interpretting the screen might be a bit of a problem?

"interpretting the screen" ?
Bitmaps are bitmaps... There is little to interpret.
The C64 has tile (text) modes as well, not that I see the relevance.

#39858 - tepples - Wed Apr 13, 2005 12:03 am

ampz wrote:
The C64 resolution (320*200) does not quite fit the GBA screen, but NES could be scaled without too visible artefacts, so I guess the same should be doable with C64. Should actually be a bit easier since the NES I think has a troublesome resolution of 256*256.

NES resolution is 256x240, and PocketNES scales a 240x213 pixel window of that down to 240x160. The point is PocketNES style scaling works in practice because it's a lot easier to scale height than to scale width.

The C=64 often uses tile modes, but symmetrically scaling tiles as you suggest would tend to leave an unreadable mess.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39892 - ampz - Wed Apr 13, 2005 6:36 am

tepples wrote:
ampz wrote:
The C64 resolution (320*200) does not quite fit the GBA screen, but NES could be scaled without too visible artefacts, so I guess the same should be doable with C64. Should actually be a bit easier since the NES I think has a troublesome resolution of 256*256.

NES resolution is 256x240, and PocketNES scales a 240x213 pixel window of that down to 240x160. The point is PocketNES style scaling works in practice because it's a lot easier to scale height than to scale width.

The C=64 often uses tile modes, but symmetrically scaling tiles as you suggest would tend to leave an unreadable mess.

The readability can be somewhat improved by averaging two lines rather than simply removing every 4th line.

The DS would be interesting for emulation purposes.. It has the extra CPU power, as well as higher resolution (less scaling) and touchscreen for emulation of keyboards and such.

#39912 - tepples - Wed Apr 13, 2005 2:21 pm

ampz wrote:
tepples wrote:
The C=64 often uses tile modes, but symmetrically scaling tiles as you suggest would tend to leave an unreadable mess.

The readability can be somewhat improved by averaging two lines rather than simply removing every 4th line.

Hardware scaling can't just "average two lines". PocketNES fakes averaging by drawing two lines alternately to the LCD, but if you're using fake averaging vertically, then you can't really use fake averaging horizontally at the same time. Or do you suggest rendering the whole screen in software to begin with?

(Video related comments split from another thread about SID emulation.)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39916 - ampz - Wed Apr 13, 2005 2:51 pm

tepples wrote:
Hardware scaling can't just "average two lines". PocketNES fakes averaging by drawing two lines alternately to the LCD,
I know. That's why the averaged lines in pocketNES flicker slightly.
Quote:
but if you're using fake averaging vertically, then you can't really use fake averaging horizontally at the same time. Or do you suggest rendering the whole screen in software to begin with?

That would probably be the easiest solution. Sprites could still be handled in hardware.
Or perhaps it is possible to do scaled tile modes by building the entire screen using sprites, or multiple tile backgrounds, or both.
C64 bitmap modes would have to be software scaled anyway, but that can probably be done without much extra processing requirements.

EDIT
Hardware scaling should of course not be much of a problem on the DS..
For the GBA, each tile can be displayed in the form av a sprite. Only use 6*6pixels of each sprite, let the rest of the pixels be transparent. There would be 40 sprites per scanline, so the GBA sprite limit is not a problem.

The only thing that would have to be done in software is scaling the individual 8*8 tiles to 6*6 sprites. But that should not be much of a problem since it will only have to be done when the game updates the tile data.
Oh, and of course some hblank DMA will have to update parts of OAM every now and then since there are "only" 128 hardware sprites in the GBA.

#39943 - tepples - Wed Apr 13, 2005 8:12 pm

ampz wrote:
Hardware scaling should of course not be much of a problem on the DS

Unlike many other 3D consoles' pixel shaders, such as those of the N64 and the PSP, the pixel shader in the Nintendo DS does not use linear interpolation. Instead, it uses PS1 style nearest neighbor resampling. However, would it be too hard to write a software downsampler for the ARM9?

Quote:
[For tile modes, t]he only thing that would have to be done in software is scaling the individual 8*8 tiles to 6*6 sprites. But that should not be much of a problem since it will only have to be done when the game updates the tile data.

You haven't seen a lot of "DYCP" demos that dynamically update almost all the tile data every frame. It's not like the NES, where tile data can be updated only during vblank; the Commodore 64 allows write access to tile data almost all the time, with VRAM access being interleaved between the CPU and the PPU just as on the GBA.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39947 - ampz - Wed Apr 13, 2005 9:12 pm

tepples wrote:
ampz wrote:
[For tile modes, t]he only thing that would have to be done in software is scaling the individual 8*8 tiles to 6*6 sprites. But that should not be much of a problem since it will only have to be done when the game updates the tile data.

You haven't seen a lot of "DYCP" demos that dynamically update almost all the tile data every frame. It's not like the NES, where tile data can be updated only during vblank; the Commodore 64 allows write access to tile data almost all the time, with VRAM access being interleaved between the CPU and the PPU just as on the GBA.

Even if tile data is updated all the time in some games and demos, why would that be much of a problem?
Yes, rewriting and scaling tile data probably takes two to three times the cycles compared to just rewriting it. It is still not alot of cycles.
It might cause some games and demos to run a bit slower on the GBA, but most will do just fine. And there would certainly not be any problems on the DS.

#40016 - sgeos - Thu Apr 14, 2005 2:33 pm

ampz wrote:
Hardware scaling should of course not be much of a problem on the DS..
For the GBA, each tile can be displayed in the form av a sprite. Only use 6*6pixels of each sprite, let the rest of the pixels be transparent. There would be 40 sprites per scanline, so the GBA sprite limit is not a problem.

The only thing that would have to be done in software is scaling the individual 8*8 tiles to 6*6 sprites. But that should not be much of a problem since it will only have to be done when the game updates the tile data.

Why not just hardware scale a BG?

-Brendan

#40036 - ampz - Thu Apr 14, 2005 5:17 pm

sgeos wrote:
ampz wrote:
Hardware scaling should of course not be much of a problem on the DS..
For the GBA, each tile can be displayed in the form av a sprite. Only use 6*6pixels of each sprite, let the rest of the pixels be transparent. There would be 40 sprites per scanline, so the GBA sprite limit is not a problem.

The only thing that would have to be done in software is scaling the individual 8*8 tiles to 6*6 sprites. But that should not be much of a problem since it will only have to be done when the game updates the tile data.
Why not just hardware scale a BG?
-Brendan

For one, GBA hardware scaling of BGs does not average pixels.
Second, I don't think the scaleable BGs are big enough IIRC.
Third, scaleable BGs do not support a few essential feature most other consoles do support. Like wrap around. Not sure if the C64 supports this, I would have to look that up.

#40060 - Lord Graga - Thu Apr 14, 2005 9:13 pm

GBA supports wraparound with rotated BG's.

#40063 - tepples - Thu Apr 14, 2005 9:34 pm

Lord Graga wrote:
GBA supports wraparound with rotated BG's.

But are rotated BGs large enough, in terms of number of distinct tiles?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#40066 - ampz - Thu Apr 14, 2005 9:44 pm

I stand corrected.

#40144 - FluBBa - Fri Apr 15, 2005 12:47 pm

tepples wrote:
Lord Graga wrote:
GBA supports wraparound with rotated BG's.

But are rotated BGs large enough, in terms of number of distinct tiles?

In one way, yes. The C64 only has 256 tiles.
But you can change the palette for each(?) tile (which is quite hard in Rot/Scale mode on the GBA as it's 256 color and no palette switch) and it can switch which bank of tiles it uses, and the tiles on the C64 are 1/2bitplane, converting this to 8bitplane on the GBA takes 4/8 times more memory.

Mmm, doesn't sound completly perfect to me.
_________________
I probably suck, my not is a programmer.