Jump to content

Photo

Graphics 8 Fedora Hat


140 replies to this topic

#126 Spaced Cowboy OFFLINE  

Spaced Cowboy

    Chopper Commander

  • 239 posts
  • Location:San Jose, CA

Posted Sat Feb 10, 2018 10:23 PM

 

actually they are quite different: http://manillismo.bl...iferencias.html

 

Most of those differences probably come down to a phase difference in the algorithm. 



#127 dmsc OFFLINE  

dmsc

    Moonsweeper

  • 441 posts
  • Location:Viņa del Mar, Chile

Posted Sun Feb 11, 2018 10:31 AM

Hi!
 

Most of those differences probably come down to a phase difference in the algorithm.


And in the rounding differences. Attached are two versions, the old one that does not round in the last operation and a new that does round, the results ar different, but I don't know which is really "better".

Original: fedora-orig.png Rounded: fedora-round.png

In run-time the rounded one is less than 0.1s slower.

Attached Files



#128 _The Doctor__ OFFLINE  

_The Doctor__

    Quadrunner

  • 5,585 posts
  • Location:10-0-11-00:02

Posted Sun Feb 11, 2018 10:46 AM

oddly enough I like the second one better, and that is slightly confusing to me. And in fact I've now downloaded it.


Edited by _The Doctor__, Sun Feb 11, 2018 10:46 AM.


#129 tebe OFFLINE  

tebe

    Dragonstomper

  • 762 posts
  • Location:Poland

Posted Tue Feb 13, 2018 2:06 AM

impressive job DMSC

 

CA65 -> MADS RELOC in attachment

 

Attached Files



#130 JamesD ONLINE  

JamesD

    Quadrunner

  • 8,244 posts
  • Location:Flyover State

Posted Sun Apr 22, 2018 9:42 AM

I posted a BASIC patch for the CoCo 3 today that replaces the regular multiply with a version that uses the hardware multiply instruction of the 6809.
It speeds up BASIC code without any other changes.
This was a quick and dirty test comparison vs regular BASIC, it hasn't been timed yet and it was just thrown together.
It will give you an idea of the speed difference.  20% to 30% faster?  And there's room for improvement.

CoCoPatch1HiRes.jpg



#131 JamesD ONLINE  

JamesD

    Quadrunner

  • 8,244 posts
  • Location:Flyover State

Posted Mon Apr 23, 2018 3:11 PM

It took a while to find the right code in this thread.  Here is the Atari code and the CoCo 3 patches including timing

It takes just under 14 minutes to complete, down from over 19.  
That time is better than my original estimate for the 6309 which should now be under 11.2 minutes.
 

100 SX=144:SY=56:SZ=64:CX=320:CY=192
110 C1=2.2*SY:C2=1.6*SY
120 DIM RR(CX)
130 FOR I=0 TO CX:RR(I)=CY:NEXT I
140 GRAPHICS 8+16:SETCOLOR 2,0,0:COLOR 1
150 CX=CX*0.5:CY=CY*0.46875:FX=SX/64:FZ=SZ/64
160 XF=4.71238905/SX
170 FOR ZI=64 TO -64 STEP -1
180   ZT=ZI*FX:ZS=ZT*ZT
190   XL=INT(SQR(SX*SX-ZS)+0.5)
200   ZX=ZI*FZ+CX:ZY=CY+ZI*FZ
210   FOR XI=0 TO XL
220     A=SIN(SQR(XI*XI+ZS)*XF)
230     Y1=ZY-A*(C1-C2*A*A)
240     X1=XI+ZX
250     IF RR(X1)>Y1 THEN RR(X1)=Y1:PLOT X1,Y1
260     X1=ZX-XI
270     IF RR(X1)>Y1 THEN RR(X1)=Y1:PLOT X1,Y1
280   NEXT XI
290 NEXT ZI

80 TIMER=0
90 POKE 65497,0
140 PMODE 4,1:HSCREEN 2:SCREEN 1,1
250 IF RR(X1)>Y1 THEN RR(X1)=Y1:HSET(X1,Y1)
270 IF RR(X1)>Y1 THEN RR(X1)=Y1:HSET(X1,Y1)
300 PRINT"TIME",TIMER/60



#132 devwebcl OFFLINE  

devwebcl

    Stargunner

  • 1,228 posts
  • Location:Chile

Posted Sat May 5, 2018 6:27 AM

It took a while to find the right code in this thread.  Here is the Atari code and the CoCo 3 patches including timing
It takes just under 14 minutes to complete, down from over 19.  
That time is better than my original estimate for the 6309 which should now be under 11.2 minutes.
 

100 SX=144:SY=56:SZ=64:CX=320:CY=192
110 C1=2.2*SY:C2=1.6*SY
120 DIM RR(CX)
130 FOR I=0 TO CX:RR(I)=CY:NEXT I
140 GRAPHICS 8+16:SETCOLOR 2,0,0:COLOR 1
150 CX=CX*0.5:CY=CY*0.46875:FX=SX/64:FZ=SZ/64
160 XF=4.71238905/SX
170 FOR ZI=64 TO -64 STEP -1
180   ZT=ZI*FX:ZS=ZT*ZT
190   XL=INT(SQR(SX*SX-ZS)+0.5)
200   ZX=ZI*FZ+CX:ZY=CY+ZI*FZ
210   FOR XI=0 TO XL
220     A=SIN(SQR(XI*XI+ZS)*XF)
230     Y1=ZY-A*(C1-C2*A*A)
240     X1=XI+ZX
250     IF RR(X1)>Y1 THEN RR(X1)=Y1:PLOT X1,Y1
260     X1=ZX-XI
270     IF RR(X1)>Y1 THEN RR(X1)=Y1:PLOT X1,Y1
280   NEXT XI
290 NEXT ZI

80 TIMER=0
90 POKE 65497,0
140 PMODE 4,1:HSCREEN 2:SCREEN 1,1
250 IF RR(X1)>Y1 THEN RR(X1)=Y1:HSET(X1,Y1)
270 IF RR(X1)>Y1 THEN RR(X1)=Y1:HSET(X1,Y1)
300 PRINT"TIME",TIMER/60


Well done. Still I think executing to the half by it synmetry is much better.

#133 JamesD ONLINE  

JamesD

    Quadrunner

  • 8,244 posts
  • Location:Flyover State

Posted Sat May 5, 2018 8:01 AM

Well done. Still I think executing to the half by it synmetry is much better.

I just ported it, someone else came up with the algorithm.

My replacement line 140 has a couple old commands that aren't needed for the Super Extended Color BASIC graphics mode. 
It guess it only needs the HSCREEN.  I've written exactly 3 BASIC programs for the CoCo 3, and all years apart, so I'm not exactly an expert on it.

There is a 16x16 bit multiply I could patch that would speed up array indexing. 
It would speed this up a little as would several other changes I made to the MC-10 ROM.  That is now around 8% faster for non-math intensive stuff, so there is clearly room for improvement, but the CoCo has a lot of BASIC software that could break, where the MC-10 did not.
For benchmarking it would probably be better to use a faster plot to make timing easier.
The end result isn't as pretty though.  :)  



Fractals, foureir transforms, etc... are some other things this patch would speed up. 


Edited by JamesD, Sat May 5, 2018 8:02 AM.


#134 tebe OFFLINE  

tebe

    Dragonstomper

  • 762 posts
  • Location:Poland

Posted Sun May 6, 2018 5:54 AM

program fedora_hat;
 
uses crt, graph, sysutils;
 
const
 sx: single = 144;
 sx_2 : single = 144 * 144;
 sy: single = 56;
 half: single = 0.5;
 sz = 64;
 cx = 320;
 cy = 192;
 
 
var
 c1, c2, scx, scy, xf, zt, zs, fx, fy, fz, zx, zy, a, ifz: single;
 
 i: word;
 
 gd, gm,
 xl, xi, x1, y1: smallint;
 
 zi: shortint;
 
 tim: cardinal;
 
 rr: array [0..cx-1] of smallint;
 
begin
 
gd := D8bit;
gm := m640x480;
 
InitGraph(gd,gm,'');
 
tim:=GetTickCount;
 
c1:=2.2*sy;
c2:=1.6*sy;
 
for i:=0 to cx-1 do rr[i] := cy;
 
scx:=cx * 0.5;
scy:=cy * 0.46875;
fx:=sx/64;
fz:=sz/64;
 
zt:=fx*64;
ifz:=fz*64;
 
xf:=4.71238905/sx;
 
for zi:=64 downto -64 do begin
 
 zs:=zt*zt;
 xl:=trunc(sqrt(sx_2-zs)+half);
 
 zx:=ifz+scx;
 zy:=ifz+scy;
 
 for xi:=0 to xl do begin
  a:=sin(sqrt(xi*xi+zs)*xf);
 
  y1:=trunc(zy-a*(c1-c2*a*a));
 
  x1:=trunc(xi+zx);
  if rr[x1] > y1 then begin rr[x1]:=y1; PutPixel(x1,y1, 15) end;
 
  x1:=trunc(zx-xi);
  if rr[x1] > y1 then begin rr[x1]:=y1; PutPixel(x1,y1, 15) end;
 
 end;
 
 zt:=zt-fx;
 ifz:=ifz-fz;
 
end;
 
writeln(GetTickCount - tim,' tick');
 
repeat until keypressed;
 
end.

22455 ticks = ~7.485 min

Attached Files


Edited by tebe, Sun May 6, 2018 5:56 AM.


#135 JamesD ONLINE  

JamesD

    Quadrunner

  • 8,244 posts
  • Location:Flyover State

Posted Sun May 6, 2018 8:46 AM

22455 ticks = ~7.485 min

Nice!  I've always preferred C over Pascal, but I liked Pascal better than BASIC.

A good compiler is always going to beat interpreters.
Having to parse lines and convert numerical constants every time a line is executed really slows down most interpreters.
 



#136 TheGreatGrizz OFFLINE  

TheGreatGrizz

    Combat Commando

  • 2 posts

Posted Sun Oct 21, 2018 3:11 PM

I tried it using turbo basic xl 1.5 with altirra emulator and it ran 3 times faster if I remember correctly !

 

About 1 houre instead of 3 houres with atari basic.

 

In quick basic 64 on windows 10 64 bits I think I got over 100 frames per second... on a 4.0 ghz cpu...

 

I intend to try it on VICE emulator for pet cbm computer with hires video card emulator... version 3.2 (or 3.3) ? emulates hires grafx I think...

 

To be continued...


Edited by TheGreatGrizz, Sun Oct 21, 2018 3:17 PM.


#137 Geister ONLINE  

Geister

    Chopper Commander

  • 105 posts
  • Location:Lehigh Valley, PA

Posted Sun Oct 21, 2018 6:29 PM

I already did a version for the C64 on the VICE emulator.  It was nice because the 320X200 resolution matched the calculated extents in the program without having to trap for an out of bounds error as the Atari code has to do.  Unfortunately, the lack of any plot or drawto commands in Commodore Basic V2.0 made the graphics very "POKEy"



#138 Faicuai OFFLINE  

Faicuai

    Dragonstomper

  • 907 posts
  • Location:Florida, U.S.A.

Posted Wed Oct 24, 2018 12:58 PM

Latest run on Atari800/Incognito (and 800XL/Ultimate):

1. Assembler / Machine code: 00m:16.80s
2. Altirra Basic v1.55: 11m:27.31s
3. TurboBasic v1.50: 12m:15.22s

Hand-timed, directly, to avoid fouled-up internal timers.

Above results achieved with high-performance ROMs that I posted a while ago, as well as shutting down Antic for max. 6502 throughput (now supported NATIVELY by such ROMs thanks to Atari's own vestigial code left in there since 1983, and no longer needed in Basic or any other high-level code).

Edited by Faicuai, Wed Oct 24, 2018 12:59 PM.


#139 _The Doctor__ OFFLINE  

_The Doctor__

    Quadrunner

  • 5,585 posts
  • Location:10-0-11-00:02

Posted Wed Oct 24, 2018 2:26 PM

would be cool to have you post up the complete fedora with O.S. package in a zip for all to enjoy right here in this thread. perhaps a blurb on how the folks can do the burn and install and all the methods in between. I kind of would like this to become the official rom of the line... :)



#140 Faicuai OFFLINE  

Faicuai

    Dragonstomper

  • 907 posts
  • Location:Florida, U.S.A.

Posted Mon Oct 29, 2018 8:34 PM

would be cool to have you post up the complete fedora with O.S. package in a zip for all to enjoy right here in this thread. perhaps a blurb on how the folks can do the burn and install and all the methods in between. I kind of would like this to become the official rom of the line... :)

 

Good idea!

 

Been working on putting this together, with some extra bonus items.

Here's the most recent update:

 

  1. Assembler / Machine code: 00m:16.80s
  2. FastBasic 3.5:                   09m:05s (=> includes spatial optimization that chops 10secs. of runtime, about 2,500 FO ops).
  3. Altirra Basic v1.55:            11m:27.31s
  4. TurboBasic v1.50:             12m:15.22s

 

I am attaching two .ATRs:

 

  1. First one is a hand-picked collection of system BIOS/ROMS, to be used (preferably) on Incognito and/or Ultimate (because it is breeze to upload them there, via SDX and UFlash).
    • They can also be burned in a compatible EPROM chip, if that's what is available.
    • All of these ROMs have been properly signed and will pass checksum tests, where applicable.
    • So far, they will beat the shit (in relative terms) out of practically anything that is out there, math-wise.
    • A special, custom high-performance FP version of Avery's Altirra ROM has been included (for testing / joy purposes).
    • Altirra Basic 1.55 8K rom also included, which combined with the above, puts the A800/XL into early (stock) Intel 8088 / 8086 territory, while STILL being interpreted, and STILL fitting 8K, also matching or exceeding Z80 performance (when it comes to most of these classical benchmarks).
    • Anything that shows "XE0Xi___" is for INCOGNITO (A800), and "XE0Xu___" is for Ultimate (XL).
    • F__ means only 1200XL function-keys revived. FP_ means latter+ FP pack. FPH means latter + XL Help key enabled.
    • Attached File  BIOS-Ultimate_Incognito.atr   179.64KB   7 downloads
  2. Second one is a collection of classical (hand written and/or ported) benchmarks, in both Basic and machine-executable code:
    1. .BAS stands for Atari Basic
    2. .FAB stands for Fast Basic (FEDORA02.FAB, from the above update is there)
    3. .MSB stands for Microsoft Basic
    4. .CPM stands for CPM text file to be run with Microsoft Basic 5.29 (CPM). NO NEED to translate with ICDS copy function.
    5. Most basic files include extensive cross-platform results in REM section, for your convenience.
    6. .OBJ means that is directly executable from SDX / DOS prompt.
    7. ICDS utility to transfer from SIO attached ATR into IndusGT (#1) SIO floppy drive.
    8. A revised Trub Terminal with better colors.
    9. Attached File  Scratchpad.atr   179.64KB   7 downloads

Have fun!


Edited by Faicuai, Mon Oct 29, 2018 8:48 PM.


#141 fujidude OFFLINE  

fujidude

    Quadrunner

  • 5,095 posts
  • Location:United States of America

Posted Tue Oct 30, 2018 12:13 AM

Here is an updated Python 3 version of the program.  Should run on any platform which has Python 3 installed:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Name:        archimedes.py
# Purpose:     implement the Archimedes' spiral prgoram in Python 3.x
#
# Author:      fujidude for just the Python version, original code
#              Charles Bachand, pub. Antic magazine, issue 7, pp.60-61.
#
# Created:     2018-10-29
# ----------------------------------------------------------------------------

# import necessary modules
import tkinter
import math


def end():
    rootwin.destroy()


rootwin = tkinter.Tk()  # main (root) application window based on Tkinter
rootwin.wm_title("Archimedes' Spiral")

quitBtn = tkinter.Button(rootwin, text="Exit", command=end)
quitBtn.pack(side="bottom")

graphzone = tkinter.Canvas(rootwin, width=320, height=192, bg="lightblue")
graphzone.pack()

XP = 144
XR = 4.71238905
XF = XR / XP

for ZI in range(-64, 65):
    ZT = ZI * 2.25
    ZS = ZT * ZT
    XL = int(math.sqrt(20736 - ZS) + 0.5)
    for XI in range(0 - XL, XL+1):
        XT = math.sqrt(XI * XI + ZS) * XF
        YY = (math.sin(XT) + math.sin(XT * 3) * 0.4) * 56
        X1 = XI + ZI + 160
        Y1 = 90 - YY + ZI
        graphzone.create_oval(X1, Y1, X1, Y1, fill="white")
        graphzone.create_line(X1, Y1+1, X1, 191, fill="white")

rootwin.mainloop()

And then here is a screenshot of it after run:

 

Archimedes' Spiral_001.png


Edited by fujidude, Tue Oct 30, 2018 12:14 AM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users