Page 9 of 22

Re: Gens4All with Z80 Emulation

Posted: Mon Oct 25, 2021 7:59 pm
by matador
Thanks man. This incredible work.

Re: Gens4All with Z80 Emulation

Posted: Tue Oct 26, 2021 11:54 pm
by KmusDC
Ian Micheal wrote:
KmusDC wrote:Hello bro, excellent contribution, good to see updates for this magnificent emulator. I would like to know how to convert it to an iso for dreamshell. Greetings
as normal that should work use iso make tools once you get the files from abovr un scramble the 1St_read.bin normal stuff

thanks a lot. It works perfect.

Re: Gens4All with Z80 Emulation

Posted: Wed Oct 27, 2021 2:33 am
by TapamN
The example code I posted is equivalent to this:

Code: Select all

void pvr_tex_lmemset32(pvr_ptr_t dst, int l, size_t len) {
	//Set PVR DMA registers
	volatile int *pvrdmacfg = (int*)0xA05F6888;
	pvrdmacfg[1] = pvrdmacfg[0] = 0;
	
	//Convert read/write area pointer to DMA write only area pointer
	void *dmaareaptr = ((uintptr_t)dst & 0xffffff) | 0x11000000;
	
	sq_set32(dmaareaptr, l, len);
}
I've tested it, and it definitely works on real hardware. It's possible that some/all emulators don't support it.
Ian Micheal wrote:

Code: Select all

   //Set QACR registers
   volatile int *qacr = (int*)0xFF000038;
   qacr[1] = qacr[0] = 0x11;
How does this related to

Code: Select all

    /* Set store queue memory area as desired */
    QACR0 = ((((unsigned int)sbuf->vramData)>>26)<<2)&0x1c;
    QACR1 = ((((unsigned int)sbuf->vramData)>>26)<<2)&0x1c;
My qacr[0]/qacr[1] value is just the precalculated result of what's written to QACR0/QACR1. Also, all that needs to be done to generate the QACR value for a given pointer is "(unsigned int)ptr >> 24". The extra shifting and masking is unnecessary.
Ian Micheal wrote: In your sh4 lib

Code: Select all

#define NONCACHED(a) (typeof (&(a)[0]))(((unsigned int)(a)) |  (1 << 29))
#define CACHED(a)    (typeof (&(a)[0]))(((unsigned int)(a)) & ~(1 << 29))
#define OCI_BANK0(a) (typeof (&(a)[0]))(((unsigned int)(a)) & ~(1 << 25))
#define OCI_BANK1(a) (typeof (&(a)[0]))(((unsigned int)(a)) |  (1 << 25))
That's not SQ stuff. It's for controlling how the SH4's cache is accessed.

Re: Gens4All with Z80 Emulation

Posted: Wed Oct 27, 2021 2:46 am
by Ian Micheal
Thank you TapmN! I understand now thank you have it working on hardware your a Genus you know it :) :D

Re: Gens4All with Z80 Emulation

Posted: Wed Oct 27, 2021 3:13 am
by Ian Micheal
I have no idea how you come up with this or even thought of it lol

Re: Gens4All with Z80 Emulation

Posted: Wed Oct 27, 2021 5:37 am
by fafadou
You are very good @tapamN, awesome work.

Re: Gens4All with Z80 Emulation

Posted: Wed Oct 27, 2021 11:46 am
by Ian Micheal
I have been using this for years i use it few of my ports I came up with

Code: Select all

void dc_txr_dma_cpy(void *dest, void *src, int n)
{
	long i = n/32;
	char	*ptr=dest;


	do 
	{
		asm("ocbp @%0" : : "r" (ptr));
		ptr += 32;
	} while (-- i);

		pvr_txr_load_dma(dest, src, n,0,NULL,0);

}

Re: Gens4All with Z80 Emulation

Posted: Thu Oct 28, 2021 5:09 pm
by Ian Micheal
Your SQ way is faster then pvr dma block trasnfer This is my benchmark using SDL dreamhal 1.0

Code: Select all

TapmN SQ ```32x32 blits (blits/sec):   3276.8  4275.57  3091.32   4371.4 ```

Code: Select all

 ``` Pvr DMA 32x32 blits (blits/sec):  3056.72  3934.68  2868.35  3927.13 ```

Re: Gens4All with Z80 Emulation

Posted: Fri Oct 29, 2021 7:54 pm
by KmusDC
https://youtu.be/2r9Dkiq2-IY

Re: Gens4All with Z80 Emulation

Posted: Sat Oct 30, 2021 12:43 am
by dcsteve
Look 8 minutes into that video. Contra Hard Corp is perfect. Sound and drums are spot on crystal clear.