Posted Sun Jun 1, 2003 5:28 AM
Posted Sun Jun 1, 2003 6:14 AM
Posted Sun Jun 1, 2003 6:34 AM
Happy_Dude said:
Posted Sun Jun 1, 2003 7:26 AM
lda #%00100000 sta PF1 sta PF0

sleep 40 lda #%00010000 sta PF2
Posted Sun Jun 1, 2003 7:40 AM
Happy_Dude said:
lda #%00100000 sta PF1 sta PF0
sleep 40 lda #%00010000 sta PF2
Posted Sun Jun 1, 2003 8:25 AM
lda #%10000000 sta PF1 sta PF0This is showing the relation between PF1 and PF0. both in their 1st position. (now)
sleep 40 lda #%00010000 sta PF2I really didn't think this one through. If you change halfway through the
lda #%000100000 sta PF1 sta PF0 sleep 12 lda #%00011100 sta PF0 sta PF1This code changes the playfield mid scan and does what I thought the first
Posted Thu Jun 5, 2003 10:05 AM
;------------------------------------------------ ;Top line lda #15 ; A nice whitish colour sta COLUPF lda #%11111111 ; Fill the whole playfield sta PF0 ; left sta PF1 ; mid sta PF2 ; right sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC ; make it 8 scanlines please lda #%00000000 ; Reset Playfield sta PF1 sta PF2 ;------------------------------------------------ ;Side lines Picture lda #15 ; load up the white sta COLUPF lda #%00010000 ; PF0's left sta PF0 sleep 2 ; wait for it to draw lda #$0 sta COLUPF ; then kill it sleep 25 ; for 25 cycles lda #15 ; mmmm White sta COLUPF ; Colour Ready to draw some more. lda #%10000000 ; PF2's right sta PF2 ; Now draw the right side and sta WSYNC ; Snooze for the rest of the scanline inx cpx #176 bne Picture ;------------------------------------------------ ;bottom line - same as top (GOTO TOP to read comments :P ) lda #15 sta COLUPF lda #%11111111 sta PF0 sta PF1 sta PF2 sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC lda #%00000000 sta PF1 sta PF2As for horizontal scrolling - I wish I knew
Posted Thu Jun 5, 2003 7:03 PM
;Scrolling color border thingy processor 6502 include "vcs.h" include "macro.h" COUNTER1 = $80 COLOROFFSET = $81 TIMETOCHANGE = 2 ; speed of "animation" SEG ORG $F000 Reset ; Clear RAM and all TIA registers ldx #0 lda #0 Clear sta 0,x inx bne Clear ;------------------------------------------------ ; Once-only initialisation... lda #0 ;lda #$45 sta COLUPF ; set the playfield colour StartOfFrame ; Start of vertical blank processing lda #0 sta VBLANK lda #2 sta VSYNC ; 3 scanlines of VSYNCH signal... sta WSYNC sta WSYNC sta WSYNC lda #0 sta VSYNC ; 37 scanlines of vertical blank... ldx #0 VerticalBlank sta WSYNC inx cpx #36; Now waiting 36 lines bne VerticalBlank ;do some color offset calcs ldx #$02 stx COLUBK;redundant as we never change COLUBK, but... :) ldx #0 ldy COUNTER1 cpy #TIMETOCHANGE bne notyet inc COLOROFFSET ldy COLOROFFSET lda #0 sta COUNTER1 notyet inc COUNTER1 ldy COLOROFFSET sta WSYNC ; wait for last line of vblank DrawField Top sty COLUPF lda #$FF sta PF0 sta PF1 sta PF2 lda #0 inx iny sta WSYNC cpx #15 bne Top SLEEP 3 ; sync up middle Middle sty COLUPF lda #$F0 sta PF0 lda #0 sta PF1 sta PF2 lda #0 SLEEP 15 sta PF0 lda #$F0 sta PF2 lda #0 sta WSYNC inx iny cpx #177 bne Middle Bottom sty COLUPF lda #$FF sta PF0 sta PF1 sta PF2 sta WSYNC inx iny cpx #192 bne Bottom lda #%01000010 sta VBLANK ; end of screen - enter blanking ldx #0 stx COLUPF Overscan sta WSYNC inx cpx #30 bne Overscan jmp StartOfFrame ORG $FFFA .word Reset ; NMI .word Reset ; RESET .word Reset ; IRQ END
Posted Thu Jun 5, 2003 8:21 PM
Posted Thu Jun 5, 2003 8:39 PM
Happy_Dude said:
Posted Thu Jun 5, 2003 8:47 PM
Galaga_Freak said:
Happy_Dude said:
Top sty COLUPF lda #$FF sta PF0 sta PF1 sta PF2 lda #0 inx iny sta WSYNC cpx #15 bne Top SLEEP 3 ; sync up middle Middle sty COLUPF lda #$F0 sta PF0 lda #0 sta PF1 sta PF2 lda #0 SLEEP 15 sta PF0 lda #$F0 sta PF2 lda #0 sta WSYNC inx iny cpx #177 bne Middle Bottom sty COLUPF lda #$FF sta PF0 sta PF1 sta PF2 sta WSYNC inx iny cpx #192 bne Bottom15 lines for the top 177 scanlines for the middle and 192 for the bottom = 384 not including overscan and vblank.
Posted Thu Jun 5, 2003 8:54 PM
Posted Thu Jun 5, 2003 9:06 PM
Posted Thu Jun 5, 2003 9:36 PM
;------------------------------------------------ ;Top line lda #%11111111 ;fill playfield sta PF0 sta PF1 sta PF2 lda #15 ; It looks like white sta WSYNC ; all thats visable so wait sta COLUPF ; before writing the line sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC ; Give me 7 lda #%00000000 ; Clear the 2 PF's that arn't PF0 sta PF1 sta PF2 ;------------------------------------------------ ;Side lines Picture lda #15 ; Re-initalize whiteness sta COLUPF lda #%00010000 ; And PF0 sta PF0 sleep 2 ; let it write lda #$0 ; now get rid of the damn thing sta COLUPF sleep 25 ; and wait until the reflected bit has been written black lda #15 ; and Re-initalize the colour (again) sta COLUPF lda #%10000000 ; Line up PF2 sta PF2 sta WSYNC ; wait till end of scanline inx cpx #176 bne Picture ; do it till it's done ;------------------------------------------------ ;bottom line (yadda yadda yadda...) lda #15 sta COLUPF lda #%11111111 sta PF0 sta PF1 sta PF2 sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC sta WSYNC lda #$0 ; Clear to return sta COLUPF
Posted Fri Jun 6, 2003 1:06 AM
Galaga_Freak said:
Posted Fri Jun 6, 2003 10:11 AM
Thomas Jentzsch said:
Posted Fri Jun 6, 2003 12:46 PM
Nature Boy said:
Quote
Posted Fri Jun 6, 2003 1:45 PM
Thomas Jentzsch said:
Posted Fri Jun 6, 2003 1:53 PM
Nature Boy said:
Posted Fri Jun 6, 2003 2:04 PM
Thomas Jentzsch said:
Posted Fri Jun 6, 2003 3:49 PM
Posted Fri Jun 6, 2003 5:43 PM
Andrew Davie said:
Happy_Dude said:
; 2600 for Newbies ; lesson 14 - playfield ; Question 4 - One way to do horizontal scrolling with the playfield. processor 6502 include "vcs.h" include "macro.h" ; OBJECTIVE: This variation of the lesson 14 kernel does horizontal scrolling with the playfield. ; Only PF0 is used. The program uses to variables to store the left and right side values ; of the playfield. These are declared below: PATTERN_LEFT = $80 PATTERN_RIGHT = $82 TIMETOCHANGE = 20 SEG ORG $F000 RESET ; Clear RAM and all TIA regs LDX #0 LDA #0 CLEAR STA 0,X INX BNE CLEAR LDA #$45 STA COLUPF LDY #0 ; Here we assign the pattern values to our left and right side of the playfield. ; Try using different values. LDA #$0 STA PATTERN_LEFT LDA #$01 STA PATTERN_RIGHT STARTOFFRAME LDA #0 STA VBLANK LDA #2 STA VSYNC STA WSYNC STA WSYNC STA WSYNC LDA #0 STA VSYNC ; 37 scanlines of vertical blank LDX #0 VERTICALBLANK STA WSYNC INX CPX #37 BNE VERTICALBLANK ; HANDLE A CHANGE IN THE PATTERN ONCE EVERY 20 FRAMES ; WRITE THE PATTERN TO PF1 INY CPY #TIMETOCHANGE BNE SCROLLCOMPLETE LDY #0 ; The following code uses arithmetic left shift commands (ASL) to make the scrolling happen. ; We shift the bits of the playfield variables to the left. Original bit 7 is shifted to the Carry. ; The program uses BCC to check if a bit was dropped. Dropped bits are inserted to the ; opposite pattern variable by the INC command. The INC command can mess up the pattern if ; the original bit 0 is turned on. To avoid this we shift everything to the left before incrementing. SHIFTRIGHT CLC ASL PATTERN_RIGHT BCC SHIFTLEFT ASL PATTERN_LEFT INC PATTERN_LEFT BCC SCROLLCOMPLETE INC PATTERN_RIGHT JMP SCROLLCOMPLETE SHIFTLEFT ASL PATTERN_LEFT BCC SCROLLCOMPLETE INC PATTERN_RIGHT SCROLLCOMPLETE ; DO 192 SCANLINES OF COLOR CHANGING (OUR PICTURE) LDX #0 PICTURE STX COLUPF ; Load the left pattern into PF1 register. LDA PATTERN_LEFT STA PF1 ; Wait enough cycles before drawing right pattern. SLEEP 20 ; Load right pattern to PF1. LDA PATTERN_RIGHT STA PF1 STA WSYNC INX CPX #192 BNE PICTURE LDA #%01000010 STA VBLANK ; 30 LINES OF OVERSCAN LDX #0 OVERSCAN STA WSYNC INX CPX #30 BNE OVERSCAN JMP STARTOFFRAME ORG $FFFA INTERRUPTVECTORS .WORD RESET .WORD RESET .WORD RESET END
[color=blue]; Pseudocode: ; ; Clear Carry ; Shift bits in variable PATTERN_RIGHT to the left. Original bit 7 is shifted into the Carry. ; ; if no bit was dropped from PATTERN_RIGHT (Carry Clear) then ; ; Shift the bits in PATTERN_LEFT ; if no bit was dropped from PATTERN_LEFT then ; ; Scroll is complete. Continue program flow. ; ; else ; ; Insert dropped bit from left pattern into PATTERN_RIGHT (Using the INC command). ; ; end ; ; else ; ; Shift bits in PATTERN_LEFT ; Insert dropped bit from right pattern into PATTERN_LEFT. ; If no bit was dropped from PATTERN_LEFT then ; ; Scroll is complete. ; ; else ; ; Insert dropped bit from left pattern into PATTERN_RIGHT. ; ; end ; ; end[/color]
SHIFTRIGHT CLC ASL PATTERN_RIGHT BCC SHIFTLEFT ASL PATTERN_LEFT INC PATTERN_LEFT BCC SCROLLCOMPLETE INC PATTERN_RIGHT JMP SCROLLCOMPLETE SHIFTLEFT ASL PATTERN_LEFT BCC SCROLLCOMPLETE INC PATTERN_RIGHT SCROLLCOMPLETE
Posted Sat Jun 7, 2003 1:35 AM
dew2050 said:
Posted Sat Jun 7, 2003 2:57 AM
Posted Sat Jun 7, 2003 9:38 AM
Thomas Jentzsch said:
dew2050 said:
CLC ASL PATTERN_RIGHT BCC SHIFTLEFT ASL PATTERN_LEFT INC PATTERN_LEFT BCC SCROLLCOMPLETE INC PATTERN_RIGHT JMP SCROLLCOMPLETE SHIFTLEFT ASL PATTERN_LEFT BCC SCROLLCOMPLETE INC PATTERN_RIGHT SCROLLCOMPLETE
CLC ROL PATTERN_RIGHT ROL PATTERN_LEFT BCC SCROLLCOMPLETE INC PATTERN_RIGHT SCROLLCOMPLETE
0 members, 0 guests, 0 anonymous users