Thanks!
Jim
Posted Tue Jan 11, 2005 1:24 AM
Posted Tue Jan 11, 2005 1:34 AM
Posted Tue Jan 11, 2005 4:44 AM
Posted Wed Jan 12, 2005 2:36 AM
Cybergoth said:
processor 6502 include vcs.h include macro.h ;set origin to the start of the 4k rom SEG ORG $F000 ; vet up variables YPosP0 = $80; first address in RAM HeightP0 = $81 SpeedCounter = $83 ScanLineCount = $84 Reset ;Clear RAM and all TIA registers ldx #0 lda #0 Clear sta 0,x inx bne Clear ;total 9 bytes! InitializeVariables lda #90 sta YPosP0 lda #186;we have 6 lines of playfield at the botton so ;192-6=186 sta ScanLineCount ;EndInitializeVariables ;//////////////////////////////////////// StartOfFrame; Beginning of the game ;//////////////////////////////////////// ;===================================== ; VerticalSync ;top 3 scanlines ;using macro. this also stops vsync VERTICAL_SYNC ;===================================== ;===================================== ;VerticalBlank ;37 scanlines ldx #37 ; 37 scanlines of vertical blank... vblankloop sta WSYNC dex bne vblankloop ; check the joystick controls here ;;;;;;;;;;;;;;; ;MovePlayers ;;;;;;;;;;;;;;; ; for up and down, we INC or DEC ; the Y Position ; MoveDown LDA #%00010000 ;Down? BIT SWCHA BNE EndMoveDown LDA ScanLineCount CMP YPosP0 BEQ ResetYDown INC YPosP0 JMP EndMoveDown ResetYDown LDA #11 STA YPosP0 EndMoveDown ; MoveUp LDA #%00100000 ;Up? BIT SWCHA BNE EndMoveUp LDA #11 CMP YPosP0 BEQ ResetYUp DEC YPosP0 JMP EndMoveUp ResetYUp LDA ScanLineCount STA YPosP0 EndMoveUp ;assum horiz speed will be zero LDX #0 ; MoveLeft LDA #%01000000 ;Left? BIT SWCHA BNE EndMoveLeft LDX #%00010000 ;a 1 in the left nibble means go left ;; moving left, so we need the mirror image LDA #%00001000 ;a 1 in D3 of REFP0 says make it mirror STA REFP0 EndMoveLeft ; MoveRight LDA #%10000000 ;Right? BIT SWCHA BNE EndMoveRight LDX #%11110000 ;a -1 in the left nibble means go right... ;; moving right, cancel any mirrorimage LDA #%00000000 STA REFP0 EndMoveRight STX HMP0 ;set the move for player 0 ;testing. trying to fix obstruction on left side of screen LDA WSYNC ;;;;;;;;;;;;;;;; ;EndMovePlayers ;;;;;;;;;;;;;;;; STX VBLANK ;EndVerticalBlank ;======================================== ;======================================== ;DrawScreen ;192 scanlines ;now you have 192 scanlines of picture ;remember, that's 160 clocks / 3 = 53 cpu cycles ;RestoreGraphics LDA #$00 STA COLUBK ; Set Background to Black LDA #15*8 STA COLUPF LDA #1 sta CTRLPF lda #$1C sta COLUP0 lda #%00000101 sta NUSIZ0 ;end restore graphics ;paint image here LDY #0 STY HeightP0;init height to zero LDX ScanLineCount;192-6=186 because we have 6 lines of playfield to draw sta WSYNC STA HMOVE;set the sprite in motion loop sta WSYNC LDA #0 STA GRP0 CPX YPosP0 BNE SkipP0 LDY #8 STY HeightP0;if we are at the correct local, set the height ;use this to determine if we should start ;painting SkipP0 LDY HeightP0;put HeightP0 into Y for addressing BEQ FinishP0 IsP0 LDA Player_0_up-1,Y;put a line of graphics into A STA GRP0; put the line of graphics into the graphics register DEC HeightP0; to decriment so we know when to stop FinishP0;jump here if we are not painting DEX BNE loop LDA #0 STA GRP0;turn off player graphics ldx #6 Draw_Picture_loop STA WSYNC LDA Playfield_PF0-1,X STA PF0 sta PF1 sta PF2 DEX bne Draw_Picture_loop LDA #%01000010 ; Disable TIA Output STA VBLANK ;EndDrawScreen ;================================ ;================================ OverScan ;now you have 30 scanlines of overscan ;(2280 machine cycles, 6840 color clocks ;initialize graphics LDA #$00 ; put $00 in A STA WSYNC STA PF0; clear out first playfield section STA PF1; clear out second playfield section STA PF2; clear out third playfield section STA GRP0 ; clear out player graphic 0 STA GRP1 ; clear out player graphic 1 STA ENAM0 ; clear out missile 0 STA ENAM1 ; clear out missile 1 STA ENABL ; clear out ball STA COLUP0 ; set player 0 to black STA COLUP1 ; set player 1 to black STA COLUPF ; set playfield to black STA COLUBK ; set background to black ;end initialize graphics LDX #29 LDA #2 O1 STA WSYNC DEX BNE O1 ;EndOverScan ;================================== ;/////////////////////////////////////// ;go back to the beginning: ;inifinate loop JMP StartOfFrame ;////////////////////////////////////// ;***************************** ;Graphics ;***************************** Playfield_PF0 .byte #%10000001 ; .byte #%10000001 ; .byte #%01000010 ; .byte #%01000010 ; .byte #%00100100 ; .byte #%00011000 ; Player_0_up .byte #%00001000 .byte #%00011100 .byte #%00111110 .byte #%01111111 .byte #%11111110 .byte #%01111100 .byte #%00111000 .byte #%00010000 ;this is the end. change origin to the end of the 4k rom org $FFFA TheEnd .word Reset ;NMI;used in 7800? .word Reset ;RESET .word Reset ;IRQ;used in 7800? ;end of file END
Posted Wed Jan 12, 2005 4:04 AM
loop LDA #0 CPX YPosP0 BNE SkipP0 LDY #8 STY HeightP0;if we are at the correct local, set the height ;use this to determine if we should start ;painting SkipP0 sta WSYNC STA GRP0 LDY HeightP0;put HeightP0 into Y for addressing BEQ FinishP0 IsP0 LDA Player_0_up-1,Y;put a line of graphics into A STA GRP0; put the line of graphics into the graphics register DEC HeightP0; to decriment so we know when to stop FinishP0;jump here if we are not painting DEX BNE loop
0 members, 0 guests, 0 anonymous users