I'm new to 2600 programming, and it seems that timing is pretty critical there.
I searched a lot in documentation, studying sources code example and debugged some games to see timing, and it seems that not every rom does the same things. (TIM64T value not the same, or strange vsync/vblank enable)
In my template I get some blank lines at the beginning of the screen(in stella) whereas medieval mayhem PAL version starts at the top of the screen.
So, are the TV timing as critical as I think, or does a wrong timing isn't very dangerous for the TV Set ?
I will use a PAL system so I'm trying to get a PAL template.
I would like to know if it's seems correct and If I don't get the timing wrong.
Thank you !
processor 6502 include "vcs.h" include "macro.h" ORG $F000 Start: CLEAN_START Loop: ;-------- ; VSync lda #2 ; VSync On Value sta WSYNC ; Finish Current Line sta VSYNC ; Turn VSync On lsr ; VSync Off Value sta WSYNC ; Wait 3 lines sta WSYNC sta WSYNC sta VSYNC ; Turn VSync Off ;--------- ; VBlank ; NTSC: (3/37/192/30) ; PAL: (3/45/228/36) <- SCANLINE_TIME = 76 VBLANK_LINES = 45 SCREEN_LINES = 228 OVERSCAN_LINES = 36 lda #2 ; VBlank On Value sta VBLANK lda #(VBLANK_LINES*SCANLINE_TIME)/64 sta TIM64T vbloop: lda INTIM bne vbloop sta WSYNC sta VBLANK ;--------- ; Screen ldx #SCREEN_LINES scloop: stx COLUBK dex sta WSYNC bne scloop ;----------- ; Overscan lda #2 ; VBlank On Value sta VBLANK lda #(OVERSCAN_LINES*SCANLINE_TIME)/64 sta TIM64T ovloop: lda INTIM bne ovloop ;------------- ; Next Frame jmp Loop ;------------- ; Interrupts ORG $FFFA .word Start ; NMI .word Start ; RESET .word Start ; IRQ END
Edited by Orion_, Fri Apr 23, 2010 2:04 PM.














