Atari 6502 software sprites

Made something in Assembly? Show it off, and tell us how it works...
Absolute beginners welcome... we want to see what you've done!
Forum rules
There is a special rule on this forum...
This forum is intended to offer equal amounts encouragement and constructive feedback...
Therefore, if you say 2 negative things about someones work, you must think of 2 or more equally positive things...

Eg: "Great first effort, the idea is absolutely fascinating... However I noticed a few bugs, and maybe the graphics could be improved..."

If you can't think of anything good to say, then don't say anything!

If we don't encourage newbie programmers they won't have the confidence and motivation to stick at it and become great programmers! *speaking from experience*
Post Reply
Posts: 15
Joined: Mon Feb 17, 2020 6:09 pm

Atari 6502 software sprites

Post by matibee » Sun Dec 06, 2020 11:18 pm

Hey all,

I just wanted to let you know that I'm tinkering away at my background code and tools for a new game project and the first stage is almost done -- a 'software sprite' system.

(Sorry I couldn't figure out how to embed the gif...) ... sp=sharing

Believe it or not, there's a lot going on in that little gif;
  • Character based sprites
  • Double buffered display
  • Page flipping and screen clearing during the VBI (edit - I forgot to mention what a challenge this was..) The display is currently 40 columns x 20 rows and there isn't time in the vertical blank period to simply set 800 bytes to zero. So for every line I keep a 'screen clear byte' which tells me which column of 8 characters in that line needs zeroing. When plotting a character it's trivial to divide its X position by 8 and EOR the result into the screen clear byte.
  • Sprite data can be pre-shifted right to allow per-pixel screen position (rather than moving a whole character at a time)
    Of the 8 static sprites in the gif the bottom row shows pixel offset versions (2 pixels shifted each time in monochrome Gr. 0, which equals 1 pixel in 4 colour mode)
  • When drawing a sprite the system looks to see if there's already a character on screen at position (x,y) and if there is, it EOR's the new sprite data into it, otherwise it places the next free char on screen and copies the sprite data into that. Repeat for all characters of all sprites.
  • Sprites can be any number of characters in width and height (within reason) and there's a pre-calculated look up table for empty characters that the sprite drawing routine can simply ignore.
  • I've not implemented masking because it's going to be too much of burden on the system but I could implement it just for special cases (like the player sprite) should the colour mangling turn out to be particularly distracting. I can't yet decide if a per-pixel version of the ZX Spectrum's colour clash will be endearing or just plain shite :)
  • Right now it's managing to draw a decent number of sprites in real time but I think I'll need to find some performance tweaks and/or limit the number of objects on screen once the actual game gets under development
  • So far, only running in Altirra, configured as a stock, PAL, 64k, 800XL but I look forward to testing on real hardware when there's something more worthy to test
  • Test sprites in the gif are nothing to do with the game I have in mind :)
This entire system was going to be my 'next big game dev project' back in 1990 but I went and bought an Amiga instead! However, I'm really enjoying the rapid speed of development on a modern pc with large, coloured text editors, almost instantaneous compile times and an emulator/debugger to step thru' and trace -- it's made this project a million times easier than it would have been 30 years ago.

I just wanted to thank you Keith for the inspiration. Please keep up the great work!

User avatar
Posts: 463
Joined: Mon Apr 22, 2019 3:19 am

Re: Atari 6502 software sprites

Post by akuyou » Sun Dec 13, 2020 6:22 am

Looks fantastic... I can certainly believe it has taken a lot of work, as I've written a few test programs myself like this and they always balloon in to code monsters!

It sounds like you're put some fantastic work in there, so I hope to hear more of what you've got planned for it.

Keep up the great work!
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

Posts: 2
Joined: Fri Feb 12, 2021 11:59 pm

Re: Atari 6502 software sprites

Post by lerugray » Mon Feb 22, 2021 12:08 pm

This looks great! I have been struggling to get playfields looking decent on the 6502 so will be looking at your bitmap tool

Post Reply

Return to “Show and Tell”