NEW GAME and special BOOK (and more!) to come from Côté Gamers! ! Check this topic!

Main Menu

Videopac-emulator on the ZX Spectrum

Started by dr beep, March 16, 2021, 06:51:40 PM

Previous topic - Next topic

dr beep


in 2000 I coded a Videopac-emulator on the ZX Spectrum.
It uses a method to translate 8048 ROMS into Z80 code and then run the translated code.

It is slow and not all games run.

Last year I recoded my ZX81 emulator from 1997 and I think I can make the Videopac-emulator better as well.

I might ask a few things, although I worked all things out in 2000 with the info from Dan Boris site.

If you want to try the emulator:


Yes, I remember playing it many years ago. ;) 8)

dr beep

After coding SHOGUN ( experts : SEE MY POST REGARDING HARDWARE ISSUES) I started totake a look on my videopac-emulator from 2000.

My documentation is old and coded on a compiler on the ZX Spectrum itself.
Due to lack of memory parts are hardcoded and I need a disassembler to make it readable.

These days I can use a crosscompiler that will do the job for me.
I already have several ideas to improve the speed of the emulator.
Also some ideas to make GOLF run on the emulator. This game has some issues with my collissiondetection which I might fix in a general way.

Still not all games will run on the ZX Spectrum. I will keep off sound and colour might become an option ( SHOGUN needs colour!).

Quick question to the experts:
Is SEL RB0 only used in the BIOS? If so I can win speed with an alternative way to emulate SEL RB0 and SEL RB1.


> Quick question to the experts:
> Is SEL RB0 only used in the BIOS? If so I can win speed with an alternative way to emulate SEL RB0 and SEL RB1.

I use it in my code, as I don't use the interrupt routines from the BIOS ... basically it depends if a game is using the BIOS a lot or if it doesn't ... if it doesnt, it gives the programmer more variables in the second RB ...
sex, lies, and videopac

dr beep


I still think I can speed up the emulator even if I correctly emulate SEL RB0/RB1.
I can "translate" the BIOS-routines into opcodes that are not used and make those execute the full BIOS-routine.

dr beep

I just coded a new main emulationpart.

The main emulator part is now 33 tstates to get to an emulated code. This was 55 tstates.
Also the emulation itself is quicker. Besides that the code is smaller.

Still a long way to go, so far only 8 opcodes emulated.

dr beep

Due to the translation from 8048 to Z80 CALL and RET can meet 4 fases. I need to test them all.
Sofar working:

8048 8048 working
8048 Z80 working
Z80 8048 need testing
Z80  Z80   working

dr beep

All CALL and RET now tested and working.

This 8048-code
000   07   dec a
001   1405   call 005
003   0400   jmp 000
005   1208   jb0 008
007   15   ret
008   15   ret

Translates into this Z80-code
9d01 dec a
9d02 call 9d0a
9d05 jp 9d13
9d08 dw 0003   ; remnant from testing all addresses translated
9d0a bit 0,a
9d0c jp nz,9d12
9d0f jp 9d16
9d12 ret
9d13 jp 9d01
9d16 ret

dr beep

I started with a shortened opcodefinderprogram, but the code got too long to maintain this method.
I now use a routine with the same effect as in the 2000 emulaor but the opcode is found in 44 tstates not in 55 so 25% in the new emulator.


Videopac+ G7400 & C7420