home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l005 / 2.ddi / SAMPLE / INT.ASM < prev    next >
Encoding:
Assembly Source File  |  1991-11-09  |  3.9 KB  |  133 lines

  1. ;
  2. ; **************************************************
  3. ; *     Copyright (c) 1991.7.10 by   Mr. Lei       *
  4. ; **************************************************
  5. ;
  6.                 .model  tiny
  7.                 .code
  8.                 org     100h
  9.  
  10. Start:          jmp     Main
  11.  
  12.                 org     4000h
  13.  
  14. Handle       dw 0
  15. DefaultPage  db 0ffh
  16. Fname        db 'E:\XSLIB.LEI', 0
  17. cclib        db '\CCLIBJ.DOT', 0
  18.  
  19. Int60:
  20. ;
  21. ;     Entry:    BH    --   Functions 80h: Change XSLIB Page
  22. ;                                         BL --  XSLIB Page
  23. ;                          Functions 81h: Return Segment value
  24. ;     Return:   CS:0  --   16K Page Data
  25. ;
  26.                 cmp     bh, 80h
  27.                 jz      INT60_1
  28.                 jmp     INT60_2
  29. INT60_1:
  30.                 int     3
  31.                 cmp     bl, cs:defaultpage
  32.                 jnz     int60_0
  33.                 iret
  34. int60_0:
  35.                 mov     cs:defaultpage, bl
  36.  
  37.                 push    ax
  38.                 push    bx
  39.                 push    cx
  40.                 push    dx
  41.                 push    ds
  42.  
  43.                 push    cs
  44.                 pop     ds
  45.  
  46.                 cmp     bl, 60h
  47.                 jb      XS
  48.                 mov     dx, offset cclib        ; Read cclib
  49.                 sub     bl, 60h
  50.                 jmp     ok
  51. XS:
  52.                 mov     dx, offset Fname
  53. OK:
  54.                 push    bx
  55.                 mov     ax, 3d00h               ; Read-only access
  56.                 int     21h                     ; Open file
  57.                 pop     bx
  58.                 mov     Handle, ax
  59.  
  60.                 mov     ax, 4000h
  61.                 xor     bh, bh
  62.                 mul     bx                      ; DX:AX = Source * AX
  63.                 mov     cx, dx
  64.                 mov     dx, ax                  ; file offset CX:DX
  65.  
  66.                 mov     bx, cs:Handle
  67.                 mov     ax, 4200h               ; Move pointer from beginning
  68.                 int     21h                     ; Move file pointer to page
  69.  
  70.                 mov     cx, 4000h               ; 16K
  71.                 xor     dx, dx                  ; DS:DX = CS:0000
  72.                 mov     ah, 3fh
  73.                 int     21h                     ; Read file
  74.  
  75.                 mov     ah, 3eh
  76.                 int     21h                     ; Close file
  77.  
  78.                 pop     ds
  79.                 pop     dx
  80.                 pop     cx
  81.                 pop     bx
  82.                 pop     ax
  83.                 iret
  84. INT60_2:
  85.                 cmp     bh, 81h
  86.                 jz      INT60_3
  87.                 jmp     INT60_Exit
  88.  
  89. INT60_3:        mov     bx, cs
  90.                 mov     ds:word ptr [6146h], bx
  91. INT60_Exit:
  92.                 iret
  93.  
  94. ; *********************************************************
  95.  
  96. Main0:
  97.  
  98. ShowMsg      db 'INT60  1991.7', 0dh, 0ah, '$'
  99. ErrorMsg     db 'Sorry, XSLIB not found!', 0dh, 0ah, '$', 0
  100.  
  101. Main:
  102.                 push    cs
  103.                 pop     ds
  104.  
  105.                 mov     ah, 9
  106.                 mov     dx, offset ShowMsg
  107.                 int     21h
  108.  
  109.                 mov     ax, 3d00h               ; Read-only access
  110.                 mov     dx, offset Fname
  111.                 int     21h                     ; Open file
  112.                 jnc     OpenOK
  113.  
  114.                 mov     ah, 9                   ; Open fail
  115.                 mov     dx, offset ErrorMsg
  116.                 int     21h
  117.                 mov     ax, 4c01h               ; Error Exit to Dos
  118.                 int     21h                     ; Exit code is  01H
  119.  
  120. OpenOK:
  121.                 mov     bx, ax
  122.                 mov     ah, 3eh
  123.                 int     21h                     ; close file
  124.  
  125.                 mov     ax, 2560h
  126.                 mov     dx, offset Int60
  127.                 int     21h                     ; Set interrupt vector 60h
  128.                 mov     dx, offset Main0
  129.                 int     27h                     ; TSR
  130.  
  131.                 end     Start
  132.  
  133.