added PAL/NTSC detection

This commit is contained in:
FeralChild64 committed 2019-08-07 21:20:05 +02:00
1 parent 7bc76670cd
commit 1feef6abdb
4 files changed
+47 -10

No files matched your search

+11 -3
View File
@@ -17,6 +17,14 @@ startup_banner:
`TARGET_HOOK_BANNER
;; Print PAL/NTSC
ldx #30 ; NTSC
lda PALNTSC
beq +
ldx #31 ; PAL
*
jsr print_packed_message
;; Work out free bytes, and display
jsr basic_do_new
lda basic_top_of_memory_ptr+0
@@ -26,7 +34,7 @@ startup_banner:
lda basic_top_of_memory_ptr+1
sbc basic_end_of_text_ptr+1
jsr print_integer
jsr print_integer
lda #$20
jsr JCHROUT
@@ -37,8 +45,8 @@ startup_banner:
;; jump into warm start loop
jmp basic_warm_start
startup_message:
;; Clear the screen
.byte $93
+26 -2
View File
@@ -14,7 +14,32 @@ cint:
cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start?
jsr setup_vicii
;; Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable
;; see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc
cint_w0:
lda VIC_RASTER
cint_w1:
cmp VIC_RASTER
beq cint_w1
bmi cint_w0
;; Result in A, if no interrupt happened during the test:
;; #$37 -> 312 rasterlines, PAL, VIC 6569
;; #$06 -> 263 rasterlines, NTSC, VIC 6567R8
;; #$05 -> 262 rasterlines, NTSC, VIC 6567R56A
cmp #$07
bcs cint_pal
cint_ntsc:
lda #$00
beq +
cint_pal:
lda #$01
*
sta PALNTSC
;; Initialise cursor blink flags (Compute's Mapping the 64 p215)
lda #$00
sta cursor_blink_disable
@@ -51,4 +76,3 @@ cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start?
;; Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215)
jmp clear_screen