HELP: Pascal & C/C++ (with a little assembly)

Discussion in 'C Programming' started by dhruba.bandopadhyay@hotmail.com, Aug 5, 2007.

  1. Guest

    Am using Borland C++ 4.5 for the old dos.h APIs. It appears that newer
    versions of compilers stop support for the oldskool DOS routines. Am
    trying to convert/port an oldskool Pascal program that uses registers/
    interrupts into C/C++.


    1. What are the inline($FA); & inline($FB); Pascal functions? What is
    the C/C++ equivalent?
    inline($CD / $1C);
    inline($9C);


    2. Just checking if this is correct Pascal-to-C conversion:

    fillchar(playscores, sizeof(playscores), 0);//Pascal
    memset(&playscores, 0, sizeof(playscores));//C

    scrofsptr = addr(scr_ofs);//Pascal
    scrofsptr = &(scr_ofs);//C

    getintvec(0x9, oldkeyvec);//Pascal
    getvect(0x9, oldkeyvec);//C

    setintvec(0x9, addr(newkbdint()));//Pascal
    setvect(0x9, &(newkbdint));//C

    s = seg(dat);//Pascal
    s = (unsigned int)dat & 0xFFFF0000;//C

    o = ofs(dat);//Pascal
    o = (unsigned int)dat & 0x0000FFFF;//C

    port[0x40] = lo(count);//Pascal
    outp( 0x40, lo(count) );//C

    port[0x40] = hi(count);//Pascal
    outp( 0x40, hi(count) );//C


    3. dos.h contains a bunch of register structures.
    My Pascal functions makes use of bx, es, si registers and this fits
    nicely in struct REGPACK.
    However some Pascal functions uses the 'al' register and struct
    REGPACK doesn't have this member.

    The union REGS gives me the 'al' register but doesn't provide a 'es'
    register. See the dilemma?

    It appears each function fills in a register struct and then calls
    either:
    intr(0x7a, &regs);
    or
    intr(0x2f, &regs);

    Should I use the int386x() function since it takes 2 register
    structures, one for input, one for output/result?

    and then checks the 'al' member for the results.


    4. How can I reverse the bits of a byte or word?
     
    , Aug 5, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tad Johnson
    Replies:
    4
    Views:
    387
    Tad Johnson
    Jan 25, 2004
  2. Replies:
    6
    Views:
    382
    Moonlit
    Sep 2, 2006
  3. Replies:
    5
    Views:
    383
    Moonlit
    Sep 2, 2006
  4. ThaDoctor
    Replies:
    3
    Views:
    385
    Alan Woodland
    Sep 28, 2007
  5. Daniel
    Replies:
    1
    Views:
    214
    Bart van Ingen Schenau
    Jul 9, 2013
Loading...

Share This Page