Jump to content

yllawwally

Members
  • Content Count

    309
  • Joined

  • Last visited

Posts posted by yllawwally


  1. Do you have a multimeter? It still sounds like a power problem to me. Take the meter, and set it to DC, for 10 volts. With the Atari powered on, place the black lead, to the middle leg of the 7805. Then place the red leg to each of the legs. One leg should measure 9-10volts. The other leg, must measure 5v. If you have less than 5v on one leg, and less than 7 on the other it's your power supply. The 2600 uses a lot of current, 500ma. There should be a list of voltages and currents listed on the power supply. You can check there, many of the multi voltage supplies I've seen only have 300ma at 9v.


  2. I have a 4 line scrolling background across the top. However it doesn't display properly, when scrolling.

     

    this is the code I use to setup a line

    	LDA PFData0		; 4 cycles
    STA PF0_L1
    LDA PFData1		; 4 cycles
    STA PF1_L1
    LDA PFData2		; 4 cycles
    STA PF2_L1
    LDA PFData3		; 4 cycles
    STA PF3_L1
    LDA PFData4		; 4 cycles
    STA PF4_L1
    LDA PFData5		; 4 cycles
    STA PF5_L1
    LDA PFData6		; 4 cycles
    STA PF_TEMP
    LDA Screen_Location+1
    AND #000011
    CLC
    ADC #1
    TAY
    ROTATE1	ROL PF_TEMP
    ROR PF5_L1
    ROL PF4_L1
    ROL PF3_L1
    ROR PF2_L1
    ROL PF1_L1
    ROL PF0_L1
    DEY
    BNE ROTATE1

    face30.txt


  3. I have my code set for four sets of creatures to go accross the screen. These four enemies don't move up and down. However the hero needs to go up and down. When he crosses the boundry he gets a little messed up. I've been trying to get this working for a couple weeks. How are other people doing this? I looked into VDEL, but I wasn't sure how to implement it. I was able to get the hero to cross the bottom two sections, without messing up the graphics, but the other transistions are giving me problems.

    face25.txt


  4. I figured why I needed to offset the graphics and start positions of the creatures. I wasn't decrementing their skipdraw counters on each scanline. So the first was off by 20 lines, the next one by the 20 lines plus the 50 the first was displayed within, and this continued with the next 2 as well. I had trouble finding time to decrement all 5 counters on each scanline. How are other people doing this? I'm going to change the value used for the top of the screen for each creature, so that position 172 is the same place for all the creatures, without the need for all the decrementing.


  5. Now I have the creatures moving properly. Thanks for all the help. There are four lines of sprites. Why do I need to position them at the same place, for them to appear. If I set each P?_YPosFromBot to 172, and place an offset for the skip draw code, they show up. If I don't make these modifications, they don't show up. When I move the hero up the shift as well, such that he loses two pixels on the 3rd row, then two more on the 2nd, and 4 on the 1st.

     

    ;Setting some variables...
    LDA #172
    STA P0_YPosFromBot
    LDA #50
    STA P0_XPos
    LDA #122 ;was 172
    STA P1_YPosFromBot
    LDA #50
    STA P1_XPos
    LDA #72 ;was 172
    STA P2_YPosFromBot
    LDA #50
    STA P2_XPos
    LDA #22 ;was 172
    STA P3_YPosFromBot
    LDA #50
    STA P3_XPos

     

    ;setup pic animations ----------------------------------------------
    
    lda #<MainPlayerGraphics2 	;low byte of ptr is graphic
    CLC	;clear carry
    ADC PICS
    sta P2_Ptr		;(high byte already set)
    
    lda #>MainPlayerGraphics2 ;high byte of graphic location
    sta P2_Ptr+1	;store in high byte of graphic pointer
    
    lda #C_KERNAL_HEIGHT + #C_P0_HEIGHT - #1
    sec
    sbc P2_YPosFromBot ;subtract integer byte of distance from bottom
    sta P2_Y
    
    
    lda P2_Ptr
    sec
    sbc P2_YPosFromBot	;integer part of distance from bottom
    clc
    adc #C_P0_HEIGHT+#92
    sta P2_Ptr	;2 byte
    
    ;setup pic animations ----------------------------------------------
    
    ;setup pic animations ----------------------------------------------
    
    lda #<MainPlayerGraphics3 	;low byte of ptr is graphic
    CLC	;clear carry
    ADC PICS
    sta P3_Ptr		;(high byte already set)
    
    lda #>MainPlayerGraphics3 ;high byte of graphic location
    sta P3_Ptr+1	;store in high byte of graphic pointer
    
    
    lda #C_KERNAL_HEIGHT + #C_P0_HEIGHT - #1
    sec
    sbc P3_YPosFromBot ;subtract integer byte of distance from bottom
    sta P3_Y
    
    
    lda P3_Ptr
    sec
    sbc P3_YPosFromBot	;integer part of distance from bottom
    clc
    adc #C_P0_HEIGHT+#142
    sta P3_Ptr	;2 byte
    
    ;setup pic animations ----------------------------------------------

    face.bin


  6. I didn't think about that it would only need to be positioned one per frame, I'll make those changes later. I am reusing the player0 for 4 different sprites. The modified code with sta hmove added is shown below. The first copy works properly, why do the 2 clones not use the fine positioning? They act the same as before.

     

    ScanLoop ;start of kernal +++++++++++++++++++++++ for player 0
    
    
    ;skipDraw
    ; draw player sprite 0:
    lda     #C_P0_HEIGHT-1     ; 2
    dcp     P0_Y            ; 5 (DEC and CMP)
    bcs     .doDraw0        ; 2/3 ; should be bcs
    lda     #0              ; 2
    .byte   $2c             ;-1 (BIT ABS to skip next 2 bytes)(kinda like a jump)
    .doDraw0:
    lda     (P0_Ptr),y      ; 5
    sta     GRP0            ; 3 = 18 cycles (constant, if drawing or not!)
    
    lda P0_XPos
    ;lda #30
    ldx #0
    
           sec	     ; 2 set carry
    .Div15   
    sbc #15      ; 2         
    bcs .Div15   ; 3(2)
    
    tax
    lda fineAdjustTable,x       ; 13 -> Consume 5 cycles by guaranteeing we cross a page boundary
    sta HMP0 ;,x
    
    sta RESP0 ;,x	;the x must be a 0 for player 0  or 1 player 1
    
    
    
           DEY             ;count down number of scan lines          2 cycles = 
           STA WSYNC                                                ;3 cycles =
    STA HMOVE
    CPY #150
           BCS ScanLoop                                             ;2 cycles =
    EndScanLoop ;end of kernal +++++++++++++++++ for player 0


  7. I have 4 sets of creatures. Only the top row is currently set to move. However the movement is jerky. It only moves in 8 pixel jumps. I am trying to to use, what I think is called battlezone positioning? I was hoping someone could point out what I'm doing wrong here.

     

    Here is the code to draw the first row, full source is attached.

    ScanLoop ;start of kernal +++++++++++++++++++++++ for player 0
    
    
    ;skipDraw
    ; draw player sprite 0:
    lda     #C_P0_HEIGHT-1     ; 2
    dcp     P0_Y            ; 5 (DEC and CMP)
    bcs     .doDraw0        ; 2/3 ; should be bcs
    lda     #0              ; 2
    .byte   $2c             ;-1 (BIT ABS to skip next 2 bytes)(kinda like a jump)
    .doDraw0:
    lda     (P0_Ptr),y      ; 5
    sta     GRP0            ; 3 = 18 cycles (constant, if drawing or not!)
    
    lda P0_XPos
    ;lda #30
    ldx #0
    
           sec	     ; 2 set carry
    .Div15   
    sbc #15      ; 2         
    bcs .Div15   ; 3(2)
    
    tax
    lda fineAdjustTable,x       ; 13 -> Consume 5 cycles by guaranteeing we cross a page boundary
    sta HMP0 ;,x
    
    sta RESP0 ;,x	;the x must be a 0 for player 0  or 1 player 1
    
    
    
           DEY             ;count down number of scan lines          2 cycles = 
           STA WSYNC                                                ;3 cycles =
    CPY #150
           BCS ScanLoop                                             ;2 cycles =
    EndScanLoop ;end of kernal +++++++++++++++++ for player 0

    face15.txt


  8. I don't know what happened to the graphics info. In the original source, it's all in binary. Something about pasting it here, damaged it.

     

    
    processor 6502
    include vcs.h
    org $F000
    
    ;Variables ------
    
    YPosFromBot = $80;
    VisiblePlayerLine = $81;
    PICS = $82;
    ROLLING_COUNTER = $83;
    Graphics_Buffer = $84
    YPosFromBotE1 = $85;
    VisibleEnemyLine = $86;
    VisibleEnemyLineCurrent = $87;
    EnemyLineBuffer = $88;
    VisiblePlayerLineCurrent = $90;
    BG_0 = $91;
    BG_1 = $92;
    BG_2 = $93;
    
    
    
    ; Constants ------
    playerheight      ds #8;
    
    
    ;generic start up stuff...
    Start
    SEI	
    CLD  	
    LDX #$FF	
    TXS	
    LDA #0	
    STA ROLLING_COUNTER
    STA PICS
    STA EnemyLineBuffer
    
    ClearMem 
    STA 0,X		
    DEX		
    BNE ClearMem	
    
    LDA #$00   ;start with a black background
    STA COLUBK	
    LDA #$1C   ;lets go for bright yellow, the traditional color for happyfaces
    STA COLUP0
    ;Setting some variables...
    LDA #80
    STA YPosFromBot	;Initial Y Position
    STA YPosFromBotE1
    
    LDA #010001		; 2 cycles
    STA BG_0		; 3 cycles
    STA BG_1		; 3 cycles
    STA BG_2		; 3 cycles
    
    ;; Let's set up the sweeping line. as Missile 1
    
    
    LDA #2
    ;	STA ENAM1  ;enable it
    LDA #33
    STA COLUP0 ;color it
    STA COLUP1 ;color it
    
    LDA #$10
    ;	STA NUSIZ0	;make it quadwidth (not so thin, that)
    STA NUSIZ1	;make it quadwidth (not so thin, that)
    
    LDA #000000	; set to not move
    STA HMM1	; of HMM1 sets it to moving
    
    
    
    ;VSYNC time
    MainLoop ;+++++++++++++++++++++++++++The start of a new screen
    LDA #0
    STA GRP0
    STA GRP1	
    STA PF0
    STA PF1
    STA PF2
    LDA #2
    STA VSYNC	
    STA WSYNC	
    
    
    ; for up and down, we INC or DEC
    ; the Y Position
    
    LDA #010000	;Down?
    BIT SWCHA 
    BNE SkipMoveDown
    INC YPosFromBot
    INC YPosFromBotE1
    INC YPosFromBotE1
    SkipMoveDown
    
    LDA #100000	;Up?
    BIT SWCHA 
    BNE SkipMoveUp
    DEC YPosFromBot
    DEC YPosFromBotE1
    DEC YPosFromBotE1
    SkipMoveUp
    
    ; for left and right, we're gonna 
    ; set the horizontal speed, and then do
    ; a single HMOVE.  We'll use X to hold the
    ; horizontal speed, then store it in the 
    ; appropriate register
    
    
    
    
    ;assum horiz speed will be zero
    LDX #0	
    
    
    LDA #%01000000	;Left?
    BIT SWCHA 
    BNE SkipMoveLeft
    LDX #$10	;a 1 in the left nibble means go left
    
    
    ;; moving left, so we need the mirror image
    LDA #001000   ;a 1 in D3 of REFP0 says make it mirror
    STA REFP0
    STA REFP1
    SkipMoveLeft
    
    LDA #%10000000	;Right?
    BIT SWCHA 
    BNE SkipMoveRight
    LDX #$F0	;a -1 in the left nibble means go right...
    
    ;; moving right, cancel any mirrorimage
    LDA #000000
    STA REFP0
    STA REFP1
    
    SkipMoveRight
    
    
    STX HMP0	;set the move for player 0, not the missile like last time...
    STX HMP1	;set the move for player 0, not the missile like last time...
    
    
    
    ; see if player and missile collide, and change the background color if so
    
    ;just a review...comparisons of numbers always seem a little backwards to me,
    ;since it's easier to load up the accumulator with the test value, and then
    ;compare that value to what's in the register we're interested.
    ;in this case, we want to see if D7 of CXM1P (meaning Player 0 hit
    ; missile 1) is on. So we put 10000000 into the Accumulator,
    ;then use BIT to compare it to the value in CXM1P
    
    LDA #%10000000
    BIT CXM1P		
    BEQ NoCollision	;skip if not hitting...
    LDA YPosFromBot	;must be a hit! load in the YPos...
    STA COLUBK	;and store as the bgcolor
    NoCollision
    STA CXCLR	;reset the collision detection for next time
    
    STA WSYNC ;//////////////////////////////////////////////
    
    ;setup pic animations ----------------------------------------------
    INC ROLLING_COUNTER
    
    LDA ROLLING_COUNTER
    AND #15		;every 8th screen swap to next image of player
    CMP #8
    BEQ PICSET4
    JMP PICSET3
    PICSET4	LDA  PICS
    CMP  #8
    BEQ PICSET
    LDA  #8
    JMP PICSET2
    PICSET	LDA  #0
    PICSET2	STA PICS
    PICSET3
    
    
    LDA ROLLING_COUNTER
    AND #25		;how often to move enemy, larger number is slower
    CMP #8
    BEQ PICSET5
    LDA #001111	; +1 in the left nibble
    JMP PICSET6
    PICSET5	LDA #011111	; 0 in the left nibble
    PICSET6	STA HMP1	; of HMP1 sets it to moving the enemy
    
    
    
    LDA #8
    CLC
    ADC PICS	;add value of pics to Accumulator 
    STA VisibleEnemyLineCurrent	
    
    LDA #8
    CLC
    ADC PICS	;add value of pics to Accumulator 
    STA VisiblePlayerLineCurrent
    
    ;setup pic animations ----------------------------------------------
    
    STA WSYNC ;//////////////////////////////////////////////	
    LDA #43	
    STA TIM64T	
    LDA #0
    STA VSYNC 	
    
    ;------------------------- setup backgrounds 20 pixels accross
    LDA #255			; 3 cycles
    STA PF0			; 3 cycles
    STA PF1			; 3 cycles
    STA PF2			; 3 cycles
    ;-------------------------
    
    
    
    WaitForVblankEnd
    LDA INTIM	
    BNE WaitForVblankEnd	
    LDY #4 ; was 191 	
    
    
    STA WSYNC	
    STA HMOVE 	
    
    STA VBLANK  	
    
    
    ;main scanline loop...
    
    
    
    PreScanLoop
    
    
    
    ScanLoop1 ;start of kernal +++++++++++++++++++++++ for skyline
    LDA PFCOLOR-1,Y		; 4 cycles
    STA COLUBK	;and store as the bgcolor ; 3 cycles
    LDA PFData0-1,Y		; 4 cycles
    STA PF0			; 3 cycles
    LDA PFData1-1,Y		; 4 cycles
    STA RESM0		; 3 cycles places left scan line leftmost
    STA PF1			; 3 cycles
    LDA PFData2-1,Y		; 4 cycles
    STA PF2			; 3 cycles
    
    
    LDA #0							;2 cycles =30
    STA GRP1	; put player 1 into grp1 3 cycles 
    STA GRP0	;put that line as player graphic 0	 ;3 cycles =28
    DEY		;count down number of scan lines	  2 cycles =71
    STA WSYNC 						 ;3 cycles =74
    BNE ScanLoop1		 				 ;2 cycles =76
    EndScanLoop1 ;end of kernal +++++++++++++++++++++++ for skyline
    
    LDA #100;
    
    STA COLUBK	;and store as the bgcolor
    LDY #186 ; was 191 was 186
    LDA #0
    STA PF0			; 3 cycles
    STA PF1			; 3 cycles
    STA PF2			; 3 cycles
    
    LDA #%11100011	;The last 3 bits control number and size of players
    		;the firs 3 bits control missle size
    STA NUSIZ0
    STA NUSIZ1
    STA WSYNC 						 ;3 cycles
    
    
    ScanLoop ;start of kernal +++++++++++++++++++++++ for players
    
    
           ;-------------------------- y register is the line number currently being drawn
           ; SPRITE DRAW
           tya                     ; 2 Transfers the byte in the Y Register to the Accumulator.
           sec                     ; 2 Sets the carry (C) flag (in the processor Status Register byte).
           sbc YPosFromBot         ; 3 Subtracts a byte in memory from the byte in the Accumulator, and "borrows" if necessary.
           adc #8      		; 2 Adds byte in memory to the byte in the Accumulator, plus the carry flag if set. 
           bcs .Draw               ; 2(3) Branches up to 127 bytes forward or 128 bytes backward from its own address if the carry flag is set. 
           nop                     ; 2 Wait
           nop                     ; 2 Wait
           sec                     ; 2 Sets the carry (C) flag 
           lda MainPlayerGraphics,y          ; 5 Loads the Accumulator with a byte from memory. 
           bcs .skipDraw           ; 3 Branches up to 127 bytes forward or 128 bytes backward from its own address if the carry flag is set.
    .Draw
           sta GRP0	          ; 3 Stores the byte in the Accumulator into memory.
    .skipDraw
            ;-->18 cycles used
            ;--------------------------
    
    
    skipDrawRight        ; 3 from BCC
      LDA #0            ; 2
      BEQ continueRight ; 3 Return...
    
    
    ;	STA GRP0  	;set player graphics                                  3 cycles
    ;	STA GRP1  	;set player graphics                                  3 cycles
    
    
    
    
    
    
    
    
    
    
    
    
      TXA                          ; 2 A-> Current scannline
      SEC                          ; 2 Set Carry
      SBC YPosFromBot 		; 3 
      ADC #8          		; 2 calc if sprite is drawn
      BCC skipDrawRight            ; 2/3 To skip or not to skip?
      TAY                          ; 2
      lda P1Graphic,y              ; 4
    continueRight:
      STA GRP0    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    DEY		;count down number of scan lines	  2 cycles =
    STA WSYNC 						 ;3 cycles =
    BNE ScanLoop		 				 ;2 cycles =
    EndScanLoop ;end of kernal +++++++++++++++++ for players
    
    
    STA WSYNC  	
    STA VBLANK 	
    LDX #24		
    
    
    
    OverScanWait
    STA WSYNC
    DEX
    BNE OverScanWait
    JMP  MainLoop      
    
    
    
    MainPlayerGraphics
    .byte #010100
    .byte #010100
    .byte #011000
    .byte #011000
    .byte #%01111110
    .byte #010000
    .byte #111000
    .byte #111000
    SpriteEnd
    
    .byte #100010
    .byte #100100
    .byte #101000
    .byte #011000
    .byte #%01111110
    .byte #010000
    .byte #111000
    .byte #111000
    
    
    
    EnemyGraphics
    .byte #%01111000
    .byte #%10000100
    .byte #001000
    .byte #010000
    .byte #010000
    .byte #010000
    .byte #111000
    .byte #111000
    
    
    .byte #%01111000
    .byte #%01001000
    .byte #010000
    .byte #100000
    .byte #100000
    .byte #100000
    .byte #%01110000
    .byte #%01110000
    
    PFData0
           .byte #001111
           .byte #011111
           .byte #%01111111
           .byte #%11111111
    
    PFData1
           .byte #000000
           .byte #001110
           .byte #111111
           .byte #%01111111
    
    PFData2
           .byte #000000
           .byte #011000
           .byte #%10111100
           .byte #%11111111
    
    PFCOLOR
    .byte #$5F
    .byte #$5D
    .byte #$5B
    .byte #$59
    
    
    org $FFFC
    .word Start
    .word Start
    
    


  9. I tried to adapt this code to use skipdraw. However the graphics are not correct. The sprite starts in the correct location, however it seems to scroll through the memory, until you're on a certain y position. Then the graphics continue to the bottom of the screen. My code is below.

     

     

    processor 6502
    include vcs.h
    org $F000
    
    ;Variables ------
    
    YPosFromBot = $80;
    VisiblePlayerLine = $81;
    PICS = $82;
    ROLLING_COUNTER = $83;
    Graphics_Buffer = $84
    YPosFromBotE1 = $85;
    VisibleEnemyLine = $86;
    VisibleEnemyLineCurrent = $87;
    EnemyLineBuffer = $88;
    VisiblePlayerLineCurrent = $90;
    BG_0 = $91;
    BG_1 = $92;
    BG_2 = $93;
    
    
    
    ; Constants ------
    playerheight      ds #8;
    
    
    ;generic start up stuff...
    Start
    SEI	
    CLD  	
    LDX #$FF	
    TXS	
    LDA #0	
    STA ROLLING_COUNTER
    STA PICS
    STA EnemyLineBuffer
    
    ClearMem 
    STA 0,X		
    DEX		
    BNE ClearMem	
    
    LDA #$00   ;start with a black background
    STA COLUBK	
    LDA #$1C   ;lets go for bright yellow, the traditional color for happyfaces
    STA COLUP0
    ;Setting some variables...
    LDA #80
    STA YPosFromBot	;Initial Y Position
    STA YPosFromBotE1
    
    LDA #010001		; 2 cycles
    STA BG_0		; 3 cycles
    STA BG_1		; 3 cycles
    STA BG_2		; 3 cycles
    
    ;; Let's set up the sweeping line. as Missile 1
    
    
    LDA #2
    ;	STA ENAM1  ;enable it
    LDA #33
    STA COLUP0 ;color it
    STA COLUP1 ;color it
    
    LDA #$10
    ;	STA NUSIZ0	;make it quadwidth (not so thin, that)
    STA NUSIZ1	;make it quadwidth (not so thin, that)
    
    LDA #000000	; set to not move
    STA HMM1	; of HMM1 sets it to moving
    
    
    
    ;VSYNC time
    MainLoop ;+++++++++++++++++++++++++++The start of a new screen
    LDA #0
    STA GRP0
    STA GRP1	
    STA PF0
    STA PF1
    STA PF2
    LDA #2
    STA VSYNC	
    STA WSYNC	
    
    
    ; for up and down, we INC or DEC
    ; the Y Position
    
    LDA #010000	;Down?
    BIT SWCHA 
    BNE SkipMoveDown
    INC YPosFromBot
    INC YPosFromBotE1
    INC YPosFromBotE1
    SkipMoveDown
    
    LDA #100000	;Up?
    BIT SWCHA 
    BNE SkipMoveUp
    DEC YPosFromBot
    DEC YPosFromBotE1
    DEC YPosFromBotE1
    SkipMoveUp
    
    ; for left and right, we're gonna 
    ; set the horizontal speed, and then do
    ; a single HMOVE.  We'll use X to hold the
    ; horizontal speed, then store it in the 
    ; appropriate register
    
    
    
    
    ;assum horiz speed will be zero
    LDX #0	
    
    
    LDA #%01000000	;Left?
    BIT SWCHA 
    BNE SkipMoveLeft
    LDX #$10	;a 1 in the left nibble means go left
    
    
    ;; moving left, so we need the mirror image
    LDA #001000   ;a 1 in D3 of REFP0 says make it mirror
    STA REFP0
    STA REFP1
    SkipMoveLeft
    
    LDA #%10000000	;Right?
    BIT SWCHA 
    BNE SkipMoveRight
    LDX #$F0	;a -1 in the left nibble means go right...
    
    ;; moving right, cancel any mirrorimage
    LDA #000000
    STA REFP0
    STA REFP1
    
    SkipMoveRight
    
    
    STX HMP0	;set the move for player 0, not the missile like last time...
    STX HMP1	;set the move for player 0, not the missile like last time...
    
    
    
    ; see if player and missile collide, and change the background color if so
    
    ;just a review...comparisons of numbers always seem a little backwards to me,
    ;since it's easier to load up the accumulator with the test value, and then
    ;compare that value to what's in the register we're interested.
    ;in this case, we want to see if D7 of CXM1P (meaning Player 0 hit
    ; missile 1) is on. So we put 10000000 into the Accumulator,
    ;then use BIT to compare it to the value in CXM1P
    
    LDA #%10000000
    BIT CXM1P		
    BEQ NoCollision	;skip if not hitting...
    LDA YPosFromBot	;must be a hit! load in the YPos...
    STA COLUBK	;and store as the bgcolor
    NoCollision
    STA CXCLR	;reset the collision detection for next time
    
    STA WSYNC ;//////////////////////////////////////////////
    
    ;setup pic animations ----------------------------------------------
    INC ROLLING_COUNTER
    
    LDA ROLLING_COUNTER
    AND #15		;every 8th screen swap to next image of player
    CMP #8
    BEQ PICSET4
    JMP PICSET3
    PICSET4	LDA  PICS
    CMP  #8
    BEQ PICSET
    LDA  #8
    JMP PICSET2
    PICSET	LDA  #0
    PICSET2	STA PICS
    PICSET3
    
    
    LDA ROLLING_COUNTER
    AND #25		;how often to move enemy, larger number is slower
    CMP #8
    BEQ PICSET5
    LDA #001111	; +1 in the left nibble
    JMP PICSET6
    PICSET5	LDA #011111	; 0 in the left nibble
    PICSET6	STA HMP1	; of HMP1 sets it to moving the enemy
    
    
    
    LDA #8
    CLC
    ADC PICS	;add value of pics to Accumulator 
    STA VisibleEnemyLineCurrent	
    
    LDA #8
    CLC
    ADC PICS	;add value of pics to Accumulator 
    STA VisiblePlayerLineCurrent
    
    ;setup pic animations ----------------------------------------------
    
    STA WSYNC ;//////////////////////////////////////////////	
    LDA #43	
    STA TIM64T	
    LDA #0
    STA VSYNC 	
    
    ;------------------------- setup backgrounds 20 pixels accross
    LDA #255			; 3 cycles
    STA PF0			; 3 cycles
    STA PF1			; 3 cycles
    STA PF2			; 3 cycles
    ;-------------------------
    
    
    
    WaitForVblankEnd
    LDA INTIM	
    BNE WaitForVblankEnd	
    LDY #4 ; was 191 	
    
    
    STA WSYNC	
    STA HMOVE 	
    
    STA VBLANK  	
    
    
    ;main scanline loop...
    
    
    
    PreScanLoop
    
    
    
    ScanLoop1 ;start of kernal +++++++++++++++++++++++ for skyline
    LDA PFCOLOR-1,Y		; 4 cycles
    STA COLUBK	;and store as the bgcolor ; 3 cycles
    LDA PFData0-1,Y		; 4 cycles
    STA PF0			; 3 cycles
    LDA PFData1-1,Y		; 4 cycles
    STA RESM0		; 3 cycles places left scan line leftmost
    STA PF1			; 3 cycles
    LDA PFData2-1,Y		; 4 cycles
    STA PF2			; 3 cycles
    
    
    LDA #0							;2 cycles =30
    STA GRP1	; put player 1 into grp1 3 cycles 
    STA GRP0	;put that line as player graphic 0	 ;3 cycles =28
    DEY		;count down number of scan lines	  2 cycles =71
    STA WSYNC 						 ;3 cycles =74
    BNE ScanLoop1		 				 ;2 cycles =76
    EndScanLoop1 ;end of kernal +++++++++++++++++++++++ for skyline
    
    LDA #100;
    
    STA COLUBK	;and store as the bgcolor
    LDY #186 ; was 191 was 186
    LDA #0
    STA PF0			; 3 cycles
    STA PF1			; 3 cycles
    STA PF2			; 3 cycles
    
    LDA #%11100011	;The last 3 bits control number and size of players
    		;the firs 3 bits control missle size
    STA NUSIZ0
    STA NUSIZ1
    STA WSYNC 						 ;3 cycles
    
    
    ScanLoop ;start of kernal +++++++++++++++++++++++ for players
    
    
           ;-------------------------- y register is the line number currently being drawn
           ; SPRITE DRAW
           tya                     ; 2 Transfers the byte in the Y Register to the Accumulator.
           sec                     ; 2 Sets the carry (C) flag (in the processor Status Register byte).
           sbc YPosFromBot         ; 3 Subtracts a byte in memory from the byte in the Accumulator, and "borrows" if necessary.
           adc #8      		; 2 Adds byte in memory to the byte in the Accumulator, plus the carry flag if set. 
           bcs .Draw               ; 2(3) Branches up to 127 bytes forward or 128 bytes backward from its own address if the carry flag is set. 
           nop                     ; 2 Wait
           nop                     ; 2 Wait
           sec                     ; 2 Sets the carry (C) flag 
           bcs .skipDraw           ; 3 Branches up to 127 bytes forward or 128 bytes backward from its own address if the carry flag is set.
    .Draw
           lda MainPlayerGraphics,y          ; 5 Loads the Accumulator with a byte from memory. 
           sta GRP0	          ; 3 Stores the byte in the Accumulator into memory.
    .skipDraw
            ;-->18 cycles used
            ;--------------------------
    
    ;	STA GRP0  	;set player graphics                                  3 cycles
    ;	STA GRP1  	;set player graphics                                  3 cycles
    
    
    
    
    DEY		;count down number of scan lines	  2 cycles =
    STA WSYNC 						 ;3 cycles =
    BNE ScanLoop		 				 ;2 cycles =
    EndScanLoop ;end of kernal +++++++++++++++++ for players
    
    
    STA WSYNC  	
    STA VBLANK 	
    LDX #24		
    
    
    
    OverScanWait
    STA WSYNC
    DEX
    BNE OverScanWait
    JMP  MainLoop      
    
    
    
    MainPlayerGraphics
    .byte #010100
    .byte #010100
    .byte #011000
    .byte #011000
    .byte #%01111110
    .byte #010000
    .byte #111000
    .byte #111000
    SpriteEnd
    
    .byte #100010
    .byte #100100
    .byte #101000
    .byte #011000
    .byte #%01111110
    .byte #010000
    .byte #111000
    .byte #111000
    
    
    
    EnemyGraphics
    .byte #%01111000
    .byte #%10000100
    .byte #001000
    .byte #010000
    .byte #010000
    .byte #010000
    .byte #111000
    .byte #111000
    
    
    .byte #%01111000
    .byte #%01001000
    .byte #010000
    .byte #100000
    .byte #100000
    .byte #100000
    .byte #%01110000
    .byte #%01110000
    
    PFData0
           .byte #001111
           .byte #011111
           .byte #%01111111
           .byte #%11111111
    
    PFData1
           .byte #000000
           .byte #001110
           .byte #111111
           .byte #%01111111
    
    PFData2
           .byte #000000
           .byte #011000
           .byte #%10111100
           .byte #%11111111
    
    PFCOLOR
    .byte #$5F
    .byte #$5D
    .byte #$5B
    .byte #$59
    
    
    org $FFFC
    .word Start
    .word Start
    


  10. I'm trying to convert this code to use skipdraw. However so far the graphics aren't correct. What am I doing wrong?

     

    ; move a happy face with the joystick by Kirk Israel
    ; (with a can't'dodge'em line sweeping across the screen)
    
    processor 6502
    include vcs.h
    org $F000
    
    ;Variables ------
    
    YPosFromBot = $80;
    VisiblePlayerLine = $81;
    PICS = $82;
    ROLLING_COUNTER = $83;
    Graphics_Buffer = $84
    YPosFromBotE1 = $85;
    VisibleEnemyLine = $86;
    VisibleEnemyLineCurrent = $87;
    EnemyLineBuffer = $88;
    VisiblePlayerLineCurrent = $90;
    BG_0 = $91;
    BG_1 = $92;
    BG_2 = $93;
    
    
    
    ; Constants ------
    playerheight      ds #8;
    
    
    ;generic start up stuff...
    Start
    SEI	
    CLD  	
    LDX #$FF	
    TXS	
    LDA #0	
    STA ROLLING_COUNTER
    STA PICS
    STA EnemyLineBuffer
    
    ClearMem 
    STA 0,X		
    DEX		
    BNE ClearMem	
    
    LDA #$00   ;start with a black background
    STA COLUBK	
    LDA #$1C   ;lets go for bright yellow, the traditional color for happyfaces
    STA COLUP0
    ;Setting some variables...
    LDA #80
    STA YPosFromBot	;Initial Y Position
    STA YPosFromBotE1
    
    LDA #010001		; 2 cycles
    STA BG_0		; 3 cycles
    STA BG_1		; 3 cycles
    STA BG_2		; 3 cycles
    
    ;; Let's set up the sweeping line. as Missile 1
    
    
    LDA #2
    ;	STA ENAM1  ;enable it
    LDA #33
    STA COLUP0 ;color it
    STA COLUP1 ;color it
    
    LDA #$10
    ;	STA NUSIZ0	;make it quadwidth (not so thin, that)
    STA NUSIZ1	;make it quadwidth (not so thin, that)
    
    LDA #000000	; set to not move
    STA HMM1	; of HMM1 sets it to moving
    
    
    
    ;VSYNC time
    MainLoop ;+++++++++++++++++++++++++++The start of a new screen
    LDA #0
    STA GRP0
    STA GRP1	
    STA PF0
    STA PF1
    STA PF2
    LDA #2
    STA VSYNC	
    STA WSYNC	
    
    
    ; for up and down, we INC or DEC
    ; the Y Position
    
    LDA #010000	;Down?
    BIT SWCHA 
    BNE SkipMoveDown
    INC YPosFromBot
    INC YPosFromBotE1
    INC YPosFromBotE1
    SkipMoveDown
    
    LDA #100000	;Up?
    BIT SWCHA 
    BNE SkipMoveUp
    DEC YPosFromBot
    DEC YPosFromBotE1
    DEC YPosFromBotE1
    SkipMoveUp
    
    ; for left and right, we're gonna 
    ; set the horizontal speed, and then do
    ; a single HMOVE.  We'll use X to hold the
    ; horizontal speed, then store it in the 
    ; appropriate register
    
    
    
    
    ;assum horiz speed will be zero
    LDX #0	
    
    
    LDA #%01000000	;Left?
    BIT SWCHA 
    BNE SkipMoveLeft
    LDX #$10	;a 1 in the left nibble means go left
    
    
    ;; moving left, so we need the mirror image
    LDA #001000   ;a 1 in D3 of REFP0 says make it mirror
    STA REFP0
    STA REFP1
    SkipMoveLeft
    
    LDA #%10000000	;Right?
    BIT SWCHA 
    BNE SkipMoveRight
    LDX #$F0	;a -1 in the left nibble means go right...
    
    ;; moving right, cancel any mirrorimage
    LDA #000000
    STA REFP0
    STA REFP1
    
    SkipMoveRight
    
    
    STX HMP0	;set the move for player 0, not the missile like last time...
    STX HMP1	;set the move for player 0, not the missile like last time...
    
    
    
    ; see if player and missile collide, and change the background color if so
    
    ;just a review...comparisons of numbers always seem a little backwards to me,
    ;since it's easier to load up the accumulator with the test value, and then
    ;compare that value to what's in the register we're interested.
    ;in this case, we want to see if D7 of CXM1P (meaning Player 0 hit
    ; missile 1) is on. So we put 10000000 into the Accumulator,
    ;then use BIT to compare it to the value in CXM1P
    
    LDA #%10000000
    BIT CXM1P		
    BEQ NoCollision	;skip if not hitting...
    LDA YPosFromBot	;must be a hit! load in the YPos...
    STA COLUBK	;and store as the bgcolor
    NoCollision
    STA CXCLR	;reset the collision detection for next time
    
    STA WSYNC ;//////////////////////////////////////////////
    
    ;setup pic animations ----------------------------------------------
    INC ROLLING_COUNTER
    
    LDA ROLLING_COUNTER
    AND #15		;every 8th screen swap to next image of player
    CMP #8
    BEQ PICSET4
    JMP PICSET3
    PICSET4	LDA  PICS
    CMP  #8
    BEQ PICSET
    LDA  #8
    JMP PICSET2
    PICSET	LDA  #0
    PICSET2	STA PICS
    PICSET3
    
    
    LDA ROLLING_COUNTER
    AND #25		;how often to move enemy, larger number is slower
    CMP #8
    BEQ PICSET5
    LDA #001111	; +1 in the left nibble
    JMP PICSET6
    PICSET5	LDA #011111	; 0 in the left nibble
    PICSET6	STA HMP1	; of HMP1 sets it to moving the enemy
    
    
    
    LDA #8
    CLC
    ADC PICS	;add value of pics to Accumulator 
    STA VisibleEnemyLineCurrent	
    
    LDA #8
    CLC
    ADC PICS	;add value of pics to Accumulator 
    STA VisiblePlayerLineCurrent
    
    ;setup pic animations ----------------------------------------------
    
    STA WSYNC ;//////////////////////////////////////////////	
    LDA #43	
    STA TIM64T	
    LDA #0
    STA VSYNC 	
    
    ;------------------------- setup backgrounds 20 pixels accross
    LDA #255			; 3 cycles
    STA PF0			; 3 cycles
    STA PF1			; 3 cycles
    STA PF2			; 3 cycles
    ;-------------------------
    
    
    
    WaitForVblankEnd
    LDA INTIM	
    BNE WaitForVblankEnd	
    LDY #4 ; was 191 	
    
    
    STA WSYNC	
    STA HMOVE 	
    
    STA VBLANK  	
    
    
    ;main scanline loop...
    
    
    
    PreScanLoop
    
    
    
    ScanLoop1 ;start of kernal +++++++++++++++++++++++ for skyline
    LDA PFCOLOR-1,Y		; 4 cycles
    STA COLUBK	;and store as the bgcolor ; 3 cycles
    LDA PFData0-1,Y		; 4 cycles
    STA PF0			; 3 cycles
    LDA PFData1-1,Y		; 4 cycles
    STA RESM0		; 3 cycles places left scan line leftmost
    STA PF1			; 3 cycles
    LDA PFData2-1,Y		; 4 cycles
    STA PF2			; 3 cycles
    
    
    LDA #0							;2 cycles =30
    STA GRP1	; put player 1 into grp1 3 cycles 
    STA GRP0	;put that line as player graphic 0	 ;3 cycles =28
    DEY		;count down number of scan lines	  2 cycles =71
    STA WSYNC 						 ;3 cycles =74
    BNE ScanLoop1		 				 ;2 cycles =76
    EndScanLoop1 ;end of kernal +++++++++++++++++++++++ for skyline
    
    LDA #100;
    
    STA COLUBK	;and store as the bgcolor
    LDY #186 ; was 191 was 186
    LDA #0
    STA PF0			; 3 cycles
    STA PF1			; 3 cycles
    STA PF2			; 3 cycles
    
    LDA #%11100011	;The last 3 bits control number and size of players
    		;the firs 3 bits control missle size
    STA NUSIZ0
    STA NUSIZ1
    STA WSYNC 						 ;3 cycles
    
    
    ScanLoop ;start of kernal +++++++++++++++++++++++ for players
           ;-------------------------- 
           ; SPRITE DRAW
           tya                     ; 2 Transfers the byte in the Y Register to the Accumulator.
           sec                     ; 2 Sets the carry (C) flag (in the processor Status Register byte).
           sbc SpriteEnd           ; 3 Subtracts a byte in memory from the byte in the Accumulator, and "borrows" if necessary.
           adc #8      		; 2 Adds byte in memory to the byte in the Accumulator, plus the carry flag if set. 
           bcs .Draw               ; 2(3) Branches up to 127 bytes forward or 128 bytes backward from its own address if the carry flag is set. 
           nop                     ; 2 Wait
           nop                     ; 2 Wait
           sec                     ; 2 Sets the carry (C) flag 
           bcs .skipDraw           ; 3 Branches up to 127 bytes forward or 128 bytes backward from its own address if the carry flag is set.
    .Draw
           lda MainPlayerGraphics,y          ; 5 Loads the Accumulator with a byte from memory. 
           sta GRP0	          ; 3 Stores the byte in the Accumulator into memory.
    .skipDraw
            ;-->18 cycles used
            ;--------------------------
    
    STA GRP0  	;set player graphics                                  3 cycles
    STA GRP1  	;set player graphics                                  3 cycles
    
    
    
    
    DEY		;count down number of scan lines	  2 cycles =
    STA WSYNC 						 ;3 cycles =
    BNE ScanLoop		 				 ;2 cycles =
    EndScanLoop ;end of kernal +++++++++++++++++ for players
    
    
    STA WSYNC  	
    STA VBLANK 	
    LDX #24		
    
    
    
    OverScanWait
    STA WSYNC
    DEX
    BNE OverScanWait
    JMP  MainLoop      
    
    
    
    MainPlayerGraphics
    .byte #010100
    .byte #010100
    .byte #011000
    .byte #011000
    .byte #%01111110
    .byte #010000
    .byte #111000
    .byte #111000
    SpriteEnd
    
    .byte #100010
    .byte #100100
    .byte #101000
    .byte #011000
    .byte #%01111110
    .byte #010000
    .byte #111000
    .byte #111000
    
    
    
    EnemyGraphics
    .byte #%01111000
    .byte #%10000100
    .byte #001000
    .byte #010000
    .byte #010000
    .byte #010000
    .byte #111000
    .byte #111000
    
    
    .byte #%01111000
    .byte #%01001000
    .byte #010000
    .byte #100000
    .byte #100000
    .byte #100000
    .byte #%01110000
    .byte #%01110000
    
    PFData0
           .byte #001111
           .byte #011111
           .byte #%01111111
           .byte #%11111111
    
    PFData1
           .byte #000000
           .byte #001110
           .byte #111111
           .byte #%01111111
    
    PFData2
           .byte #000000
           .byte #011000
           .byte #%10111100
           .byte #%11111111
    
    PFCOLOR
    .byte #$5F
    .byte #$5D
    .byte #$5B
    .byte #$59
    
    
    org $FFFC
    .word Start
    .word Start
    


  11. I just bought one for 40 with phaser patrol and fireball. I overpaid a little. I was mad for having missed that auction that went for 16. There's a CIB one on ebay for 35. 18 is not bad, just make sure that when they modded it, they didn't damage the whole thing. I recieved my supercharger yesterday, but I misplaced my cassette player, and haven't gotten to use it yet.

×
×
  • Create New...