log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Drag'N'Drop Autumn edition now available (News:)
- !DualHead puts 2 screens in one (News:)
- RISC OS London Show 2017 - Notes from the talks (News:6)
- November News (News:)
- !Organizer 2.28 reviewed (News:2)
- !OBrowse reviewed (News:10)
- Aemulor (Gen:16)
- DDE reaches release 28 and above (News:)
- Elesar quicks dispels stormy clouds (News:2)
- RISC OS London Show 2017 (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
Site Search
 
Article archives
The Icon Bar: Programming: Direct screen plotting - word alignment?
 
  Direct screen plotting - word alignment?
  andrew (23:59 26/1/2001)
   (00:00 27/1/2001)
     (13:02 27/1/2001)
       (14:38 27/1/2001)
         (17:27 27/1/2001)
           (19:16 27/1/2001)
           (19:16 27/1/2001)
             (19:17 27/1/2001)
 
andrew Message #4719, posted at 23:59, 26/1/2001
Unregistered user Hi,

I'm trying to plot a 50x50 sprite using an assembler routine of mine. I cannot seem to do this using acombination of plotting words and single bytes (the sprite is Mode28).
It works using bytes alone or words alone when the sprite is divisible by 4.
I'm thinking that the plotter is not sending the words to a word aligned address on every scanline givign the sprite a 'fuzzy' appearance.
However, when I check the screen memory address that each set of words must plot onto it is divisible by 4.

Could anybody please point out my error?

Regards

Andrew

[Edited by tfountain at 11:53, 27/1/2001. Removed smiley]

  ^[ Log in to reply ]
 
andrew Message #4720, posted at 00:00, 27/1/2001, in reply to message #4719
Unregistered user The mode should say mode twenty eight.
  ^[ Log in to reply ]
 
johnstlr Message #4721, posted at 13:02, 27/1/2001, in reply to message #4720
Unregistered user Is there any chance you could post a screenshot somewhere so we could take a look?

Other than that by fuzzy do you mean that the left and right edges of the sprite are out of sync? If so it suggests you're not plotting the correct number of bytes on each line leaving your pointers unaligned.

50x50 seems an odd size for a sprite. 48x48 would seem to make more sense. I guess it's a specific picture or something as opposed to background tile.

The only other thing I can suggest is taking a look at the plotting routines in Warp - specific the tile plotting routines - as they do what you want for smaller sprites. Three things though - firstly they assume a raw sprite (ie just the sprite data), secondly I've never been able to test the 16bpp and 24bpp plotter and thirdly the code is a bit nasty as I wrote the code to plot a line as a bunch of macros as !ASM doesn't have a command to repeat instructions. The result it that each routine is spread across two files, but you only really need to find the macros.

  ^[ Log in to reply ]
 
andrew Message #4722, posted at 14:38, 27/1/2001, in reply to message #4721
Unregistered user Thanks Lee.
Yes, they're out of sync as you say.
I'm plotting a word of sprite data 12 times and then 2 bytes and then incrementing the screen address by 590 to move to the next line but this appears to leave the line 2 bytes out of sync only for it to return in sync for the next loop pass.
  ^[ Log in to reply ]
 
johnstlr Message #4723, posted at 17:27, 27/1/2001, in reply to message #4722
Unregistered user How is the sprite stored? Is the sprite data completely contigeous in memory or do you have each line word aligned with two spare bytes at the end of each line? I'm just thinking that maybe your pointer into the sprite data isn't word aligned or it's not being setup to point at the following line of sprite data correctly. This would explain why it sorts itself out every other line because you'll be going from aligned to non-aligned to aligned again.

To try and draw this in ASCII for a sprite that's 6 pixels wide, is the sprite stored like

AAAAAABBBBBBCCCCCC

in which case line B is not word aligned but line C is and D wouldn't be, or

AAAAAA00BBBBBB00CCCCCC00

in which case are you sure you're moving your pointer to the sprite data on to the next line correctly for each line?

  ^[ Log in to reply ]
 
andrew Message #4724, posted at 19:16, 27/1/2001, in reply to message #4723
Unregistered user Yes, that's solved the problem exactly Lee. The data was stored with two bytes at the end of each line so that when loaded in again, the line below wouldn't be word-aligned as expected by the plotter. So I've saved with two free unused bytes at the end of each row. I was looking a the plotting routine when I should have been looking at the accessing of the stored data.
Thanks again!

Andrew

  ^[ Log in to reply ]
 
andrew Message #4725, posted at 19:16, 27/1/2001, in reply to message #4723
Unregistered user Yes, that's solved the problem exactly Lee. The data was stored with two bytes at the end of each line so that when loaded in again, the line below wouldn't be word-aligned as expected by the plotter. So I've saved with two free unused bytes at the end of each row. I was looking a the plotting routine when I should have been looking at the accessing of the stored data.
Thanks again!

Andrew

  ^[ Log in to reply ]
 
andrew Message #4726, posted at 19:17, 27/1/2001, in reply to message #4725
Unregistered user I'll send you the updated program for what it's worth.
  ^[ Log in to reply ]
 

The Icon Bar: Programming: Direct screen plotting - word alignment?