ZX81X2.ROM - and the big bang

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
User avatar
siggi
Posts: 879
Joined: Thu May 08, 2008 9:30 am
Location: Dauernheim, Germany
Contact:

Re: ZX81X2.ROM - and the big bang

Post by siggi » Thu Nov 08, 2018 9:55 am

I have now installed that new rom (a little bit "patched" for LOAD/SAVE using MEFISDOS drives) in 4 of my Zeddies. Even my C programs, compiled using Z88DK, now run much faster, because they also call the new and fast rom CLS routine :mrgreen:

Thanks for that great rom
Siggi
My ZX81 web-server: online since 2007
http://zx81-siggi.endoftheinternet.org/index.html

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

Re: ZX81X2.ROM - and the big bang

Post by zsolt » Thu Nov 08, 2018 5:00 pm

Hi,

I have made some changes in the 'series generator' routine.

In the 1st round of the generator loop the operands (and the results too) were zeros.
The improved version skips this 1st round, so saves some times:

Code: Select all

;
; The initialization phase.
;
	.db $3A		;;mul-by-2		2*x

	DEFB $C0	;;st-mem-0		2*x
	DEFB $02	;;delete		.
	DEFB $A0	;;stk-zero		0

;;-	DEFB $C2	;;st-mem-2		0

	.db $C1		;;st-mem-1		0

	.db $2D		;;duplicate		0,0.

	.db $2F		;;jump
	.db G_LOOP1-$	;;to G-LOOP1	- skip the 1st round
;
; a loop is now entered to perform the algebraic calculation for each of
; the numbers in the series
;
G_LOOP
	DEFB $2D	;;duplicate		v,v.			(old round 1: 0,0)
	DEFB $E0	;;get-mem-0		v,v,2*x			(old round 1: 0,0,2x)
	DEFB $04	;;multiply		v,v*2*x			(old round 1: 0,0)
	DEFB $E2	;;get-mem-2		v,v*2*x,v		(old round 1: 0,0,0)
	DEFB $C1	;;st-mem-1		v,v*2*x,v		(old round 1: 0,0,0)
	DEFB $03	;;subtract		v,v*2*x-v		(old round 1: 0,0)
G_LOOP1
	DEFB $34	;;end-calc
;
; the previous pointer is fetched from the machine stack to H'L' where it
; addresses one of the numbers of the series following the series literal.
;
	CALL stk_data		; routine STK-DATA is called directly to
				; push a value and advance H'L'.

	CALL GEN_ENT2		; routine GEN-ENT-2 recursively re-enters
				; the calculator without disturbing
				; system variable BREG
				; H'L' value goes on the machine stack and is
				; then loaded as usual with the next address.

	DEFB $0F	;;addition
	DEFB $01	;;exchange
	DEFB $C2	;;st-mem-2
	DEFB $02	;;delete

	DEFB $31	;;dec-jr-nz
	DEFB G_LOOP-$	;;back to G-LOOP
;
zx81x2b_test.png
You can find the renewed ROM image (and the source) at the end of the first post of this topic.
Regards,
Zsolt
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]

Post Reply