Jump to content

Photo

Graphics 8 Fedora Hat


124 replies to this topic

#101 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 12,754 posts
  • Location:United Kingdom

Posted Thu Mar 12, 2015 10:38 AM

Just a heads-up and no disrespect to CA65, but MADS also supports relocatable object file linking.

Edited by flashjazzcat, Thu Mar 12, 2015 10:39 AM.


#102 dmsc ONLINE  

dmsc

    Moonsweeper

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

Posted Thu Mar 12, 2015 12:15 PM

Hi!

Just a heads-up and no disrespect to CA65, but MADS also supports relocatable object file linking.


Sorry, I did not know that :)

Does it also support multiple sections?

Edited by dmsc, Thu Mar 12, 2015 12:16 PM.


#103 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 12,754 posts
  • Location:United Kingdom

Posted Thu Mar 12, 2015 1:28 PM

Sorry, I did not know that :)

Does it also support multiple sections?

 

I have only used relocatable MADS binaries with a custom-written loader on the Atari. I've never used the linker; I just know it exists. ;)

Check out the "Relocatable Code" section here. The section at the end deals with linking. The download package also provides examples ("Libraries").



#104 JamesD ONLINE  

JamesD

    Quadrunner

  • 7,735 posts
  • Location:Flyover State

Posted Thu Mar 12, 2015 3:04 PM

The Apple II version runs in about 32 minutes once compiled with Einstein.
That's really no improvement and I think I used the right options for the best speed.
Clearly, most of the time is spent in the floating point library but this should have eliminated the constant parsing that goes on at runtime.
I'll double check the compiler options and try again if I messed up.  I may try The Beagle Compiler to see if it's any better.

I recompiled and retested.  It completed the image in a little over 22 minutes.
So almost 1/3 of the time spent drawing from BASIC is spent on interpreter activities like parsing, searching for lines, converting strings to numbers, etc...
*edit*
No code changes were required.


Edited by JamesD, Thu Mar 12, 2015 3:06 PM.


#105 JamesD ONLINE  

JamesD

    Quadrunner

  • 7,735 posts
  • Location:Flyover State

Posted Thu Mar 12, 2015 6:37 PM

I recompiled and retested.  It completed the image in a little over 22 minutes.
So almost 1/3 of the time spent drawing from BASIC is spent on interpreter activities like parsing, searching for lines, converting strings to numbers, etc...
*edit*
No code changes were required.

I tried the Beagle Compiler V1.0 and it seems to be taking the same amount of time.
The newer version supports a couple high speed math cards which would speed things up quite a bit but there is no emulation of those cards.

*edit* 

It ended up taking a minute longer than Einstein 

The two math cards Beagle Compiler supports are:
Innovative Systems' Floating Point Engine
Applied Engineering's Fast Math Card

The notes included with the compiler show some sample times for a hi-res plot and 2000 runs of the Savage Benchmark.
The AE care shows execution times half of those without the card for the hi-res plot and the FPE card is about 8 times as fast as the standard compiled version.
The Savage Benchmarks demonstrate an even greater difference over the standard compiled version.

In theory, with the FPE card an Apple could complete this in under 3 minutes if that ratio held.


Edited by JamesD, Thu Mar 12, 2015 6:57 PM.


#106 fujidude OFFLINE  

fujidude

    River Patroller

  • 4,697 posts
  • Location:United States of America

Posted Thu Mar 12, 2015 6:43 PM

Hi!
 

It is the assembler from the CC65 suite, http://cc65.github.io/cc65/ IMHO the best assembler for the 6502 :) :)

Seriously, the thing that makes ca65 stand apart from the rest is it support for object files and linking, that makes possible to structure big programs with multiple independent files.

 

I've heard of MADS and ATASM too.  How do those stack up?



#107 Rybags OFFLINE  

Rybags

    Quadrunner

  • 15,220 posts
  • Location:Australia

Posted Thu Mar 12, 2015 8:58 PM

AtAsm is probably the most alike to Mac-65 but isn't well supported and earlier versions have some bugs making it IMO unusable.

 

MADS is probably the most feature-rich cross assembler for 6502 and widely used.  Source from AtAsm and Mac-65 can be ported over with fairly minimal effort.

I don't think the English documentation for Mads is so great through.  Might have changed since I last looked.



#108 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 12,754 posts
  • Location:United Kingdom

Posted Fri Mar 13, 2015 6:27 AM

Avery's translated docs are perfectly usable, IMO.

#109 fujidude OFFLINE  

fujidude

    River Patroller

  • 4,697 posts
  • Location:United States of America

Posted Fri Mar 13, 2015 2:53 PM

Which one gets hooked into Eclipse?



#110 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 12,754 posts
  • Location:United Kingdom

Posted Fri Mar 13, 2015 3:04 PM

Which one gets hooked into Eclipse?


Any of these:

assemblers.PNG

#111 MrFish ONLINE  

MrFish

    River Patroller

  • 4,213 posts
  • Location:1010-1010

Posted Fri Mar 13, 2015 3:17 PM

I don't think the English documentation for Mads is so great through.  Might have changed since I last looked.

 

Take a look for yourself: MAD-ASSEMBLER 1.9.5 - English Documentation



#112 fujidude OFFLINE  

fujidude

    River Patroller

  • 4,697 posts
  • Location:United States of America

Posted Fri Mar 13, 2015 7:22 PM

Any of these:

attachicon.gifassemblers.PNG

Quite a few... just not ca65 I see.



#113 JamesD ONLINE  

JamesD

    Quadrunner

  • 7,735 posts
  • Location:Flyover State

Posted Sat Mar 14, 2015 1:24 AM

Quite a few... just not ca65 I see.

Just not the one I switched to.  Argh



#114 fujidude OFFLINE  

fujidude

    River Patroller

  • 4,697 posts
  • Location:United States of America

Posted Sat Mar 14, 2015 9:43 AM

Just not the one I switched to.  Argh

 

You could switch again... it might not be that much trouble if the capabilities and syntax are similar enough (if not identical).  Then again, if you're happy where yer at that's fine too.  I did some reading on the cc65 site and it seems like a nice suite of programs.



#115 devwebcl OFFLINE  

devwebcl

    Stargunner

  • 1,141 posts
  • Location:Chile

Posted Sat Mar 14, 2015 10:12 AM

By the way, in the Atari you can turn the screen DMA off and turn it on only at the end, reducing the overhead, then the runtime would be only 16 seconds.

 

The screen is black, so I assume you are using this optimization already.

Do you have a version, where we can watch the image being rendered ?



#116 dmsc ONLINE  

dmsc

    Moonsweeper

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

Posted Sat Mar 14, 2015 8:15 PM

Hi!
 

The screen is black, so I assume you are using this optimization already.
Do you have a version, where we can watch the image being rendered ?


You are right, I attached the wrong XEX (but the zip contained the correct source).

This is the last, complete, version. It is 765 bytes.

Attached Files



#117 devwebcl OFFLINE  

devwebcl

    Stargunner

  • 1,141 posts
  • Location:Chile

Posted Sat Mar 14, 2015 8:44 PM

Hi!
 

You are right, I attached the wrong XEX (but the zip contained the correct source).

This is the last, complete, version. It is 765 bytes.

 

Cool, that's a nice demo.

 

by the way, I can see the final image is slightly different to the original image at the boundaries (on the top of the hat).

this happens to the apple2 and other versions as well (I did a Java version and also is different),

 

I haven't checked the code for the difference, but I can assume is related to SQR or SIN functions.



#118 dmsc ONLINE  

dmsc

    Moonsweeper

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

Posted Sat Mar 14, 2015 9:21 PM

Hi!,

Cool, that's a nice demo.
 
by the way, I can see the final image is slightly different to the original image at the boundaries (on the top of the hat).
this happens to the apple2 and other versions as well (I did a Java version and also is different),
 
I haven't checked the code for the difference, but I can assume is related to SQR or SIN functions.


Yes, I noticed it too, but it only appears in the Atari version, I think it is a problem with the way BASIC rounds the floating point values to draw the pixels.

There are one difference in the algorithm:
- In the original the loop ends at a precomputed coordinate, with the variable XL=INT(SQR(SX*SX-ZS)+0.5).
- In this version, I rearranged this as: SX*SX = XL*XL + ZS, so the condition is "X*X + ZS >= SX*SX".

This causes a difference in the "ring" at the border of the figure.

#119 JamesD ONLINE  

JamesD

    Quadrunner

  • 7,735 posts
  • Location:Flyover State

Posted Sat Mar 14, 2015 10:14 PM

I tried the Beagle Compiler V1.0 and it seems to be taking the same amount of time.
The newer version supports a couple high speed math cards which would speed things up quite a bit but there is no emulation of those cards.

*edit* 

It ended up taking a minute longer than Einstein 

The two math cards Beagle Compiler supports are:
Innovative Systems' Floating Point Engine
Applied Engineering's Fast Math Card

The notes included with the compiler show some sample times for a hi-res plot and 2000 runs of the Savage Benchmark.
The AE care shows execution times half of those without the card for the hi-res plot and the FPE card is about 8 times as fast as the standard compiled version.
The Savage Benchmarks demonstrate an even greater difference over the standard compiled version.

In theory, with the FPE card an Apple could complete this in under 3 minutes if that ratio held.

I looked up the FPE card and it has a 68881 or 68882 Math Coprocessor on it.
Single precision IEEE floats are one less byte in length that Applesoft and double precision are twice as long so there would be some overhead in converting.
But it shows the potential for such an upgrade. 


Edited by JamesD, Sat Mar 14, 2015 10:17 PM.


#120 JamesD ONLINE  

JamesD

    Quadrunner

  • 7,735 posts
  • Location:Flyover State

Posted Sat Mar 14, 2015 11:13 PM

 

You could switch again... it might not be that much trouble if the capabilities and syntax are similar enough (if not identical).  Then again, if you're happy where yer at that's fine too.  I did some reading on the cc65 site and it seems like a nice suite of programs.

I really wanted the ability to make libraries of code and use a linker to join everything.
That's how I do things for work and to me it doesn't make any sense to do it any other way.



#121 fujidude OFFLINE  

fujidude

    River Patroller

  • 4,697 posts
  • Location:United States of America

Posted Sun Mar 15, 2015 11:30 AM

I really wanted the ability to make libraries of code and use a linker to join everything.
That's how I do things for work and to me it doesn't make any sense to do it any other way.

 

That's a good point too.  It all depends on what features are the most valued by each person.



#122 devwebcl OFFLINE  

devwebcl

    Stargunner

  • 1,141 posts
  • Location:Chile

Posted Tue Mar 17, 2015 5:38 AM

Hi!,


Yes, I noticed it too, but it only appears in the Atari version, I think it is a problem with the way BASIC rounds the floating point values to draw the pixels.

There are one difference in the algorithm:
- In the original the loop ends at a precomputed coordinate, with the variable XL=INT(SQR(SX*SX-ZS)+0.5).
- In this version, I rearranged this as: SX*SX = XL*XL + ZS, so the condition is "X*X + ZS >= SX*SX".

This causes a difference in the "ring" at the border of the figure.

 

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

Attached Thumbnails

  • diff4.png


#123 JamesD ONLINE  

JamesD

    Quadrunner

  • 7,735 posts
  • Location:Flyover State

Posted Tue Dec 15, 2015 6:29 PM

Laser 500 code.

Notice I put the graphics mode and color setting before the loop.

This change will make pretty much every version I posted run faster.
 

100 DIM RR(320)
110 GR 4 : COLOR 3,0,0 
120 FOR I=0 TO 320:RR(I)=193:NEXT I
130 XP=144:XR=4.71238905:XF=XR/XP
140 FOR ZI=64 TO -64 STEP -1
150 ZT=ZI*2.25:ZS=ZT*ZT
160 XL=INT(SQR(20736-ZS)+0.5)
170 ZX=ZI+160:ZY=90+ZI
180 FOR XI=0 TO XL
190 XT=SQR(XI*XI+ZS)*XF
200 YY=(SIN(XT)+SIN(XT*3)*0.4)*56
210 X1=int(XI+ZX):Y1=int(ZY-YY)
220 IF RR(X1)>Y1 THEN RR(X1)=Y1:SET(X1,Y1)
230 X1=ZX-XI
240 IF RR(X1)>Y1 THEN RR(X1)=Y1:SET(X1,Y1)
250 NEXT XI:NEXT ZI
260 GOTO 260


Edited by JamesD, Tue Dec 15, 2015 6:31 PM.


#124 JamesD ONLINE  

JamesD

    Quadrunner

  • 7,735 posts
  • Location:Flyover State

Posted Wed Dec 16, 2015 12:36 AM

 

Laser 500 code.

Notice I put the graphics mode and color setting before the loop.

This change will make pretty much every version I posted run faster.
...

Except it's not actually inside the loop so it doesn't matter.  <groan>



#125 JamesD ONLINE  

JamesD

    Quadrunner

  • 7,735 posts
  • Location:Flyover State

Posted Wed Sep 13, 2017 4:08 AM

MC-10 using standard MICROCOLOR BASIC.  This is a text screen really and 64x32..

A video of it drawing.  The left side is regular Microcolor BASIC and the right side is my enhanced version.


 

100 SX=26:SY=8:SZ=10:CX=64:CY=32
110 DIM RR(CX)
120 FOR I=0 TO CX:RR(I)=CY:NEXT I
130 CLS 0
140 CX=CX*0.5:CY=CY*0.46875:FX=SX/64:FZ=SZ/64
150 XF=4.71238905/SX
160 FOR ZI=64 TO -64 STEP -4
170   ZT=ZI*FX:ZS=ZT*ZT
180   XL=INT(SQR(SX*SX-ZS)+0.5)
190   ZX=ZI*FZ+CX:ZY=CY+ZI*FZ
200   FOR XI=0 TO XL
210     XT=SQR(XI*XI+ZS)*XF
220     YY=(SIN(XT)+SIN(XT*3)*0.4)*SY
230     X1=XI+ZX:Y1=ZY-YY
240     IF RR(X1)>Y1 THEN RR(X1)=Y1:SET(X1,Y1,1)
250     X1=ZX-XI
260     IF RR(X1)>Y1 THEN RR(X1)=Y1:SET(X1,Y1,1)
270   NEXT XI:NEXT ZI
280 IF INKEY$="" THEN 280


And Jim Gerrie altered it to use 64x48 graphics.

screenshot_0004.png
 

0 DIMLU(1,2):GOSUB9000:GOTO100
3 CLS0:POKE49151,28:RETURN
4 POKE49151,0:CLS:RETURN
5 XX=INT(X1/2):YY=INT(Y1/3):BY=MC+XX+YY*32:VL=LU(INT(X1-XX*2),INT(Y1-YY*3)):POKEBY,VLORPEEK(BY):RETURN
6 XX=INT(X1/2):YY=INT(Y1/3):BY=MC+XX+YY*32:VL=LU(INT(X1-XX*2),INT(Y1-YY*3)):POKEBY,(NOT(NOT(VLORPEEK(BY))ORVL)):RETURN
100 SX=28:SY=10:SZ=14:CX=64:CY=48
110 DIM RR(CX)
120 FOR I=0 TO CX:RR(I)=CY:NEXT I
130 CLS0:POKE49151,68
140 CX=CX*0.5:CY=CY*0.46875:FX=SX/64:FZ=SZ/64
150 XF=4.71238905/SX
160 FOR ZI=64 TO -64 STEP -4
170 ZT=ZI*FX:ZS=ZT*ZT
180 XL=INT(SQR(SX*SX-ZS)+0.5)
190 ZX=ZI*FZ+CX:ZY=CY+ZI*FZ
200 FOR XI=0 TO XL
210 XT=SQR(XI*XI+ZS)*XF
220 YY=(SIN(XT)+SIN(XT*3)*0.4)*SY
230 X1=XI+ZX:Y1=ZY-YY
240 IF RR(X1)>Y1 THEN RR(X1)=Y1:GOSUB5
250 X1=ZX-XI
260 IF RR(X1)>Y1 THEN RR(X1)=Y1:GOSUB5
270 NEXT XI:NEXT ZI
280 IF INKEY$="" THEN 280
290 SOUND1,1:END
9000 LU(0,0)=32:LU(0,1)=8:LU(0,2)=2:LU(1,0)=16:LU(1,1)=4:LU(1,2)=1:MC=16384:RETURN

Edited by JamesD, Wed Sep 13, 2017 4:17 AM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users