Jump to content
IGNORED

Missiles cannot occupy same horizontal pos ?


Recommended Posts

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 by Grevle
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...