Saturday, May 4, 2019

MTU 80 Column 3d hat

I remember this program that I typed in from a magazine years ago that would draw a neat 3d function. So let's see if we can find it:


https://j-b.livejournal.com/268176.html
Atari 8-bit "Archimedes Spiral" demo - FOUND!


I searched google for:
mtu commodore pet graphics "high-resolution"
which led me to an ebay ad and if you look closely it says "May 1981" so let's see what we can find for ads for MTU in may 1981.





Micro, the 6502 magazine, may 1981 page
http://archive.6502.org/publications/micro/micro_36_may_1981.pdf

I found the original source for the ebay ad picture:

https://archive.org/details/creativecomputing-1981-05/page/n67





And another page that mentions the MTU ad and rewriting it in 68000

http://www.easy68k.com/paulrsm/dg/dg07.htm


It was originally for the PET with a MTU graphics board, but it wasn't hard to convert to Apple II Applesoft Basic, but I kept getting illegal quantity errors on the hplots being outside of the range 0-279 for x and 0-191 for y so there's code to keep them within range.

You can paste the program into mame's lua console and then unthrottle with F10 and set the frameskip to skip 10/10 it to run it really fast. If you shrink the mame window it will go even faster. I think I can get it to 1200% on my system so it only takes about 8 minutes.



emu.keypost([[
   NEW
 10 HGR2 : HCOLOR=3
 20 P=160 : Q=100
 30 XP=120:XR=1.5*3.1415927
 40 YP=56:YR=1:ZP=64
 50 XF=XR/XP:YF=YP/YR:ZF=XR/ZP
 60 FOR ZI=-Q TO Q-1
 70 IF ZI<-ZP OR ZI>ZP GOTO 150
 80 ZT=ZI*XP/ZP:ZZ=ZI
 90 XL=INT(.5+SQR(XP*XP-ZT*ZT))
 100 FOR XI=-XL TO XL
 110 XT=SQR(XI*XI+ZT*ZT)*XF:XX=XI
 120 YY=(SIN(XT)+.4*SIN(3*XT))*YF
 130 GOSUB 170
 140 NEXT XI
 150 NEXT ZI
 160 STOP
 170 X1=XX+ZZ+P
 180 Y1=YY-ZZ+Q
 181 IF Y1<1 THEN Y1=1  : REM MUST BE 1 OR ERROR IN 210
 182 IF Y1>191 THEN Y1=191
 183 IF X1<0 THEN X1=0
 184 IF X1>279 THEN X1=279
 190 HCOLOR=3:HPLOT X1,191-Y1
 210 HCOLOR=0:HPLOT X1,191-(Y1-1) TO X1,191-0
 220 RETURN
 RUN
]])


I also like this applesoft program to plot the gaussian distribution in 3d on codegolf:

https://codegolf.stackexchange.com/questions/123039/plot-the-gaussian-distribution-in-3d/123079