Skip to content

Commit 0fbbc00

Browse files
authored
Add support for DOS Upper Memory Blocks (UMBs). (#38)
* Import unmodified USE!UMBS source. From https://forum.vcfed.org/index.php?threads/loading-dos-high-on-a-xt.32320/ * Customize the UMB Driver prompts. * Refactor memory management. Allow activation of EMS/UMB on demand. * Update the XTEMM and XTUMBS drivers to map their ranges. * Add instructions for all the drivers.
1 parent 553ca58 commit 0fbbc00

File tree

14 files changed

+1711
-94
lines changed

14 files changed

+1711
-94
lines changed

XTMax/Code/XTMax/XTMax.ino

Lines changed: 140 additions & 85 deletions
Large diffs are not rendered by default.

XTMax/Drivers/LTEMM/LTEMM.ASM

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,18 +3027,25 @@ instmsg PROC NEAR
30273027
RET
30283028
instmsg ENDP
30293029
;--------------------------------------------------------------------
3030-
; Check EMS i/o port.
3030+
; Initialize EMS window and check EMS i/o port.
30313031
; output
3032-
; for lo-tech EMS board, we cannot read from the page registers
3033-
; hence we just return OK anyway.
30343032
; cf = 0 : OK
30353033
; cf = 1 : NG
30363034
;--------------------------------------------------------------------
30373035
ckemsio PROC NEAR
30383036
MOV DX,CS:EMSIO
3039-
; JJP IN AL,DX
3040-
; JJP CMP AL,255 ;check TRS flag
3041-
; JJP JE ckems3
3037+
ADD DX,10 ; EMS segment register
3038+
MOV AX,CS:PAGE_FRAME_SEG
3039+
OUT DX,AX
3040+
ADD DX,3 ; debug base register
3041+
OUT DX,AX
3042+
DEC DX ; EMS pages count register
3043+
MOV AL,PHYS_PAGES
3044+
OUT DX,AL
3045+
ADD DX,3 ; debug register
3046+
IN AL,DX
3047+
CMP AL,2 ; Region::EmsWindow
3048+
JNE ckems3
30423049
ckems4:
30433050
CLC ;reset CF
30443051
RET
@@ -3520,9 +3527,9 @@ info:
35203527
; EMM driver initial routine work data area
35213528
;--------------------------------------------------------------------
35223529
start_msg db CR,LF
3523-
DB 'XTEMM: EMM Driver for XTMax r02',CR,LF
3530+
DB 'XTEMM: EMM Driver for XTMax r03',CR,LF
35243531
db ' Based on Lo-tech EMM Driver for the Lo-tech 2MB EMS board.',CR,LF
3525-
db ' Based on modifications by Michael Karcher.',CR,LF
3532+
db ' Based on modifications by Michael Karcher.',CR,LF
35263533
db ' Based on original works Copyright (c) 1988, Alex Tsourikov.',CR,LF
35273534
db ' All rights reserved.',CR,LF
35283535
db 'Using EMS '

XTMax/Drivers/LTEMM/README.TXT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Syntax: DEVICE=LTEMM.EXE [/switches]
2929
/i:nnn - EMS i/o port base address (260)
3030
/h:nnn - Maximal number of handles (64)
3131
/d:nn - Depth of contest saves (5)
32-
/f:nnn - First page number (0)
3332
/n - Bypass memory test
3433
/x - Perform long memory test
3534
/3 - Use only EMS 3.2 functions

XTMax/Drivers/README.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# XTMax Device Drivers
2+
3+
## BIOS Extension ROM for SD Card (BootROM)
4+
5+
The XTMax maps a BIOS Extension ROM at address 0xCE000-0xCE7FF, plus a bank of registers at address 0xCE800-0xCEFFF.
6+
7+
The BIOS Extension ROM presents the SD Card on the Teensy as a fixed disk drive that can be used for booting and/or for
8+
storage in MS-DOS and other operating systems using INT13h fixed disk services (note: OS/2 does not use INT13h fixed
9+
disk services and therefore cannot use the SD Card).
10+
11+
The ROM can be relocated by changing the address `BOOTROM_ADDR` in the [`bootrom.h`](../Code/XTMax/bootrom.h) and
12+
re-deploying the Teensy sketch. The address **must** be a multiple of 2048 bytes (2KB) and must be within the range
13+
0xC8000-DF800 (this is the range that the BIOS searches).
14+
15+
### Preparing an SD Card for use with MS-DOS
16+
17+
The preferred method for preparing an SD Card for use is to use the machine with the XTMax. From an MS-DOS prompt, begin
18+
with re-writing the Master Boot Record (MBR) onto the SD Card. This is needed in order to make sure that the SD Card can
19+
be used for booting. Modern devices are shipped pre-formatted with an MBR that is not compatible with older x86
20+
micro-processors.
21+
22+
```
23+
A:\> FDISK /MBR
24+
```
25+
26+
Next, partitions can be created on the SD Card with `FDISK`.
27+
28+
```
29+
A:\> FDISK
30+
```
31+
32+
If there is another fixed disk drive, be sure to select the correct drive from the `FDISK` menu. The existing partition
33+
on the SD Card must first be deleted, before creating a new Primary Partition. **This will destroy the entire content of
34+
the SD Card**. The new Primary Partition must be set as Active if the SD Card must be used for booting.
35+
36+
The partition on the SD Card will now appear as a new logical drive, typically `C:` or `D:` depending on availability.
37+
38+
Finally, the partition must be formatted. Use `FORMAT` and use the `/S` switch if the SD Card must be used for booting.
39+
40+
Note: MS-DOS will typically limit a partition size to 2GB. However, it is possible to create 3 additional Extended
41+
Partitions to increase the usage of the SD Card. These partitions will appear as new logical drives, such as `E:`, `F:`,
42+
etc... depending on availability.
43+
44+
## MS-DOS Driver for SD Card (XTSD)
45+
46+
This driver is provided as a back-up option for machines without support for BIOS Extension ROMs. It is based on the
47+
[SDPP](https://github.com/nilseuropa/sdpp) driver originally written by Robert Armstrong and later improved by Dan
48+
Marks.
49+
50+
**This driver is not necessary when the BIOS Extension ROM is loaded by the BIOS during boot.**
51+
52+
The device driver can be found here: [`XTSD.SYS`](https://raw.githubusercontent.com/MicroCoreLabs/Projects/master/XTMax/Drivers/XTSD.SYS).
53+
Once downloaded, it must be placed on a drive accessible during boot and must be invoked from `CONFIG.SYS` as shown in
54+
the example below:
55+
56+
```
57+
DEVICE=A:\XTSD.SYS
58+
```
59+
60+
When loaded, the driver will create a new logical drive for the SD Card, typically `C:` or `D:` depending on
61+
availability.
62+
63+
### Preparing an SD Card for use with MS-DOS
64+
65+
The SD Card can be prepared from another machine. In this example, the SD Card is prepared from a Windows 10/11 machine.
66+
67+
Use `DISKPART`. First, use `LIST DISK` to find the disk number of the SD Card then `SELECT DISK #` with the appropriate
68+
disk number.
69+
70+
Next, use `CLEAN` to delete all partitions. **This will destroy the entire content of the SD Card**.
71+
72+
Finally, create a new partition with `CREATE PART PRIMARY SIZE=#` by specifying the desired partition size in MB.
73+
Depending on the version of MS-DOS on the machine that will be using the SD Card, there are limit on the size (typically
74+
2048 ie 2GB).
75+
76+
The partition must be formatted, for example with `FORMAT #: /FS:FAT /Q`.
77+
78+
## EMS Driver for MS-DOS (XTEMM)
79+
80+
This driver provides LIM 4.0 Expanded Memory (EMS) through the [PSRAM](https://www.pjrc.com/store/psram.html) on the
81+
Teensy. It is based on the LoTech [`LTEMM.EXE`](https://www.lo-tech.co.uk/wiki/LTEMM.EXE) driver and inspired by work by
82+
Alex Tsourikov and Michael Karcher. Note that while the driver is compliant with EMS 4.0, it does not support memory
83+
back-filling.
84+
85+
The device driver can be found here: [`XTEMM.EXE`](https://raw.githubusercontent.com/MicroCoreLabs/Projects/master/XTMax/Drivers/XTEMM.EXE).
86+
Once downloaded, it must be placed on a drive accessible during boot and must be invoked from `CONFIG.SYS` as shown in
87+
the example below:
88+
89+
```
90+
DEVICE=A:\XTEMM.EXE /N
91+
```
92+
93+
The address of the memory window used by the EMS driver is 0xD0000-0xDFFFF by default and can be changed with the `/P`
94+
argument. For example, to use segment 0xE000 (mapping to 0xE0000-0xEFFFF), the syntax is as follows:
95+
96+
```
97+
DEVICE=A:\XTEMM.EXE /P:E000 /N
98+
```
99+
100+
## UMB Driver for MS-DOS (XTUMBS)
101+
102+
This driver provides Upper Memory Blocks (UMBs) in unused regions of the Upper Memory Area (UMA). It is based on the
103+
`USE!UMBS` driver originally written by Marco van Zwetselaar and later rewritten by Krister Nordvall and published on
104+
the [VCFED forum](https://forum.vcfed.org/index.php?threads/loading-dos-high-on-a-xt.32320/).
105+
106+
The device driver can be found here: [`XTUMBS.SYS`](https://raw.githubusercontent.com/MicroCoreLabs/Projects/master/XTMax/Drivers/XTUMBS.SYS).
107+
Once downloaded, it must be placed on a drive accessible during boot and must be invoked from `CONFIG.SYS` as shown in
108+
the example below:
109+
110+
```
111+
DEVICE=A:\XTUMBS.SYS D000-E000
112+
```
113+
114+
In the example above, the memory region at 0xD0000-0xDFFFF will be used as an UMB. **Care must be taken to not conflict
115+
with other memory regions used by periperals or other drivers.** For example, the region at 0xD0000 may also be used
116+
by the EMS driver, and both drivers shall not be configured to conflict with each other.
117+
118+
The XTMax can create UMBs at any address within the 0xA0000-0xEFFFF range. The only restriction is that the address and
119+
size of the UMB must be a multiple of 2048 bytes (2KB).
120+
121+
The `XTUMBS` driver can accept several ranges for UMBs, as shown in the example below with two distinct ranges:
122+
123+
```
124+
DEVICE=A:\XTUMBS.SYS A000-B000 D000-E000
125+
```
126+
127+
**Note that the XTMax only enables RAM for the UMBs upon loading the `XTUMBS` driver. Therefore, tools such as
128+
[`TEST!UMB.EXE](https://raw.githubusercontent.com/MicroCoreLabs/Projects/master/XTMax/Drivers/TEST!UMB.EXE) cannot be used to
129+
identify available UMBs.** Instead, the user must identify the unavailable ranges (such as video RAM or ROMs) with tools
130+
like CheckIt! and determine which ranges are safe to use as UMBs.

XTMax/Drivers/TEST!UMB.EXE

1.28 KB
Binary file not shown.

XTMax/Drivers/USEUMB/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.sys
2+
*.exe
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Build with NASM",
8+
"type": "shell",
9+
"command": ".\\build.cmd && copy *.SYS ..\\",
10+
"options": {
11+
"cwd": "${workspaceFolder}"
12+
},
13+
"problemMatcher": [],
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
}
19+
]
20+
}

XTMax/Drivers/USEUMB/README

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
==============================================================
2+
3+
Please read the manual. It's only 14 pages, several of which
4+
you may skip. It is included in this archive under the name
5+
USE!UMBS.DOC. If you want to print it out (which I strongly
6+
recommend), simply type this command at the dos prompt:
7+
TYPE USE!UMBS.DOC >LPT1
8+
9+
--------------------------------------------------------------
10+
11+
I dedicated all of this software to the public domain. Feel
12+
free to copy it and give it to anyone you wish. If you do so,
13+
please copy the *entire* archive, with all of the following
14+
files included:
15+
16+
--------------------------------------------------------------
17+
18+
README : this file Marco van.Zwetselaar
19+
USE!UMBS.DOC : documentation Oorsprongpark 5
20+
USE!UMBS.SYS : the device driver 3581 ES Utrecht (NL)
21+
USE!UMBS.ASM : the source code Fido NetMail 2:281/701
22+
TEST!UMB.EXE : tests for UMBs Phone 030-313128
23+
24+
==============================================================

0 commit comments

Comments
 (0)