Jump to content

Vertical Trench experimenting issues.


Recommended Posts

  Playing around with the idea of trying to do a version of Trench but with vertical scrolling this time. (Never figured out how to get rid of the scanline twitch jumping from the menu into the game on the first.) Anyway, just wondering what is causing the little ship bounce when you are on the far left of the screen. Is it some kind of "align" issue? Also, is it missing a line of VSYNC somehow?

Doubt I would have lasers on this one with the width problem. (Lasers worked better scrolling horizontal. Just turn them on and off.) Also with more layers of depth I'm wondering how playable this could be.


  • Like 5
Link to comment
Share on other sites

The ship is bouncing because one of the display kernels is updating GRP0 too late, so it is dropped down by one line. 


Looking at the code there are two things you could do that will make an immediate impact. First put all of your zeropage ram references into seg.u vars instead of hardcoding them. Use "ds" to designate how many bytes so that you can easily do much more than 1 or 2.


       seg.u vars
       ORG $80

frameCounter   ds 1  ; ds = designate space, 1 byte of ram in this case
playerX        ds 1
playerY        ds 1
gameGrid       ds 20  ; 20 bytes of ram


The second thing is reducing the multiple kernels for the different playfields. It would be much more managable to make pointers to playfield data you want instead.


; load pointers
    ldy shipAltitude        ; Y = 0 to 6
    lda ShipDataPtrLoTab,Y
    sta spritePtr
    lda ShipDataPtrHighTab,Y
    sta spritePtr+1

    ldy screenFrameNumber   ; Y = 0 to 3
    lda Pf0_PtrLoTab,Y
    sta pf0Gfx
    lda Pf0_PtrHighTab,Y
    sta pf0Gfx+1

; data tables
    .byte <ShipData
    .byte <ShipData2
    .byte <ShipData3
    .byte <ShipData4
    .byte <ShipData5
    .byte <ShipData6
    .byte <ShipData7
    .byte >ShipData
    .byte >ShipData2
    .byte >ShipData3
    .byte >ShipData4
    .byte >ShipData5
    .byte >ShipData6
    .byte >ShipData7

    .byte <Frame1PF0
    .byte <Frame2PF0
    .byte <Frame3PF0
    .byte <Frame4PF0
    .byte >Frame1PF0
    .byte >Frame2PF0
    .byte >Frame3PF0
    .byte >Frame4PF0


Than your kernel becomes:

    lda (SpritePtr),y
    sta WSYNC
    sta GRP0
    lda (pf0Gfx),y
    sta PF0
    lda (pf1Gfx),y
    sta PF1
    lda (pf2Gfx),y
    sta PF2

    cpy #140
    bne DrawDaScreen

    sta WSYNC
    lda #0
    sta PF0
    sta PF1
    sta PF2
    sta COLUBK
    sta COLUPF

    sta WSYNC
    jmp OScanS



  • Like 1
Link to comment
Share on other sites

Thanks for the advice! Hard to break old habits. I'm used to loading stuff directly in. Haven't used pointers much. Well, I'm sure it can be cleaned up much more but got a non-bouncy version now. I used pointers for PF0,PF1,PF2... At first the bounce just shifted right a little. Rearranged the order then the playfield started getting warped. Moved the WSYNC to the top and it's looking pretty good now. (Still got one scanline on the top flashing on and off but the bounce is fixed). Probably why my car in Retro Racing takes a dip down a scanline at times or the playfield swims. Didn't change all the hard coding yet.


Edited by Domeshtan
  • Like 1
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.

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.

  • Recently Browsing   0 members

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