Patch: Toshiba T3100e

Discussion of development and patch submission.
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Patch: Toshiba T3100e

Post by JohnElliott »

Apologies for any roughness around the edges of this patch, but I wanted to get it to a workable condition before the feature freeze. It adds support for the Toshiba T3100e laptop.

I've tested the patch against the latest checkin, and it appears to compile and boot satisfactorily.

Some known issues / design choices:
i) Like the PC1512 and PC200 emulations, it only supports one hardware font, not the four of the original hardware.
ii) The motherboard video chipset is always used; the original allows it to be disabled and replaced by an add-on card. Again, this is how other emulations like the PC1640 and PC200 behave.
iii) f you want to get into the BIOS setup screen on a real T3100e, you'd hold down the 'Fn' key while booting. I haven't worked out how to replicate this effect on PCEM, so to get into the BIOS you have to use DEBUG under DOS:

Code: Select all

C:\>debug
-g=f000:4000
PM me if you want the T3100e ROM images.
Attachments
t3100e.patch
(68.14 KiB) Downloaded 427 times
User avatar
omarsis81
Posts: 945
Joined: Thu 17 Dec, 2015 6:20 pm

Re: Patch: Toshiba T3100e

Post by omarsis81 »

Nice add! Does the screen look redish too?
Maybe we could have something like Ctrl+Shift or Alt+Shift to simulate the Fn key
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

The screen looks like this:
Image
Image

The thing with the 'Fn' key is that that it doesn't produce a scancode, so I'm not clear how the BIOS detects it. I do have a dump of the keyboard controller firmware; maybe that will provide some clues.

ETA: OK, it looks like it's done by that mysterious command 0xBB that gets sent to the keyboard controller at startup; bit 2 of the byte it returns seems to give the status of the 'Fn' key.
User avatar
omarsis81
Posts: 945
Joined: Thu 17 Dec, 2015 6:20 pm

Re: Patch: Toshiba T3100e

Post by omarsis81 »

Excellent job Mr. Elliott. I hope to see it committed soon
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

JohnElliott wrote:OK, it looks like it's done by that mysterious command 0xBB that gets sent to the keyboard controller at startup; bit 2 of the byte it returns seems to give the status of the 'Fn' key.
And here's a little patch that (applied on top of the T3100e patch) allows right-Ctrl or right-Alt to be used as a trigger for the BIOS screen (hold either down while rebooting).

I've since found a list of other things the Fn key does. My patch doesn't emulate any of these at the moment; most of them are processed by the keyboard controller firmware rather than coming through to the BIOS as scancodes.
Attachments
fn_key.patch
(816 Bytes) Downloaded 387 times
User avatar
BoisterousSleet75
Posts: 39
Joined: Fri 11 Aug, 2017 3:06 am

Re: Patch: Toshiba T3100e

Post by BoisterousSleet75 »

Very nice add! I hope those patch (including Fn key patch) will be committed before feature freezes.
Long Live Marxism-Leninism-Maoism! ☭
User avatar
SarahWalker
Site Admin
Posts: 2053
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Patch: Toshiba T3100e

Post by SarahWalker »

Committed at rev 890.
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

I managed to get a proper dump of the T3100e font ROM this evening. Unfortunately its character bitmaps aren't stored in the same order as the mocked-up one that I coded against.

The attached patch fixes the font loader so that it uses the proper ROM rather than my mocked-up version. You'll need the updated ROM, of course; it's 64k rather than the 8k of the mocked-up version. You'll have to PM me for the updated ROM set.
Attachments
proper_font.patch
(844 Bytes) Downloaded 386 times
User avatar
SarahWalker
Site Admin
Posts: 2053
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Patch: Toshiba T3100e

Post by SarahWalker »

Committed at rev 895.
Greatpsycho
Posts: 151
Joined: Tue 22 Mar, 2016 10:03 am
Location: Korea
Contact:

Re: Patch: Toshiba T3100e

Post by Greatpsycho »

This patch ensures that STAT_IFULL to be set immediately after sending keyboard self-test command applies only to the Toshiba T3100e. This solves the problem that Samsung SPC-4200P/SPC-4216P does not boot.
And it also apples all even command value between 0xF0 and 0xFE to reset CPU. This solves the problem that XENIX286 can't reset the CPU.

To JohnElliott : I regret that I have arbitrarily uploaded the patch without consulting with you.
Attachments
keyboard_at.c.patch
Patch for keyboard controller.
(1.09 KiB) Downloaded 387 times
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

Greatpsycho wrote:To JohnElliott : I regret that I have arbitrarily uploaded the patch without consulting with you.
There's no need for regrets. I probably should have created a separate implementation for the T3100e keyboard controller rather than piggybacking on the AT one, since a lot of its commands behave differently from the IBM versions.
User avatar
SarahWalker
Site Admin
Posts: 2053
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Patch: Toshiba T3100e

Post by SarahWalker »

Committed at revs 901 & 902.
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

This patch makes the following improvements to the T3100e:

* Enables [Fn]+key combinations (using right-Ctrl or right-Alt as [Fn]). In particular:
* Implements switching the built-in display adapter between the 'internal' plasma display ([Fn]+[Home]) and an 'external' CGA monitor ([Fn]+[End])
* Allows the video font to be toggled between thin and thick ([Fn]+[Right arrow]).
* Implements the four hardware fonts of the original, selectable in BIOS setup.

Nearly all of the differences are in T3100e-specific code, or work by setting variables that only the T3100e pays any attention to. The main change in general code is allowing multiple fonts on the CGA.

I haven't implemented the 'turbo' commands (though the appropriate keypresses [Fn]+[PgUp] / [Fn]+[PgDn] are detected), because I don't know how / if the CPU speed can be changed while emulation is running.
Attachments
t3100e_fn.patch
(21.34 KiB) Downloaded 381 times
Greatpsycho
Posts: 151
Joined: Tue 22 Mar, 2016 10:03 am
Location: Korea
Contact:

Re: Patch: Toshiba T3100e

Post by Greatpsycho »

I found a bug that MS-DOS version 5.0 or greater version crashes when kernel is loaded in HMA area when I use 1024KB memory configuration. To fix this problem, you should add mem_mapping_set_exec() call to t3100e_map_ram function in t3100e.c.

Previous code:

Code: Select all

	/* Bit 4 set if upper RAM is mapped to high memory 
         * (and bit 1 set if XMS enabled) */
	if ((val & 0x12) == 0x12)
	{
		mem_mapping_set_addr(&t3100e_ems.upper_mapping,
					mem_size * 1024,
					upper_len);
		mem_mapping_enable(&t3100e_ems.upper_mapping);
	}
	else
	{
		mem_mapping_disable(&t3100e_ems.upper_mapping);
	}
Fixed code:

Code: Select all

	/* Bit 4 set if upper RAM is mapped to high memory 
         * (and bit 1 set if XMS enabled) */
	if ((val & 0x12) == 0x12)
	{
		mem_mapping_set_addr(&t3100e_ems.upper_mapping,
					mem_size * 1024,
					upper_len);
		mem_mapping_enable(&t3100e_ems.upper_mapping);
		mem_mapping_set_exec(&t3100e_ems.upper_mapping, ram + t3100e_ems.upper_base);
	}
	else
	{
		mem_mapping_disable(&t3100e_ems.upper_mapping);
	}
User avatar
omarsis81
Posts: 945
Joined: Thu 17 Dec, 2015 6:20 pm

Re: Patch: Toshiba T3100e

Post by omarsis81 »

JohnElliott wrote:I haven't implemented the 'turbo' commands (though the appropriate keypresses [Fn]+[PgUp] / [Fn]+[PgDn] are detected), because I don't know how / if the CPU speed can be changed while emulation is running.
The CPU speed can be changed on the fly, as you can change it PCem's config menu too and PCem doesn't restart
User avatar
BoisterousSleet75
Posts: 39
Joined: Fri 11 Aug, 2017 3:06 am

Re: Patch: Toshiba T3100e

Post by BoisterousSleet75 »

Greatpsycho wrote:I found a bug that MS-DOS version 5.0 or greater version crashes when kernel is loaded in HMA area when I use 1024KB memory configuration. To fix this problem, you should add mem_mapping_set_exec() call to t3100e_map_ram function in t3100e.c.

Previous code:

Code: Select all

	/* Bit 4 set if upper RAM is mapped to high memory 
         * (and bit 1 set if XMS enabled) */
	if ((val & 0x12) == 0x12)
	{
		mem_mapping_set_addr(&t3100e_ems.upper_mapping,
					mem_size * 1024,
					upper_len);
		mem_mapping_enable(&t3100e_ems.upper_mapping);
	}
	else
	{
		mem_mapping_disable(&t3100e_ems.upper_mapping);
	}
Fixed code:

Code: Select all

	/* Bit 4 set if upper RAM is mapped to high memory 
         * (and bit 1 set if XMS enabled) */
	if ((val & 0x12) == 0x12)
	{
		mem_mapping_set_addr(&t3100e_ems.upper_mapping,
					mem_size * 1024,
					upper_len);
		mem_mapping_enable(&t3100e_ems.upper_mapping);
		mem_mapping_set_exec(&t3100e_ems.upper_mapping, ram + t3100e_ems.upper_base);
	}
	else
	{
		mem_mapping_disable(&t3100e_ems.upper_mapping);
	}
I'm agree with this. if JohnElliott can update this patch with fixed code would be Great.
Long Live Marxism-Leninism-Maoism! ☭
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

Here's a revised patch. I've added the mem_mapping_set_exec() as advised, and also made some further improvements to the video emulation, to implement CRTC register 12h (attribute mapping and display type). The Toshiba CHAD utility, which controls how colour attributes are mapped to amber/black, now appears to work.
Attachments
t3100e_fn2.patch
(27.02 KiB) Downloaded 353 times
Fenix77
Posts: 80
Joined: Fri 01 Sep, 2017 11:59 am

Re: Patch: Toshiba T3100e

Post by Fenix77 »

Hello!

I think i found a bug. When i run Windows 2.11/286 with EMS memory, the emulator Lock up when i open the Write application, but when i configure all memory as XMS, including the 384kb upper memory, there is no problem. (I don't know if the patch of Greatpsycho fixes this issue).

Also I Want to ask if this model (T3100e) supports 1.44MB floppy disks. Because the emulated T3100e reads 720kb and 360kb only.
And finally the EMS test program of Douglas Boling detects the EMS memory as v4 0 capable, but no Large Page Frame is supported.
Is it a bug or is it how the real machine works? I ask it because, the EMS 4.0 memory boards of late '80 did not support all the specs of the EMS 4.0 standard.
Some of them supported backfilling of conventional memory from 256kb to 640kb an others only from 512kb. Others were EMS 3.2 capable boards with an EMS 4.0 device driver.

Thanks!
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

I think the EMS issue needs a similar fix to Greatpsycho's, only for the EMS memory mapping rather than the XMS one. Something like this, in t3100e_ems_out():

Code: Select all

	if (regs->page_exec[pg])
	{
		if (t3100e_log) pclog("Enabling EMS RAM at %05x\n",
				page_to_addr(pg));
		mem_mapping_enable(&regs->mapping[pg]);
		mem_mapping_set_exec(&regs->mapping[pg], ram + regs->page_exec[pg]); // <--- new line
	}
The real hardware can read 1.4M floppies, so I don't know why the emulated machine can't.

Is this the EMS test utility you mean? I get the same results on the emulated machine and real hardware:

Code: Select all

LIM EMS 4.0 Driver Test Program 1.02
Written by Douglas Boling

Function 19, Non-volatile handles not supported.

Function 28, No hardware support for alternate registers.
             Software support tested.

EMS tests completed.  No errors detected.
Fenix77
Posts: 80
Joined: Fri 01 Sep, 2017 11:59 am

Re: Patch: Toshiba T3100e

Post by Fenix77 »

Hello.

Yes i used that test, and also i used the Manifest utility included in Qram 2.02.
i took two screenshots.
The first is From Toshiba and the Second from GW-286CT GEAR using the SCAT chip emulation developed by Gratpsycho. In the Toshiba there is no Mappeable memory.
This mappeable memory is the ´large page frame', this memory is backfilled and managed by the EMS 4.0 chipset.



Here is the explanation of what I read and understood from old pc magazines from late '80i avaiable in google books and the book DOS beyond 640kb.
https://archive.org/details/DOS_Beyond_640K_2nd_edition

The mappeable memory can be 'moved' from conventional to EMS and from EMS to conventional memory directly by EMS 4.0 chipset. The CPU reuses the space same addresses to write different portions of memory and calls to the EMS board/chipset when the portion of memory have to be switched and other written portion must be called.
(in the 286 GEAR the area from 4n00 to An00 is mappeable this means that area can be reused several times by CPU and when a memory block is switched, the actual adress of the code or data is stored by the EMS chip).
This is the same is done with the 64kb page frame located at E000 or D000 but in the EMS 3.2 spec only one page of 16kb can be moved per clock cycle. In the EMS 4.0 the four pages (64kb) can be moved, but if the EMS 4.0 memory board and/or chipset support the 'large page frame' also the entire 384kb memory block of the backfilled conventional memory can be 'moved' modifing the registers of the memory board instead of moving the actual data.
Without it, only 64kb of executable code can be stored in the EMS memory because only the 64kb page frame can be used. Of course you can use all the EMS memory to store data, but it still limited to 64kb to store executable code.

Some applications such as Deskview and Windows 2.x, and Windows 3.0 when runs in real mode can 'move' the mappeable area of the conventional memory back and Forth the EMS memory.
Attachments
GEAR 286
GEAR 286
GEAR 286.png (116.34 KiB) Viewed 22137 times
Toshiba T3100e
Toshiba T3100e
TOSHIBA EMS.png (102.85 KiB) Viewed 22137 times
Greatpsycho
Posts: 151
Joined: Tue 22 Mar, 2016 10:03 am
Location: Korea
Contact:

Re: Patch: Toshiba T3100e

Post by Greatpsycho »

Fenix77 wrote: The first is From Toshiba and the Second from GW-286CT GEAR using the SCAT chip emulation developed by Gratpsycho. In the Toshiba there is no Mappeable memory.
This mappeable memory is the ´large page frame', this memory is backfilled and managed by the EMS 4.0 chipset.
Not all chipsets support large page frame. For example, according to technical document, Chips & Technologies 82C212 NEAT, 82C812 NEATsx and 82C836 SCATsx chipset supply EMS 4.0 specific driver but does not support laege page frame. I didn't see Toshiba T3100e's technical document, however, this machine does not seem to support laege page frame either.
Fenix77
Posts: 80
Joined: Fri 01 Sep, 2017 11:59 am

Re: Patch: Toshiba T3100e

Post by Fenix77 »

Hello

Sorry. I thought that if all chipsets EMS 4.0 supported mapping upper memory areas other than the 64kb page frame they also must support the large page frame.
But after testing the emulated SCATsx i can see they're two differents things unrelated one to another. The Windows 2.11/286 readme file states that EMS 4.0 is required
and recommends,(if the board supports it) disable 384kb of conventional memory and fill it with the memory board.(although the emulated Laser XT uses EMS 3.2 with an EMS 4.0 driver and it works).

Thanks again for this incredible work with these EMS memory chipset and JohnElliott for this Toshiba machine. They were expensive pieces of hardware back in the day and for this reason they were very little known too.
For instance T3100e had a monochrome screen that uses patterns instead of bright intensities to reproduce color, unlike the phosphor amber monitors did with the Hercules graphics card. Also, I discovered that the T3100e can have a 20 or 40Mb hard disk, and 80286 running at 12 or 16 MHz and 1.44 floppy drive, on Wikipedia site mentions that the floppy drive is 720kb. But the second reference link in references go to the PDF file created by Thoshiba and says 1.44mb drives are supported. https://web.archive.org/web/20040515024 ... 100e_E.pdf
User avatar
SarahWalker
Site Admin
Posts: 2053
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Patch: Toshiba T3100e

Post by SarahWalker »

Committed latest patch at rev 910.
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

Thanks Sarah!

Looking at the behaviour of the floppy drive, the BIOS seems to be looking at CMOS location 10h to get the drive type, which is as expected -- but there's no UI to set this. Instead, that location is initialised by the BIOS using code at F000:6000, which in turn seems to ask the keyboard controller for details (command 0xB4). So I'll have to work out how to implement that. It looks to me as if the following configurations are supported:
* One internal 3.5" floppy drive, which can be 720k, 1.4M or something else (tri-mode?).
* Two internal 3.5" floppy drives, both of the same type.
* One internal 3.5" floppy drive as above, plus an external drive that can be 360k or 1.2M.

I strongly suspect some of this information comes from three motherboard jumpers near the keyboard controller, which the maintenance manual only names as 'FD2', 'FD2MB' and 'F2HD'.

The QRAM Manifest tool produces the same display on real hardware as on Fenix77's second screenshot, so I don't think the T3100e supports a large page frame. I tried reducing conventional RAM to 512k to see if it backfills with EMS between 512k and 640k, but it doesn't.
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

omarsis81 wrote:The CPU speed can be changed on the fly, as you can change it PCem's config menu too and PCem doesn't restart
OK, any thoughts on using something like this to implement a software 'turbo' setting?

Code: Select all

void t3100e_turbo_set(uint8_t value)
{
	t3100e_ems.turbo = value;
	if (!value)
	{
		int c = cpu;
		cpu = 0;	/* 286/6 */
		cpu_set();
		cpu = c;
	}
	else
	{
		cpu_set();
	}
}
Fenix77
Posts: 80
Joined: Fri 01 Sep, 2017 11:59 am

Re: Patch: Toshiba T3100e

Post by Fenix77 »

My bad, I tested the Write application of Windows 2.11 with EMS memory and it works correctly. I added STACKS=9,512 in the config.sys like Greatpsycho suggested me for the 386-SX KMX-C-02.
So there is no issue with EMS memory emulation.
By the way, What parameters must be used by the Chad utility in order to change the appearance of black/amber colors?

Thanks again!
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

CHAD takes two parameters from 1 to 4, separated by a comma. The first controls how colour on colour is presented, and the second controls colour on black.
Options are:
1 => Normal
2 => Inverse
3 => Bold
4 => Bold inverse

The default setting is CHAD 2,1 . You can also append a ",W" to the command to persist the setting to CMOS.
User avatar
gen_angry
Posts: 127
Joined: Sat 25 Feb, 2017 6:48 am

Re: Patch: Toshiba T3100e

Post by gen_angry »

Question/Feature request: if the display for this is a 'display adapter' setting for a particular type of monochrome screen adapter, any chance that someone could make a 'blue screen' option?

ie: https://3.bp.blogspot.com/-Mw0I2B3iDS4/ ... 174934.jpg

Whether this is possible or not, thank you regardless :)
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

Since no-one's objected to my idea of how to do a soft turbo switch, here's the patch implementing it. It also adds support for a few more keyboard controller commands, which seem to fix 1.4M floppy drive support and the long delay at boot when using the 3.0 BIOS.
Attachments
t3100e_fdd.patch
(7.48 KiB) Downloaded 370 times
User avatar
JohnElliott
Posts: 113
Joined: Sun 31 Jan, 2016 7:29 pm

Re: Patch: Toshiba T3100e

Post by JohnElliott »

gen_angry wrote:Question/Feature request: if the display for this is a 'display adapter' setting for a particular type of monochrome screen adapter, any chance that someone could make a 'blue screen' option?

ie: https://3.bp.blogspot.com/-Mw0I2B3iDS4/ ... 174934.jpg

Whether this is possible or not, thank you regardless :)
It's too late for this version, but I do have ROMs for the T1000...
Image
Post Reply