IRF Posted May 2, 2016 Report Share Posted May 2, 2016 (edited) 'AND #C0' sets the zero flag if A holds any value from 0 to 63 (00-3F), and 'AND #E0' sets the zero flag if A holds any value from 0 to 31 (00-1F). Note that you can't use 'AND N-1' to set the zero flag on every Nth pass through a loop that increments A unless N is 1, 2, 4, 8, 16, 32, 64, 128 or 256. Or to put it in a way that's easy to follow during the game by watching the 'lives' indicator dancing in the status bar (assuming that the in-game music is on): With the AND C0 instruction in effect, whatever the thing that the PV makes happen, occurs [or doesn't occur, depending on the polarity of the 'check'] every tick during the first half of the first rendition of 'Rich Man' in every 256-tick cycle (sixteen 'dance steps'), and then doesn't occur [or does!] during the second half of the tune and throughout the next full tune rendition. Then the effect resumes at the beginning of the third rendition of the tune (lasting again for half the tune's length). AND E0 means that the effect only lasts [or is disabled] for the first quarter of the tune (eight 'dance steps'). N.B. Willy's lives make 64 dance steps (progressing through the four frames of animation sixteen times) during each 256-tick game cycle. Edited May 2, 2016 by IRF jetsetdanny 1 Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted May 2, 2016 Author Report Share Posted May 2, 2016 Danny, I forgot to mention that when I set the operand of the AND command to D0, I altered it from the original value which you had set of E0, which is one of the values that you mentioned at the start of this thread - and that's what made me wonder if it was indeed the Screen Flash Patch Vector that you were having trouble summarising in the readme? It is the Screen Flash PV (which I call the Flashing Screen PV in "WNM SE"'s Readme), indeed, and its cousin, the Coloured Screen PV. I offer a disassembly of all of my PVs in the Readme, and these two go as quoted below. The descriptions in red are obviously wrong and need to be modified. If you have any suggestions as to what specifically should be put / would make sense there, please let me know :) . Flashing Screen This PV works by setting the value of the screen flash counter and thus activating the screen flash routine (which is unused in the original "JSW", where it resides at #8A11 Quote Link to comment Share on other sites More sharing options...
IRF Posted May 2, 2016 Report Share Posted May 2, 2016 I'll have a read of that and a think later, and see if I can come up with an improved wording. :) Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted May 2, 2016 Author Report Share Posted May 2, 2016 Thanks! :) Quote Link to comment Share on other sites More sharing options...
IRF Posted May 3, 2016 Report Share Posted May 3, 2016 (edited) Danny, I believe both PV's amount to the same thing, except that one lasts longer than the other (due to the C0 versus E0 operand), one 'hardly flashes' because the value of another variable is set so low (thus when it is loaded up to the Screen Flash Counter, it doesn't take long to decrement to zero), and of course you've modified one version so it can be adapted differently for different rooms. But I think they're the same in essence. It's late now but I'll try and give a detailed description of how they work tomorrow. For now, I'll just point out that the reason you need to add 1 to your chosen colour value, is because the original Screen Flash routine decrements the current value of A immediately before loading it up to the Screen Flash Counter variable, so you're effectively countering that. Edited May 3, 2016 by IRF Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted May 3, 2016 Author Report Share Posted May 3, 2016 Thanks for this info, Ian! :) Quote Link to comment Share on other sites More sharing options...
IRF Posted May 3, 2016 Report Share Posted May 3, 2016 (edited) Danny, at the start of this thread you seemed to suggest that these routines of yours didn't quite do what you had originally anticipated? I wonder if the following alternative code implements what you were initially trying to achieve? (I understand you're happy with the resulting product that you ended up with, so this is purely for the point of academic discussion.) 3A CB 85 - LD A, (#85CB) - load the 'tick counter' to the A register E6 1F - AND #1F - the AND operand (00011111 in binary) is 255 (#FF) minus your chosen operand of 224 (#E0) C8 - RET Z - note that the conditionality of the check upon which the Return command is based, is the opposite to the C0 command in your PV 3A CD 85 - LD A, (#85CD) - load the current value of the Screen Flash Counter from #85CD to the A register 3C - INC A - increment the A register by one 32 CD 85 - load the value of the A register back to the Screen Flash Counter at #85CD C9 - RETURN (With the value of the Screen Flash Counter at #85CD initialised to a high value such as #FF, so the Screen Flash effect can be witnessed for a long period.) The above has the effect of slowing down the screen flash routine, so that the colour change only happens once every 32 'ticks' (or every 8 'dance steps'), instead of every tick. Other than the speed, it cycles through the colours in the usual way. If the operand of the AND command was set to #3F (which is 255 minus 192, or #FF minus #C0 which was your other chosen value for the AND operand), then the colour change would occur every 64 ticks. Furthermore, AND 0F would cause the screen colour to change every 16 ticks; AND 07 every 8 ticks; AND 03 every 4 ticks; AND 01 every 2 ticks; AND #7F every 128 ticks. I still intend to provide a detailed explanation of how it all works, but hopefully the above gives you some insight! Edited May 3, 2016 by IRF Spider and jetsetdanny 2 Quote Link to comment Share on other sites More sharing options...
IRF Posted May 24, 2016 Report Share Posted May 24, 2016 Thanks for this info, Ian! :) Danny, did you pick up the document I forwarded via a PM (it fell at the end of a 'page' of messages so you may have missed it). If so, did it help you to formulate the appropriate words for your readme? Spider 1 Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted May 24, 2016 Author Report Share Posted May 24, 2016 Danny, did you pick up the document I forwarded via a PM (it fell at the end of a 'page' of messages so you may have missed it). If so, did it help you to formulate the appropriate words for your readme? Not yet, but I am aware of it and I will work on it when I'm done with the code in "WNM SE", which should be very soon, hopefully. Thanks in advance for the document :) . IRF and Spider 2 Quote Link to comment Share on other sites More sharing options...
IRF Posted November 2, 2016 Report Share Posted November 2, 2016 I think this thread probably belongs in 'Chat' (alongside Danny's 'Language Questions' thread), rather than in 'Remakes'? Spider 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.