ascjulia.c and ascbrot.c

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
veekoo
Posts: 26
Joined: 07 Jun 2021, 07:07

Re: ascjulia.c and ascbrot.c

Post by veekoo »

This is current state of coding. Pictures added.
Attachments
ascbrot.jpg
ascbrot.jpg (62.34 KiB) Viewed 1166 times
ascjulia.jpg
ascjulia.jpg (61.32 KiB) Viewed 1166 times
lb3361
Posts: 109
Joined: 17 Feb 2021, 23:07

Re: ascjulia.c and ascbrot.c

Post by lb3361 »

Using the console directly instead of putchar() avoids the buffering effect and allows you to change colors and x/y positions.

Code: Select all

  ...
  /* Unchanged code above */
  if(x+y < 4) {     /* Why x+y < 4 btw? */
    return i;
  }
  return 1;
}

#include <gigatron/console.h>

void main(void) {
  int x, y, data;
  float sx, sy;
   
  for(y = 0; y < HEIGHT; y = y + YSTEP ) {
    for(x = 0; x < WIDTH; x = x + XSTEP ) {
      sx = SCALE * (WIDTH/2.0 - x) / (WIDTH/2.0);
      sy = SCALE * (HEIGHT/2.0 - y) / (HEIGHT/2.0);
      data = julia(sx, sy);
      console_state.cx = x;
      console_state.cy = y;
      console_state.fgbg = (((data-48)*6+1) & 0x3f) << 8;
      console_print((char*)&data, 1);
    }
  }
}
giving
Screenshot from 2021-09-15 21-10-47.png
Screenshot from 2021-09-15 21-10-47.png (11.76 KiB) Viewed 1150 times
veekoo
Posts: 26
Joined: 07 Jun 2021, 07:07

Re: ascjulia.c and ascbrot.c

Post by veekoo »

Cool. Very colorful.

A couple of things in code that might be considered. Testing things takes time. Best place is start testing is with ascii-versions, graphics versions take hours to draw the screen.

Code: Select all

//-------------------------------------------------------
 if(zz > 32) break; //might work with already at zz>4
//-------------------------------------------------------
  if(x+y < 4) {     /* Why x+y < 4 btw? */ -> I think this is not needed, instead just return i;
    return i;
  }
  return 1;
//-------------------------------------------------------
veekoo
Posts: 26
Joined: 07 Jun 2021, 07:07

Re: ascjulia.c and ascbrot.c

Post by veekoo »

Latest sources and executables can be found at:

https://github.com/veekooFIN/
Post Reply