-
Notifications
You must be signed in to change notification settings - Fork 1
primo emulation
Primo (a Hungarian computer based on U880 which is basically a Z80) emulation in Xep128 is a middle way between software and hardware emulation. Enterprise related emulation in Primo mode still works, Dave, Nick, and everything. What is different though, that interpretation of I/O ports are modified to be Primo-ish. Still, the video output of Primo is done by Nick, even an LPT is created to "emulate" the screen of the Primo computer, and B0...B3 ports of Dave is used to map the right segment (even the ROM of the Primo), also the "beep bit" of Primo is simply passed on Dave volume register with setting Dave into D/A mode first. In theory, Primo applications can even access Enterprise ports if port number is greater than or equal to 0x40.
Actually, emulation does the following:
- It creates a Primo "compatible" LPT in video segment 0xFF and activates that LPT (in LPIXEL mode, also VINT is generated once in each frame). This VRAM segment used for LPT is not mapped to Primo.
- It maps Primo ROM to page 0 (port 0xB0)
- It maps some RAM segment to page 1 (port 0xB1)
- It maps some RAM segment to page 2 (port 0xB2)
- It maps a VRAM segment to page 3, where LPT's LPIXEL mode LD1 pointer points (port 0xB3)
- It sets CPU speed to 2.5MHz
- It disables all interrupts in Dave, Z80 won't get any (maskable) interrupt from now
- It puts Dave into D/A mode for both channels
- It disables memory wait states (port 0xBF)
- It resets Z80, so address 0 is executed which will be Primo ROM
Note, that this logic is somewhat incorrect, as with VRAM access timing of Enterprise cause different speed than on a real Primo (slower). Maybe higher CPU speed should be choosen, but memory waiting adjusted by port 0xBF to compensate more or less, or disable Nick clock adjustment on VRAM access. However, since currently Xep128 does not emulate "slow down" of VRAM access (that is, VRAM access timing), it does not matter too much currently.
In Primo mode the following modifications are done (only, otherwise full Enterprise emulation is done):
- Nick's VINT output is "cloned" as NMI, bypassing Dave totally, if Primo did not disable NMI
- Reading and writing I/O ports 0x00 - 0x3F are modified compared to standard Enterprise mode
- Reading I/O ports 0x00 - 0x3F causes vsync (mask 32) state to be shown (for all ports in that range), bit 0 shows the keyboard status for the given Primo key (based on the port number), this is translated from EP keyboard matrix with a fixed table
- Writing I/O ports 0x00 - 0x3F causes NMI enabling/disabling (bit 7), bit 3 selects video page (Xep128 modifies the LD1 pointer in the LPT), and bit 6 is simply forwarded to Dave as D/A audio data (0=>0, 1=>63).
Xep128, the minimalistic Enteprise-128 emulator with main focus on exotic hardware