A new ZX81 Emulator

Emulator and emulator development specific topics
Bill H
Posts: 163
Joined: Sat Nov 27, 2010 6:05 pm

Re: A new ZX81 Emulator

Post by Bill H »

Hi all - I am back to working on this, its going along nicely but I am stumped. After I load a .P file to the proper location in memory (along with all the correct system variables) where should I jump into the ROM? I am only making use of the "NAME" routine to get the name they passed in LOAD " " then I am using my emulator code to load the P file (which I created with the TS1000 emulator by jeff v) into memory starting at 16393 ($4009, ie system variable "VERSION" ) and all loads good, just need to know where to go to pass back control to the ZX81 ROM. The actual load routines in the ROM are a bunch of spaghetti. The only thing I was able to chase down was to go to the SLOW/FAST routine which seems to be where it ends up when there is no more data to load but that just causes it to reset system variables, loosing what I loaded. Any help would be great - there is a lot of interest in the Coleco Adam community in this emulator project.

Bill H
Bill H
Posts: 163
Joined: Sat Nov 27, 2010 6:05 pm

Re: A new ZX81 Emulator

Post by Bill H »

Bill H wrote: Fri Jan 29, 2021 9:20 pm Hi all - I am back to working on this, its going along nicely but I am stumped. After I load a .P file to the proper location in memory (along with all the correct system variables) where should I jump into the ROM? I am only making use of the "NAME" routine to get the name they passed in LOAD " " then I am using my emulator code to load the P file (which I created with the TS1000 emulator by jeff v) into memory starting at 16393 ($4009, ie system variable "VERSION" ) and all loads good, just need to know where to go to pass back control to the ZX81 ROM. The actual load routines in the ROM are a bunch of spaghetti. The only thing I was able to chase down was to go to the SLOW/FAST routine which seems to be where it ends up when there is no more data to load but that just causes it to reset system variables, loosing what I loaded. Any help would be great - there is a lot of interest in the Coleco Adam community in this emulator project.

Bill H
I think I may have answered my own question. A Report F (no filename) works fine from my routine:

RST $08
DEFB $0E

So I figured - can I do a Report 0 - all is good? I tried this:

RST $08
DEFB $FF

And it works - I realized the report code is 1 less than the value you want - so 255 is 1 less than 0 in 8 bit :)
dr beep
Posts: 2059
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: A new ZX81 Emulator

Post by dr beep »

Hello Bill,

with the same error I coded my first emulator, however my games have evolved beyond that. My latest emulator has the right return address. I will post it later.


BTW since last year I coded several games with special code on the screen. Your emulator might need a change to have those running.
dr beep
Posts: 2059
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: A new ZX81 Emulator

Post by dr beep »

Bill,

this is where my emulator continues after LOADING a program

Code: Select all

; In the ROM teh LOAD-routine is altered to come here.
; LOADING goes from BASIC so you can alter to you own special hardware
loader  di
	ld b,4			; 1024 and more
	call bk2bas		; use BASIC as loader
	im 2

	ld hl,(frames)		; after loading simulate 1 intrupt only
	dec hl			
	set 7,h
	ld (frames),hl	

	ld hl,isr2		; skip normal intrupt for >1/2 sec after loading
	ld (isrmod+1),hl	; to create time to run special code in some games
	ld b,tab1
	ld de,#676+#8000		; start after loading a game
	ei			
	jp i00+1
I altered the ROM at LOADBYTE.
From there I made my own loader (In BASIC, under "bk2bas")

After the load I must reset IM 2 for the screendisplay.
The normal ROM will decrease frames 1x. I simulate that too. This is NEEDED for my games that use machinecode over the sysvar
that use this behaviour.

After that you can start the program at #676
dr beep
Posts: 2059
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: A new ZX81 Emulator

Post by dr beep »

Bill,

How is this emulator going?
Post Reply