Resource centre for ZX Spectrum games
      using Manic Miner and Jet Set Willy game engines

 

Archive of the

Manic Miner & Jet Set Willy Yahoo! Group

messages

 

 

 

Message: 6929

Author: ian.rushforth

Date: 14/11/2016

Subject: Re: Broadsoft Lifts v0.2: Hex-editor type-in

 

I've been studying the disassembly for the Broadsoft Lifts Patch.  Congratulations Andrew, it's a great bit of code!


However, one thing is puzzling me: the purpose of the check 'CP #FE' at xHxL+#3D.  (JSW48 variant address.)


Preamble: [Having already established that Willy shares a cell-column with part of the lift], the routine tests the value of A, which has been established as the Lift guardian's y-coordinate (rounded down to the nearest #10) minus Willy's coordinate (rounded down to the nearest #10).


Immediately prior to the CP #FE, a similar check (CP #30) had been made, with a conditional relative jump if the Carry Flag is set.


So if the difference in y-coordinates between the Lift guardian and Willy is #00, #10 or #20, then the program will have been sent to +#4F, to activate the 'lift code proper'.


In that circumstance, won't the subsequent CP #FE always set the Carry Flag (because A will only have values that are a multiple of #10, in the range #30-#F0)?  So if the program reaches +#3D, won't the relative jump to +#60 (bypassing the 'lift code proper' because Willy is below the lift, or is too far above it) always take place?


Therefore, if the conditionality of the relative jump at +#3B were reversed (so that it was a 'JR NC'), with the destination address changed (to point at the '11 08 00' command), then perhaps the subsequent four bytes (+#3D to +#40) would be unnecessary?


Or am I missing something?  (That's entirely possible, so I hope I don't come across as being 'precocious'!)

 

 

arrowleft
arrowright