From 9923c80d62b339010ba5bbe6c77ef3501b5ce726 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sun, 30 Jul 2023 13:42:19 +0200 Subject: more robust extendend memory detection --- dosfetch.pas | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/dosfetch.pas b/dosfetch.pas index 014a793..979924d 100644 --- a/dosfetch.pas +++ b/dosfetch.pas @@ -33,8 +33,40 @@ begin end; procedure extended_memory; +var a, c, d : integer; + l : longint; + err : byte; begin - writeln(cmos($17) + 256*longint(cmos($18)), ' KB'); + err := 0; + + asm + mov ah, $88; + int $15; + jnc @@skip; + mov err, ah; + @@skip: + mov a, ax; + end; + + if err > 0 then + writeln('none') { XXX could be wrong on XT } + else begin + asm + clc; + mov ax, $E801; + int $15; + jnc @@skip; + mov err, ah; + @@skip: + mov c, cx; + mov d, dx; + end; + + if err > 0 then + writeln(cmos($17) + 256*longint(cmos($18)), ' KB') + else + writeln(longint(c) + 64*longint(d), ' KB'); + end; end; procedure disksize(disk: byte); -- cgit 1.4.1