Nukey Shay Posted November 8, 2008 Share Posted November 8, 2008 That's an interesting thought. Is it hard to do? No, if you are not concerned with the actual variance (so long as it keeps them different). The X register already contains a value that rises by 5, so just use that to EOR the state value. MoveDragon_3: ;; LDA DragonDiff,Y ;4 (removed) TXA ;2 Get current dragon offset SEC ;2 SBC #RDragonNumber ;2 subtract minimal value EOR DragonDiff,Y ;4 Flip bits to create unique wait value ;continue... STA NUSIZ0,X ;4 Store as Dragon's State (Open Mouthed) That will keep dragons waiting at different intervals following a bite. If you want a higher variance, perform an ASL before the EOR instruction. Quote Link to comment Share on other sites More sharing options...
EarthQuake Posted November 8, 2008 Share Posted November 8, 2008 If you really want to improve on Adventure, why not make the dragons be able to face the direction it's moving in? After all, there is a built in player register to flip the graphics. It should have been done that way from the start. I've been waiting 30 years for that. I've thought about the same thing in the past, but I just came to accept the current behavior. Nukey Shay recently packed the kernal a bit tighter, so it might actually be possible now, but there is still the problem of positioning the dragon when it bites the player when it's being flipped. It's a really good idea though, just don't know how feasible this would be. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted November 8, 2008 Share Posted November 8, 2008 If you really want to improve on Adventure, why not make the dragons be able to face the direction it's moving in? After all, there is a built in player register to flip the graphics. It should have been done that way from the start. I've been waiting 30 years for that. Code the exception into the Setup routine. The unused bits in the sprite size data byte can provide a "flag" for any sprite that is to differ (and if set, if it's X position is less than or greater than the ball). ResizeObject:;Object1 Size LDY #$00 ;2 Set no reflect ;2 existing lines... LDA Store8,X ;4 Get Object1's width... STA NUSIZ0 ;3 Set sprite width BPL NotReversable1 ;2 Branch if sprite is inanimate LDA Obj1X ;3 Get object's X location SEC ;2 SBC PlayerY ;3 Subtract player's location BMI NotReversable1 ;2 Branch if sprite is on the right LDY #$08 ;2 Set reflect NotReversable1: STY REFP0 ;3 store reflect ResizeObject2:;Object2 Size LDY #$00 ;2 Set no reflect ;2 existing lines... LDA Store8,X ;4 Get Object1's width... STA NUSIZ1 ;3 Set sprite width BPL NotReversable2 ;2 Branch if sprite is inanimate LDA Obj2X ;3 Get object's X location SEC ;2 SBC PlayerY ;3 Subtract player's location BMI NotReversable2 ;2 Branch if sprite is on the right LDY #$08 ;2 Set reflect NotReversable2: STY REFP1 ;3 store reflect Then set bit 7 in the width data for animated sprites. Quote Link to comment Share on other sites More sharing options...
EarthQuake Posted November 8, 2008 Share Posted November 8, 2008 (edited) Two things with the above code: You checked for PlayerY instead of PlayerX, and the sprite flipping is backward. I dunno how to fix the latter, using BPL instead of BMI misses something and causes crashes when I have a lot of dragons on screen. EDIT: Oh duh, just flip the dragon bitmaps. Edited November 8, 2008 by EarthQuake Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 8, 2008 Author Share Posted November 8, 2008 This is such a cool idea! Then set bit 7 in the width data for animated sprites. How do you do this? Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted November 9, 2008 Share Posted November 9, 2008 In the Objects table, there's a collection of bytes for each sprite (ram/rom address, color, etc). It's the last byte for each one. Add $80 to the value shown to set the high bit for each dragon. NUSIZ registers do not use the upper 2 bits ($80 and $40), so you can use bit6 for something else too. Quote Link to comment Share on other sites More sharing options...
EarthQuake Posted November 9, 2008 Share Posted November 9, 2008 (edited) How do you do this? Add $80 to the byte that controls the size. Or just simply make it $80, since most objects have a size of $00 to begin with. Oops, someone beat me to it. Edited November 9, 2008 by EarthQuake Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 9, 2008 Author Share Posted November 9, 2008 (edited) Okay, I found that, but when I try to assemble it Dasm gives me an error: Unresolved symbol list REFP0 and REFP1. It doesn't seem to recognize the control register. Edit: I got it to assemble by assigning REFP1 and REFP0 ram locations E5 and E6, but the screen jumps up and down, so I'm still not doing something right. Edited November 9, 2008 by accousticguitar Quote Link to comment Share on other sites More sharing options...
EarthQuake Posted November 9, 2008 Share Posted November 9, 2008 (edited) Hmm, it should be working, although when I tried it with my source code, the "two existing lines" were actually three: ResizeObject: LDA Store8,X ; Get size of Object1. ;4 ORA #$10 ; And set to larger size if necessary. ;2 STA NUSIZ0 ; (Used by bridge and invisible surround. ;3 I put the LDY #$00 before it, and the rest of the code after this block of instructions, and the same for object2 in the ResizeObject2 routine. After defining REFP1 and REFP0, adding $80 to the width of the dragons, and flipping the bitmaps of the dragons, everything worked perfectly. Oh and make sure it uses PlayerX instead of PlayerY. Edited November 9, 2008 by EarthQuake Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 9, 2008 Author Share Posted November 9, 2008 Like this? It still shakes. ;Object1 Size ResizeObject: ;Object1 Size LDY #$00 ;2 Set no reflect LDA Store8,X ;Get Object1's Size ;4 ORA #$10 ;And set to larger size if necessary. ;2 STA NUSIZ0 ;(Used by bridge and invisible surround);3 BPL NotReversable1 ;2 Branch if sprite is inanimate LDA Obj1X ;3 Get object's X location SEC ;2 SBC PlayerX ;3 Subtract player's location BMI NotReversable1 ;2 Branch if sprite is on the right LDY #$08 ;2 Set reflect NotReversable1: STY REFP0 ;3 store reflect ;Object2 Size ResizeObject2: ;Object2 Size LDY #$00 ;2 Set no reflect LDA Store8,X ;Get Object2's Size ;4 ORA #$10 ;And set to larger size if necessary. ;2 STA NUSIZ1 ;(Used by bridge and invisible surround);3 BPL NotReversable2 ;2 Branch if sprite is inanimate LDA Obj2X ;3 Get object's X location SEC ;2 SBC PlayerX ;3 Subtract player's location BMI NotReversable2 ;2 Branch if sprite is on the right LDY #$08 ;2 Set reflect NotReversable2: STY REFP1 ;3 store reflect I tried changing the ram locations but it didn't make a difference. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted November 9, 2008 Share Posted November 9, 2008 Okay, I found that, but when I try to assemble it Dasm gives me an error: Unresolved symbol list REFP0 and REFP1. It doesn't seem to recognize the control register. Edit: I got it to assemble by assigning REFP1 and REFP0 ram locations E5 and E6, but the screen jumps up and down, so I'm still not doing something right. REFP0 and REFP1 are hardware registers...$0B and $0C respectively. Bit 3 controls whether or not the sprite is to be flipped (all other bits are unused). REFP0 = $0B REFP1 = $0C Hmm, it should be working, although when I tried it with my source code, the "two existing lines" were actually three:ResizeObject: LDA Store8,X ; Get size of Object1. ;4 ORA #$10 ; And set to larger size if necessary. ;2 STA NUSIZ0 ; (Used by bridge and invisible surround. ;3 Bits 4 and 5 set the missile width (the side panels), This can be placed right in the data table, making ORA #$10 superfluous. Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 9, 2008 Author Share Posted November 9, 2008 (edited) I got it working! I deleted the RTS instead of moving it to the end on ResizeObject2. That's why the screen was jumping. It's kind of weird seeing the dragons face the other way. Thanks for the help! Edited November 9, 2008 by accousticguitar Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 10, 2008 Author Share Posted November 10, 2008 The dead dragons flip too. Quote Link to comment Share on other sites More sharing options...
EarthQuake Posted November 10, 2008 Share Posted November 10, 2008 I guess one way of getting around that, is to check if the dragon's current state is the "moving" state, and then flip the sprite if that is the case. It would prevent the sprites from flipping if you're eaten, they are dead, or they are biting (preventing the need to reposition the dragon when it's flipped). And yes, I agree, the dragons look mighty strange when flipped. Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 10, 2008 Author Share Posted November 10, 2008 I thought all was well, but it's not. When I take the princess into the win room, the screen goes gray and black and gets all wigged out. Does your version have that problem EarthQuake? Quote Link to comment Share on other sites More sharing options...
EarthQuake Posted November 10, 2008 Share Posted November 10, 2008 (edited) Oops, delete me. Edited November 10, 2008 by EarthQuake Quote Link to comment Share on other sites More sharing options...
EarthQuake Posted November 10, 2008 Share Posted November 10, 2008 Not quite sure I've ever experienced anything like that before. I'm pretty sure the above code wouldn't cause the playfield or background to exhibit any such things, at least. Can you describe in detail what's going on? What things' colors are being changed? How do they change over time? Is the screen rumbling or are the colors just changing? Is it possible to take screenshots? Are you just getting random output or is the game still in a semi-working state? Does the select button fix everything? Quote Link to comment Share on other sites More sharing options...
EarthQuake Posted November 10, 2008 Share Posted November 10, 2008 (edited) Okay after looking at it, it basically just crashes. I just got a black screen. I really don't think this has anything to do with the new sprite flipping code. Instead, I think it's related to the main loop where it checks if the winning condition has been met. You didn't reorder any of the code in the first part of the main game loop did you? Edited November 10, 2008 by EarthQuake Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 10, 2008 Author Share Posted November 10, 2008 Not this time around. I'll fiddle with it some more today if I have time. Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 11, 2008 Author Share Posted November 11, 2008 It was this line: ORA #$10 I had commented it out in both places. I took away the semicolons and it works fine now. Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 11, 2008 Author Share Posted November 11, 2008 Here is what I did to stop the dead dragons from flipping. It's kind of long, but it seems to work. ;Object1 Size ResizeObject: ;Object1 Size LDY #$00 ;2 Set no reflect LDA Store8,X ;Get Object1's Size ;4 ORA #$10 ;And set to larger size if necessary. ;2 STA NUSIZ0 ;(Used by bridge and invisible surround);3 BPL NotReversable1 ;2 Branch if sprite is inanimate LDA RDragonR+4 CMP #$01 BEQ NotReversable1 LDA GDragonR+4 CMP #$01 BEQ NotReversable1 LDA YDragonR+4 CMP #$01 BEQ NotReversable1 LDA BDragonR+4 CMP #$01 BEQ NotReversable1 LDA FDragonR+4 CMP #$01 BEQ NotReversable1 LDA Obj1X ;3 Get object's X location SEC ;2 SBC PlayerX ;3 Subtract player's location BMI NotReversable1 ;2 Branch if sprite is on the right LDY #$08 ;2 Set reflect NotReversable1: STY REFP0 ;3 store reflect ;Object2 Size ResizeObject2: ;Object2 Size LDY #$00 ;2 Set no reflect LDA Store8,X ;Get Object2's Size ;4 ORA #$10 ;And set to larger size if necessary. ;2 STA NUSIZ1 ;(Used by bridge and invisible surround);3 BPL NotReversable2 ;2 Branch if sprite is inanimate LDA RDragonR+4 CMP #$01 BEQ NotReversable2 LDA GDragonR+4 CMP #$01 BEQ NotReversable2 LDA YDragonR+4 CMP #$01 BEQ NotReversable2 LDA BDragonR+4 CMP #$01 BEQ NotReversable2 LDA FDragonR+4 CMP #$01 BEQ NotReversable2 LDA Obj2X ;3 Get object's X location SEC ;2 SBC PlayerX ;3 Subtract player's location BMI NotReversable2 ;2 Branch if sprite is on the right LDY #$08 ;2 Set reflect NotReversable2: STY REFP1 ;3 store reflect RTS Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 11, 2008 Author Share Posted November 11, 2008 Oops, that doesn't work because if there is a live dragon appearing on the list after a dead dragon it will no longer flip. Quote Link to comment Share on other sites More sharing options...
mos6507 Posted November 11, 2008 Share Posted November 11, 2008 (edited) Keep at it guys This will be a big milestone if you get the dragons facing properly. I'm sure Warren would be interested in seeing this also. Edited November 11, 2008 by mos6507 Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 11, 2008 Author Share Posted November 11, 2008 The live dragons work great, I'm trying to get the dead dragons to stop moving. My latest failed attempt: ;Object1 Size ResizeObject: ;Object1 Size LDY #$00 ;2 Set no reflect LDA NUSIZ0,X CMP #$01 BEQ NotReversable1 LDA Store8,X ;Get Object1's Size ;4 ORA #$10 ;And set to larger size if necessary. ;2 STA NUSIZ0 ;(Used by bridge and invisible surround);3 BPL NotReversable1 ;2 Branch if sprite is inanimate LDA Obj1X ;3 Get object's X location SEC ;2 SBC PlayerX ;3 Subtract player's location BMI NotReversable1 ;2 Branch if sprite is on the right LDY #$08 ;2 Set reflect NotReversable1: STY REFP0 ;3 store reflect ;Object2 Size ResizeObject2: ;Object2 Size LDY #$00 ;2 Set no reflect LDA NUSIZ0,X CMP #$01 BEQ NotReversable2 LDA Store8,X ;Get Object2's Size ;4 ORA #$10 ;And set to larger size if necessary. ;2 STA NUSIZ1 ;(Used by bridge and invisible surround);3 BPL NotReversable2 ;2 Branch if sprite is inanimate LDA Obj2X ;3 Get object's X location SEC ;2 SBC PlayerX ;3 Subtract player's location BMI NotReversable2 ;2 Branch if sprite is on the right LDY #$08 ;2 Set reflect NotReversable2: STY REFP1 ;3 store reflect RTS Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted November 12, 2008 Share Posted November 12, 2008 Change the location of the exception. If it's just the chasing dragon that you are concerned with, stick it right where the sprite shape is stored. Maybe place the chasing dragon sprite on a different page from ALL other sprites...then just check for that page when storing Obj1Hi and Obj2Hi. In that case, you wouldn't need to alter the size data and other stuff. Undo ALL the changes thus far, and use something LIKE** this instead... ;existing lines (in MY file)... JSR GetObjectState ;6 Find current state in the state information INY ;2 Index to the state's corresponding graphic pointer LDA (CurrentObject),Y ;5 Get Object1's low graphic address... STA Obj1Lo ;3 and store for printing sprite 0 INY ;2 bump index LDA (CurrentObject),Y ;5 Get Object1's high graphic address... STA Obj1Hi ;3 and store for printing sprite 0 ;added lines... LDY #$00 ;2 Set no reflect CMP #>GfxDrag0 ;2 is it a chasing dragon bitmap? BNE NotReversable1 ;2 skip ahead if not LDA Obj1X ;3 Get object's X location SEC ;2 SBC PlayerX ;3 Subtract player's location BMI NotReversable1 ;2 Branch if sprite is on the right LDY #$08 ;2 Set reflect NotReversable1: STY REFP0 ;3 store reflect for sprite 0 And do the same thing for the second sprite (be sure to change the label names). This works well for specific shapes you only want the ability given to (rather than the ability to grant it to all shapes). Just place the dragon sprite on a different memory page than all of the rest. ** NOTE: I'm posting the word "Like" because I don't know what your guys' assemblies look like (and nobody ever seems to post the files that help is needed on) But you should be able to figure out what it's doing here. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.