%import textio %import floats %zeropage basicsafe ; Note: this program is compatible with C64 and CX16. main { const uword width = 30 const uword height = 20 const ubyte max_iter = 16 sub start() { txt.print("calculating mandelbrot fractal...") %asm {{ stx P8ZP_SCRATCH_REG ; reset the jiffy clock ldx #0 ldy #0 lda #0 jsr c64.SETTIM ldx P8ZP_SCRATCH_REG }} ubyte pixelx ubyte pixely for pixely in 0 to height-1 { float yy = (pixely as float)/0.4/height - 1.0 for pixelx in 0 to width-1 { float xx = (pixelx as float)/0.3/width - 2.2 float xsquared = 0.0 float ysquared = 0.0 float x = 0.0 float y = 0.0 ubyte iter = 0 while iter