Author Topic: CRTC - specific question (registers 8 and 6)  (Read 3190 times)

0 Members and 1 Guest are viewing this topic.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1014
  • Likes Given: 926
CRTC - specific question (registers 8 and 6)
« on: 23: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:
Code: [Select]
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 ;)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Longshot

  • CPC664
  • ***
  • Posts: 99
  • Country: fr
    • Logon System Web Site
  • Liked: 86
  • Likes Given: 20
Re: CRTC - specific question (registers 8 and 6)
« Reply #1 on: 11: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
Rhaaaaaa

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1014
  • Likes Given: 926
Re: CRTC - specific question (registers 8 and 6)
« Reply #2 on: 12: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)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1014
  • Likes Given: 926
Re: CRTC - specific question (registers 8 and 6)
« Reply #3 on: 12: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]
« Last Edit: 12:46, 22 October 09 by Devilmarkus »
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1014
  • Likes Given: 926
Re: CRTC - specific question (registers 8 and 6)
« Reply #4 on: 12: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]
« Last Edit: 13:03, 22 October 09 by Devilmarkus »
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1014
  • Likes Given: 926
Re: CRTC - specific question (registers 8 and 6)
« Reply #5 on: 14: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]
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1014
  • Likes Given: 926
Re: CRTC - specific question (registers 8 and 6)
« Reply #6 on: 14: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]
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Longshot

  • CPC664
  • ***
  • Posts: 99
  • Country: fr
    • Logon System Web Site
  • Liked: 86
  • Likes Given: 20
Re: CRTC - specific question (registers 8 and 6)
« Reply #7 on: 15: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.
Rhaaaaaa

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1014
  • Likes Given: 926
Re: CRTC - specific question (registers 8 and 6)
« Reply #8 on: 15:55, 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.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 391
  • Likes Given: 60
Re: CRTC - specific question (registers 8 and 6)
« Reply #9 on: 02:34, 26 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) {

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1014
  • Likes Given: 926
Re: CRTC - specific question (registers 8 and 6)
« Reply #10 on: 10:02, 26 October 09 »
Yes, otherwise you're introducing more tests every cycle.

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

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.
« Last Edit: 10:06, 26 October 09 by Devilmarkus »
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 391
  • Likes Given: 60
Re: CRTC - specific question (registers 8 and 6)
« Reply #11 on: 01: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

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1014
  • Likes Given: 926
Re: CRTC - specific question (registers 8 and 6)
« Reply #12 on: 02:24, 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.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1014
  • Likes Given: 926
Re: CRTC - specific question (registers 8 and 6)
« Reply #13 on: 14: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:
Code: [Select]
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  ::)
« Last Edit: 14:48, 28 October 09 by Devilmarkus »
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release