Let's calculate! - renewed arithmetic routines

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
User avatar
zsolt
Posts: 175
Joined: Wed Apr 20, 2011 11:43 am
Location: Fót, Hungary

Re: Let's calculate! - renewed arithmetic routines

Post by zsolt » Thu Jun 28, 2018 7:46 pm

Hi,

Here come the latest bug fixes. Olofsen sent a newer program, wich tests the functions using very big and very small numbers.
l.p
olofsen's limits tester
(2.12 KiB) Downloaded 14 times
There were problems, with the renewed cosine function and the new INT routine was also buggy (in case of negative integer numbers).
Surprisingly i found a little bug in the SQR routine :o which is there since debut of SG81 ROM:

Code: Select all

;
;   This guess is based on a Usenet discussion.
;   Halve the exponent to achieve a good guess.(accurate with .25 16 64 etc.)
;
;;-	LD HL,$4071		; Address first byte of mem-3		($4071 points mem-4!!!)

	ld hl,$406C		; Address first byte of mem-3
Due to that wrong address the routine was very slow, in case of very big and very small numbers:
speedtest.png

@Siggi: the function-labels have been renamed - they now start with an "fn_" prefix. ;)

Regards,
Zsolt
Attachments
SG81_G2.zip
(144.89 KiB) Downloaded 17 times
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]

User avatar
stefano
Posts: 378
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Let's calculate! - renewed arithmetic routines

Post by stefano » Fri Jul 27, 2018 1:22 pm

I posted a couple of years ago the Lambda 8300 disassembly, you may have noticed that it reorganized the FP-CALC opcodes to handle the END instruction as a sort of "status" bit together with some of the provided functions. It was probably used to obfuscate the code (to avoid copyright problems) and to compress it a little more.

User avatar
zsolt
Posts: 175
Joined: Wed Apr 20, 2011 11:43 am
Location: Fót, Hungary

Re: Let's calculate! - renewed arithmetic routines

Post by zsolt » Fri Jul 27, 2018 7:13 pm

Hi Stefano,
Yes, i know your great work, and the 2nd post of this topic begins with you. :D (and there were some links as well) ;)
Regards,
Zsolt
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]

User avatar
stefano
Posts: 378
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Let's calculate! - renewed arithmetic routines

Post by stefano » Mon Jul 30, 2018 1:20 pm

oops.. :)

Post Reply