home *** CD-ROM | disk | FTP | other *** search
- ;
- ; **************************************************
- ; * Copyright (c) 1991.7.10 by Mr. Lei *
- ; **************************************************
- ;
- .model tiny
- .code
- org 100h
-
- Start: jmp Main
-
- org 4000h
-
- Handle dw 0
- DefaultPage db 0ffh
- Fname db 'E:\XSLIB.LEI', 0
- cclib db '\CCLIBJ.DOT', 0
-
- Int60:
- ;
- ; Entry: BH -- Functions 80h: Change XSLIB Page
- ; BL -- XSLIB Page
- ; Functions 81h: Return Segment value
- ; Return: CS:0 -- 16K Page Data
- ;
- cmp bh, 80h
- jz INT60_1
- jmp INT60_2
- INT60_1:
- int 3
- cmp bl, cs:defaultpage
- jnz int60_0
- iret
- int60_0:
- mov cs:defaultpage, bl
-
- push ax
- push bx
- push cx
- push dx
- push ds
-
- push cs
- pop ds
-
- cmp bl, 60h
- jb XS
- mov dx, offset cclib ; Read cclib
- sub bl, 60h
- jmp ok
- XS:
- mov dx, offset Fname
- OK:
- push bx
- mov ax, 3d00h ; Read-only access
- int 21h ; Open file
- pop bx
- mov Handle, ax
-
- mov ax, 4000h
- xor bh, bh
- mul bx ; DX:AX = Source * AX
- mov cx, dx
- mov dx, ax ; file offset CX:DX
-
- mov bx, cs:Handle
- mov ax, 4200h ; Move pointer from beginning
- int 21h ; Move file pointer to page
-
- mov cx, 4000h ; 16K
- xor dx, dx ; DS:DX = CS:0000
- mov ah, 3fh
- int 21h ; Read file
-
- mov ah, 3eh
- int 21h ; Close file
-
- pop ds
- pop dx
- pop cx
- pop bx
- pop ax
- iret
- INT60_2:
- cmp bh, 81h
- jz INT60_3
- jmp INT60_Exit
-
- INT60_3: mov bx, cs
- mov ds:word ptr [6146h], bx
- INT60_Exit:
- iret
-
- ; *********************************************************
-
- Main0:
-
- ShowMsg db 'INT60 1991.7', 0dh, 0ah, '$'
- ErrorMsg db 'Sorry, XSLIB not found!', 0dh, 0ah, '$', 0
-
- Main:
- push cs
- pop ds
-
- mov ah, 9
- mov dx, offset ShowMsg
- int 21h
-
- mov ax, 3d00h ; Read-only access
- mov dx, offset Fname
- int 21h ; Open file
- jnc OpenOK
-
- mov ah, 9 ; Open fail
- mov dx, offset ErrorMsg
- int 21h
- mov ax, 4c01h ; Error Exit to Dos
- int 21h ; Exit code is 01H
-
- OpenOK:
- mov bx, ax
- mov ah, 3eh
- int 21h ; close file
-
- mov ax, 2560h
- mov dx, offset Int60
- int 21h ; Set interrupt vector 60h
- mov dx, offset Main0
- int 27h ; TSR
-
- end Start
-