Grevle Posted April 6, 2016 Share Posted April 6, 2016 (edited) So i used missiles and it seems they cannot occupy the same horizontal position, that means that diferent missiles cannot be shown side to side without erasing the other missile. Even though the missiles have there own horizontal posision register. Is the reason because the missiles occupy the same memory location ? i know different bits turn on and off different missiles, so this behaviour is by design ? Edited April 6, 2016 by Grevle Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted April 6, 2016 Share Posted April 6, 2016 Not true! You need to be careful how you write to the missiles memory. Use masking to only set the bit for missile 0 for example, not wiping out the bits fir missiles 1,2,3 in the process. I'm posting via phone so I can't illustrate with code right now. Quote Link to comment Share on other sites More sharing options...
Grevle Posted April 6, 2016 Author Share Posted April 6, 2016 (edited) Ok can you give me a illustration when you have the possibility to do it ? Thank you. Edited April 6, 2016 by Grevle Quote Link to comment Share on other sites More sharing options...
Rybags Posted April 6, 2016 Share Posted April 6, 2016 First up, you have to use masking when doing draw/erase since missiles all share the same memory. In assembler it's easy but Atari Basic at least is fairly hard. Also, re using same position. Due to priority there will usually be certain precedence in what you can see. Default is always that Player 0 has priority over 1 then 2 then 3. Same applies to missiles. If multicolour players enabled then colours are mixed (ORed) between missiles 0, 1 and 2, 3. If 5th player bit is enabled via Prior bit then all the missiles take the colour from PF3. Quote Link to comment Share on other sites More sharing options...
analmux Posted April 6, 2016 Share Posted April 6, 2016 Using Turbobasic XL you can use the byte OR ("!") and byte AND ("&") commands: F.e. PRINT 85 ! 170 gives 255 F.e. PRINT 85 & 15 gives 5 Then you can f.e. clear missile 1: use AND 11110011 (binary), thus AND 243 (decimal), applied to the value of address X: Y = X & 243 Then you can add a 2-bit value Z, which is some positive integer from 0 to 3. Now multiply by 4: PRINT Y+Z*4 Quote Link to comment Share on other sites More sharing options...
analmux Posted April 6, 2016 Share Posted April 6, 2016 Note that Y and Z*4 are binary disjoint, so: Y+Z*4 = Y ! (Z*4) Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted April 6, 2016 Share Posted April 6, 2016 Ok can you give me a illustration when you have the possibility to do it ? Thank you. In ASM: The Draw routine draws 1 pixel to missile 0 using ORA. It loads the whole byte representing all 4 missiles (each has 2 bits). The ORA only affects where the mask has a '1' value, not a '0' value. Then STA store it back. The Erase routine uses AND. A zero bit in the AND Mask erases that pixel/bit. DrawSwordHandle2 lda (Ptr1),y ora #$01 ; ora #%00000001 sta (Ptr1),y iny lda (Ptr1),y ora #$01 ; ora #%00000001 sta (Ptr1),y EraseSwordHandle lda (Ptr1),y AND #%11111100 ; sta (Ptr1),y ; iny lda (Ptr1),y AND #%11111100 ; sta (Ptr1),y 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.