Please convert this C program to TP7 (again :) 
Author Message
 Please convert this C program to TP7 (again :)

Hi,
Sorry, I will give more info and the full program this time around.  This is my
2nd time posting to newsgroups (1st was the last post) so forgive me, Pascal
gurus.
This program was designed for use in C to check if MSCDEX is installed and give
its version number.  I programmed it in C and it works, but as my favorite
language is pascal (TMT for the moment) I want to convert it all to pascal.
Thanks in advance!

Here's the full code:
BTW, I got this code off the net at http://www.*-*-*.com/ ~marcj/cdrom.html

int isMSCDEX_installed(void)
{
   unsigned short flag = 0xDADA;
   unsigned char  status = 0;
   asm {
      mov   AX,flag
      push  AX
      mov   AX,01100H
      int     2FH
      pop    BX
      mov   flag,BX
      mov   status,AL
    }
   return ((status == 0xFF && flag == 0xADAD) ? 1 : 0);

Quote:
}

And to check version Number is the following (short) program:

void displayMSCDEX_version(void)
{
   union REGS r;
   r.x.ax = 0x150C;
   int86(0x2F, &r, &r);
   printf("MSCDEX version %d.%2.2d\n",r.h.bh,r.h.bl);

Quote:
}

Anyways, thank you for your previous posts......


Sun, 09 Mar 2003 10:28:12 GMT  
 Please convert this C program to TP7 (again :)


Quote:
> Hi,
> Sorry, I will give more info and the full program this time around.
This is my
> 2nd time posting to newsgroups (1st was the last post) so forgive me,
pascal
> gurus.
> This program was designed for use in C to check if MSCDEX is installed
and give
> its version number.  I programmed it in C and it works, but as my
favorite
> language is pascal (TMT for the moment) I want to convert it all to
pascal.
> Thanks in advance!

> Here's the full code:
> BTW, I got this code off the net at

http://www.he.net/~marcj/cdrom.html

- Show quoted text -

Quote:

> int isMSCDEX_installed(void)
> {
>    unsigned short flag = 0xDADA;
>    unsigned char  status = 0;
>    asm {
>       mov   AX,flag
>       push  AX
>       mov   AX,01100H
>       int     2FH
>       pop    BX
>       mov   flag,BX
>       mov   status,AL
>     }
>    return ((status == 0xFF && flag == 0xADAD) ? 1 : 0);
> }

function Is_MSCDEX_installed: boolean;
var flag: word;
    status: shortint;
begin
     flag := $DADA;
     asm
        mov ax, flag
        push ax
        mov ax, 01100h
        int 02Fh
        pop bx
        mov flag, bx
        mov status, al
     end;
     Is_MSCDEX_Installed = (status = -1) and (flag = $ADAD);
end;

But for this one there is simpler code: (returns true if mscdex is not
there)
function Is_MSCDEX_Not_installed: boolean; assembler;
asm
   mov ax, 0DADAh
   push ax
   (* with $G+ (286 code), you can even write push 0DADAh *)
   mov ax, 01100h
   int 02Fh
   pop bx
   xor ah, ah           (* high byte of ax = 0 *)
   dec ah               (* if correct, ax is now 0FFFFh *)
   xor bx, not 0ADADh   (* if correct, bx is now 0FFFFh *)
   and ax, bx           (* if correct, ax is still 0FFFFh *)
   and al, ah           (* if correct, al is still 0FFh *)
   inc al               (* if correct, al (return value) is 000h *)
end;

Are there further optimizations for it?

Quote:

> And to check version Number is the following (short) program:

> void displayMSCDEX_version(void)
> {
>    union REGS r;
>    r.x.ax = 0x150C;
>    int86(0x2F, &r, &r);
>    printf("MSCDEX version %d.%2.2d\n",r.h.bh,r.h.bl);
> }

This trick is also available; but printf is not there in Pascal.
uses Dos; (* like a INCLUDE *)

procedure Display_MSCDEX_Version ();
var regs: registers;
begin
     regs.ax := $150C;
     intr ($2F, regs);
     writeln ('MSCDEX version ', regs.bh, '.', regs.bl);
end;

Quote:
> Anyways, thank you for your previous posts......

--
Rudolf Polzer

Sent via Deja.com http://www.deja.com/
Before you buy.



Sun, 09 Mar 2003 14:18:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Tp7-Help me please to convert a bitmap pictures

2. PLEASE HELP - convert TP6 TPU files to TP7

3. Convert this C program to TP7

4. help needed please for CS 110 class

5. Problem with Delphi3 CS and Sybase 11 - HELP please

6. TP7 free again

7. Program Idea Please please please

8. Program Idea Please Please Please

9. Running sub-programs in TP6/TP7 programs

10. please help again on BLOB.

11. help again,please

12. Sigh-Help MSSQL again please!

 

 
Powered by phpBB® Forum Software