| |
Peiselulli
Registered: Oct 2006 Posts: 81 |
detecting pal, drean, ntsc or old ntsc
Hello,
I want to know if a test like this is reliable for the four different machine types PAL, NTSC, NTSC(old) and DREAN (ACME source code):
OLD_NTSC = 1
NTSC = 0
PAL = 2
DREAN = 3
!to "detect.prg",cbm
!cpu 6510
* = $0801
!by $0b,$08,$00,$00,$9e,$32,$30,$36,$31,$00,$00,$00
detect: sei
w0: lda $d012
w1: cmp $d012
beq w1
bmi w0
and #$03
cmp #$01
bne w2
lda #OLD_NTSC
bne detected ; unconditional
w2: cmp #$03
lda #$00
rol
beq detected ;ntsc
;check for drean or pal
ldx #$00
lda #$10
l inx
cmp $d012
bne l
lda #PAL
cpx #$70
bcc detected
;is a drean
lda #DREAN
detected:
tay
lax offset,y
l2: lda base_text,x
beq end
jsr $ffd2
inx
bne l2
end: lda #$0d
jmp $ffd2
base_text:
old_ntsc_text: !text "OLD "
ntsc_text: !text "NTSC",0
pal_text: !text "PAL",0
drean_text: !text "DREAN",0
offset:
!byte ntsc_text-base_text
!byte old_ntsc_text-base_text
!byte pal_text-base_text
!byte drean_text-base_text
|
|
... 63 posts hidden. Click here to view all posts.... |
| |
Flavioweb
Registered: Nov 2011 Posts: 463 |
Here it is the stabilized TWW version:
INIT
SEI
CLD
LDX #$FF
TXS
LDA #$2F
STA $00
LDA #$35
STA $01
;-------------------
LDX #<NO_NMI
LDY #>NO_NMI
STX $0318
STY $0319
STX $FFFA
STY $FFFB
LDY #$00
STY $DC03 ; Port $DC01 = Input
DEY
STY $DC02 ; Port $DC00 = Output
;-------------------
LDA #$7F
STA $DC0D
STA $DD0D
LDA $DC0D
LDA $DD0D
;-------------------
LDA #$00
STA $DD0E ; Stop CIA #2 Timer A
STA $DD04
STA $DD05 ; Set Timer A = 0 (NMI will trigger immediately when Timer A is restarted)
LDA #$81
STA $DD0D ; Set Timer A as NMI source
LDA #$01
STA $DD0E ; Start Timer A (triggers NMI and unless the NMI get's acked, any new NMI's will be ignored).
LDA #$00 ; From this point on we will not be disturbed and can commence testing.
STA $D015 ; No Sprites
;------------------------------------------------------------------------------
; Detect the model
;---------------------------------------
; 312 rasterlines -> 63 cycles per line PAL => 312 * 63 = 19656 Cycles / VSYNC
; 262 rasterlines -> 64 cycles per line NTSC V1 => 262 * 64 = 16768 Cycles / VSYNC
; 263 rasterlines -> 65 cycles per line NTSC V2 => 263 * 65 = 17095 Cycles / VSYNC
; 312 rasterlines -> 65 cycles per line PAL DREAN => 312 * 65 = 20280 Cycles / VSYNC
;------------------------------------------------------------------------------
LDA #$FF ; Use CIA #1 Timer A to count cycled in a frame
STA $DC06
STA $DC07 ; Latch #$ffff to Timer B
LDY #%00011001
LDA #$7F
WAIT_BEAM_01
CMP $D012
BNE WAIT_BEAM_01
BIT $DEAD
BIT $BEEF
STA $D011
STY $DC0F ; Start Timer B (One shot mode (Timer stops automatically when underflow)
LDY #$00
LDA #$1B
STA $D011
LDA #$7F
WAIT_BEAM_02
CMP $D012
BNE WAIT_BEAM_02
BIT $DEAD
BIT $BEEF
STA $D011
;-------------------
STY $DC0F
LDX $DC06
LDY $DC07
STY $0400
STX $0401
LDA #$1B ; TURN BACK ON SCREEN TO SEE RESULT
STA $D011
;-------------------
WAIT_SOME_SPACE
LDA $DC01
AND $DC00
AND #$10
BNE WAIT_SOME_SPACE
JMP INIT
;-------------------
NO_NMI
RTI
In $0400/$0401 there are values to subtract from $FFFF to obtain cycles/VSYNC (-1).
PAL: $B338 ($FFFF-$B338 = $4CC7)
NTSC: $BD39 ($FFFF-$BD39 = $42C6)
DREAN: $B0C8 ($FFFF-$B0C8 = $4F37)
Tested on "x64 2.4.5 r27742M".
Someone can test it on real hardware? |
| |
Fungus
Registered: Sep 2002 Posts: 680 |
Mine counted cycles also and used vsync to check. Although I made a small math error about old ntsc. sprites and DMA don't matter with a timer, since the clock runs independant of such stuff, and the up to 1 line delay doesn't matter really.
Nice different ways of checking, cool to see. Not that anyone cares about NTSC ;) |
| |
MagerValp
Registered: Dec 2001 Posts: 1074 |
Quoting Peiselulli@MagerValp : But the main reason for starting this thread is missing : detection between "drean" an "pal".
Yes, but that was in 2012, H Macaroni's thread necrophilia was regarding PAL vs NTSC. For Drean vs PAL it's of course a little more work.
I'd love to see some Drean releases though, two extra cycles per line should allow for some neat tricks not possible on PAL. |
| |
Peiselulli
Registered: Oct 2006 Posts: 81 |
But unfortunately I'm waiting for a test result on a drean machine since then ;-( |
| |
chatGPZ
Registered: Dec 2001 Posts: 11350 |
Quote:I'd love to see some Drean releases though, two extra cycles per line should allow for some neat tricks not possible on PAL.
i'd love to see one or two people who own such machines and are willing to run a bunch of testprogs - because everything in VICE regarding drean is pure guesswork :) |
| |
Durandal
Registered: May 2006 Posts: 30 |
Quote: Quote:I'd love to see some Drean releases though, two extra cycles per line should allow for some neat tricks not possible on PAL.
i'd love to see one or two people who own such machines and are willing to run a bunch of testprogs - because everything in VICE regarding drean is pure guesswork :)
Me, hedning and Thierry already did 3 years ago ;)
http://csdb.dk/forums/?roomid=7&topicid=73859#81066
(unless there's some new tests that need to be done on the Drean) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11350 |
there are a couple new ones... not exactly sure which though, tlr is the VIC guy =) |
| |
tlr
Registered: Sep 2003 Posts: 1787 |
Quoting Groepazi'd love to see one or two people who own such machines and are willing to run a bunch of testprogs - because everything in VICE regarding drean is pure guesswork :)
It's not pure guesswork since those much valued tests The_WOZ, Thierry and hedning did.
It's far less verified than PAL emulation but not so far from NTSC emulation IMO. This goes for x64sc. For x64 all bets are off as usual.
Sorry for the late answer BTW. Was away watching Kraftwerk... ;) |
| |
hedning
Registered: Mar 2009 Posts: 4720 |
I'm willing to test stuff on my drean if people need it. Just PM me. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11350 |
ok so that improved since last time i checked (which was the first and last time i ever run a supposedly drean specific program =P)
then instead everyone bug tlr about fixing that damned sprite x stretch bug =D |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 - Next |