;//////////////////////////////////////////////////// ;// Playfieldzzzz - Programme 4 ;// Shazz - MJJ Prod - Aout 2013 ;//////////////////////////////////////////////////// ; Rasters Scrolling avec le fond (COLUBK) ; Playfield asymétrique processor 6502 include "vcs.h" include "macro.h" include "mymacro.h" ;----------------------------------------------------------------------- ; Variables ;----------------------------------------------------------------------- Couleur = $80 ;----------------------------------------------------------------------- ; Code ;----------------------------------------------------------------------- seg code org $F000 Start CLEAN_START ; init la VCS (voir macro) LDA #$0 ; couleur du fond noir STA COLUBK LDA #%00000000 ; Playfield symétrique STA CTRLPF LDA #$9E STA COLUPF LDA #0 STA Couleur MainLoop ;*********************** Debut du Kernel VERTICAL_SYNC ; equivalent 3 scanlines LDA #0 ; // 2 cycles STA VSYNC ; Turn VSYNC Off // 3 cycles ;*********************** Debut de la VBL, un peu moins de 45 lignes / 3420 cycles dispo avant fin du timer LDA #53 ; // 2 cycles -> 43 en NTSC, 53 en PAL STA TIM64T ; // 4 cycles ;*********************** Debut du temps machine dispo (3399 cycles) ;*********************** Fin du temps machine dispo WaitForVblankEnd LDA INTIM ; // 4 cycles BPL WaitForVblankEnd ; // 3 cycles STA WSYNC ; // 3 cycles ; // Total 21 cycles ; // en PAL (45*76) 3420-21 = 3399; 3399/64 = 53.10 LDA #0 STA VBLANK ; On termine le blanking ;*********************** Fin de la VBL ;*********************** Debut de l'affichage LDY #227 LDX Couleur ; 1ere couleur, 0 à la 1ere frame, 1 à la 2eme... ScanlineLoop STX COLUBK ; 3 (8) SLEEP 5 ; 5 (13) ; PF left LDA Screen_PF0,Y ; 4 (17) -> no boundary cross STA PF0 ; 3 (20) -> were consumed to this point : 20 cycles < 22 cycles, 21 is ok, 22 glitches LDA Screen_PF1,Y ; 4 (24) STA PF1 ; 3 (27) -> were consumed to this point 27 <= 84/3=28, 27 is ok, 28 glitches LDA Screen_PF2,Y ; 4 (31) STA PF2 ; 3 (34) -> were consumed to this point : 34 < 116/3=38, 39 is ok !!! 40 glitches... INX ; 2 (36) (raster stuff) INX ; 2 (38) -> we are at 37 cycles here SLEEP 2 ; 2 (40) ; PF right LDA Screen_PF3,Y ; 4 (44) STA PF0 ; 3 (47) -> were consumed to this point : 47 cycles < 148/3=49.3 cycles ! 48 is ok, 49 glitches LDA Screen_PF4,Y ; 4 (51) STA PF1 ; 3 (54) -> were consumed to this point : 54 < 164/3=54, 54 is ok, 55 glitches LDA Screen_PF5,Y ; 4 (58) STA PF2 ; 3 (61) -> were consumed to this point : 63 < 196/3=65, 64 is ok, 65 glitches STA WSYNC ; 3 (64) ;*********************** scanline boundary DEY ; 2 (2) BNE ScanlineLoop ; 2+1 (5) LDX #0 STX COLUBK INC Couleur INC Couleur ; on modifie la couleur de depart => scrolling ! ;*********************** Fin de l'affichage Overscan LDA #2 STA WSYNC STA VBLANK ; On reactive le blanking LDX #35 OverScanWait ;*********************** 36 lignes avant la fin de l'overscan STA WSYNC DEX BNE OverScanWait STA WSYNC ; 35+1 = 36 lignes ;*********************** Fin de l'overscan ;*********************** Debut du Kernel, retour au départ JMP MainLoop ;*********************** Data ! INCLUDE "MJJA.ASM" ;*********************** Vecteurs de la VCS org $FFFC .word Start ; RESET .word Start ; IRQ, non utilisé sur la 7600 end