Emulation questions

Discuss the games, programs, utilities... and vaporware!
Post Reply
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Emulation questions

Post by @username@ » Thu Oct 24, 2013 1:54 pm

Ok, if this information has been documented somewhere, please give me a link.

1. How does the memory mapping work?

Is it similar to other consoles, where a page/bank is selected, an invalid page/bank simply returns the last page?

2. Has the BIOS been documented like the ColecoVision one? Is there a list of functions/addresses, boot sequence?

3. CV Memory Map - is this correct?

0000 - 00FF - Page Zero RAM
0100 - 03FF - RAM
1000 - 1003 - PIA including SN76489
2000 - 2001 - VDP TM9918A Read
3000 - 3001 - VDP TM9918A Write
4000 - BFFF - ROM / Cartridge Addressable
C000 - F7FF - Unkown? Mess suspects Centronics at E800-E801?
F800 - FFFF - BIOS ROM

Thanks for reading.
Last edited by @username@ on Sat Dec 27, 2014 9:58 pm, edited 1 time in total.
User avatar
carlsson
Posts: 507
Joined: Fri Jun 13, 2008 7:39 am
Location: Västerås, Sweden

Re: Emulation quesions

Post by carlsson » Thu Oct 24, 2013 10:03 pm

Not sure what you mean with memory mapping. As far as I know, all ROM, RAM and I/O are always within the 64K addressing range of the 6502.

The BIOS has been briefly documented by Barry Klein, and Mobsie is currently going through the BIOS more thoroughly for useful routines.

The memory map seems reasonable. IIRC the RAM is mirrored through the first 4K but it might be a hardware artifact rather than on purpose. See also previous threads in the homebrew section.

Are you trying to develop an own emulator or improve an existing one?
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Re: Emulation quesions

Post by @username@ » Fri Oct 25, 2013 1:24 am

hi carlsson,
carlsson wrote:Not sure what you mean with memory mapping. As far as I know, all ROM, RAM and I/O are always within the 64K addressing range of the 6502.
Perhaps the wrong choice of words. What I'd like to understand is how the cartridge, although it physically only contains say 4k ROM, can appear to be available at several mirrored locations.
Is this the wiring on the cart itself, or does the CV do this through the bus connection for example?
carlsson wrote:Are you trying to develop an own emulator or improve an existing one?
I always like to look at how emulators work, and enjoy learning new things as I go along.

Most folks would say look at Mame or Mess, but to me, those code bases have become so huge and intertwined, that it's getting harder to take a specific machine in isolation and understand it.

I am looking at FunnyMu (Unofficial), with a view to maybe fixing the sound core. I've restored the polyphony, so it sounds more like Mess. However, I'd like to knock up my own SN76489 core, with the documentation available.
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Emulation quesions

Post by Mobsie » Fri Oct 25, 2013 9:33 am

Hi, i try to post soon the Bios routines i found. Is not only the soundplayer that all games use, there are special copy routines. The games use this routines to setup the sprite and char graphics, only one call and the bios copy from to ROM to different places in the VDP RAM, all parameter are set near the place where we set the VDP reg. and the interrupt.

I also don`t like Mess etc., i prefer a great emu for each machine. I have one for the VIC-20, for the CreatiVison etc.

What i miss as programmer is the possibility to show some register like the VDP etc. It helps a lot when you write games. The Classic99 Emu, is Ti99/4a, is a perfect example because i can every time watch the VDP Register etc. to control VDP Reg. switching and so on.

If someone can integrate this in the Funnymu, the Luca Version, it will be perfect.
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Emulation Questions

Post by @username@ » Sun Oct 27, 2013 12:40 am

Hi Mobsie,

Having read your post about the BIOS player, I decided to go through the cartridges to have a listen. I've now saved those out to an event log, as the more data I have - the better chance of getting it right - hopefully!
This list should be most of them - the offset on the end of each is where to call.

Code: Select all

AIRSEA-BE2D AIRSEA-BF54
ASTROPIB-B5BE ASTROPIB-B896
AUTOCHAS-B4C5 AUTOCHAS-B514 AUTOCHAS-B51C AUTOCHAS-BBFF
CHOPPER-7A34 CHOPPER-8A8C
CRAZYCH-B10C CRAZYCH-B13A CRAZYCH-B206
DEEPS8K-B5E9 DEEPS8K-B618 DEEPS8K-B639
MOUSEPUZ-A0FF MOUSEPUZ-AB9D
PLANET8K-B5E9 PLANET8K-B619 PLANET8K-B639
POLICEJ1-B435 POLICEJ1-B5DF POLICEJ1-B70B POLICEJ1-B716
TANKAT8K-B52E TANKAT8K-B563
TENS8K-B100
I have these stored in simple CPUClockCount-PSGEvent files. If anyone reading this has any of the games, an audio recording of a real Creativision playing would be great!

I also investigated the memory map again, and try as I might, I can't get a single ROM to read or write from outside it's load addresses. This leads me to believe that perhaps only a 2K mapping table is required.
For example, I looked at the same ROM in different sizes. Locomotive10K and Locomotive12K. The 'mirrored' 2K is just a repeat of the previous 2K. Likewise, with Tennis 6K and 8K, the 'mirrored' section is
2K of 0xFF - or no memory present. So I think the mirroring is a red herring.

Again, if anyone knows of a ROM which does read from a mirrored page, please point me at it - so I can better understand the page selection process.

The problem of running the Video Diagnostic cartridge is due to a bug in the VDP/SDL implementation of FunnyMu. You can get it to go by allocating another 4 pages (8k) of VRAM. Maybe it's using one of the
undocumented modes of the TMS9918 - who knows!.

Anyhoo - that''s enough rambling for one day!
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Emulation quesions

Post by Mobsie » Sun Oct 27, 2013 10:35 am

I try to use some Special 9918 Mode and dont work on emu only on real
CV.
In the Scramble Demo i work on at the Moment i use 4 different pattern
Tables to make 2 Pixel softscrolling , later in a Real Game i will use more
To make Smoth 1 Pixel scrolling, Hope this will work in the emu.
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Re: Emulation quesions

Post by @username@ » Sun Oct 27, 2013 12:58 pm

creatiVision cartridge mapping thoughts

16 bit address == BBBB PAAA AAAA AAAA

Where B == Bank Select, P == Page Select and A == 11 Bit Address

My theory appears to be born out with the cartridges available.

To demonstrate, take a look at Deap Sea Rescue 6KB and 8KB versions.

Both load both pages on bank $B, thus

BBBB P ADDRESS
------ --- ----------
1011 1 0 - $7FF
1011 0 0 - $7FF

Deep Sea Rescue 8K then loads bank $A, as before

BBBB P ADDRESS
------ --- ----------
1010 1 0 - $7FF
1010 0 0 - $7FF

Deep Sea Rescue 6K only loads

BBBB P ADDRESS
------ --- ----------
1010 0 0 - $7FF

So how do they both work?

I suspect that in a real cartridge, the PAGE line is simply not connected. Thus selecting 0x800 or 0x000 would
read the same data. I don't believe the 8K version of Deep Sea Rescue is valid. Why would any developer place an
extra 2KB ROM, then only use THE EXACT SAME 7 BYTES from the previous 2KB? Makes no sense to my tiny mind ;)

Likewise, Locomotive 10K and 12K versions can be explained the same way. BANK $7 only contains 2KB of valid data.
Locomotive 12K has the last 2KB repeated in the dump, which can be explained with the BANK/PAGE theory.

Again, the mirrored/reflected RAM works the same way. After selecting BANK 0, any 12 bit address select will only
read/write the lower 1KB, the other lines are simply ignored. Suspect these actually are not connected to anything.

The above can be further born out by looking at the 'mirrors', and how they occur. To 'mirror' an entire 4K BANK
is easily understood. Take any 4KB cartridge and map it to BANK 0x0B. However, only connect bit 0. Now any ODD BANK
will appear to be the same data. So a 4KB cartridge would be available at BANKS $5,$7,$9 and $B.

While this is all theoretical, it helps to understand the emulator when an invalid address is encountered. Is it a
problem with the emulator?, or the dump?, for example.

Expect more rabbid ramblings soon ... and thanks for reading this far!!
Mobsie wrote:I try to use some Special 9918 Mode and dont work on emu only on real
CV.
In the Scramble Demo i work on at the Moment i use 4 different pattern
Tables to make 2 Pixel softscrolling , later in a Real Game i will use more
To make Smoth 1 Pixel scrolling, Hope this will work in the emu.
Two things come to mind
1) Can you record audio of one of the release games you have?
2) Have you tried,say, doubling the emulator VRAM to see if that works?
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Emulation quesions

Post by Mobsie » Tue Oct 29, 2013 11:07 am

i can record ALL games for you, i have all. What do you need exact? The main jingle and the sound effects i think, right?
And how you want the record, is enough to record quick with iPhone and push to Youtube for you, or you need better quality?
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Emulation quesions

Post by Mobsie » Tue Oct 29, 2013 1:02 pm

Hi, here is a quick and dirty iPhone record. http://www.youtube.com/watch?v=lJgDunyAyb4
Is not okay i think. On http://www.obsieger.de/deepsea.wav you can listen an wav i record with Yamaha Soundrecorder. I don`t know is okay for you or not. When not i must use the Audio-Out and record direct. Let me know.
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Re: Emulation questions

Post by @username@ » Tue Oct 29, 2013 5:23 pm

Mobsie wrote:Hi, here is a quick and dirty iPhone record. http://www.youtube.com/watch?v=lJgDunyAyb4
Is not okay i think. On http://www.obsieger.de/deepsea.wav you can listen an wav i record with Yamaha Soundrecorder. I don`t know is okay for you or not. When not i must use the Audio-Out and record direct. Let me know.
Thanks Mobsie, made my day! The iPhone recording shows that the seashells etc are not in the video from the beginning - whew! - I thought i'd missed something!
The sound is a little quiet - but not to worry I can filter with audacity to get the volume up - and it's enough for me to compare emulated sound vs real thing in terms of timing.

I think I'm pretty close, my "LEGO" emulator is working ok. If you're ok with running it, provided you're on windows or linux, I can stick a link to a copy. If you're on OSX, hey - want to compile something :)
Post Reply