Emulation questions

Discuss the games, programs, utilities... and vaporware!
User avatar
Mobsie
Posts: 709
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Emulation quesions

Post by Mobsie » Tue Oct 29, 2013 8:34 pm

Hi, i am happy to help you. Yes with the seashells is strange, i think is a bug because looks not great. For your info, i am OSX User and run the Funnymu in a "VirtualBox" Win7 Machine.
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 10:04 pm

Mobsie wrote:Hi, i am happy to help you. Yes with the seashells is strange, i think is a bug because looks not great. For your info, i am OSX User and run the Funnymu in a "VirtualBox" Win7 Machine.
This should be interesting then :)

Here's a link to a Windows x86(32-bit) test. Just undo to a directory, click the app and it should go. It is very minimal - but as you use FunnyMu, you can follow the structure.

Can you compile X-Code on your OSX box? or Unix (MacPorts) style? I think SDL 2 is available, for it, but without a mac ...

Does your copy of Crazy Chicken have the dot eating sound all through the intro, or does it stop occasionally?

Thanks again!

http://tinyurl.com/nt2x77x
User avatar
Mobsie
Posts: 709
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Emulation quesions

Post by Mobsie » Wed Oct 30, 2013 7:53 am

Hi, yes i have xcode installed and also SDL. I long time not program on MAC because i only write for classic and now only CV. But with some time to remember i can compile.

"Does your copy of Crazy Chicken have the dot eating sound all through the intro, or does it stop occasionally? "

OH?? This i don`t know, i will check today.
I record some more sound today for you, with more volume.
User avatar
Mobsie
Posts: 709
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Emulation quesions

Post by Mobsie » Wed Oct 30, 2013 8:52 am

Hi again, i test your EMU and works. Great work.

Here you can see with AutoChase: http://www.youtube.com/watch?v=HmHx6yB_LT0

Here with my actual Demo i upload soon to the forum: http://www.youtube.com/watch?v=ND6c0ruEnoU
Both works PERFECT!

Only with DeepSea i got an Illegal-Opcaode Error, see the pic. But maybe is because i change a lot in the game-rom, i try the original later.
Foto.JPG
Again, great work and maybe at the end you can insert my "Dream Feature" the Register display.
You do not have the required permissions to view the files attached to this post.
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Re: Emulation quesions

Post by @username@ » Wed Oct 30, 2013 1:21 pm

@Mobsie - Thanks for testing so quickly! Your demo looks very cool!!

I will put here how I think the PIA works, and maybe it will help you too, if you need a few cycles back. Works ok in emulator - may die on a real machine :)
If anyone knows this to be wrong, please, please let us know!

M6821 PIA

Memory Mapped Input / Output (MMIO) in the creatiVision is:

Code: Select all

$1000 PIA 0 Data Direction Register / Peripheral Data Register (DDR/PDR)
$1001 PIA 0 Control Register (CR)
$1002 PIA 1 DDR / PDR
$1003 PIA 1 CR
The control register is described as

Code: Select all

 MSB                                                  LSB
 +------+------+------+------+------+------+------+------+
 | IRQ1 | IRQ2 |  C2  | C2   | C2   | DDR  | C1   | C1   |
 | FLAG | FLAG |  DIR | ST1  | ST2  | PDR  | IRQ1 | IRQ2 |
 +------+------+------+------+------+------+------+------+
 |  RO  |  RO  |  RW  |  RW  |  RW  |  RW  |  RW  |  RW  |
 +------+------+------+------+------+------+------+------+
So from this, dealing with IRQ lines etc, is pretty straight forward. From the application notes, IRQs, if requested, are raised on I/O completion. For an emulator, this is logically, WRITE DATA, transpose BITs 0 and 1 to BITs 6 and 7. In code (CR & $3) << 6 | (CR & $3F). BIT 2 is used to select whether the data port should present either the DDR or the PDR on the next read/write. As it's name suggests, the DDR controls which BITs of the 8bit data bus are input (0) or output (1).

An example from BIOS select PSG function:

Code: Select all

ROM:FE67                 LDA     #$22     ; CR Select IRQ1 for completion on DIR output. Next read/write is for DDR
ROM:FE69                 STA     $1003    ; Set PIA 1
ROM:FE6C                 LDA     #$FF     ; Set DDR to 0x11111111 - All pins output
ROM:FE6E                 STA     $1002    ; Update DDR
ROM:FE71                 LDA     #$26     ; CR select IRQ1 for completion on DIR output. Next read/write is for PDR
ROM:FE73                 STA     $1003    ; Set it
ROM:FE76                 RTS
The PSG is then written by the function at FE77

Code: Select all

ROM:FE77                 STA     $1002    ; Write A to PSG
ROM:FE7A
ROM:FE7A loc_FE7A:         
ROM:FE7A                 LDA     $1003    ; Read PIA 1 CR
ROM:FE7D                 BPL     loc_FE7A ; Wait for IRQ1 to raise, signalling completion
ROM:FE7F                 LDA     $1002    ; Read data from PSG. Reset IRQ1/2 to 0.
ROM:FE82                 RTS
Reading the keyboard and joysticks is somewhat different - and luckily for the emulator, uses polled I/O. The keyboard setup functon at FFA0 sets this up.

Code: Select all

ROM:FA00                 LDA     #0
ROM:FA02                 STA     $1001           ; PIA 0 no IRQs, select DDR on next read/write
ROM:FA05                 STA     $1003           ; PIA 1 no IRQs, select DDR on next read/write
ROM:FA08                 STA     $1002           ; PIA 1 8bits INPUT
ROM:FA0B                 LDA     #$F
ROM:FA0D                 STA     $1000           ; PIA 0 Lower Nibble as output
ROM:FA10                 LDA     #4
ROM:FA12                 STA     $1001           ; Select PDR
ROM:FA15                 STA     $1003           ; Select PDR
ROM:FA18                 LDA     #$F7            ; High nibble is discarded. Low nibble is inverted. So 7 inverted == 8, or I/O matrix 4.
ROM:FA1A                 LDX     #3
ROM:FA1C
ROM:FA1C loc_FA1C:                              
ROM:FA1C                 STA     $1000           ; Select mux - high nibble ignored.
ROM:FA1F                 PHA
ROM:FA20                 LDA     $1002           ; Read byte
ROM:FA23                 EOR     #$FF            ; Invert input
ROM:FA25                 STA     $18,X
ROM:FA27                 PLA
ROM:FA28                 SEC
ROM:FA29                 ROR     A               ; $FB / $FD / $FE  [ 4 / 2 / 1 ]
ROM:FA2A                 DEX
ROM:FA2B                 BPL     loc_FA1C        ; Countdown X to 0
ROM:FA2D                 STA     $1000           ; Reset. A=FF == Matrix 0
ROM:FA30                 JSR     sub_FE67        ; Select SN76489 OUT
This is where you can save some cycles. By writing your own keyscan, you don't always need all four matrices. For example, matrix 1 will return all bits needed for joystick 1 and left button. Again, thanks for reading this far, let me know if any of it''s just plain wrong!
Last edited by @username@ on Mon Nov 11, 2013 6:50 pm, edited 3 times in total.
User avatar
Mobsie
Posts: 709
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Emulation quesions

Post by Mobsie » Thu Oct 31, 2013 11:45 am

here 2 more videos for you, hope the sound help you.

Crazy Chicky : http://www.youtube.com/watch?v=WGAGuXk31nA

Mouse Puzzle : http://www.youtube.com/watch?v=smUxS-M70j8
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Re: Emulation quesions

Post by @username@ » Thu Oct 31, 2013 2:27 pm

Mobsie wrote:here 2 more videos for you, hope the sound help you.

Crazy Chicky : http://www.youtube.com/watch?v=WGAGuXk31nA

Mouse Puzzle : http://www.youtube.com/watch?v=smUxS-M70j8
Good news on Crazy Chick - the sound does indeed stop!

Bad news on Mouse Puzzle .... seems I have some further investigation into the periodic sound counter and clock. The drum beat is way too loud in the default SN76489A driver.

I've put together another binary for you, this time with some switches.

-b load alternate bios - needs full path
-r load alternate rom - needs full path
-f fullscreen 4:3 aspect
-v mobsie VDP dump. If launched with -v, use F12 to pause, run to next change. F11 terminates debug log.

Thanks again!

Now I'll go and look at the sound again ...
Last edited by @username@ on Fri Nov 01, 2013 10:55 pm, edited 1 time in total.
User avatar
Mobsie
Posts: 709
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Emulation quesions

Post by Mobsie » Thu Oct 31, 2013 4:04 pm

Great! Thanks again.
The VDP Dump is what i need, perfect.
The fullscreen also works perfect. The normal window mode is now double size always. Maybe you can make here a switch, i like the small window as before.
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Re: Emulation quesions

Post by @username@ » Thu Oct 31, 2013 9:09 pm

Ok Mobsie, another one there now - use -h to show options.

I've also added LLIST/LPRINT to a text file for BASIC. I've just started looking at how CLOAD/CSAVE work - so any info on that would be helpful!. I can see that it sets a clock pulse running, but no clue for now on how it modulates against it!
Hope you like the latest sound :)
User avatar
Mobsie
Posts: 709
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Emulation quesions

Post by Mobsie » Fri Nov 01, 2013 7:40 am

have you made new version? I ask because you have not attach one. For the CLOAD and CSAVE i know that Carlson do a lot with this and TOM who build the interface for Commodore Tape.
Post Reply