💾 Archived View for bbs.geminispace.org › u › stack › 21680 captured on 2024-12-17 at 15:55:07. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
OK, this is incredibly fun!
6502-fu is coming back to me. I am ripping through my code, cleaning and optimizing. It's amazing what you can do when you start thinking that way.
For instance I had a subroutine which checked if the Wummel is at an intersection. It looked decent, maybe 10-12 lines of assembly, maybe 25 cycles. But, another 6 cycles each to call and to return! Inlining it saves 12 cycles. Then, only positions divisible by 8 can maybe be intersections. 7 out of 8 times a moving Wummel can quickly rule out an intersection. Optimizing the fast check to 7 cycles, while the longer case takes 22 cycles averages out to 8.875 cycles per check -- much faster than a call/return that does nothing!
And that's just a simple optimization. The real fun is realizing that by restructuring code, or lookup tables, or whatever -- you can cut the code by an order of magnitude! I just did that in the Wummel control code. And that is just pure joy.
I feel like my brain was built for this. I love every second of it. Doing it on modern machines is silly (I can't help myself anyway, most of what I write on x86 is under 20 kilobytes).
Nov 10 · 5 weeks ago
🚀 stack [OP/mod] · Dec 06 at 15:24:
Haven't updated for a while, as I took off to NYC for a bit...
Last session I got pretty much everything moving, and collision detection working. A bit messy still.
I also don't know where to begin with sound fx. Seems that libraritis started already back in NES days, and there are no guides on how to make sounds -- everyone uses some sort of interrupt-driven library...
will get back to it soon...
Write an NES game... — I've done a bit of 6502 programming, and as a teen, wrote some game code snippets on an Atari800 and an Apple ][... By the time the NES came out I was busy dropping out of high school, hanging out with the wrong people, etc. Eventually jumped back into coding 68K machines, and entirely missed the NES until my kids started gaming. I've always looked at it enviously, as the NES represented the high point of 8-bit game machines, possibly all game machines, beautifully...
💬 stack [mod] · 12 comments · 6 likes · Oct 27 · 7 weeks ago