User Tools

Site Tools


base:detect_vic_type

Detect VIC Model

“Well…for the definition. As far as I know, there are (at least) 3 different vic types:

new (with the grey dots if you change the color - 9 lumas) old (without the grey dots - 9 lumas) VERY old (without the grey dots - 5 lumas).

This VIC-Check routine checks only for the new/old version, not the very old with less luma steps!”

VIC_type no.---luma steps---VICCHECK.prg
----------------------------------------

PAL    8565R2-4191      9        new vic 
PAL    8565R2-3991(22)  9        new vic 
PAL    8565R2-0787(22)  9        new vic 

PAL    6596R5           9        old vic 
PAL    6569R3-4685      9        old vic 
PAL    6569R3-2983      9        old vic 

PAL    6569R1-2283      5        old vic

PAL-N  6572R0           ?        new vic
NTSC   6567R8           ?        flickers between old/new vic
; ---------------------------------------------------------------------------
; VIC-Check 2 written by Crossbow/Crest (shamelessly disassembled by Groepaz)
; ---------------------------------------------------------------------------

                 JSR     $FF81 ; clear screen

                 SEI           ; disable irq

                 ; init VIC registers
                 LDX     #$2F

loc_813:                    
                 LDA     vicregs,X
                 STA     $D000,X
                 DEX
                 BNE     loc_813

                 ; clear sprite data at $2800
                 TXA

loc_81D:                    
                 STA     $2800,X
                 INX
                 BNE     loc_81D

                 LDA     #$10
                 STA     $2800

                 ; put a black reversed space at start of charline 22
                 LDA     #$A0
                 STA     $770
                 STA     $7FB      ; sprite pointer
                 STA     $DB70

mainloop:                    

                 ; wait for rasterline $e4       
                 LDA     #$E4
loc_835:                                
                 CMP     $D012
                 BNE     loc_835

                 ; waste some cycles
                 LDX     #3
loc_83C:
                 DEX
                 BNE     loc_83C

                 LDX     #$1C
                 STX     $D011     ; $d011=$1c

                 LDY     #$5B
                 DEX
                 STX     $D011     ; $d011=$1b

                 ; 4 cycles more for ntsc
                 LDA     $2A6
                 BNE     loc_851

                 NOP
                 NOP

loc_851:
                 STY     $D011     ; $d011=$5b (enables ECM)
                 STX     $D011     ; $d011=$1b

                 LDX     $D01F     ; sprite/background collision (will be either 0 or 8)

                 ; display result
                 LDY     #0
loc_85C:
                 LDA     victype,x
                 STA     $400,Y
                 LDA     #1
                 STA     $D800,Y
                 INX
                 INY
                 CPY     #8
                 BNE     loc_85C

                 JMP     mainloop

; ---------------------------------------------------------------------------
victype:
                 !scr "old vic "
                 !scr "new vic "

vicregs:
                 .BYTE   0,0,0,0, 0,0,$18,$E4, 0,0,0,0, 0,0,0,0 ; sprite x pos
                 .BYTE   0 ; sprite x msb
                 .BYTE $9B ; $d011
                 .BYTE  $E ; $d012
                 .BYTE $3E ; $d013 latch x
                 .BYTE $6C ; $d014 latch y
                 .BYTE   8 ; $d015 Sprite display Enable
                 .BYTE $C8 ; $d016
                 .BYTE   0 ; $d017 Sprites Expand 2x Vertical (Y)
                 .BYTE $15 ; $d018 Memory Control Register
                 .BYTE $79 ; $d019 Interrupt Request Register (IRR)
                 .BYTE $F0 ; $d01a Interrupt Mask Register (IMR)
                 .BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
base/detect_vic_type.txt · Last modified: 2015-04-17 04:31 by 127.0.0.1