home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ASMPRG.ZIP / READ.ME < prev    next >
Text File  |  1993-01-30  |  3KB  |  60 lines

  1. ********************************************************************************
  2. ****************************- I M P O R T A N T -*******************************
  3. ********************************************************************************
  4. **                                                                            **
  5. **    "This software is provided as is and carries no warranty whatsoever.    **
  6. **    Larry Morley ("Author") disclaims and excludes any and all implied      **
  7. **    warranties of merchantability, title and fitness for particular         **
  8. **    purpose.  Author does not warrant that the software will satisfy your   **
  9. **    requirements or that the software is without defect or error or that    **
  10. **    operation of the software will be uninterrupted.  You are using the     **
  11. **    software at your risk.  Use of this software constitutes acceptance     **
  12. **    of these terms."                                                        **
  13. **                                                                            **
  14. ********************************************************************************
  15. ********************************************************************************
  16. *  (c) Larry Morley 1992, 1993; All Rights Reserved.                           *
  17. ********************************************************************************
  18.  
  19. These files contain a couple of things - a OS/2 2.0 program in assembler that
  20. makes KBD and VIO calls, and a demo of one way to call 16 bit code from 32
  21. bit code (KDB, VIO et. al. are still 16 bit...).
  22.  
  23. Here's how the 32 bit code calls the 16 bit functions:
  24.  
  25.    (1) The 32 bit caller uses the PREP16 macro to allocate local temp
  26.        storage /work space for registers and addresses.
  27.  
  28.    (2) The 32 bit caller pushes function parameters on the stack; optionally,
  29.        32 bit flat pointers are converted to SELECTOR:OFFSET.
  30.  
  31.    (3) The 32 bit caller uses the CALL16 macro to call the 16 bit function.
  32.  
  33. Here's how control is transferred between 32 and 16 bit code:
  34.  
  35.    The 32 bit caller calls a function in a USE32 segment.  This function
  36.    does a 48 bit FAR jump (16 bit segment, 32 bit offset) to a function
  37.    in a USE16 segment, after saving a 48 bit return address on the stack.
  38.    The 48 bit (FWORD) jump loads CS and EIP; this allows the jump into
  39.    the 16 bit segment (the high order 16 bits of EIP are zeroed).  The
  40.    16 bit function then calls the target 16 bit function.  When the
  41.    target function returns, the 16 bit code does a 48 bit FAR jump back
  42.    to the 32 bit intermediate segment, which restores registers and
  43.    returns to the original caller.
  44.  
  45.    This approach doesn't use FS or GS (IBM and MS docs say they're reserved
  46.    for use by the operating system), and the code is pure with no data
  47.    segment.
  48.  
  49.    Please send me any feedback - comments, questions, etc. - that you
  50.    might have.
  51.  
  52.    Larry Morley
  53.    CIS 73670,563
  54.  
  55.    6909 Custer Rd #2503
  56.    Plano, TX 75023
  57.    (214) 618-0934
  58.  
  59.    <end>
  60.