- mov ah, 51h ; Get PSP seg
- int 21h
- mov es, bx
- mov ax, es:[16h] ; Prev PSP seg
- cmp ax, bx
- jnz @@9
- mov ax, 3e00h ; COMMAND
- mov bx, 4 int 21h
- @@9:
- ret
- InitPRN:
- mov ax, 3e00h
- mov bx, 4 ; PRN
- int 21h
- mov ax, 3d01h
- mov dx, offset PRNname
- push cs
- pop ds
- int 21h
- ret
- PRNname db 'PRN',0
- InitMouse: ; 2/16/1993 by Mr. Lei
- push es
- xor ax, ax
- mov es, ax
- cmp word ptr es:[33h4+2], 0
- jz @@0 cmp word ptr es:[33h4], 0
- jz @@0
- mov ax, 21h
- int 33h ; Hook Mouse Interrupt
- @@0: pop es
- ret
- ; ------------- CMOS CLOCK set to System -----------------------------------
- UpdateTime:
- call GetRealTime
- mov ah, 2dh
- int 21h
- ret
- GetRealTime:
- mov ah,2 int 1Ah
- mov al,ch
- call bcdxchg
- mov ch,al
- mov al,cl
- call bcdxchg
- mov cl,al
- mov al,dh
- call bcdxchg
- mov dh,al
- mov dl,0
- ret
- BCDxchg:
- push ax
- push cx
- mov cl,4
- shr al,cl
- pop cx
- mov bl,0Ah
- mul bl
- pop bx
- and bl,0Fh
- add al,bl
- ret
- ; -----------------------------------------------------------------------
- ; Display string
- ColorPrintStr:
- lodsb
- mov bh, al ; color
- xor cx, cx
- mov dx, 014fh
- mov ax, 0600h
- int 10h
- mov ah, 02 ; GotoXY (0, 0)
- xor dx, dx
- mov bh, 0 int 10h
- PrintStr:
- push cs
- pop ds
- xor bx, bx
- @@1: lodsb
- cmp al, '
- jz @@2
- or al, al
- jz @@2
- mov ah, 0eh
- int 10h
- jmp short @@1
- @@2: mov al, cs:clsStrcolor
- mov cs:clsStr, al
- ret
- ; -----------------------------------------------------------------------
- Self dw 0
- clsStrcolor db 17h
- clsStr db 17h ; Color (White in Blue)
- db ' RAMinit Version 2.12 (c) 1989-1994 by KingSoft Ltd. Mr. Leijun'
- db 0dh,0ah
- db ' ['
- ShowCopies db ''
- db '] Activate...',0ah,0dh,'
- endTSR equ $
- mcbList equ offset endTSR + 2 + 2
- vecList equ mcbList + 710 + 2 + 10h + 1 + 400h
- devLink equ vecList + 4 + 5 26 + 4 + 10 30h + 4
- xmsList equ devLink + 2 + MaxHandles 2
- emsList equ xmsList + 4 + 1024
- crtMode equ emsList + 2 + 1Dh + 4 + 10h
- tsrLen equ crtMode + 1
- ;
- ; DOS Environment Reserved by RI
- ; --------------------------------------------------
- ; Flag 'XX' 2 bytes
- ; Environment Segment 1 word
- ; Free MCBs <=710 bytes
- ; MCB segment 1 word
- ; MCB 5 bytes
- ; End flag 'MM' 1 word
- ; COM LPT ports 10h bytes
- ; LEDs status 1 bytes
- ; Packed vectors list <=400h bytes
- ; Flag 'CV' 2 bytes
- ; CVT First DPB pointer 4 bytes
- ; DPBs data <=526 bytes
- ; First DCB pointer 4 bytes
- ; Pointer to NUL 4 bytes
- ; All device driver datas <=30h10 bytes
- ; Flag 'XM' 2 bytes
- ; XMS free handle counter 2 bytes
- ; EMS free handle list <=100h4 bytes
- ; Flag 'EM' 2 bytes
- ; EMS free handle counter 2 bytes
- ; EMS free handle list <=1024 bytes
- ; EMS handle 1 word
- ; Number of pages 1 word
- ; Flag '--' 1 word
- ; Equipment List 1 word
- ; CRT 40:49h-66h 1dh bytes
- ; 40:A8h 1 dword
- ; BIOS User Data Area 40:F0--FF 10h bytes
- ; **
- ;
- main: jmp main0
- Print Macro Str
- Lea dx, Str
- call DisplayStr
- endm
- InstMsg db 'RAMinit Version 2.12 '
- db 'Copyright (c) 1989-1994 by KingSoft Ltd. ',0dh,0ah,'
- Msg0 db 'Already installed !',0dh,0ah,0ah
- db 'For Help, type "RI /?". ',0dh,0ah,'
- Msg_0 db 0ah,'Residents a new RAMinit copy [y/n] ?
- Msg_2 db 'OK, RI No.'
- Msg_RI db '2'
- db ' residents successful !', 0dh,0ah,'
- Msg1 db 'Activate with:
- KeyMsg db 'Right_Shift
- db 'Left_Shift$ '
- KMsg1 db 'Left_Ctrl$ '
- db 'Left_Alt$ '
- db 'Right_Ctrl$ '
- db 'Right_Alt$ '
- KMsg2 db 'Ctrl$ '
- db 'Alt$ '
- db 'Ctrl$ '
- db 'Alt$ '
- PlusMsg db ' +
- crlf db 0dh,0ah,'
- HelpMsg db 'Programmed by Mr. Leijun Dec 1992', 0dh,0ah,0ah
- db 'Usage: RI [options]',0dh,0ah,0ah
- db '/H,/? Display this screen',0dh,0ah
- db '/CLS Removes all TSR programs after current RI',0dh,0ah
- db '/RET Removes TSR programs include current RI',0dh,0ah
- db '/NEW Residents a new data copy of current environment',0dh,0ah
- db '/ALL Removes all RI copies and all other tsr programs',0dh,0ah
- db '/Sxyy.. Define Hotkey x=AuxHotkey yy..=shift status',0dh,0ah
- db ' x=auxiliary hotkey (default is "X") ',0dh,0ah
- db ' x equ "1" means need AuxHotkey',0dh,0ah
- db ' yy..=shift status [CAScas]',0dh,0ah
- db ' C: Left Ctrl A: Left Alt S: Left Shift',0dh,0ah
- db ' c: Right Ctrl a: Right Alt s: Right Shift',0dh,0ah,0ah
- db 'Example: "RI /S1c" means Hotkey is Right_Ctrl+X',0dh,0ah
- db ' "RI /S0Cc" means HotKey is Left_Ctrl+Right_Ctrl',0dh,0ah
- db ' "RI /CLS" equals simply press hotkey',0dh,0ah
- db ' "RI /RET" Removes all TSRs after current RI and this RI',0dh,0ah
- db 0ah
- db 'Contact me for RAMinit problems: (01)2561155 Call 1997',0dh,0ah
- db '
- ErrMsg db 'ERROR: Invalid options !',0dh,0ah,0ah,'
- WinErr db 7, 'Sorry, I cannot work in Windows DOS environment.',0dh,0ah,'
- SetMsg db 7, 'Defines new Hotkey successful !',0dh,0ah,0ah,'
- tsrOK db False
- Main0:
- cld
- Print instMsg
- call IsWinDos
- or ax, ax
- jz @@1
- Print WinErr
- mov ax, 4c00h
- int 21h
- @@1:
- call HotKeyValid
- mov cs:Status, 0
- call EMS_test
- call CmpDosVer
- call CmpSideKick
- call GetMachineID
- call ModifyHotKeyPrompt
- mov ax, 0c0d7h
- int 2fh
- mov es, ax
- cmp word ptr es:[101h], 'IE' ; 'LEI'
- jnz @@0
- mov cs:Self, ax
- @@0:
- call CmdLine
- call PrintHotKeyPrompt
- cmp cs:tsrOK, true
- jz @@2
- call tsrReplyOK
- @@2: cmp cs:tsrOK, true
- jnz @@_2
- call PrintCopies
- @@_2:
- mov word ptr cs:[100h], 'EL'
- mov byte ptr cs:[102h], 'I'
- push cs
- pop es
- push cs
- pop ds
- std
- mov si, offset eof
- mov cx, eof - offset Here
- mov di, tsrLen
- add di, cx
- inc cx
- rep movsb
- cld
- mov bx, tsrLen
- jmp bx
- Here:
- mov ax,cs
- mov es,ax
- mov di,offset endTSR
- mov cs:DataBegin, di
- mov cs:NextDataSeg, -1
- mov ax, 'XX'
- stosw
- in al, 0a1h
- mov ah, al
- in al, 21h
- push ax
- mov word ptr cs:old_8259, ax
- xor ax, ax
- out 21h,al ; CLI
- call SaveOthers
- call SetSelfInt
- call BackupVecList
- cmp cs:Power, true
- jnz @@20
- call BackupCVTchain
- call BackupMemoryManager
- @@20:
- call BackupBiosData
- sti
- mov cs:Flag, ' ' ; no busy
- mov cs:StopFlag, 0 ;
- mov cs:tsrLength, di
- call SetDosEnvSeg
- cmp cs:Self, 0
- jz @@29
- push cs
- pop ds
- push cs
- pop es
- cld
- mov cx, cs:tsrLength
- mov si, cs:DataBegin
- sub cx, si
- mov di, 120h
- mov cs:DataBegin, di
- rep movsb
- mov cs:tsrLength, di
- @@29:
- pop ax
- out 21h, al ; STI
- mov al, ah
- out 0a1h, al
- mov dx, cs:tsrLength
- inc dx
- int 27h
- ; ----------------------------------------------------------------------------
- SetDosEnvSeg:
- push ds
- push es
- mov ax, cs
- @@10: mov es, ax
- mov ax, es:[16h] ; Get father process psp segment
- or ax, ax
- jz @@11
- mov bx, es
- cmp ax, bx
- jnz @@10
- @@11:
- mov es, word ptr es:[2ch] ; Get father process env segment
- mov cs:DosEnv, es
- pop es
- pop ds
- ret
- ; ----------------------------------------------------------------------------
- SaveOthers:
- mov ax, cs:[2ch] ; Env Seg
- stosw
- call backupMCB ; Current MCB
- mov ax, 40h ; COM LPT Port
- mov ds, ax
- mov si, 0h
- mov cx, 8
- rep movsw
- mov si, 17h ; LED status
- lodsb
- stosb
- ; call OpenLEDs
- ret
- ; --------------------------------------------------------------------------
复制代码
|