Jump to content
IGNORED

Round missile?


Recommended Posts

So I'm trying to make a round missile and I'm having trouble. Here is my current missile drawing code:

 

StopCoinDrawing    
            lda #0
            sta ENAM0

            jmp tTTTT
            
Turn_M0_on

        ldx SFXTimer
        cpx #0
        beq DisplayM0
        
        lda #0
        sta ENAM0    
        
        jmp tTTTT
        
DisplayM0
        ldx GameRunning
        cpx #2
        bcs StopCoinDrawing

        ldx CoinDrawTimer
        cpx #4
        beq StopCoinDrawing

        inc CoinDrawTimer

        lda #2
        sta ENAM0    

        ldx CoinDrawTimer
        cpx #2
        beq roundcoin2
                
        ldx CoinDrawTimer
        cpx #4
        beq roundcoin1
                    
        jmp tTTTT    
    
roundcoin1    
        lda #$25
        sta NUSIZ0    
        
        jmp tTTTT    
        
roundcoin2    
        lda #$35
        sta NUSIZ0    
    
        jmp tTTTT  

That produces this:

post-9475-0-10815100-1520772120.png

 

Is there a way to maneuver the coin's X position so the top and bottom are in the center instead of being at the left to make it a round shape instead of a D shape?

Link to comment
Share on other sites

So I'm trying to make a round missile and I'm having trouble. Here is my current missile drawing code:

StopCoinDrawing    
            lda #0
            sta ENAM0

            jmp tTTTT
            
Turn_M0_on

        ldx SFXTimer
        cpx #0
        beq DisplayM0
        
        lda #0
        sta ENAM0    
        
        jmp tTTTT
        
DisplayM0
        ldx GameRunning
        cpx #2
        bcs StopCoinDrawing

        ldx CoinDrawTimer
        cpx #4
        beq StopCoinDrawing

        inc CoinDrawTimer

        lda #2
        sta ENAM0    

        ldx CoinDrawTimer
        cpx #2
        beq roundcoin2
                
        ldx CoinDrawTimer
        cpx #4
        beq roundcoin1
                    
        jmp tTTTT    
    
roundcoin1    
        lda #$25
        sta NUSIZ0    
        
        jmp tTTTT    
        
roundcoin2    
        lda #$35
        sta NUSIZ0    
    
        jmp tTTTT  

That produces this:

attachicon.gifcoin.png

 

Is there a way to maneuver the coin's X position so the top and bottom are in the center instead of being at the left to make it a round shape instead of a D shape?

 

 

this is what you need?

 

http://atariage.com/forums/topic/71120-6502-killer-hacks/?p=876950

Link to comment
Share on other sites

You have to use HMM0 & HMOVE to shift the missile as well as NUSIZ0 to resize it. Something like this (untested):

KernelLoop:
  sta WSYNC
  sta HMOVE       ; 3  3
  lda (SIZE),y    ; 5  8  size of missile for current scanline
  sta NUSIZ0      ; 3 11
  ...             ; later in scanline as this is for the NEXT scanline
  lda (SHIFT),y   ; 5 ??
  sta HMM0        ; 3 ??
  dey             ; 2 ??
  bne KernelLoop  ; 2 ?? (3 ??)
 
...
 
CoinSize:
  byte $25 ; _XX_   row 0 Note: the $x5 = Double Size Player.  
  byte $25 ; _XX_   row 1       if your player can be different sizes you will need
  byte $35 ; XXXX   row 2       to make additional CoinSize tables to go along with
  byte $35 ; XXXX   row 3       each player size
  byte $35 ; XXXX   row 4
  byte $35 ; XXXX   row 5
  byte $25 ; _XX_   row 6
  byte $25 ; _XX_   row 7
 
CoinShift:  ; NOTE this data is for the NEXT scanline, so is off 1 row from CoinSize
  ;          _XX_   row 0
  byte $00 ; _XX_   row 1
  byte $10 ; XXXX   row 2 - shift left 1 pixel
  byte $00 ; XXXX   row 3
  byte $00 ; XXXX   row 4
  byte $00 ; XXXX   row 5
  byte $F0 ; _XX_   row 6 - shift right 1 pixel
  byte $00 ; _XX_   row 7
  byte $00 ;        row 8

Link to comment
Share on other sites

I guess I can't use it in this game. I got it working, but it screws everything else up. I'm just posting this here in case someone finds it useful:

 

Turn_M0_on

        ldx SFXTimer
        cpx #0
        beq DisplayM0
        
        lda #0
        sta ENAM0    
        
        jmp tTTTT
        
DisplayM0
        ldx GameRunning
        cpx #2
        bcs StopCoinDrawing

        ldx CoinDrawTimer
        cpx #5
        beq StopCoinDrawing

        inc CoinDrawTimer

        lda #2
        sta ENAM0    

        lda #0
        sta HMM0      

        ldx CoinDrawTimer
        cpx #2
        beq roundcoin1
                
        ldx CoinDrawTimer
        cpx #4
        beq roundcoin2
                    
            
                    
        jmp tTTTT    
    
roundcoin1    
        sta WSYNC
        sta HMOVE

        lda #$35
        sta NUSIZ0    
        
        lda #$20
        sta HMM0          
        
        jmp tTTTT    
        
roundcoin2    
        sta WSYNC
        sta HMOVE

        lda #$25
        sta NUSIZ0    
    
        lda #$E0
        sta HMM0      
    
        jmp tTTTT
Link to comment
Share on other sites

Other objects moving to where they shouldn't? HMP0, HMP1, HMM1 and HMBL need to be zeroed out before you get roundcoin1. Easiest way to do that is sta HMCLR after you've set the position of all the objects. But you can't do it too soon after you set those positions. From Stella Programmer's Guide:

8.0 Horizontal Motion

Horizontal motion allows the programmer to move any of the 5 graphics objects relative to their current horizontal position. Each object has a 4 bit horizontal motion register (HMP0, HMP1, HMM0, HMM1, HMBL) that can be loaded with a value in the range of +7 to -8 (negative values are expressed in two’s complement from). This motion is not executed until the HMOVE register is written to, at which time all motion registers move their respective objects. Objects can be moved repeatedly by simply executing HMOVE. Any object that is not to move must have a 0 in its motion register. With the horizontal positioning command confined to positioning objects at 15 color clock intervals, the motion registers fills in the gaps by moving objects +7 to -8 color clocks. Objects can not be placed at any color clock position across the screen. All 5 motion registers can be set to zero simultaneously by writing to the horizontal motion clear register (HMCLR).

There are timing constraints for the HMOVE command. The HMOVE command must immediately follow a WSYNC (Wait for SYNC) to insure the HMOVE operation occurs during horizontal blanking. This is to allow sufficient time for the motion registers to do their thing before the electron beam starts drawing the next scan line. Also, for mysterious internal hardware considerations, the motion registers should not be modified for at least 24 machine cycles after an HMOVE command.

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...