CPCWiki forum

General Category => Programming => Topic started by: arnoldemu on 13:59, 30 March 16

Title: CRTC type detection code
Post by: arnoldemu on 13:59, 30 March 16
I am hoping to collect as many different bits of code that detect CRTC type together into one zip package for the benefit of testing on emulators.

So far I have the publically available code from Offset, Madram and Longshot.

I am thinking of extracting the detection code from various demos.

To the demo programmers who post here, is it ok for me to do that?

For each piece of code I will put which demo it came from and the authors of the demo in the source code.






Title: Re: CRTC type detection code
Post by: PulkoMandy on 14:34, 30 March 16
They are most likely all copies from the 3 you have (or earlier versions).


I'd say no problem for my productions, but I don't remember including a CRTC test in any of them, and if I did, I'd have used OffseT's one.
Title: Re: CRTC type detection code
Post by: Kris on 15:38, 30 March 16
Code from Ramlaid in the demo called " DTC" is to be considered as well; however, I'm not sure that he posted any messages here :(

Title: Re: CRTC type detection code
Post by: Ast on 23:35, 30 March 16
You can use the code in AE2010 demo which only detects Cpc Plus and Cpc Old. Note that this code don't run properly on emulators, include winape.
It's based on gate array in/out bug on asic series.
Title: Re: CRTC type detection code
Post by: roudoudou on 12:32, 08 April 16
Quote from: arnoldemu on 13:59, 30 March 16
I am hoping to collect as many different bits of code that detect CRTC type together into one zip package for the benefit of testing on emulators.


this one looks cool
Test CRTC [Quasar Net] (http://quasar.cpcscene.net/doku.php?id=coding:test_crtc)



Title: Re: CRTC type detection code
Post by: fgbrain on 12:43, 08 April 16
didnt you check the relevant wiki page??


http://www.cpcwiki.eu/imgs/9/99/Elmar_Krieger-SPECIAL_EFFECTS.dsk (http://www.cpcwiki.eu/imgs/9/99/Elmar_Krieger-SPECIAL_EFFECTS.dsk)


there's a  CRTC check by ELMSOFT in Basic! (LISTING2.BAS)
Title: Re: CRTC type detection code
Post by: arnoldemu on 13:23, 08 April 16
Quote from: fgbrain on 12:43, 08 April 16
didnt you check the relevant wiki page??


http://www.cpcwiki.eu/imgs/9/99/Elmar_Krieger-SPECIAL_EFFECTS.dsk (http://www.cpcwiki.eu/imgs/9/99/Elmar_Krieger-SPECIAL_EFFECTS.dsk)


there's a  CRTC check by ELMSOFT in Basic! (LISTING2.BAS)
:-[ No.
I'll add that to the collection.

Title: Re: CRTC type detection code
Post by: Rhino on 13:46, 08 April 16
This is the code I used for Batman Forever:



    ; Detect CRTC type

    ; Output

    ; a = CRTC type (0,1,2,3,4)

getCRTCType
    ld    bc,#bc0c        ; select reg 12 (R/W)
    out    (c),c
    ld    bc,#bd00+%0110100    ; write a value
    out    (c),c

;    call    wVb
    ld     b,#f5            ; wait Vbl
@vbLoop1
    in    a,(c)
    rra
    jr    c,@vbLoop1
@vbLoop2
    in    a,(c)
    rra
    jr    nc,@vbLoop2

    ld    b,#be            ; read from status register
    in    a,(c)
    ld    d,a

    inc    b            ; read from #bf (read register)
    in    a,(c)

    cp    d            ; #be == #bf?
    jr    z,@CRTC_3_4

    ; CRTC 0 1 or 2

    cp    c;%0110100        ; same value?
    jr    nz,@CRTC_1_2

    ; CRTC 0

    xor    a       
    ret

@CRTC_1_2
    ld    a,d
    and    a,%011111
    jr    nz,@CRTC_2

    ; CRTC 1

    ld    a,1
    ret

    ; CRTC 2

@CRTC_2
    ld    a,2
    ret

    ; CRTC 3 or 4

@CRTC_3_4
    ld     bc,&f782
    out     (c),c
    dec     b
    ld     a,&F
    out     (c),a
    inc     b
    out     (c),c
    dec     b
    in     c,(c)
    cp     c
    jr     nz,@CRTC_4

    ; CRTC 3

@CRTC_3
    ld    a,3
    ret

    ; CRTC 4

@CRTC_4
    ld    a,4
    ret


Title: Re: CRTC type detection code
Post by: TotO on 13:47, 08 April 16
@arnoldemu (http://www.cpcwiki.eu/forum/index.php?action=profile;u=122)
Are you interrested about testing CRTC compatible IC that are not used on CPC? (like KC Compact)
If yes, I can send you that.
Title: Re: CRTC type detection code
Post by: arnoldemu on 14:31, 08 April 16
Quote from: TotO on 13:47, 08 April 16
@arnoldemu (http://www.cpcwiki.eu/forum/index.php?action=profile;u=122)
Are you interrested about testing CRTC compatible IC that are not used on CPC? (like KC Compact)
If yes, I can send you that.
Yes.

I have types 0-4 (4 is in a 464) and a KC Compact with a HD6845R (I call this type 5).

I would happily test other types if it was easy to plug them into a CPC.

Powered by SMFPacks Menu Editor Mod