+SmittyB #76 Posted December 14, 2021 17 minutes ago, PacManPlus said: Is there a faster routine to clear memory? I'm no assembly expert, but I think you can spend 2 cycles to save 160 by counting down instead of up and dropping the comparison. ; CLEAR_SCANNER - BLANK OUT ENTIRE SCANNER CLEAR_SCANNER LDX #SCANBUFLINESIZE * 4 LDA #$00 CLR_SCANNER_LOOP STA SCN_ZONE1_LINE1+$00-1,X STA SCN_ZONE1_LINE2+$00-1,X STA SCN_ZONE1_LINE3+$00-1,X STA SCN_ZONE1_LINE4+$00-1,X STA SCN_ZONE1_LINE5+$00-1,X STA SCN_ZONE1_LINE6+$00-1,X STA SCN_ZONE1_LINE7+$00-1,X STA SCN_ZONE1_LINE8+$00-1,X DEX BNE CLR_SCANNER_LOOP RTS (@Eagle, snap) 2 Quote Share this post Link to post Share on other sites
Eagle #77 Posted December 14, 2021 Also make sure that BMI is not crossing page boundary. In Mads assembly i use .Align 256 1 Quote Share this post Link to post Share on other sites
RevEng #78 Posted December 14, 2021 Yeah, don't think you'll do better than Eagle's and SmittyB's countdown suggestion, without unrolling. (which would be ridiculous) If you're not already, you can run the radar clear+build during the visible screen, after the radar itself is displayed. You could also get away with splitting the radar clear+update into strips, and update each strip on different frames. At the coarse resolution of the radar, even 1 zone per frame would likely work. 2 Quote Share this post Link to post Share on other sites
Eagle #79 Posted December 14, 2021 Quote When I write to it, I am 'OR' ing each blip on the scanner so I don't overwrite any other objects already written to the scanner. Try using Eor and after Eor again to clear. Maybe will be faster than clear all memory. 2 Quote Share this post Link to post Share on other sites
PacManPlus #80 Posted December 14, 2021 Hey Guys Thanks for the ideas (again) So, I'd put this one at the most difficult port than any game I've done so far, except for Baby Pac-Man: 2 hours ago, RevEng said: Yeah, don't think you'll do better than Eagle's and SmittyB's countdown suggestion, without unrolling. (which would be ridiculous) If you're not already, you can run the radar clear+build during the visible screen, after the radar itself is displayed. You could also get away with splitting the radar clear+update into strips, and update each strip on different frames. At the coarse resolution of the radar, even 1 zone per frame would likely work. I like the idea of clearing it during the visible screen, as I have a DLI right after it (to change resolutions). Thank you for that! I'm also planning on doing the count down... Now I know why GCC used that so much. I always like counting upward... my OCD insists on it But this is more important. 2 hours ago, Eagle said: Try using Eor and after Eor again to clear. Maybe will be faster than clear all memory. I actually tried than when I did my first attempt at Defender. I ended up undoing it, although I forget why... Something about I didn't like the way it worked. Thank you though! 2 hours ago, Eagle said: Also make sure that BMI is not crossing page boundary. In Mads assembly i use .Align 256 Yep that one's good, thank you 4 Quote Share this post Link to post Share on other sites
Eagle #81 Posted December 14, 2021 8 hours ago, RevEng said: without unrolling. (which would be ridiculous) Actually is not bad idea ldx #$0f ;SCANBUFLINESIZE-1 lda #$00 loop sta $1800,x sta $1810,x sta $1820,x sta $1830,x sta $1900,x sta $1910,x ..... ..... dex bpl loop This will save 240 cycles and cost only 72 bytes 5 Quote Share this post Link to post Share on other sites
RevEng #82 Posted December 14, 2021 19 minutes ago, Eagle said: Actually is not bad idea [...] This will save 240 cycles and cost only 72 bytes A part-way unroll... I like it! 2 Quote Share this post Link to post Share on other sites
Eagle #83 Posted December 14, 2021 8 hours ago, Eagle said: Also make sure that BMI is not crossing page boundary. In Mads assembly i use .Align 256 🤦♂️ Should be BPL This is what happens when you write posts on your phone at work. 1 Quote Share this post Link to post Share on other sites
+Cafeman #84 Posted December 14, 2021 I really enjoy reading these posts which share methods to save cycles. One question though, what is meant by the term unrolling? 1 Quote Share this post Link to post Share on other sites
+Karl G #85 Posted December 15, 2021 33 minutes ago, Cafeman said: I really enjoy reading these posts which share methods to save cycles. One question though, what is meant by the term unrolling? Since loops take cycles themselves to execute, sometimes instead of looping for X number of iterations, you code that block of code X number of times in a row, removing the loop, or "unrolling" it. Obviously this takes up more space, depending on the number of instructions in the loop and the number of iterations, and is often not practical as an optimization solution ... but when you need it, you need it. 5 Quote Share this post Link to post Share on other sites
SlidellMan #86 Posted December 15, 2021 It's basically a trade-off between speed and size. 1 Quote Share this post Link to post Share on other sites
+Cafeman #87 Posted December 15, 2021 Well, I've used the unrolling technique then, and I understand exactly why you'd use the method. I remember being instructed about the decrementing loop too for optimization reasons, else I'd have likely started off incrementing with an extra compare. I've always admired the elegant design of 6502 ASM, how you can utilize commands that will set a flag and save you an instruction, for example. 3 Quote Share this post Link to post Share on other sites
Inky #88 Posted December 19, 2021 I saw the video you posted on youtube, and I must say, I'm stoked! 2 Quote Share this post Link to post Share on other sites
PacManPlus #89 Posted December 31, 2021 Hmm... I have an idea. Once I get back home From Chipley (FL) I'll be back into this. There's at most 42 objects in the list that needs to go through per frame. There should be enough CPU time to do this. I'll have a look through the 'hot spot' utility again to see where I'm using all of my cycles. Also, I was looking at some frame-by-frame movements of the enemies, and they all seem to move every frame (so no splitting duties between frames) The only other thing possible is maybe the routine that *alters* movement is done on certain frames (i.e. they currently move left every frame but every 4th frame they decide if that direction should be altered). I did find the source code on line, but nothing is commented. I wish I could talk to Eugene Jarvis, like I did with some of the other games I've done. Just to get a general idea of how things were done on the Arcade hardware. 11 Quote Share this post Link to post Share on other sites
Goochman #90 Posted December 31, 2021 Yak visits here sometimes - wonder if he has some ideas or could pass a question to Jarvis for you? 2 Quote Share this post Link to post Share on other sites
+Karl G #91 Posted December 31, 2021 2 hours ago, PacManPlus said: Also, I was looking at some frame-by-frame movements of the enemies, and they all seem to move every frame (so no splitting duties between frames) Maybe it would be possible to have them do double the movement on alternate frames instead? The difference might not be noticeable at all. 3 Quote Share this post Link to post Share on other sites
RevEng #92 Posted December 31, 2021 30 minutes ago, Karl G said: Maybe it would be possible to have them do double the movement on alternate frames instead? The difference might not be noticeable at all. For sure, or perhaps off-screen enemies can have less-frequent more-coarse updates. But I think here we're seeing PMP just striving to make it arcade accurate, rather than hitting an actual implementation issue. 5 Quote Share this post Link to post Share on other sites
Synthpopalooza #93 Posted December 31, 2021 Out of curiosity, will sounds be done using POKEY or TIA? Got a few ideas on how to get that opening rumble filter sweep in POKEY 1 Quote Share this post Link to post Share on other sites
Inky #94 Posted January 1 16 hours ago, PacManPlus said: I did find the source code on line, but nothing is commented. I wish I could talk to Eugene Jarvis, like I did with some of the other games I've done. Just to get a general idea of how things were done on the Arcade hardware. Let me see if I can drum up his contact info. I used to have it. 1 Quote Share this post Link to post Share on other sites
+Cafeman #95 Posted January 1 Like he still remembers? 1 Quote Share this post Link to post Share on other sites
+Trebor #96 Posted January 1 4 hours ago, Cafeman said: Like he still remembers? Alan McNeil had some advice and provided information for Frenzy-Berzerk. Owen Rubin assisted with Space Duel. Eugene Jarvis offering some insight about Defender, does not seem to be out of the realm of possibility. 7 Quote Share this post Link to post Share on other sites
ZylonBane #97 Posted January 1 On 12/31/2021 at 7:48 AM, PacManPlus said: I did find the source code on line, but nothing is commented. Ahem... https://github.com/mwenge/defender/tree/master/src So are you planning on replicating the original's monophonic sound? Going monophonic might allow richer sound effects by using both TIA channels to construct each sound. 1 Quote Share this post Link to post Share on other sites
RevEng #98 Posted January 2 Speaking of Defender sound, I'll just leave this here... http://www.dl.unospace.net/defender_sound/ 9 1 Quote Share this post Link to post Share on other sites
+DrVenkman #99 Posted January 2 7 minutes ago, RevEng said: Speaking of Defender sound, I'll just leave this here... http://www.dl.unospace.net/defender_sound/ Holy crap. I was wearing headphones when I listened to those - instant nostalgia! Right back to 1980-something and playing a real Defender cab as a teenager. 😮 3 Quote Share this post Link to post Share on other sites
RevEng #100 Posted January 2 Yep, it's arcade perfect. 2 Quote Share this post Link to post Share on other sites