TSConf ZEsarUX emulation

Эмуляторы, поддерживающие TS-Conf

Postby chernandezba » Wed, 28.06.2017 17:56:36

Hi

First, sorry about writing in English, I don't know Russian and I can only read it using Google Translate ;)

I'm the author of the ZEsarUX emulator:

https://sourceforge.net/projects/zesarux/

Which emulates all the Sinclair machines and also some clones, like ZX-Uno and Spectrum Next.
I'm interested on emulating Pentevo but there are too many details I don't understand well. I'm a bit confused about the differences between Pentevo/TSConf/Baseconf/ZX Evolution; also, the majority of the documentation is written in Russian, I have tried translating it to English but the final translation is not very good so... :(

I saw some docs in English about TSConf (a spreedshet with all #nnAF ports) but there's no much more in that language. Do you know if someone is doing full documentation to English?

I really want to emulate this beautiful machine but I can't do it if there's no documentation in a language I can understand... :(

Regards
Cesar
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby TS-Labs » Wed, 28.06.2017 19:40:03

Hi, Cesar!

ZX-Evolution, as you probably know, is an FPGA clone. It has certain peripheral hardware on its board, but majority of chipset logic is packed into FPGA.
Currently there are two popular FPGA configurations for ZX-Evo: Baseconf and TS-Conf. I'm the author of the latter. So I will talk mostly about it.
These configs are quite different and compatible on the level of ZX-128 only. Each has own set of extended features.

There are bad news and good news.
Bad #1 - there's no documentation for TS-Conf in English besides that Excel and less probable that I'll write it in a near future.
Bad #2 - the emulation for TS-Conf will require 28MHz granularity for virtual system clock (i.e. emulator should be aware of DRAM timestamps with this accuracy to emulate the system properly). Generally, the complexity of emulation is more or less of Amiga level.
Good #1 - there is accurate emulation available in Unreal Speccy. The code is written in C++ and is not quite easy, but it can give an idea and can be used for reference.

I can answer questions related to TS-Conf. But do not ask me about Baseconf, I know less about its details. Emulation for Baseconf is much easier and is also available in Unreal Speccy.

Feel free to ask.
Best regards.
User avatar
TS-Labs
 
Posts: 4769
Joined: Thu, 26.07.2012 01:29:56

Postby chernandezba » Wed, 28.06.2017 20:55:14

Hi TS-Labs!

So you speak English, great!

Here you can see a experimental and preliminary emulation of TS-Conf on ZEsarUX:

https://youtu.be/uipl37Rc1Pw


By the moment I only emulate a 128kb machine, load the ts-bios.rom, and have a simple text video driver to show the bios boot. You can see I can move throught the different settings and change them, but the most important thing I need now: how do I send F-12 key? Is it mapped to some Speccy key combination? Or should I read this key from other ports? I can't see it on the spreadsheet document. I see some PS/2 keyboard ports on baseconf documentation but maybe this key is not read the same way...

Thanks a lot!
Cesar
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby TS-Labs » Thu, 29.06.2017 09:50:27

Oh, emulation seems great! =)

ZX-Evo has peripheral controller on its board which interfaces PS/2 keyboard. Keys are mapped to ZX keys either directly (0-9, A-Z etc.) or using key combinations like Caps Lock = CS+2. Some keys aren't mapped at all and used for special functions (F12 is system reset, it cannot be read from Z80 because it resets it =).
KB is read from Z80 either via normal ZX ports or via dedicated PS/2 port where keys are represented in raw scan codes. TS-BIOS uses ZX KB ports only.

The PS/2 functionality is shared with Baseconf.
W #EFF7 - bit7 = 1 enables access
W #DFF7 - register number
RW #BFF7 - register read/write

Registers.
W #F0..FF = 2 - enables access to PS/2 FIFO
R #F0..FF - read PS/2 FIFO.

This is repository with ATmega128 firmware.
User avatar
TS-Labs
 
Posts: 4769
Joined: Thu, 26.07.2012 01:29:56

Postby chernandezba » Thu, 29.06.2017 10:04:01

Thanks! So I always enter to the bios menu, even if I do a reset. Do you know if it's due to the cmos emulation? I mean, I don't still emulate cmos, so I suppose this is why it enters the bios (as a pc bios do). Are cmos ports on tsconf the same as baseconf?
Regards
Cesar
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby VBI » Thu, 29.06.2017 10:29:25

Cesar thanks for your work!
User avatar
VBI
 
Posts: 1787
Joined: Mon, 03.06.2013 09:20:29

Postby chernandezba » Thu, 29.06.2017 10:37:08

You're welcome!
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby chernandezba » Thu, 29.06.2017 11:08:15

One other question... How is rom mapped? I suppose it has a compatibility layer for +2a/+3 (64 kb rom), combining bits from port 1ffdh and 7ffdh, and other ports to map up to 512 kb rom, right?
I don't find it on the spreedshest, also looked at unreal emulator sources, file memory.cpp, but didn't understand how it maps memory (seems not to read 1ffdh port, but I'm not sure)
You can also send me a link (even in Russian) where explains how the memory handling (rom and also ram) is done, and I'll try to undertand it. Maybe it's handled like baseconf?

Cheers
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby TS-Labs » Thu, 29.06.2017 11:11:58

chernandezba wrote: So I always enter to the bios menu, even if I do a reset.

Normally not. You enter BIOS setup once it hasn't been configured, i.e. checksum is wrong. Then you can only enter by pressing SS + F12 (right shift on PS/2).
chernandezba wrote: I don't still emulate cmos, so I suppose this is why it enters the bios

Yes. Settings cannot be read properly so ROM thinks CMOS isn't configured and enters setup.
chernandezba wrote:Are cmos ports on tsconf the same as baseconf?

Yes, the same.
User avatar
TS-Labs
 
Posts: 4769
Joined: Thu, 26.07.2012 01:29:56

Postby TS-Labs » Thu, 29.06.2017 11:29:12

chernandezba wrote:How is rom mapped?

The following ports/signals are in play:
- #7FFD bit4,
- DOS signal,
- #21AF (Memconfig),
- #10AF (Page0).

Memconfig:
- bit0 is an alias of bit4 #7FFD,
- bit2 selects mapping mode (0 - map, 1 - no map),
- bit3 selects what is in #0000..#3FFF (0 - ROM, 1 - RAM).

In "no map" the page in the win0 (#0000..#3FFF) is set in Page0 directly. 8 bits are used if RAM, 5 lower bits - if ROM (ROM has 32 pages i.e. 512kB).
In "map" mode Page0 selects ROM page bits 4..2 (which are set to 0 at reset) and bits 1..0 are taken from other sources, selecting one of four ROM pages, see table.

bit1/0
00 - after reset, only in "no map" mode, System ROM,
01 - when DOS signal active, TR-DOS,
10 - when no DOS and #7FFD.4 = 0 (or Memconfig.0 = 0), Basic 128,
11 - when no DOS and #7FFD.4 = 1 (or Memconfig.0 = 1), Basic 48.


chernandezba wrote:Maybe it's handled like baseconf?

No, absolutely different.
User avatar
TS-Labs
 
Posts: 4769
Joined: Thu, 26.07.2012 01:29:56

Postby chernandezba » Thu, 29.06.2017 15:02:19

Thanks a lot! Can you explain me how ram mapping works? Having ram and rom I can advance with emulation

Regards
Cesar
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby chernandezba » Thu, 29.06.2017 18:27:48

Hi again. Sorry , I don't understand well this part:
In "map" mode Page0 selects ROM page bits 4..2 (which are set to 0 at reset) and bits 1..0 are taken from other sources, selecting one of four ROM pages, see table.

bit1/0
00 - after reset, only in "no map" mode, System ROM,
01 - when DOS signal active, TR-DOS,
10 - when no DOS and #7FFD.4 = 0 (or Memconfig.0 = 0), Basic 128,
11 - when no DOS and #7FFD.4 = 1 (or Memconfig.0 = 1), Basic 48.

So, who defines rom 00, after reset? Should I suppose that when I do a reset, it always enter System ROM? So in this case I would never exit bios, because I have to do a reset to exit it... :(
Maybe these bits 1/0 are defined somewhere else or maybe I am mistaken...
Thanks
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby chernandezba » Wed, 05.07.2017 13:45:47

Hi

Can anyone help me a bit with this?

Thanks a lot!

:)
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby psb » Thu, 06.07.2017 13:30:32

chernandezba wrote:Should I suppose that when I do a reset, it always enter System ROM? So in this case I would never exit bios, because I have to do a reset to exit it... :(

I believe this is true - you always enter to a system rom after reset. and the rom itself decide where to jump next, according to bios settings.
User avatar
psb
 
Posts: 713
Joined: Tue, 30.12.2014 23:22:32

Postby chernandezba » Fri, 07.07.2017 11:14:15

Thanks @psb
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby TS-Labs » Fri, 07.07.2017 15:49:22

Sorry for my unpardonable delay.

chernandezba wrote:Can you explain me how ram mapping works?

Registers Page0..3 (ports 0x10AF..0x13AF) select page number in Z80 memory windows 0x0000-0x3FFF..0xC000-0xFFFF.
Page0 behaviour I explained above, all others are just plain RAM page select.

Port 0x7FFD is an alias of Page3, thus selects page in 0xC000-0xFFFF window. Its behaviour depends on MemConfig LCK128 bits.
00 - 512k: #7FFD[7:6] -> Page3[4:3], #7FFD[2:0] -> Page3[2:0], Page3[7:5] = 0,
01 - 128k: #7FFD[2:0] -> Page3[2:0], Page3[7:3] = 0,
10 - Auto: OUT (#FD) works as mode 01, OUT (C), r works as mode 00,
11 - 1024k: #7FFD[7:6] -> Page3[4:3], #7FFD[2:0] -> Page3[2:0], #7FFD[5] -> Page3[5], Page3[7:6] = 0.
User avatar
TS-Labs
 
Posts: 4769
Joined: Thu, 26.07.2012 01:29:56

Postby TS-Labs » Fri, 07.07.2017 15:51:59

chernandezba wrote:So, who defines rom 00, after reset?

Hardware. The reset value in MemConfig is 0x04 and Page0 = 0, thus you have ROM at 0x0000, disabled mapping and page 0.
User avatar
TS-Labs
 
Posts: 4769
Joined: Thu, 26.07.2012 01:29:56

Postby chernandezba » Sat, 08.07.2017 18:18:09

Don't worry about your delay. I'm a bit impatient sometimes ;)
Thanks for the info, I will work on it during next days, and probably ask you some questions :)

Cheers
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby chernandezba » Mon, 10.07.2017 20:28:15

Hi

Another question, where is the charset for text mode (the one used for boot) located?
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby TS-Labs » Tue, 11.07.2017 00:49:58

Charset is located in first 2kB of page adjacent to video page, selected by VPage register.
Adjacent here means that bit 0 of VPage is inverted.
Example:
VPage = 5, font is in 0x0000..0x07FF in page 4 (5 xor 1 = 4),
VPage = 160, font is in 0x0000..0x07FF in page 161 (160 xor 1 = 161).

pentevo\unreal\Unreal\drawers.cpp
Code: Select all
   u8 *scr = page_ram(comp.ts.vpage);         // video memory address
   u8 *fnt = page_ram(comp.ts.vpage ^ 0x01);   // font address
User avatar
TS-Labs
 
Posts: 4769
Joined: Thu, 26.07.2012 01:29:56

Postby chernandezba » Tue, 11.07.2017 02:00:49

Thanks
I tried it, vpage=F6H, but seems there's no char set on F7H... maybe I'm doing something wrong

Cheers
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby chernandezba » Tue, 11.07.2017 21:31:22

Well... I'm guessing (temporarily) that vpage is the page number mapped at c000-ffffh. I know it's not the right value but reading vpage from 01AFH always give me F6H... So, my temporary value works.... You can watch it here:

https://youtu.be/FhnOeRsG5e4

;)

I assume 6x8 charset, and I'm drawing to a standard 256x192 pixels display. I'm not sure what are different resolutions of TSConf both in graphic mode and in text mode. Some places say 720 pixels width, some others 360..

Anyway, my preliminary test works. You can also see I can select 48 or 128 rom, and also you can see I can raise a fatal error when playing with random bios values :)

Cheers
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby TS-Labs » Tue, 11.07.2017 22:30:04

chernandezba wrote:that vpage is the page number mapped at c000-ffffh

Nope. VPage is simply addressing the RAM area for videocontroller. It is not mapped anywhere. But you can map the page selected for video to any of four memory 16kB windows (0x0000/0x4000.../0xC000) using Page0..3.
Example:
VPage = 0xF6, Page1 = 0xF6 - you have "video" RAM at 0x4000.

chernandezba wrote: I'm not sure what are different resolutions of TSConf both in graphic mode and in text mode.

Good assumption. Text mode uses so called 'Hi-Res' resolution which is twice as normal by X axis. One char despite being 8x8 pixels occupies screen area equal to 4x8 ZX pixels.

Correct screen looks like:
sshot000000.png


Yet another fact. The size of visible window is selected via VConfig register bits 6..7:
00 - 256x192 (512x192 for text)
01 - 320x200 (640x200 for text)
10 - 320x240 (640x240 for text)
11 - 360x288 (720x288 for text)

Screen addressing doesn't depend on frame size selected. Unused memory areas (right and down) are just not drawn.
User avatar
TS-Labs
 
Posts: 4769
Joined: Thu, 26.07.2012 01:29:56

Postby chernandezba » Tue, 11.07.2017 23:12:26

Thanks!
So maximum characters in a line, on the bigger video mode, is 360/4=90?
What is the border size in each mode?
chernandezba
 
Posts: 57
Joined: Wed, 28.06.2017 17:50:12

Postby TS-Labs » Tue, 11.07.2017 23:58:54

Yes.
Border is leftover from 360 for X and 288 for Y, pixels are in center.
X: 0 for 360x288, 104 for 256x192.
User avatar
TS-Labs
 
Posts: 4769
Joined: Thu, 26.07.2012 01:29:56

Next

Return to Emulators

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x