CPCWiki forum

General Category => Emulators => Topic started by: Devilmarkus on 21:23, 21 October 09

Title: CRTC - specific question (registers 8 and 6)
Post by: Devilmarkus on 21:23, 21 October 09
Hi together,
I need your help.

I am improving JavaCPC's CRTC emulation (types 1 and 0)

Here is a piece of new code I added into Basic6845 emulation:
public void checkHDisp(){
     if (hDisp){
         if (CRTC_type == 0){
             if ((reg[8]&0x030)==0x30)
                 listener.hDispEnd();
             else
                 if ((reg[8]&0x030)==0x00)
                     listener.hDispStart();
         } else {
             if (reg[6]!=0)
                 listener.hDispStart();
             else
                 listener.hDispEnd();
         }
     }
  }


The question I have now is:
- Is horizontal display really affected by register 6 in CRTC 1 and by register 8 in CRTC 0?
- If this is right: Is my register 6 check correct? (register 8 reacts correct as I can see)

Info to Executioner:
This code is part of Basic6845.java but is called from GateArray.java @ begin of each cycle.
All demos I tested works fine with this patch now.
(Big'o'full'o'demo from Arkos for example, or the intro of "Meuuuuhting demo" or also the scroller in first part of "DemoIzArt")
This patch is also responsible, that the "tetris effect" and the horizontal scroller in the demo "From Scratch" are fully visible.

Maybe WinApe only uses a routine like this every "setRegister"?
- Put it to begin of each cycle and check "From Scratch" demo ;)
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Longshot on 09:26, 22 October 09
You need to verify on a real cpc but setting reg 6 to 0 in some case (i don't remember when) invalidate the hdisp start.
So btw, if reg[6]!=0, you should have to test if it was previously zeroed and if the specific condition was true before to set hdisp on again.

Another thing too is the memory refresh. But you cannot do nothing about that  :P
When hdisp is off, the memory is no more read by crtc for display.
The memory refresh on cpc is linked to two things :
R register
Low byte of the memory crtc pointer
For each low byte (RR=R or CL=CRTCPtrLow) all the high adresses are refreshed.
xxRR and xxCL
If you set hdisp off, the crtc pointer is no more counting from xx00 to xxFF
R is counting the opcode number executed by Z80A
If you create a code (with a loop for example) where R is missing some values, the memory is no more refreshed and is destroyed.
If, for example, R is no more taking the value 06, the memory 0006, 0106, 0206, ..., FF06 is destroyed
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Devilmarkus on 10:25, 22 October 09
It seems that I used it correctly.
JavaCPC can show effects that cannot be shown by other emulators.

Example is "Not Dead" demo by Arkos (CRTC 1, uses Register 6)
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Devilmarkus on 10:43, 22 October 09
The demo "CPC Meuuuhting 2008" shows a scroller @ bottom of the menu part.
When you have CRTC 0, it uses register 8 for this (Which works on all emulators I tested)
When you have CRTC 1, it uses the same scroller, but with register 6 (Which doesn't work in other emulators)

Another example is "23-24-25" demo.
It shows a register 6 effect in the 2nd part, after you waited a longer time.
This effect is also not viewable with other emulators.

[cpcsmall=http://cpcwiki.eu/forum/index.php?action=dlattach;topic=408.0;attach=206,none,1]CPC6128[/cpcsmall]
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Devilmarkus on 10:49, 22 October 09
Not Dead demo running:
[cpcsmall=http://cpcwiki.eu/forum/index.php?action=dlattach;topic=408.0;attach=207,none2,1]CPC6128[/cpcsmall]
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Devilmarkus on 12:30, 22 October 09
Big'o'full'o'demo part 3 (CRTC 0, register 8 )
[cpcsmall=http://cpcwiki.eu/forum/index.php?action=dlattach;topic=408.0;attach=208,big,0]CPC6128[/cpcsmall]
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Devilmarkus on 12:45, 22 October 09
Don't forget the demo "From Scratch" which also uses register 6 to draw some effects:
[cpcsmall=http://cpcwiki.eu/forum/index.php?action=dlattach;topic=408.0;attach=209,scratch,1]CPC6128[/cpcsmall]
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Longshot on 13:29, 23 October 09
I don't say that the rule in your emulator for reg 6 and reg 8 is wrong.
I say that it's not complete, even if lot of demoes run with this code.
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Devilmarkus on 13:55, 23 October 09
Quote from: Longshot on 13:29, 23 October 09
I don't say that the rule in your emulator for reg 6 and reg 8 is wrong.
I say that it's not complete, even if lot of demoes run with this code.

So, show me disks with demos, which use this "incomplete" things... Please...
(Basic 6845 only sends memory addresses to GateArray but does not change CPC memory)

It's also not the complete emulation for REG6/8. It's only the border which is changed here.
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Executioner on 01:34, 26 October 09
Quote from: Devilmarkus on 21:23, 21 October 09
Info to Executioner:
This code is part of Basic6845.java but is called from GateArray.java @ begin of each cycle.
All demos I tested works fine with this patch now.
(Big'o'full'o'demo from Arkos for example, or the intro of "Meuuuuhting demo" or also the scroller in first part of "DemoIzArt")
This patch is also responsible, that the "tetris effect" and the horizontal scroller in the demo "From Scratch" are fully visible.

Maybe WinApe only uses a routine like this every "setRegister"?
- Put it to begin of each cycle and check "From Scratch" demo ;)

Yes, otherwise you're introducing more tests every cycle. I'm also surprised that the code works since there is no way to turn the hDisp back on, it's all inside an if (hDisp) {
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Devilmarkus on 09:02, 26 October 09
Quote from: Executioner on 01:34, 26 October 09
Yes, otherwise you're introducing more tests every cycle.

Not exactly.
I call this in GateArray.java's 'cycle' after scanStarted.
   public void cycle(){
    if (scanStarted) {
      crtc.checkHDisp();
.......


Quote from: Executioner on 01:34, 26 October 09
I'm also surprised that the code works since there is no way to turn the hDisp back on, it's all inside an if (hDisp) {

Why surprised?
hDisp is turned on by rest of routines. (I did not touch the other hDisp calling routines)

Maybe there's a better place to call this routine (without if (hDisp) {) but in setRegister it's definetively not working properly.
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Executioner on 00:53, 28 October 09
Hi Markus,

Do you have any CVS or SVN repository now? That would make it much easier to help with the code.

Cheers,
Richard
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Devilmarkus on 01:24, 28 October 09
Quote from: Executioner on 00:53, 28 October 09
Hi Markus,

Do you have any CVS or SVN repository now? That would make it much easier to help with the code.

Cheers,
Richard

Yes, I have.
SVN is active...
http://sourceforge.net/projects/javacpc

Please send me again a request via sourceforge.
The account once needed to be deleted and I had to re-activate it.

I will update SVN tomorrow with sources done today.
Title: Re: CRTC - specific question (registers 8 and 6)
Post by: Devilmarkus on 13:46, 28 October 09
SVN is up to date now.
You can browse it here:
http://javacpc.svn.sourceforge.net/viewvc/javacpc/

I also granted you SVN read/write access.

Use this config:
svn co http://javacpc.svn.sourceforge.net/svnroot/javacpc javacpc

https:// doesnt seem to work here properly.

Cheers,
Markus

P.S.: I know 80% of my codes are crap, so please have mercy  ::)
Powered by SMFPacks Menu Editor Mod