Fort Apocalypse Posted February 2, 2008 Share Posted February 2, 2008 Has anyone ever played with writing some asm code produce something like the ion field in Yar's Revenge? I heard that this was done by somehow using the source code for the data of colors and dots in the field. I haven't decompiled it though, so I don't know what it would look like. I was thinking that might be cool to put in a bB game (using asm tag somehow). Quote Link to comment Share on other sites More sharing options...
Impaler_26 Posted February 2, 2008 Share Posted February 2, 2008 You can find a commented disassembly of Yars' Revenge (plus a lot more) here: http://www.bjars.com/disassemblies.html Quote Link to comment Share on other sites More sharing options...
Devin Posted February 9, 2008 Share Posted February 9, 2008 (edited) If you want the same effect, you could also set the playfield pixels and colors using random values. There are a number of random number generator subroutines on the boards. ****EDIT**** Removed Code. It doesn't work quite as well as hoped. Edited February 19, 2008 by Devin Quote Link to comment Share on other sites More sharing options...
Cybergoth Posted February 9, 2008 Share Posted February 9, 2008 This version does not require to be seeded. Hm... but only the lowest bit is actually random, or? Quote Link to comment Share on other sites More sharing options...
Devin Posted February 9, 2008 Share Posted February 9, 2008 This version does not require to be seeded. Hm... but only the lowest bit is actually random, or? It's not a particularly attractive piece of code - I will admit, but it seems to do well enough for a game. I might eventually sit down and create a full linear congruential generator {(aX + C) mod M}. Thankfully, our good friend of the 6502 can do 16bit, 32bit, etc... addition. But that might be overkill. Anyway, it seems to work well enough given that it is only 8 bits. The INTIM helps break natural cycles and given that the computational time might vary depending on the game logic - it does throw a bit of chaos into what should be the definition of chaos! Actually, in hindsight, it might be better to ASL rather than LSR. If the EOR constant doesn't contain a high bit, only the INTIM could set it (which is unlikely given it usually going to just contain 43...0). If there is a better approach, I would love to steal.... um... USE it. Quote Link to comment Share on other sites More sharing options...
+batari Posted February 13, 2008 Share Posted February 13, 2008 (edited) Has anyone ever played with writing some asm code produce something like the ion field in Yar's Revenge? I heard that this was done by somehow using the source code for the data of colors and dots in the field. I haven't decompiled it though, so I don't know what it would look like. I was thinking that might be cool to put in a bB game (using asm tag somehow). An interesting concept, but would certainly require a kernel hack, and you would need to give up the entire playfield to fit it into bB's standard kernel, as you need enough time to read data, do a playfield write, a color write, and step through a random number generator every scanline, and the playfield writes must be precisely timed. To be precise, however, YR actually flickers the ion zone every other frame, while the other frame displays the Qotile's shield. A playfield every other frame might be possible in bB, but you will need to create a second copy of the kernel without the above changes and make sure it's called every other frame. Definitely possible, but it will take some effort. If someone else wants to work on that, be my guest (the ion zone was a good lunch-hour diversion, but a second kernel copy would take a little longer to implement...) This ion-zone kernel hack uses a random number generator in-kernel and one variable dim'ed as "lfsr." I didn't use game code as data because that didn't work too well for various reasons I won't bother going into right now. To turn off the playfield, set lfsr=0. To turn it on, set u to any of the following values: 142, 149, 150, 166, 175, 177, 178, 180, 184, 195, 198, 212, 225, 231, 243, or 250. Or if the playfield isn't random enough given one of the above, I have some sample code that varies the LFSR per frame. The joystick button will set lfsr=0, which will turn off the playfield (and break the random number generator, alas) until it is reset to one of the above values, even if the above routine is in place. EDIT: Somehow I thought this was the bB forum, so I wrote the example into bB. However, pulling the code out of the asm file could work for a general routine with a little effort (it uses constant cycles.) ion.zip Edited February 13, 2008 by batari Quote Link to comment Share on other sites More sharing options...
Fort Apocalypse Posted February 14, 2008 Author Share Posted February 14, 2008 Awesome, Fred! Thanks for your help! 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.