Jump to content
IGNORED

Fractari - Mandelbrot set generator for 8bit Atari


R0ger

Recommended Posts

11 minutes ago, Synthpopalooza said:

Oh one other thought ... if you do ANTIC 4 bitmap, map your colors like so, from brightest to darkest:

 

PF3 - PF0  - PF1 - PF2 - BAK

 

or 

 

PF2 - PF1 - PF0 - PF3 - BAK

 

This avoids PF2-PF3 inverse conflicts. 

Well you can still have inverted and non-inverted pixels in one byte. Question is how often that will happen.

Anyway, I was thinking about it and clearly you must know some way how to force character map read in middle of the line. I'm not aware it's possible.

Link to comment
Share on other sites

47 minutes ago, MrFish said:

I came up with these in GTIA 9.

 

1231998194_Mandel1.thumb.png.e79e6a746fe2e44549a5fc592c483b76.png    1018142989_Mandel2.thumb.png.7f9b9495a4cf66d3a3119a3f8613c067.png

 

Mandel 1.xex 12.45 kB · 3 downloads

 

Mandel 2.xex 12.44 kB · 1 download

 

 

I really would like to see this (as well as all Fractari samples posted so far) done on the C64.... as well as the computing times... ??

Edited by Faicuai
  • Like 1
  • Haha 2
Link to comment
Share on other sites

1 hour ago, R0ger said:

Well you can still have inverted and non-inverted pixels in one byte. Question is how often that will happen.

Anyway, I was thinking about it and clearly you must know some way how to force character map read in middle of the line. I'm not aware it's possible.

I think you would be stuck with every 8 lines being of the same attribute unless you mess with VSCROL to do Konop's mode.  That wastes a lot of memory tho but reduces your characters to 5 or 6 pixels high.

 

You write characters 0-127 sequentially to the screen then inverse each character in the map as needed should you need to use PF3.  DLI character set change on each zone.  Writing to the character set memory in each zone activates the pixels. 

Edited by Synthpopalooza
Link to comment
Share on other sites

This may be of help to you ...

 

In this post, I made a C64 koala converter in Turbo Basic, which displays in the PCIN Antic 4 plus GTIA 10 mode.  It uses the DLI character set method I mentioned.  You inverse the appropriate character in the map whenever you need to use PF3 based colors.  This method was intuitive in this example because C64's graphics are also laid out in the same manner as this method.

 

  • Like 1
Link to comment
Share on other sites

41 minutes ago, Synthpopalooza said:

I think you would be stuck with every 8 lines being of the same attribute unless you mess with VSCROL to do Konop's mode.  That wastes a lot of memory tho but reduces your characters to 5 or 6 pixels high.

 

You write characters 0-127 sequentially to the screen then inverse each character in the map as needed should you need to use PF3.  DLI character set change on each zone.  Writing to the character set memory in each zone activates the pixels. 

Well, attributes 1 character high are too restrictive for fractals. If we could force charmap refresh every 2 lines, that could be worth pursuing, but whole character ? Nah.

Link to comment
Share on other sites

  • 9 months later...
  • 2 months later...

@Heaven/TQA I guess I can share the math routines.

 

First let's look at math2.asm:

 

mul_UBBW - macro for multiplication Unsigned Byte * Byte to result Word. Uses tables square1 and square2, which contain (X^2)/4 and -(X^2)/4

sqr2 - macro which does square of word (2 bytes). The trick used here is used in all more complex versions.

 

Square is multiplication of 2 same words .. each consisting of bytes A and B. If we multiply each byte with each byte, we get partial products, which we have to sum together.

For these products I use convection AB = A*B .. which is kinda confusing, as the original number are also AB (A followed by B) .. just keep in mind that AB in first row is something different then AB later (yeah, one of the reasons I don't like sharing source codes :-D).

 

  AB
  AB
----
  BB
 AB
 AB
AA	 
----

AA is A squared, BB is B squared, which can be computed faster than multiplication using simple square table, named square. But that's not the trick. The trick is this.

Normally when multiplying, I would sum all these partial products together. But AA and BB don't overlap .. there can be no carry between them. So I can rearrange this sum like this:

AABB
 AB
 AB
----

Doesn't seem like much now .. but it helps a lot in more complex variants. Also note the routine inverts the negative numbers right at the beginning.

 

Ok, now for math3.asm. It works with 3 byte numbers, which I call triples. First there are some macros mta (move triple), mtai (move triple immediate), adt (add triple) and sbt (sub triple). Basic stuff.

 

Then there is the multiplication. 3 bytes squared into 6 bytes result. Here the sums and their simplification goes like this:

   ABC
   ABC
------
    CC
   BC 
  AC
   BC 
  BB
 AB
  AC 
 AB
AA
------
AABBCC   
 ABBC  ;stored in tmp1
 ABBC
  AC   ;stored in mr (result)
  AC

AA, BB and CC are again simple square of original bytes. To continue the confusing names, ABBC is actually A*B followed by B*C. I hope you get the idea.

You can see that 'the trick' saved lot of sums and byte manipulations, and the resulting code is quite short.

 

math4.asm then does basically the same for 4 bytes * 4 bytes with 8 bytes result. The sums go like this:

 

    ABCD
    ABCD
--------
      DD 
     CD
    BD
   AD
     CD
    CC
   BC
  AC
    BD
   BC
  BB
 AB
   AD
  AC
 AB
AA
--------
AABBCCDD
 ABBCCD	;tmp1
 ABBCCD 
  ACBD  ;tmp2
  ACBD
   AD   ;mr
   AD	
--------

And that's all. You can see that square written like this is much faster than multiplication of the same sized numbers. With multiplication all the individual partial products would be different, and I wouldn't be able to simply stack them like this.

And Mandelbrot formula can be modified so it only uses squares, and no multiplication. So it comes really handy here, and my implementation doesn't use any multiplication, besides the mul_UBBW macro.

square.zip

Edited by R0ger
  • Like 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...