CPCWiki forum

General Category => Programming => Topic started by: arnoldemu on 08:15, 27 June 16

Title: CRTC Type 2 - it's not that bad!
Post by: arnoldemu on 08:15, 27 June 16
I have tested type 2 CRTC a lot.

Really, it's not as bad as people say. Yes it has a couple of problems, but I have learnt the following:

- for R1 it acts like all other CRTCs
- for R6 it acts like type 0
- for R4 and R7 it's similar to type 0.
- R3 is like type 1.
- Set R12/R13 before the HDISP (R1) on the last scan-line for it to be used in the next frame
- Do not set R2+R3>R0
- When R4=0 and R9=0, there are two possibilities.
a) You will get a display as if you set R4 to 128. 1 scanline per char. Oh and it doesn't matter what R7 you use, it will trigger because 127 is the max for R7!
b) No display, possibly border.

I almost got R4=0, R9=0 to work. I tried to force it so that R4 would generate 128 lines. Then set R1>R0 to repeat the line. Then change R12/R13 before HDISP to change screen address. A few lines later I would then set R4 back to the value I wanted.

It *almost* worked.


I also found type 1 was the easiest to program.

Type 0, type3 and type 4 were joint next.

Type 2 was the hardest but if you think cleverly a lot of effects can be done on all.

Title: Re: CRTC Type 2 - it's not that bad!
Post by: robcfg on 08:28, 27 June 16
That's pretty useful info, thank you!
Title: Re: CRTC Type 2 - it's not that bad!
Post by: Overflow on 09:40, 27 June 16
Nice reading, thank you.

Note that I can't help! I mean: I rely on emulators to get fx compatible with all CRTCs. :picard:

Quote from: arnoldemu on 08:15, 27 June 16Type 2 (...) the hardest but if you think cleverly a lot of effects can be done on all.
I agree. YAP! runs on all CRTCs with exactly same code.

Then, I have mixed feelings. Whoever can choose whatever platform for a demo: calculator, enhanced ZX, own cpu built on a FPGA... So, it is very acceptable to forget CRTC2, or even use CRTC1-specific tricks for an unbelievable screen. That said, well, I feel bad when I read "Amstrad CPC" as platform. I believe one could write something similar starting with "Hey! this does not run on my Amstrad CPC... 464 cos' it requires 1) a disk drive 2) 128Kb".

Conclusion? none! but thank you for pointing out that a lot of fx can be done on all CRTCs.
Title: Re: CRTC Type 2 - it's not that bad!
Post by: AMSDOS on 10:40, 27 June 16
Still, I think my mind is too primitive for that style of programming.  :-[
Title: Re: CRTC Type 2 - it's not that bad!
Post by: TFM on 17:16, 27 June 16
Remember days when CRTC0 ruled the world and 1 was called "Bad" (while 2 was unknown).  ;D
Title: Re: CRTC Type 2 - it's not that bad!
Post by: Overflow on 17:35, 27 June 16
@Amsdos: thanks! this is a nice touch of humour.  :)


@TFM (http://www.cpcwiki.eu/forum/index.php?action=profile;u=179): remember... when we were young!? ouch! this is a sucker punch.
Indeed: in the early years I got a crtc0 qwerty cpc6128 imported from England.
I did not understand why my very first "overflow tome 1" did not run fine... on some monitors I thought!
Note that at that time, some guys did know what was going on: see Crafton&Xunk scrolling-in-the-border screen;
it had been inhibited on crtc2 which couldn't handle it (R2+R3>R0 removes VSYNC, thanks ArnoldEmu).
Title: Re: CRTC Type 2 - it's not that bad!
Post by: eliot on 17:44, 27 June 16
Quote from: arnoldemu on 08:15, 27 June 16
I have tested type 2 CRTC a lot.

Really, it's not as bad as people say.


The Benediction's part in the 30YMD (Q4P) works on CRTC2. There is NO adaptation for any CRTC... Funny exercise!
Title: Re: CRTC Type 2 - it's not that bad!
Post by: MaV on 18:13, 27 June 16
Yay for Benediction! Supporting all CRTC chips. ^_^
Title: Re: CRTC Type 2 - it's not that bad!
Post by: TFM on 18:21, 27 June 16
Quote from: Overflow on 17:35, 27 June 16
@TFM (http://www.cpcwiki.eu/forum/index.php?action=profile;u=179): remember... when we were young!? ouch! this is a sucker punch.
Indeed: in the early years I got a crtc0 qwerty cpc6128 imported from England.
I did not understand why my very first "overflow tome 1" did not run fine... on some monitors I thought!
Note that at that time, some guys did know what was going on: see Crafton&Xunk scrolling-in-the-border screen;
it had been inhibited on crtc2 which couldn't handle it (R2+R3>R0 removes VSYNC, thanks ArnoldEmu).

At least we're not female, so we can feel young for quite a while more.  ;D

My first CPC had a CRTC0 too, then it broke (stupid my touched the monitor and the joystick port at the same time by accident). Got a replacement from the store, had no CRTC0 any longer.  :-X
(But still having Tome 1 on one of my discs  :) )
Title: Re: CRTC Type 2 - it's not that bad!
Post by: Overflow on 19:05, 27 June 16
Quote from: MaV on 18:13, 27 June 16
Yay for Benediction! Supporting all CRTC chips. ^_^
+1
Title: Re: CRTC Type 2 - it's not that bad!
Post by: fgbrain on 19:14, 27 June 16
 Ι  agree !  According to my tests I remember these: (for crtc 2 motorola type)

Set reg3 to 9 and you can set reg2 to leftmost screen.

When reg1>reg0 , line per line splitting is possible too!

What we couldnt achieve  (back in the 90s) was vertical splitting on type2...
[not that I really master this technique anyway]
Title: Re: CRTC Type 2 - it's not that bad!
Post by: PulkoMandy on 08:40, 28 June 16
Quote from: eliot on 17:44, 27 June 16

The Benediction's part in the 30YMD (Q4P) works on CRTC2. There is NO adaptation for any CRTC... Funny exercise!


Same for Shinra's part in the 30YMD, and all other demos from Shinra :)
Title: Re: CRTC Type 2 - it's not that bad!
Post by: roudoudou on 08:46, 28 June 16
Quote from: eliot on 17:44, 27 June 16

The Benediction's part in the 30YMD (Q4P) works on CRTC2. There is NO adaptation for any CRTC... Funny exercise!


Must we disassemble your code or you may write an instructive article about the technic you used?  ;D
Title: Re: CRTC Type 2 - it's not that bad!
Post by: PulkoMandy on 09:30, 28 June 16
The source for Shinra part is available: GitHub - pulkomandy/30years (https://github.com/pulkomandy/30years)


Nothing special about the techniques used, it just takes care to do never do screen splits in the first character line of a CRTC screen (so you can't do line-by-line splitting, but most effects are more interesting with 2-line by 2-line splits which allows for more patterns and dithering in the graphics anyway)


If you are only interested in the CRTC handling code, have a look at this file which implements the single effect in the part:
30years/colors.z80 at master · pulkomandy/30years · GitHub (https://github.com/pulkomandy/30years/blob/master/src/colors.z80#L149)


Everything is built from this simple code with different textures, color palettes and addressing tables.
Powered by SMFPacks Menu Editor Mod