6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Sep 27, 2024 11:14 am

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Sun Mar 27, 2011 8:03 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Interesting - pdf link here. I think their idea is to use quadratic interpolation and therefore have smaller lookup tables than needed for linear interpolation (with a second idea of minimising the length of the coefficients and a third idea of using squaring hardware to speed up the interpolation)

Moving slightly back towards integer arithmetic and plotting of a sine curve, there's an old trick due to Minsky which is a close approximation, and uses only add and shift. In fact, maybe not even a shift because a shift by 8 is just picking off a different byte:

Image

At first this was drawing spirals, but it turned out I was using floating point division: it draws near-circles if integer division is used.
Code:
   10 A%=256                           
   20 C%=32768                         
   30 S%=A%                             
   40 FOR I%=0 TO 8000                 
   50   C%=C%-S% DIV A%                 
   60   S%=S%+C% DIV A%                 
   70   PLOT69,S%/128+600,C%/128+600   
   80   PLOT69,I%,S%/128+300           
   90   PLOT69,I%,C%/128+300           
  100   NEXT                           


(Lots of other interesting tricks in the Hakmem memo.)


Last edited by BigEd on Wed Mar 27, 2019 9:20 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Mar 28, 2011 12:31 am 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Fascinating. That is awesome info!

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Mar 28, 2011 7:31 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Marvin's trick to draw circles was used as an example program in the Acorn Atom user manual: "Atomic theory and practice". An excellent book full little bits of useful code.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Mar 28, 2011 8:56 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Nice! Code on Page 86 - picture on next page.

(I wish I'd been able to post those graphics as an ATALAN example... an exercise for the reader?)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: