21.33FF kernel version string interface (Developers)
> > I am looking for a method of detection of running FreeDOS kernel
>
> set ax=0x3000 and call int 0x21, check whether the returned bh is 0xfd.
>
> if yes, set ax=0x33ff and call int 0x21, it returns a pointer dx:ax to a
> version string.
>
> how to express this in the programming language of your choice is up to
> you, please share an example implementation code snippet here
Here's an example for the latter call in 8086 NASM assembly: callver.asm
mov ax,33ffh ; get FreeDOS version string pointer
xor dx, dx
int 21h ; returns DX AX
test dx, dx
jnz gotname
mov dx, ds
mov ax, msgnoname
The returned pointer is an ASCIZ string that may have trailing whitespace (such as CR or LF). There is some code following the quoted part that will ignore trailing whitespace.
Here's an addition I made to comcom32, a DPMI client shell written in C. It does essentially the same as my callver code: Preset dx to zero, check for a nonzero return in dx, and ignore trailing whitespace. (It also ignores leading whitespace and copies the entire string to a 256-byte buffer allocated by malloc.)
Here's the same function in RxCMD, 8086 assembly too.
Crucially this doesn't depend on the 21.3000 OEM number (like a prior version of callver) to detect support for the 21.33FF function. Instead, it presets dx to zero and checks for a non-zero segment return. This function is also supported by my more recent RxDOS kernels (which have OEM number 5Eh).
Here's the string in RxDOS's DOS code segment: https://hg.pushbx.org/ecm/rxdos-7.2x/file/38ec35f277df/RxDOS/doscode.asm#l58
Here's what it looks like in the file: (from the uncompressed RxDOS.COM file of RxDOS version 7.24)
001B90 0C 0C 0C 0C 0C 0C 0C 04-04 52 78 44 4F 53 20 76 >.........RxDOS v<
001BA0 65 72 73 69 6F 6E 20 37-2E 32 34 20 5B 68 67 20 >ersion 7.24 [hg <
001BB0 62 30 30 34 65 61 38 30-65 32 32 32 5D 20 5B 32 >b004ea80e222] [2<
001BC0 30 31 38 2D 31 30 2D 30-39 5D 00 5E 43 0D 0A 00 >018-10-09].^C...<
This is the result of using the call on my current FreeDOS in dosemu2 setup:
C:\>ldebug
-a
1E8E:0100 mov ax, 33ff
1E8E:0103 int 21
1E8E:0105 nop
1E8E:0106
-r
AX=0000 BX=0000 CX=0000 DX=0000 SP=FFFE BP=0000 SI=0000 DI=0000
DS=1E8E ES=1E8E SS=1E8E CS=1E8E IP=0100 NV UP EI PL ZR NA PE NC
1E8E:0100 B8FF33 mov ax, 33FF
-t
AX=33FF BX=0000 CX=0000 DX=0000 SP=FFFE BP=0000 SI=0000 DI=0000
DS=1E8E ES=1E8E SS=1E8E CS=1E8E IP=0103 NV UP EI PL ZR NA PE NC
1E8E:0103 CD21 int 21
-
AX=17E4 BX=0000 CX=0000 DX=00D9 SP=FFFE BP=0000 SI=0000 DI=0000
DS=1E8E ES=1E8E SS=1E8E CS=1E8E IP=0105 NV UP EI PL ZR NA PE NC
1E8E:0105 90 nop
-d dx:ax
00D9:17E0 46 72 65 65-44 4F 53 20 6B 65 72 6E FreeDOS kern
00D9:17F0 65 6C 20 2D 20 47 49 54-20 28 62 75 69 6C 64 20 el - GIT (build
00D9:1800 32 30 34 33 20 4F 45 4D-3A 30 78 66 64 29 20 5B 2043 OEM:0xfd) [
00D9:1810 63 6F 6D 70 69 6C 65 64-20 4F 63 74 20 32 38 20 compiled Oct 28
00D9:1820 32 30 32 31 5D 0A 00 00-68 93 68 93 68 93 68 93 2021]...h.h.h.h.
00D9:1830 BD 94 BD 94 68 93 68 93-BD 94 BD 94 68 93 51 93 ....h.h.....h.Q.
00D9:1840 68 93 BD 94 BD 94 BD 94-68 93 00 00 03 0C 03 0C h.......h.......
00D9:1850 06 0A 0F 00 00 00 13 13-17 18 19 19 22 5B 5D 3A ............"[]:
00D9:1860 7C 3C 3E 2B - |<>+
-
Note the trailing 0Ah byte (Line Feed).
---
l
Complete thread:
- How to detect FreeDOS kernel from Turbo Pascal program? - rosegondon, 14.01.2022, 22:39 (Developers)
- How to detect FreeDOS kernel from Turbo Pascal program? - mceric, 15.01.2022, 00:22
- How to detect FreeDOS kernel from Turbo Pascal program? - rosegondon, 15.01.2022, 16:20
- How to detect FreeDOS kernel from Turbo Pascal program? - Rugxulo, 19.01.2022, 01:05
- 21.33FF kernel version string interface - ecm, 15.01.2022, 17:32
- 21.33FF kernel version string interface - rosegondon, 17.01.2022, 20:06
- 21.33FF kernel version string interface - DosWorld, 18.01.2022, 02:54
- 21.33FF kernel version string interface - rosegondon, 18.01.2022, 09:06
- 21.33FF kernel version string interface - Laaca, 18.01.2022, 14:25
- 21.33FF kernel version string interface - tkchia, 18.01.2022, 15:30
- 21.33FF kernel version string interface - DosWorld, 18.01.2022, 16:44
- 21.33FF kernel version string interface - rosegondon, 18.01.2022, 19:14
- 21.33FF kernel version string interface - rosegondon, 18.01.2022, 09:06
- 21.33FF kernel version string interface - DosWorld, 18.01.2022, 02:54
- 21.33FF kernel version string interface - rosegondon, 17.01.2022, 20:06
- How to detect FreeDOS kernel from Turbo Pascal program? - Laaca, 18.01.2022, 19:06
- How to detect FreeDOS kernel from Turbo Pascal program? - Rugxulo, 19.01.2022, 00:57
- How to detect FreeDOS kernel from Turbo Pascal program? - Laaca, 19.01.2022, 10:33
- How to detect FreeDOS kernel from Turbo Pascal program? - Rugxulo, 19.01.2022, 00:57
- How to detect FreeDOS kernel from Turbo Pascal program? - rosegondon, 15.01.2022, 16:20
- How to detect FreeDOS kernel from Turbo Pascal program? - Oso2k, 15.01.2022, 00:24
- How to detect FreeDOS kernel from Turbo Pascal program? - Laaca, 15.01.2022, 11:09
- How to detect FreeDOS kernel from Turbo Pascal program? - mceric, 15.01.2022, 12:29
- How to detect FreeDOS kernel from Turbo Pascal program? - mceric, 15.01.2022, 00:22