Jump to content
IGNORED

Possible to Mirror, Flip, Rotate Tiles in Assembly?


Ikrananka

Recommended Posts

Apologies for the beginners question, but is there a simple way to read a tile from the pattern table and then to mirror, flip or rotate it before displaying onscreen (in assembly)?  Or is it necessary to create separate tiles for each different one.  By way of example, if I want to place a circle onscreen based on tiles, then I was wondering if I could just have a set of tiles that define one quadrant of the circle and then mirror, flip or rotate those tiles to create the other quadrants.

Edited by Ikrananka
Link to comment
Share on other sites

If you have a byte of data and a free byte in RAM, it's always possible to process the byte of data and "construct" the flipped or mirrored version in the free byte, and then send this free byte to VRAM. You need 8 such free bytes to do 90-degree tile rotations.

 

To my knowledge, there's no feature in the VDP or the Coleco BIOS that lets you do this easily.

 

Link to comment
Share on other sites

Here is a bit flipping routine that you should be able to adapt to what you need.  Just show me some love if you use it.

 

MIRROR:
    LD L, A
    RLCA
    RLCA
    XOR L
    AND 0xAA
    XOR L
    LD L, A
    RLCA
    RLCA
    RLCA
    RRC L
    XOR L
    AND 0x66
    XOR L
RET

 

 

Edited by Itchy Scratchy
Link to comment
Share on other sites

2 hours ago, Pixelboy said:

If you have a byte of data and a free byte in RAM, it's always possible to process the byte of data and "construct" the flipped or mirrored version in the free byte, and then send this free byte to VRAM. You need 8 such free bytes to do 90-degree tile rotations.

 

To my knowledge, there's no feature in the VDP or the Coleco BIOS that lets you do this easily.

 

Thanks - I suspected as much.  I looked through the VDP datasheet and found nothing there.

 

I understand the methodology you propose but this is likely a bit beyond me at present.  I really have only just started to try and learn assembly and still have an awful lot of reading to do before I tackle that kind of byte manipulation.

Link to comment
Share on other sites

2 hours ago, Itchy Scratchy said:

Here is a bit flipping routine that you should be able to adapt to what you need.  Just show me some love if you use it.

 

MIRROR:
    LD L, A
    RLCA
    RLCA
    XOR L
    AND 0xAA
    XOR L
    LD L, A
    RLCA
    RLCA
    RLCA
    RRC L
    XOR L
    AND 0x66
    XOR L
RET

Thank you ?  Unfortunately, I really have only just started to try and learn assembly and still have an awful lot of reading to do before I can hope to really understand that code and adapt it to suit.  I'll certainly try - but may end up just defining all of the tiles manually for now and then later improve upon this using variations of the code you've provided.  So, thank you for that - having an example to start from will, I'm sure, be a huge help.

 

In the meantime =====> ?❤️??

Edited by Ikrananka
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...
  • Recently Browsing   0 members

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