Posted By
Mad on 2019-12-02 11:33:32
| Re: Assembly: fast plot and line algorithms for plus/4
If you do have a lot of memory then Grahams of Oxyron approach on painting lines probably is the fastest. But however this approach involves very much code. I do have a code generator for that somewhere. But I think a normal Bresenham like Kichy shown up there is a already pretty fast at least a lot faster than basic line drawing. Line drawing is a topic where the demoscene got pretty far already. I always feared that topic in the past.. Maybe I can dig out that code generator and give that to you later on, if Kichys algorithm isn't enough for you..
Actuall graham does this per 8x8 block as far as I remember (needs some tweaking, just as an outline of that idea):
.again sbc ZP_SLOPE bcc .movepixelleftandcontinue1 sbc ZP_SLOPE bcc .movepixelleftandcontinue2 sbc ZP_SLOPE bcc .movepixelleftandcontinue3 sbc ZP_SLOPE bcc .movepixelleftandcontinue4 sbc ZP_SLOPE bcc .movepixelleftandcontinue5 sbc ZP_SLOPE bcc .movepixelleftandcontinue6 sbc ZP_SLOPE bcc .movepixelleftandcontinue7 sbc ZP_SLOPE bcc .movepixelleftandcontinue8 do just drawAll8YPixelsOnSameXPosition here jmp .again
.movepixelleftandcontinue1 dec pixelXPos drawPixel adc ZP_SLOPEORIGIN ; this is the bigger delta (x or y) (like in bresenham) sbc ZP_SLOPE ; this is the smaller delta (x or y) (like in bresenham) bcc .movepixelleftandcontinue2b sbc ZP_SLOPE bcc .movepixelleftandcontinue3b sbc ZP_SLOPE bcc .movepixelleftandcontinue4b sbc ZP_SLOPE bcc .movepixelleftandcontinue5b sbc ZP_SLOPE bcc .movepixelleftandcontinue6b sbc ZP_SLOPE bcc .movepixelleftandcontinue7b sbc ZP_SLOPE bcc .movepixelleftandcontinue8b do just drawAll7LeftYPixelsOnSameXPosition here jmp .again
This code later gets a lot longer because of all the .movepixelleftandcontinue jumps ..
I hope Kichys codelines up there already do the performance trick..
Good luck with your project!!!
|