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: 881
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: 194
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)]

User avatar
siggi
Posts: 881
Joined: Thu May 08, 2008 9:30 am
Location: Dauernheim, Germany
Contact:

Re: ZX81X2.ROM - and the big bang: compatibility problem?

Post by siggi » Tue May 14, 2019 10:20 am

Hi
there seems to be a problem: this file contains in variable A$ the source code for an assembler file (for ASDIS). The basic program contains only REM.
If the program is loaded e. g. by EO and ZX81.rom and I press RETURN, the listing is written to screen and the Zeddy is alive.
If the program is loaded by EO and ZX81x2.rom and I press RETURN, the listing is written very very slowly to screen, additional blank lines are written to screen and the Zeddy freezes.

Any ideas what goes wrong?

Siggi
M64KP1B.P
(11.88 KiB) Downloaded 48 times
My ZX81 web-server: online since 2007
http://zx81-siggi.endoftheinternet.org/index.html

Joachim
Posts: 3
Joined: Thu Sep 27, 2018 11:53 pm

Re: ZX81X2.ROM - and the big bang

Post by Joachim » Tue May 14, 2019 8:24 pm

Hi Zsolt!
I have the same problems as siggi. I can add the following informations:
The first line stays allways on top. Even a CLS-command cann't clean it. The second line is also currupted. Please the pictures.
P1090259.JPG
P1090258.JPG

On the first photograph you can see how the lines are wrong placed. On the second the second line is normaly filled. Now in the third line is the contend of the second line and so on.

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

Re: ZX81X2.ROM - and the big bang

Post by zsolt » Tue May 14, 2019 9:26 pm

Dear Siggi and Joachim,

Did you know that the d-file of your program is longer than should be? :o
It contains 32 extra bytes after the latest N/L character in front of the beginning of the variables.

Sysvar D_FILE ($400C) points $40F3, and the VARS ($4010) points $442C.
The difference is $0339 (825 dec) instead of $0319 (793 dec)
It causes the problem. :cry:

Regards,
Zsolt
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]

Joachim
Posts: 3
Joined: Thu Sep 27, 2018 11:53 pm

Re: ZX81X2.ROM - and the big bang

Post by Joachim » Wed May 15, 2019 10:32 pm

Thanks a lot for the informations, Zsolt.
This means, ASDIS - our assemblerprogram - could have a bug. Do You have an explanation, why this phenomenon dont't show up with the original ZX81-ROM?
Best regards!
Joachim

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

Re: ZX81X2.ROM - and the big bang

Post by zsolt » Wed May 22, 2019 4:26 pm

Sorry for this long silence - I was on a (very) long weekend in Barcelona. :D

The original CLS (more exactly the LOC-ADDR) routine uses the sv. VARS as a pointer, from which it is searching and counting backward the N/L characters (24+1) to get exact line address. So it skips those 32 extra bytes.
Then it prints 24x32 (768) "space" characters to clear the screen using routine PRINT-SP.

The renewed routine assumes that VARS points to the first byte after the D-File. :|

HTH,
Zsolt
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]

Post Reply