Fun with CBM arithmetics

Basic and Machine Language

Moderator: Moderators

User avatar
MrSterlingBS
Vic 20 Enthusiast
Posts: 174
Joined: Tue Jan 31, 2023 2:56 am
Location: Germany,Braunschweig

Re: Fun with CBM arithmetics

Post by MrSterlingBS »

without BASIC-patch ---------- with BASIC-patch

117521 ---------- 116585
117519 ---------- 116573
117567 ---------- 116509
117508 ---------- 116551
117553 ---------- 116550

117534 ---------- 116554

100% -------------- 99,2%
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Fun with CBM arithmetics

Post by Mike »

MrSterlingBS wrote:I am playing with the NEW BASIC ROM and MG extension and found that the NEW BASIC ROM is about 0.8% faster than the OLD one!

without BASIC-patch ---------- with BASIC-patch

[...]

100% -------------- 99,2%
That's an unintended but surely not unwelcome side effect. ;)

The routine in the patch gets called in 1 of 256 cases (when the given mantissa byte is zero) and does its job a little bit faster than the original re-used mantissa normalization routine. Edit: actually, the statistics are more in our favour. Quite some values processed in the program are small integer values (the screen co-ordinates in particular) which do have zeroes in their low mantissa bytes.

...

Something went wrong with "milkiway.zip". The *.prg file inside is corrupted and only 37 bytes long.
User avatar
MrSterlingBS
Vic 20 Enthusiast
Posts: 174
Joined: Tue Jan 31, 2023 2:56 am
Location: Germany,Braunschweig

Re: Fun with CBM arithmetics

Post by MrSterlingBS »

Okay, sorry for posting some source code again as text.
This version includes the faster sqr routine from WIMOS.
The graphic demo is from the FORUM64.

Code: Select all

0 sa=828
10 forn=0to57
20 read a%:pokesa+n,a%:next
30 data 32,43,220,240,52,16,3,76
40 data 72,210,32,199,219,165,97,56
50 data 233,129,8,74,24,105,1,40
60 data 144,2,105,127,133,97,169,4
70 data 133,103,32,202,219,169,92,160
80 data 0,32,15,219,169,87,160,0
90 data 32,103,216,198,97,198,103,208
100 data 233,96
105 @on:@clr
110 poke1,60:poke2,03
115 x1=80:x2=79:y1=96:y2=95
117 ti$="000000"
120 forx=1to80:fory=-96to95
125 w=atn(y/x):r=usr(x*x+y*y)
130 h=.5+sin(w+w+log(r)*10)/2
135 ifh<rnd(1)then145
140 @1,x1-x,y1+y:@1,x2+x,y2-y
145 next:next
150 te=ti
155 geta$
160 ifa$=""then155
165 @return
170 print"zeit: "te
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Fun with CBM arithmetics

Post by Mike »

For the *.prg file and further discussion about this demo, check out this thread: MINIGRAFIK lineart.
Post Reply