Assembly Vector Graphics Demo

For Scene Demos that display animations, graphics, and music. Also for tech demos of graphics capability of VERA or the audio capabilities of the PSG, FM, or PCM audio channels.
Post Reply
gavinhaslehurst
Posts: 47
Joined: Thu Jan 07, 2021 11:37 am

Assembly Vector Graphics Demo

Post by gavinhaslehurst »


This is a quick demo of a 2D graphics library I've been working on recently. It's written in assembler, and aims to make life a bit easier when it comes to drawing vector graphics. You can define individual polygons which can be moved about and rotated. The source code looks fairly daunting, but when it comes down to it, building, transforming and rendering the polygons is very straightforward. Hopefully this will form the basis of a game at some point soon. (Perhaps an Asteroids clone?) Once I sink my teeth into interrupt handling, I should be able to "vsync" everything so it's flicker-free. 




All comments and suggestions welcome! 




Short screen capture of this demo on YouTube (featuring my tunez!!): 

Commander X16 Demo - Vector Graphics in 6502 Assembly - YouTube




WARNING: For those who are sensitive to flickering/strobing, please be aware that this may cause problems for you. 




--




See below for a quick preview of the game I'm working on, retro flickering and all! 




Desktop 2021.02.07 - 20.15.07.01.gif



Now with less flicker! Using a bit of a hack to switch between VERA layers 0 and 1.  The effect is a bit strange, but I think overall nicer to look at. I think once I get my head around manipulating VERA memory directly I can do this properly. In the meantime, I think I've got far enough to start working on a game based on this code. 




--




Using vsync interrupt to wait before clearing the screen. Still on the flickery side, so any advice appreciated! Thanks to Stephern Horn for his tutorial on interrupts, which was very clear indeed. Check it out here (ASM Programming) Interrupts and interrupt handling · commanderx16/x16-emulator Wiki · GitHub


Attachments
Assembly Vector Graphics Demo
Assembly Vector Graphics Demo
shapes.png (9.89 KiB) Viewed 4238 times
Assembly Vector Graphics Demo
Assembly Vector Graphics Demo
colourful shapes.png (25.46 KiB) Viewed 4238 times
2D.PRG
Assembly Vector Graphics Demo
(2.1 KiB) Downloaded 229 times
2d.asm
Assembly Vector Graphics Demo
(22.18 KiB) Downloaded 243 times
2D.PRG
Assembly Vector Graphics Demo
(1.88 KiB) Downloaded 212 times
2d.asm
Assembly Vector Graphics Demo
(19.89 KiB) Downloaded 214 times
2D.PRG
Assembly Vector Graphics Demo
(1.94 KiB) Downloaded 222 times
2d.asm
Assembly Vector Graphics Demo
(19.82 KiB) Downloaded 219 times
pastblast
Posts: 20
Joined: Tue Sep 01, 2020 8:00 pm

Re: Assembly Vector Graphics Demo

Post by pastblast »

Are you still working on this? I had some thoughts that might help, if you like.

First, either pre-compute the rotated X/Y coordinates, or at least use integer sin/cos tables (possibly with interpolation, but preferably not) to get your angles.

Second, switch to sprites, and don't draw at all.

Third, if you want to use double buffering (layer 0 versus layer 1), and you want to save some time when clearing the screen, simply redraw what was on the older layer, using the background color. That has to be faster than clearing the entire screen, when the pixels on the screen are relatively sparse, as they are here.
Post Reply