Jump to content
IGNORED

Defender II Hack Attempt - Trying to find 2 portions of code


Recommended Posts

21 hours ago, Nukey Shay said:

Removing that code provides enough free space to add Defender's full city gfx...just a couple of branch pagecross glitches to iron out.

Unfortunately I didn't remove that code.... I just repurposed it elsewhere for a different function.  I currently have 130 bytes free in bank 0 and maybe 80 bytes free in bank 1 - that's with me still trying to out my radar glitch....

 

On a side note, in both yours and in mine, I am finding a lot of radar glitches.  Lots of phantom blips showing up from time to time.  I'm trying to deal with that tonight.  You may have seen from my bins that I am trying to go with a full solid bar side to side below the radar.  so when I actually set PF0 (0xF0), PF1 (0xFF), PF2 (0x83) and back to 0x00 for all three at the end of the radar update before updating the scanlines for the playing area - it tends to get worse.  This all of course is being done in the area around LF360

Link to comment
Share on other sites

Not seeing the phantom blips you mentioned (?)  Gotta make sure that the radar display loop is NOT crossing a page (0 free cycles here).

 

59 minutes ago, rallyrabbit said:

You may have seen from my bins

What bins?  I can't find any you posted (I'd have a better understanding of what your games problems are if you did).

 

BTW moving setup code out of the display bank provides enough space to add the city gfx table (208 bytes for 20 pixel version).

Edited by Nukey Shay
Link to comment
Share on other sites

11 hours ago, Nukey Shay said:

Not seeing the phantom blips you mentioned (?)  Gotta make sure that the radar display loop is NOT crossing a page (0 free cycles here).

 

What bins?  I can't find any you posted (I'd have a better understanding of what your games problems are if you did).

 

BTW moving setup code out of the display bank provides enough space to add the city gfx table (208 bytes for 20 pixel version).

As soon as I get done with housework, I'll go into the symbol file and start looking at the paging.  The end of my radar code is (which uses for previous bit but retains some of what I was doing to get the bottom bar).  I would say you are probably right about paging since this code caused one of the above branches to fail (too long).....

LF360:
       STA    WSYNC                         ;3
       LDX    #$F0                          ;2 PF0 makes radar to the entire screen
       STX    PF0                           ;3
       LDX    #$FF                          ;2 give to an unused register to save for PF2 next line
       STX    PF1                           ;3
       LDA    #$83                          ;2 sides+the tab in the lower center of the radar
       STA    PF2                           ;3
       STA    WSYNC                         ;3
       JSR    LF92E                         ;6 looks like it is designed to waste cycles
       STX    PF2                           ;3
       JSR    LF92E                         ;6 looks like it is designed to waste cycles
       LDX    #$03                          ;2
       NOP                                  ;2
       NOP                                  ;2 @55
       STA    ENABL                         ;3
       STA    VDELP1                        ;3
       STA    NUSIZ0                        ;3
       STA    NUSIZ1                        ;3 @67
       CLC                                  ;2 @69
       STA    PF2                           ;3
       STA    PF1                           ;3 @75
       STA    PF0                           ;3
       BCC    LF3A2                         ;2 always branch to update game area

 

I will say when I use your code only in my file, it does not seem to have the radar glitch as often (rarely), this is your code for the same bit:

LF360:
       DEY                            ;2 16/21/26/31/36/41/46/51/56
       BNE    LF360                   ;2 19/24/29/34/39/44/49/54/58
       STA    ENABL                   ;3 61
       STA    VDELP1                  ;3 64
       STA    NUSIZ0                  ;3 67
       STA    NUSIZ1                  ;3 70
       LDA    #$7E                    ;2 72
       STA    PF2-2,X                 ;4 00

       INX                            ;2
       BNE    LF3A2                   ;3

LF395:
       JMP    LF553                   ;3
 

You're looping rather than me trying to force things with the timing (like the original code did)

 

 

 

Here's my latest...  which is still not 100% what i want because I am still dealing with the radar issue.  Something else I noticed as soon as I put in your radar code vs the old radar code I was using is the fact that the ship goes up to the top of the play area but the ship image (and enemy images) get cut off.  This should me

 

Roughly speaking, here's the changes I made and some info on it:

1) Title Screen (part of design espire did for Defender Arcade that was not adopted)

2) End of Wave Screen changed

3) Firebomber changed into Atari 2600 Defender Bomber

4) Lander changed into Atari 2600 Lander

5) Mutant changed into Atari 2600 Mutant

6) Big Red changed into Atari 2600 Baiter

7) Phred changed into a Atari 2600 Baiter that shoots

8) Removed Bonus/dogfight Stages

9) Score digits are the digits used in Atari 2600 Defender

10) Removed Inviso

11) Radar changed to look like Atari 2600 Defender in color, border now takes up the full screen

12) Graphics for Extra Ships and Smart Bombs changed to a vector format

13) Scoring for pods is now 1000 points

14) Ship was changed (not like Stargate or Atari 2600 Defender)

15) Bonus for people at end of stage is 100 points

16) City added instead of mountains when planet is not destroyed (to give a look and feel more like Atari 2600 Defender) (Nukey Shay)

17) Removed Hypersace risk of exploding and losing the ship

18) Hypersapce can be used with Player 1 fire button while at the top of the playing area and pushing up while firing.  There is no limit on hyperspace.

   NOTE: When a Hyperspace is used successfully, the ship will not fire a laser.

   NOTE: When a person is abducted, hyperspace can be used to jump to the abduction (like the old startgate worked previously)

19) Smart Bombs can be used from player 1 fire button when at the bottom of the city or space area if planet destroyed). 

   NOTE: People in the city can still be shot if at the level to use smartbomb.

   NOTE: When a Smart Bomb is used successfully, the ship will not fire a laser.

20) Removed Munchie, Phred, Yllabian Space Guppy as eneoies

21) Sounds of enemies shooting has been changed to be more similar to Atari 2600 Defender

22) Removed the platforms under the people when planet isn't detroyed

23) The color of the people on the planet matches Defender Arcade

24) Scoring for picking up falling people is not cumulative increasing, it is a standard 500 points

25) Stargate is no longer in the play area or the scanner

26) Retained and use the dynamo that comes out in attack 2 of waves

27) First attack of each wave contains Landers, Dynamo, Bombers with Pods (after wave 5)

28) Second attack of each wave contains Baiters that do not shoot, Bombers and Landers

29) Baiters that can shoot are introduced singly after lengths of failing to end the wave after the second attack occurs

30) Wave multiplier for increasing enemy speed is slowed down by half to get better longer game play out of a typical game (one of the big complaints of defender II/stargate/defender arcade is how short the games are because it is too hard).

31) End of wave "person" bonus text now doesn't look goofy (it actually flows with the rest of the text)

32) Only the Dynamo and POD remain as they were in Defender II/Stargate.  All other images are "static" (all 4 graphics represent the same graphic).

 

I still have the options for no hits, invincible, etc on for debugging, I also have not removed the original stargate code as I use it to test with occasionally.

 

defender city v16.bin

Edited by rallyrabbit
more info
Link to comment
Share on other sites

Your scanner begins at cycle 60 instead of cycle 61...so all the writes to the GR registers are off by 1 cycle.

Quick fix:

Leading up to the scanner, A is loaded with the value 2 at both F322 and F344.  Change the 2 bytes at F344 to be D0 00 instead of A9 02.  That new branch will burn the missing cycle (A still holds a 2 from F322).

atari001.jpg

Edited by Nukey Shay
Link to comment
Share on other sites

You should not WSYNC before you draw the horizontal line below the scanner, this bumps the total to 263.

 

A time check can be done after the 2nd WSYNC to waste some cycles and store the result to $F0 temporarily.  This cuts down the time leading to the city jump later (providing the necessary cycles to use the updated city kernel).

 

Also, enough space for the full city is obtained by moving the code below $F5C3 to the areas currently being used for the city gfx.

 

Demo:

 

defcity.asm temp.bin

Link to comment
Share on other sites

Found it.  The first DEY in the city routine does not check if zero.  Odd, since it worked fine in my assembly.

You can use those spare cycles to add a branch to fix it:


    sta.w   PF2                     ;4 added 1 cycle
    tya                             ;2
;    sta     $2E                     ;3
    beq     LFFED                   ;2 branch to JMP if already 0
    and     #$03                    ;2
    beq     LFFE9                   ;2/3
    .byte   $C5                     ;3

temp.bin

Edited by Nukey Shay
Link to comment
Share on other sites

On 7/20/2019 at 5:50 AM, Nukey Shay said:

Found it.  The first DEY in the city routine does not check if zero.  Odd, since it worked fine in my assembly.

You can use those spare cycles to add a branch to fix it:


    sta.w   PF2                     ;4 added 1 cycle
    tya                             ;2
;    sta     $2E                     ;3
    beq     LFFED                   ;2 branch to JMP if already 0
    and     #$03                    ;2
    beq     LFFE9                   ;2/3
    .byte   $C5                     ;3

temp.bin 8 kB · 1 download

 

Weird that was working.  Thanks I fixed that.

Link to comment
Share on other sites

On 7/19/2019 at 10:15 PM, Nukey Shay said:

You should not WSYNC before you draw the horizontal line below the scanner, this bumps the total to 263.

 

A time check can be done after the 2nd WSYNC to waste some cycles and store the result to $F0 temporarily.  This cuts down the time leading to the city jump later (providing the necessary cycles to use the updated city kernel).

 

Also, enough space for the full city is obtained by moving the code below $F5C3 to the areas currently being used for the city gfx.

 

Demo:

 

defcity.asm 290.95 kB · 3 downloads temp.bin 8 kB · 4 downloads

OK, I think I need some more newbie explanation here.  The game seems to run fine with the code I have.... I am not sure i understand the problem I am causing.

 

I merged in the radar bit that you changed, it does work, but, my scanlines still all lined up.... 

Edited by rallyrabbit
Link to comment
Share on other sites

So I've been doing some comparisons.

 

Radar:

Stargate: Scanline 61 to 77

Defender Arcade: 61 to 77

Your build: 61 to 79

Your build of my defender city: 60 to 78 (though I know the problem here on why it starts too early)

My port without your radar code: 61 to 79

My port with you radar code include: 61 to 79

 

So, I think somewhere, I am 2 scanlines too long, so I'm trying to figure that out now.

 

Also, do you know which part of the code launches the baiters when the wave takes too long?

 

Edited by rallyrabbit
Link to comment
Share on other sites

LD542.  This is branched to when the delay timer rA8 reaches zero.  It is then given the value of 2, loop LD548 checks for any free slot (read+$22,X = 0), the low 3 bits of timer r80 is used to choose which enemy to send from table LDDE7.  LD56C is branched to if no free slots are available.

Link to comment
Share on other sites

  • 2 weeks later...

Well, I am almost done.  I decided to keep with the simple city.  I had to scale back what I Was doing on the radar to maintain the scanline behavior.  But now I have another Y index glitch in the city kernel (my code with your change from 7/23).  Seems that making the radar work on the proper scanlines has screwed up the solution you came up with for the Index Y checks.  Now I either crash when planet is destroyed or have trails on the people waiting to be abducted.

Link to comment
Share on other sites

On 8/9/2019 at 9:58 PM, Nukey Shay said:

Must be hitting HMOVE a cycle late.  Check the debugger that branches executing beforehand are not crossing pages (they will be flagged with ! in Stella's code window).

I think I was off by a cycle somehow (too short) before the branch and throwing off the rest of the loop while decrementing Y.  

Link to comment
Share on other sites

26 minutes ago, rallyrabbit said:

Well pretty quick I've found another radar bug when a lander picks up a person it starts messing up.  So will have to sort that now :) the fun never stops!

Part of the problem is that the radar display area is off by 1 cycle as well (so the GR registers are hit 1 cycle too late).  Just above the loop, change the 2 NOP instructions (4 cycles) to be STA $2E (3 cycles).

Link to comment
Share on other sites

Why were these 4 lines removed?  This is the source of the issue, I think.


       LDA    read+$4D,X              ;4
       ORA    rF1                     ;3
       STA    write+$4D,X             ;5
       BNE    LD90B                   ;2 always branch?
LD8E7:

 

V18fix.bin

Link to comment
Share on other sites

17 hours ago, Nukey Shay said:

Why were these 4 lines removed?  This is the source of the issue, I think.

 


       LDA    read+$4D,X              ;4
       ORA    rF1                     ;3
       STA    write+$4D,X             ;5
       BNE    LD90B                   ;2 always branch?
LD8E7:

 

 

V18fix.bin 8 kB · 2 downloads

Yeah it looks like it.  That ay be a victim of an unlocked computer + kids ? thanks.  Back to final testing.

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