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: 174
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 4 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 6 times
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]

Post Reply