Where is this program for the x16 please?

All aspects of programming on the Commander X16.
Post Reply
funkheld
Posts: 268
Joined: Mon Feb 26, 2024 11:11 am

Where is this program for the x16 please?

Post by funkheld »

Hi good afternoon.

I'm looking for the program please (see picture for the x16) and the source code.

I'm interested in how the image buffer was created for this.

Thanks.
Attachments
ship.jpg
ship.jpg (26.72 KiB) Viewed 546 times
User avatar
desertfish
Posts: 1038
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Where is this program for the x16 please?

Post by desertfish »

It is one of the commander x16 examples that ship with Prog8.

Try It Now!

https://github.com/irmen/prog8/blob/mas ... mk3-gfx.p8


(By the way, I don't know if you already knew this, but here is the directory with the whole bunch of Prog8 example programs: https://github.com/irmen/prog8/tree/master/examples )
Attachments
cobramk3-gfx.prg
(3.68 KiB) Downloaded 13 times
funkheld
Posts: 268
Joined: Mon Feb 26, 2024 11:11 am

Re: Where is this program for the x16 please?

Post by funkheld »

how can you do the rotation with a buffer?
User avatar
desertfish
Posts: 1038
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Where is this program for the x16 please?

Post by desertfish »

I don't really understand what you mean with "with a buffer".

I can explain globally how it works and you can maybe follow along in the source code for the details:

- the ship is made up of points and lines stored in arrays.
- the points are rotated using a 3x3 rotation matrix that is applied to each of the points of the ship. If you google this term you will get tons of details on how this is done
- the hidden line removal is done by calculating the direction the surface normal of every surface of the ship is pointing. If it is pointing towards you it is marked visible, if it points away from you into the screen, it is marked invisible (because it lies on the back side of the ship)
- note that there is a mistake still in calculating this because some surfaces are still visible at some angles where they should not be.
- screen is cleared.
- lines of the visible surfaces are drawn.
- repeat
funkheld
Posts: 268
Joined: Mon Feb 26, 2024 11:11 am

Re: Where is this program for the x16 please?

Post by funkheld »

------------------------------------------------------------------------------
I don't really understand what you mean with "with a buffer".
-------------------------------------------------------------------------------

Draw the finished image in the background and then bring the entire image to the front in the visible area.

greeting.
User avatar
desertfish
Posts: 1038
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Where is this program for the x16 please?

Post by desertfish »

Oh, it doesn't use double buffering. It draws all the pre-rotated lines as quickly as it can after clearing the display. That's why you still see it flickering, because this process takes longer than a frame to complete
funkheld
Posts: 268
Joined: Mon Feb 26, 2024 11:11 am

Re: Where is this program for the x16 please?

Post by funkheld »

how can a double buffer be created in x16?

Thanks.
mgkaiser
Posts: 31
Joined: Sat Dec 02, 2023 6:49 pm

Re: Where is this program for the x16 please?

Post by mgkaiser »

You can only double buffer some modes. Not enough vram to double buffer 8 bit color, but you can do 4bit or lower.

And remember you can get clever with a raster interrupt and change the pallette as often as every scan line if you want, so a 4 bit bitmap could have more than 16 unique colors in it if you're clever.
funkheld
Posts: 268
Joined: Mon Feb 26, 2024 11:11 am

Re: Where is this program for the x16 please?

Post by funkheld »

Hello thanks for the information.

Please explain to me how I can create a 4bit screen and at which address the screens are located for me as a beginner.

Thanks.
greeting
Post Reply