+SpiceWare Posted July 21, 2016 Share Posted July 21, 2016 How would I make it so the game starts once the fire button is pressed and then LET GO OF? Or is that even possible? ProcessSwitches: ldx EndNoise cpx #63 bcc StartOfFrame lda INPT4 ; read the player's fire button value bmi StartOfFrame StartTheGame: ;starting variables begin here. Use a RAM value to keep track of the button state. If it used to be pressed, but isn't anymore, then start the game. Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted July 22, 2016 Author Share Posted July 22, 2016 Tried, failed. I guess I'm just stupid is it. celery25.asm Quote Link to comment Share on other sites More sharing options...
tschak909 Posted July 22, 2016 Share Posted July 22, 2016 The pattern is: Check, then set. That is, check your variable, then branch if not equal (or BMI, since you're checking bit 7...it'll be equivalent in this case) to your game start if it doesn't match...regardless of which, you need to set the variable after you check it, so that when you check INPT4 the next go-around, you can see a discrepancy. -Thom Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted July 22, 2016 Author Share Posted July 22, 2016 So why won't this work? lda FirePressed cpx #1 bcc StartTheGame lda INPT4 ; read the player's fire button value bmi StartOfFrameFireIsPressed jmp StartOfFrame StartOfFrameFireIsPressed: lda #1 sta FirePressed jmp StartOfFrame Quote Link to comment Share on other sites More sharing options...
Kiwi Posted July 22, 2016 Share Posted July 22, 2016 Tried, failed. I guess I'm just stupid is it. You're not stupid. Here's an example what I did for Flappy Bird for the Colecovision. if(cdown!=0){cdown--;}//automatically count down if cooldown number is not equal zero if(refire==0 && cdown==0){ //branch when it is zero if(joypad_1!=0){ //checks if the joypad is not zero. Any direction joypad or button being pressed will run this branch. birdp=-5;cdown=6; //bird projection variable is -5 which makes him point upward, cooldown to keep from misfiring the button to soon. refire=1;}}// set refire flag to 1 if(joypad_1==0){refire=0;} //check if joypad or fire button not being press. If not be pressed it will reset refire to zero. Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted July 22, 2016 Share Posted July 22, 2016 So why won't this work? #1 - since you used LDA you need to use CMP, not CPX #2 - do the StartTheGame check after you've determined that the firebutton is not currently pressed: lda INPT4 ; check firebutton bmi StartOfFrameFireIsPressed ; branch if it is currently pressed lda FirePressed ; fire is not currently pressed cmp #1 ; so see if it was pressed on the prior frame beq StartTheGame ; if so, branch and start the game jmp StartOfFrame StartOfFrameFireIsPressed: lda #1 sta FirePressed jmp StartOfFrame Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted July 22, 2016 Author Share Posted July 22, 2016 This does not work, either. Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted July 22, 2016 Share Posted July 22, 2016 This does not work, either. Have you learned how to use Stella's debugger yet? Watching the code execute instruction-by-instruction will reveal what's wrong. Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted July 22, 2016 Author Share Posted July 22, 2016 It seems to be stuck at line 213 of this code for some reason? celery25a.asm Quote Link to comment Share on other sites More sharing options...
tschak909 Posted July 23, 2016 Share Posted July 23, 2016 I am actually putting together a quick little video on the stella debugger, for you, and others. Will post once fully published (This is recorded in 60fps FRAPS codec, so the original file is huge) -Thom Quote Link to comment Share on other sites More sharing options...
tschak909 Posted July 23, 2016 Share Posted July 23, 2016 First video: 1 Quote Link to comment Share on other sites More sharing options...
tschak909 Posted July 23, 2016 Share Posted July 23, 2016 and the second part: -Thom 1 Quote Link to comment Share on other sites More sharing options...
Just Jeff Posted July 23, 2016 Share Posted July 23, 2016 Nice!.. I learned a few things.. Does the stack in Celery really get six layers deep? Am I looking at that right? Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted July 23, 2016 Author Share Posted July 23, 2016 (edited) I fixed it! And a few other things as well. Like the flashing of the items before they appear for good. By the way, the first video isn't up any more. The second one was informative, but the music annoyed me a little. Thanks for making it. celery25b.zip Edited July 23, 2016 by atari2600land Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted July 23, 2016 Author Share Posted July 23, 2016 (edited) Made it so Mr. Celery frowns when the game ends. celery26a.zip Edited July 23, 2016 by atari2600land Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted July 23, 2016 Share Posted July 23, 2016 First video: and the second part: Well done! Three comments: 1) Any value drawn with a red background with green text is a value that changed since the last debugger screen refresh (ie: after you clicked Step, Trace, Exit, etc). So at the time of this screenshot: these values changed: PC (program counter) A (accumulator) Source Address for Y sign is now positive (the lowercase n in PS - Processor Status) RAM locations $8C, $FC and $FD changed to $07, $C9, and $F9 respectively. 2) The Processor Status (link to a nice article about each status flag) is denoted by the case, not the red background (which denotes a changed value): n = negative (sign) sign. Lowercase so positive (BPL would be taken, BMI would not) v = overflow flag. Lowercase so no overflow (BVC would be taken, BVS would not) B = break flag d = decimal flag I = interrupt mask Z = zero flag. Uppercase so set (BEQ would be taken, BNE would not)) c = carry flag. Lowercase so clear (BCC would be taken, BCS would not) N = negative. Uppercase so negative (BMI would be taken, BPL would not) v = overflow flag. B = break flag d = decimal flag I = interrupt mask z = zero flag. Lowercase so clear(BNE would be taken, BEQ would not) c = carry flag 3) What the Drive unused TIA pins randomly on a read/peek is used for - on the input registers any line not used is not connected to the databus. So for these registers: bits 7 and 6 are connected for most of the collision registers while only bit 7 is connected for the INPTx (paddle ports and fire buttons) and CXBLPF registers. On most 2600s the unconnected lines end up taking on the value left over by the address used to read the input register. So LDA INPT4 (which reads address $0C) when you're not pressing fire will return $8C while LDA INPT5 will return $8D. On some 2600s you'll get random values, which can expose bugs in programs. By checking the Drive unused TA pins.. Stella will emulate those other systems and instead of getting back $8C from INPT4 (if fire isn't pressed) you'll get back other values such as: $AF, $8F, $BD, etc. were only the value in bit 7 can be counted on. There are mirror addresses, so INPT4 could also be read via other addresses such as $1C, $2C, $3C, etc. When using a mirror such as $3C to read INPT4 the value returned when fire is not held would be $BC. Stella's aware of the mirrors and will helpfully show you when they're being used: 2 Quote Link to comment Share on other sites More sharing options...
tschak909 Posted July 23, 2016 Share Posted July 23, 2016 Ah, yes.. ok, makes sense. I hadn't studied the VCS schematics in the case of the unused pins, makes sense that they would float, if they're literally not bolted down to the bus. I quickly made these at around 2am in the morning, so I stumbled over stuff. -Thom Quote Link to comment Share on other sites More sharing options...
tschak909 Posted July 23, 2016 Share Posted July 23, 2016 Nice!.. I learned a few things.. Does the stack in Celery really get six layers deep? Am I looking at that right? Incorrect, the stack is 3 levels deep, the full return addresses are stored on the stack little endian. -Thom 1 Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted July 24, 2016 Author Share Posted July 24, 2016 Is that OK? I mean the game works and all, but I am wondering. Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted July 24, 2016 Share Posted July 24, 2016 Is that OK? I mean the game works and all, but I am wondering. The stack usage? Yes, that's OK. More complex games need to use more RAM to keep track of things, which means there's less RAM available for stack usage. For those you just limit the usage of JSR calls to only those things that need to be called from multiple places, such as PosObject or Random. Quote Link to comment Share on other sites More sharing options...
Just Jeff Posted July 24, 2016 Share Posted July 24, 2016 Yeah it's not a problem. I was just trying to get a better understanding of the stack and also just confirm it is where I thought it is. And I did. It never occurred to me that it was holding 16 bit numbers... But of course it does. So now I know the stack is twice as big as I thought. Still, three routines deep surprises me a little for this game. Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted July 24, 2016 Share Posted July 24, 2016 The stack can hold 8 bit values as well. PHA - takes the 8 bit value in the Accumulator and saves it in the stack PLA - takes an 8 bit value off the stack and puts it in the Accumulator PHP - takes the 8 bit value that holds the Processor Status and saves it in the stack PLP - takes an 8 bit value off the stack and puts it in the Processor Status Quote Link to comment Share on other sites More sharing options...
tschak909 Posted July 24, 2016 Share Posted July 24, 2016 (edited) PHP is a very nifty instruction if you can get things arranged correctly, You can literally use it to quickly thwack the enables of missiles and ball registers both in succession and in constant time by placing the stack pointer over the top of them, (so long as you have the carry bit set correctly by EORing Y scanlines, for example)...This trick is used in more than a few classic VCS titles, first in Combat, and again in Pole Position (to be able to get the top most road stripe line thwacked on/off quickly enough.) (just remember to save and restore your stack, otherwise your program will go off into the weeds...) I know I've mentioned it before, but that is one of my favorite tricks here on the VCS, and it shows two things: (1) neat things happen when the hardware guys and the software guys are not only friends, but help each other develop the product. See also, the Atari 400/800 and the Amiga. (2) neat things happen for you when you think outside the box. -Thom Edited July 24, 2016 by tschak909 Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted July 25, 2016 Author Share Posted July 25, 2016 I'm trying to put the paddle code into my current build. I get the paddle to start the game using fire, but it won't move up or down. Why?! celery28.asm Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted July 25, 2016 Author Share Posted July 25, 2016 Never mind. I figured it out. 1 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.