SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Emulator and emulator development specific topics
User avatar
kokkiklhs
Posts: 103
Joined: Sat Jan 10, 2015 12:09 pm

Re: SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Post by kokkiklhs »

Well, last night I was thinking about what I asked and I decided to experiment a little by myself...
I ripped the 8k ROM file out of the emulator's TAP and replaced it with the fast ROM from zsolt...
Purple border after loading and the Spectrum (I used Spectaculator on the PC for the experiment, not a real machine) hanged...

Then I fired up a HEX editor and noticed that the ROM used in your emulator had a couple of altered bytes here and there (especially at the beginning), compared to the original Sinclair ROM and to zsolt's ROM. I changed these bytes to zsolt's ROM, according to the modifications that I found in your emulator's ROM but then I saw that there were also the particular mods made to some bytes by zsolt for speeding up, compared to the original ROM and the emulator's ROM... Not very easy for me, who didn't know where exactly to look and what to do.... :mrgreen:

At a certain point I managed to have a proper boot of the emulated Zeddy inside the Spectrum. Hooraaaay!!! (I thought so)... The simultaneous pressing of 1 and 0 keys gave me the menu, but... the Zeddy itself had no functioning keypresses at all, only the cursor was waiting at the bottom left of the screen and there I gave up, as my next try gave again a hanging screen with garbaged cursor...
Partial success, partial failure...
Anyway, I will be waiting for you to get your magic hands on it whenever you can... But I'd like to share this interesting experience of mine, even though it led to a non-working Zeddy, it was fun!!
:lol:
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Post by dr beep »

Problem is the intruptserviceroutine that is placed over part of the ROM, I need to check all changes.
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Post by dr beep »

kokkiklhs wrote: Sat Dec 12, 2020 8:55 am Hmmm, I was recently reading this:
viewtopic.php?f=5&t=2986
Great improvements by zsolt here, excellent work...

My crazy thought to propose to dr.beep:
Could it be possible to build a separate version of your amazing SP-2-ZX81 emulator using this ROM? An original/improved ROM switching option to the already built emulator would consume another 8k of the precious 48k RAM, so it's most probably out of question...
I suspect that you may have already thought about it, or even tried to do it, but what would the result be, running on a REAL speccy?
:roll:
I have decided NOT to make a version with the altered ZX81 ROM.

The mainreason is that most optimizations in the ROM are found in speeding up routines.
My emulator must emulate all routines and the gain would be marginal.
To get speed in my emulator most used routines are translated to work in rewritten code on the ZX Spectrum.
Speed is gained from those rewritten routines. Small changes won't add more than I have now.

A part of my already translated routine:

Code: Select all

; -------------------------
; THE 'POINTERS' SUBROUTINE
; -------------------------
L09AD:  PUSH    AF              ;
        PUSH    HL              ;
        LD      HL,$400C        ; sv D_FILE_lo
        LD      A,$09           ;

;; NEXT-PTR
L09B4:  set 7,h
	LD      E,(HL)          ;
        INC     HL              ;
        LD      D,(HL)          ;
	res 7,h


I will however take a look on the ZX80-emulator since this is a whole new computer.
User avatar
kokkiklhs
Posts: 103
Joined: Sat Jan 10, 2015 12:09 pm

Re: SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Post by kokkiklhs »

dr beep wrote: Tue Feb 02, 2021 3:48 pm
I have decided NOT to make a version with the altered ZX81 ROM.

The mainreason is that most optimizations in the ROM are found in speeding up routines.
My emulator must emulate all routines and the gain would be marginal.
To get speed in my emulator most used routines are translated to work in rewritten code on the ZX Spectrum.
Speed is gained from those rewritten routines. Small changes won't add more than I have now.

I will however take a look on the ZX80-emulator since this is a whole new computer.
Well, this is quite reasonable, thanks for your time checking such an option! The ZX80 emulator will be gorgeous, that's for sure!!!

8-)
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Post by dr beep »

Loading my latest game into my emulator reveilled a bug in opcode #31 : LD SP.NNNN

Now solved in v2.01

http://www.mediafire.com/file/dbox3vu1s ... 1.tap/file


P.S. The bugged screen on start is expected in the emulation on the ZX Spectrum.
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Post by dr beep »

Small bug fixed in v202

My games that use JP (HL) to end a screen had 1 moment where that didn't work. Now fixed.

Also added SHOGUN1K with a stackpointer fix for the emulator. The game will still run on a 1K ZX81 but on a larger ZX81 the SP is moved.

https://www.mediafire.com/file/h31z7slu ... 2.zip/file
Spinnetti
Posts: 253
Joined: Sat Sep 12, 2020 11:29 pm

Re: SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Post by Spinnetti »

Cool stuff - you are definitely a Sinclair master!
Zeddy: ZX80, ZX81/ZXpand, TS1000/ZXpand, TS1500/Zxpand+
Speccy: 48k, +, +2, +3, TS2068, "Bare Metal" Pi, Next KS2, IF1/Microdrives/Vdrive/Light Gun/VGA-Joy
QL: Minerva/QL-VGA/Custom PSU
C5: 24v, LiFE battery, Disc brakes
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Post by dr beep »

New version 2.11 available.

2.10
added saving.

2.11
Better check on reading keyboard. Simplified reading returned false input when ZXPAND or KEMPSTON was read.
Now both interfaces are disabled. Only reading keyboard is allowed ( IN #nnFE ), check on #FE added
This fix allows 2PAXMAN to be played on the emulator (Screen update to 4 is best)

TAP-file as ZIP for this site
sp2zx-211.zip
(13.76 KiB) Downloaded 225 times
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Post by dr beep »

The memory is almost full but I was able to add IX-intrupt.

My game CALCULUS MAZXIMUS is using IX to do some lowres intrupts.
I was able to add this support in the v2.13 version.

I also altered the game itself and added a line where you can see which key matches the operands.
I also added 2 bytes which in the emulator will clear the screen when needed but on a zeddy or other emulator will have no effect. With perfect emulation the speed of my emulator would go done.
sp-2-zx81-v213-c.zip
(130.43 KiB) Downloaded 230 times
EDIT: corrected version for ZX81 keyboard display.
Last edited by dr beep on Sun May 01, 2022 11:05 pm, edited 2 times in total.
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: SP-2-ZX81, the new ZX81-emulator for the 48K ZX Spectrum

Post by dr beep »

The demo sprite basic is working too.
You must skip the poking and running in 8k-16k.
Post Reply