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: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: ZX81X2.ROM - and the big bang

Post by siggi »

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, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
User avatar
zsolt
Posts: 214
Joined: Wed Apr 20, 2011 11:43 am
Location: Fót, Hungary

Re: ZX81X2.ROM - and the big bang

Post by zsolt »

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: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

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

Post by siggi »

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 562 times
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
Joachim
Posts: 5
Joined: Thu Sep 27, 2018 11:53 pm

Re: ZX81X2.ROM - and the big bang

Post by Joachim »

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: 214
Joined: Wed Apr 20, 2011 11:43 am
Location: Fót, Hungary

Re: ZX81X2.ROM - and the big bang

Post by zsolt »

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: 5
Joined: Thu Sep 27, 2018 11:53 pm

Re: ZX81X2.ROM - and the big bang

Post by Joachim »

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: 214
Joined: Wed Apr 20, 2011 11:43 am
Location: Fót, Hungary

Re: ZX81X2.ROM - and the big bang

Post by zsolt »

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)]
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: ZX81X2.ROM - and the big bang

Post by Shaun_B »

Technical question, is there any way that this could be included to run with the ZX81 emulator on the ZX Spectrum Next?

It looked like I could just switch one ROM image for another but on the ZX Next SD Card the ROM image is 32K.

Regards,

Shaun
User avatar
1024MAK
Posts: 5102
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: ZX81X2.ROM - and the big bang

Post by 1024MAK »

Shaun_B wrote: Fri Feb 14, 2020 7:36 pm Technical question, is there any way that this could be included to run with the ZX81 emulator on the ZX Spectrum Next?

It looked like I could just switch one ROM image for another but on the ZX Next SD Card the ROM image is 32K.
I could maybe see why the Next may have a 16K byte ROM image (that’s the size of the ROM in the memory map), but not a 32K byte ROM image. Unless the ROM file is ZX Spectrum 128K / +2 sized. These machines use bank switching to swap between the top ‘half’ and the ‘bottom’ half of a physical 32K byte ROM chip.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: ZX81X2.ROM - and the big bang

Post by Shaun_B »

1024MAK wrote: Sat Feb 15, 2020 3:51 pm I could maybe see why the Next may have a 16K byte ROM image (that’s the size of the ROM in the memory map), but not a 32K byte ROM image. Unless the ROM file is ZX Spectrum 128K / +2 sized. These machines use bank switching to swap between the top ‘half’ and the ‘bottom’ half of a physical 32K byte ROM chip.

Mark
The "Emulator ROM" might contain emulator code in there, that's my thinking.

Regards,

Shaun.
Post Reply