Jump to content
IGNORED

Help Programming a bullet


Recommended Posts

I'm very new to atari programming and was wondering how i could have my ship shoot out a bullet and also face the left side of the screen (it is currently at the right)

Thanks :)

 

 

    processor 6502
    include "vcs.h"
    include "macro.h"
    
    org $F000

YPosFromBot = $80;
VisiblePlayerLine = $81;
PlayerBuffer = $82 ;setup an extra variable

;generic start up stuff...
start
    SEI    
    CLD      
    ldx #$FF    
    TXS    
    lda #0        
ClearMem 
    sta 0,X        
    dex        
    bne ClearMem    
    lda #$00        
    sta COLUBK    ;start with black background
    lda #$08
    sta COLUP0
    
;Setting some variables...
    lda #80
    sta YPosFromBot    ;Initial Y Position

    lda #$20    
    sta NUSIZ0    ;Quad Width

;VSYNC time
MainLoop:
    lda #2
    sta VSYNC    
    sta WSYNC    
    sta WSYNC     
    sta WSYNC    
    lda #43    
    sta TIM64T    
    lda #0
    sta VSYNC 
    
    lda #%00010000    ;Down?
    bit SWCHA 
    bne SkipMoveDown
    inc YPosFromBot
SkipMoveDown

    lda #%00100000    ;Up?
    bit SWCHA 
    bne SkipMoveUp
    dec YPosFromBot
SkipMoveUp

WaitForVblankEnd:
    lda INTIM    
    bne WaitForVblankEnd    
    ldy #191     
    sta WSYNC
    sta VBLANK 
    
ScanLoop:
    sta WSYNC

    lda PlayerBuffer ;buffer was set during last scanline
    sta GRP0         ;put it as graphics now        
    
CheckActivatePlayer
    CPY YPosFromBot
    bne SkipActivatePlayer
    lda #8
    sta VisiblePlayerLine 
SkipActivatePlayer


    lda #0        
    sta PlayerBuffer   ;set buffer, not GRP0

    ldx VisiblePlayerLine    ;check the visible player line...
    BEQ FinishPlayer    ;skip the drawing if its zero...
    
IsPlayerOn    
    lda Ship-1,x    
    sta PlayerBuffer    

   dec VisiblePlayerLine     ;and decrement the line count
FinishPlayer

    dey        
    bne ScanLoop    

    lda #2        
    sta WSYNC      
    sta VBLANK     
    ldx #30
    
OverScanWait:
    sta WSYNC
    dex
    bne OverScanWait
    jmp MainLoop
    
Ship:
    .byte #%00000000
    .byte #%00100000
    .byte #%01111000
    .byte #%11111100
    .byte #%01111111
    .byte #%11111100
    .byte #%01111000
    .byte #%00100000      
    
    org $FFFC
    .word start
    .word start    

galactus.asm

Link to comment
Share on other sites

You need to read several tutorials to understand some basic 2600 programming concepts.

For example, you could mirror your Sprite so it faces the other direction, see REFP0 register.

https://alienbill.com/2600/101/06happy.html

 

As for the bullet, you need to look into tutorials for handling missile and player movement. It will require using ENAM0, NUSIZ0, RESP0, HMOVE and other registers. It sould be too complicated to describe it all here. Seek out one of the tutorials by Andrew Davie or the Spiceware Collect tutorial. 

https://8bitworkshop.com/v3.7.1/?file=examples%2Fmissiles.a&platform=vcs

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...