home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / PROG / XLIB.ZIP / EXAMPLE1.ASM next >
Encoding:
Assembly Source File  |  1993-08-23  |  1.6 KB  |  40 lines

  1.                .MODEL        LARGE,PASCAL
  2.                .386P
  3.  
  4.                INCLUDE        XLIB.INC       ;Include XLIB public symbols
  5.                INCLUDELIB     XLIB.LIB       ;Link with XLIB.LIB
  6.  
  7.                .STACK         1024
  8.                .CODE
  9.                .STARTUP
  10.                CALL           INITXLIB       ;Initialize XLIB
  11.                OR             EAX,EAX        ;EAX = 0 if successful
  12.                JZ             INITDONE
  13.                .EXIT          0              ;Initialization failed
  14.  
  15. INITDONE:      PUSHD          OFFSET DEMOPROC
  16.                CALL           CALLPM         ;Execute DEMOPROC in protected
  17.                .EXIT          0
  18.  
  19. ;Protected-mode routines must be placed in following segment:
  20. TSEG           SEGMENT PARA PUBLIC USE32 'CODE'
  21.                ASSUME CS:TSEG, SS:TSEG, DS:TSEG, ES:TSEG, FS:DSEG, GS:DGROUP
  22.  
  23. ;Protected-mode routine to print message to the screen using DOS function.
  24. DEMOPROC       PROC NEAR
  25.                MOV            EBX,OFFSET PMMSG
  26.                MOV            AH,02H
  27. MSGLOOP:       MOV            DL,CS:[EBX]    ;32-bit offset!!!!!
  28.                OR             DL,DL
  29.                JZ             EXIT
  30.                INT            21H            ;Print character with DOS
  31.                INC            EBX
  32.                JMP            MSGLOOP
  33. EXIT:          RET                           ;Go back to real or V86 mode
  34. PMMSG          DB  "In 32-bit protected mode!!!  "
  35.                DB  "Returning to real mode.",10,13,0
  36. DEMOPROC       ENDP
  37.  
  38. TSEG           ENDS
  39.                END
  40.