之前微博帖子中引用的链接已挂,今天重新在网上找到了完备版,如下:
(在移动端窄屏看大篇幅代码,大概体验不如 PC 端。大家可以试试点击右上角的「……」,然后「复制链接」,方便的时候,在 PC 端看看。)
火线高能……
;
; RI.ASM Revision 2.12 [ July 12, 1994 ]
Revision equ'V2.12 '
;
;
;
; RAMinit Release 2.0
; Copyright (c) 1989-1994 by Yellow Rose Software Co.
; Written by Mr. Leijun
;
; Function:
; Press HotKey to remove all TSR program after this program
;
;
; ..........................................................................
; Removed Softwares by RI:
; SPDOS v6.0F, WPS v3.0F
; Game Busters III, IV
; NETX ( Novell 3.11 )
; PC-CACHE
; Norton Cache
; Microsoft SmartDrv
; SideKick 1.56A
; MOUSE Driver
; Crazy (Monochrome simulate CGA program)
; RAMBIOS v2.0
; 386MAX Version6.01
; ..........................................................................
; No cancel softwares:
; Windows 3.1 MSD
;
; No removed TSR softwares:
; MS-DOS fastopen
; Buffers, Files ... (QEMM 6.0)
; QCache (386MAX 6.01)
; ..........................................................................
;
COMMENT
V2.04 Use mouse driver software reset function to initiation mouse
2/17/1993 by Mr. Lei and Mr. Feng
V2.05 RI cannot work in Windows DOS prompt
3/9/1993 by Mr. Lei
V2.06 1. When XMS cannot allocate 1K memory, RI halts.
2. RI repeat deallocates EMS memory.
V2.07 HotKey Setup Error
4/25/1993 by Mr. Lei
V2.08 KB Buffer
V2.10 1. Release high memory blocks (EMM386 QEMM386 S-ICE 386MAX)
2. RI copies flag
V2.12 1. Exists a critical error in Init 8259 procedure
2. Save [40:F0--FF] user data area
dosseg
.model tiny
.code
locals @@
org 100h
Start: jmp Main
org 103h
True equ 1
False equ 0
MaxHandles equ 100h
INT3 macro
out 0ffh,al
endm
;
; HotKey Status Test Var
; --------------- ---------------
;
; 7 6 5 4 3 2 1 0 417 418496
; . . x . x . . . Left Alt is pressed 82
; x . . . x . . . Right Alt is pressed 88
; . . . x . x . . Left Ctrl is pressed 41
; . x . . . x . . Right Ctrl is pressed 44
; . . . . . . x . Left Shift is pressed2
; . . . . . . . x Right Shift is pressed1
;
LeftAlt equ00101000b
RightAlt equ10001000b
LeftCtrl equ00010100b
RightCtrl equ01000100b
LeftShift equ00000010b
RightShift equ00000001b
HotKey db LeftCtrl or RightCtrl
DataBegin dw0
NextDataSeg dw 0ffffh
oldInt2F_addr dw 0,0
XMS_control dw 0,0
Handle_begin dw0
cvtOfs dw 0 ; DOS 3.0 equ 0 and above DOS 4.0 is1
org 104h
db 0dh
db Revision
db ??date
db26
org 114h
tsrLength dw0
MachineID db 0FCh ; IBM PC/AT
AuxHotKey db 0 ; 2Dh ; 'X' Scan Code
AuxHotKeyName db'X$ '
Power db True
Flag db'!'
Kbd102 db0
NoFlag db0
StopFlag db1
DosEnv dw0
WorkSeg dw0
PrevDataSeg dw0
Copies db'1'
old_8259 db 0 ; 21h port
db 0 ; a1h port
Status dw0
XMSbit equ00000001b
EMSbit equ00000010b
SKbit equ10000000b
GoINT1C: db 0eah
oldInt1C_addr dw 0,0
newINT1C:
test cs:Status, SKbit
jnz GoINT1C
cmp cs:StopFlag,0
jz @@0
;
; Mr. Lei 2/8/1993
; Problem: if WPS quit and reenter, old RI cann't control keyboard. ;
push ds
push ax
xor ax, ax
mov ds, ax
mov ax, ds:[94]
cmp ax, offset NewInt9
pop ax
pop ds
jnz GoINT1C
mov cs:StopFlag,0
@@0: push ax
push ds
push es
xor ax, ax
mov ds, ax
mov es, ds:[94+2]
cmp word ptr es:[101h], 'IE' ;'LEI'
jz @@1
cli
mov cs:StopFlag,1
mov ax, ds:[94]
mov cs:oldINT9_addr2, ax
mov ax, ds:[94+2]
mov cs:oldINT9_addr2[2], ax
mov ds:[94], offset newINT9_2
mov ds:[94+2], cs
sti
@@1: pop es
pop ds
pop ax
jmp GoINT1C
; ----------------------------------------------------------------------
; INT2F Func
;
; AX = C0D7h Return RI segment in AX
; AX = C0D8h Removes all TSR programs after RI
; AX = C0D9h Removes all TSR programs include RI
; AX = C0DAh Removes all RI copies
; ----------------------------------------------------------------------
newINT9_2:
mov cs:NoFlag,1
pushf
db 9ah ; call far ptr oldint9_addr
oldInt9_Addr2 dw 0,0
jmp newINT9_proc
newINT9:
pushf
db 9ah ; call far ptr oldint9_addr
oldInt9_Addr dw 0, 0 cmp cs:NoFlag,0
jz newINT9_proc
mov cs:NoFlag,0
iret
newINT9_proc:
cmp cs:Flag, '!' ; busy ?
jnz @@0
iret
@@0:
mov cs:Flag, '!' ; set busy flag
push ax ; cmp hot key
push bx
push es
mov ax,40h
mov es,ax
cmp cs:AuxHotKey,0
jz @@_1
mov bx, es:[1ah]
cmp bx, es:[1ch]
jz @@10
push bx
mov bl, es:[bx+1]
cmp bl, cs:AuxHotKey
pop bx
jnz @@10
@@_1:
mov ah,es:[17h] ; test CTRL SHIFT ALT
mov al,cs:HotKey
push ax
and ax,0f0fh
cmp al,ah
pop ax
jnz @@10 cmp cs:Kbd102, True
jnz @@1
shr al,1
shr al,1
shr al,1
shr al,1
push ax
mov ah, es:[18h]
and ax, 303h
cmp al, ah
pop ax
jnz @@10
mov ah, es:[96h]
shr ax,1
shr ax,1
and ax, 303h
cmp al, ah
jnz @@10 cmp cs:AuxHotKey,0
jz @@_3
inc bx
inc bx
cmp bx, 3eh
jb @@_2
mov bx, 1eh
@@_2:
mov es:[1ah], bx
@@_3:
call IsWinDos
or ax, ax
jz @@1
call Beep
@@10:
sti
pop es
pop bx
pop ax
mov cs:Flag, ' ' ; no busy
iret
@@1: ; OK
pop es
pop bx
pop ax
KeepSelf:
call RemoveTSR
push es
mov es,cs:WorkSeg
mov dx,es:tsrLength
mov di,dx
mov al,0h ; Aug 24,1993
mov cx,100h
rep stosb
pop es
int 27h
NoKeepSelf:
mov ax,0e07h
int 10h
mov cs:clsStr, 47h ; Color (White in Red)
call RemoveTSR
dec cs:Copies
call RestoreSelfIntVec
push es
cmp cs:PrevDataSeg,0
jz @@1
mov es, cs:PrevDataSeg
mov es:NextDataSeg,-1
@@1: pop es
mov ax, 4c00h
int 21h
RestoreMCB:
push ds
push es
lodsw ;'MZ'
@@0: lodsw
cmp ax,'MM'
jz @@1
mov es,ax
xor di,di
movsb
movsw
movsw
inc ax
mov bx, ds
cmp ax, bx
jz @@10
mov byte ptr es:[8], 0 ; Aug 24,1993
@@10: cmp byte ptr es:[0],'Z'
jnz @@0
mov byte ptr es:[10h],0
jmp @@0
@@1:
pop es
pop ds
ret
; -------------------------------------------------------------------------
CloseFiles:
mov ax, 5 ; Begin handle
push ds
push si
mov cx, 15 ; Max handle
sub cx, ax
inc cx
mov bx, ax
@@1: push bx
push cx
mov ah, 3eh
int 21h
pop cx
pop bx
inc bx
loop @@1
pop si
pop ds
ret
; -------------------------------------------------------------------------
RestorePort:
mov di, 40h ; restore port
mov es, di
xor di, di
mov cx,8
rep movsw
ret
; -------------------------------------------------------------------------
RestoreLEDs:
lodsb
and al, 11110000b ; LED status
mov ah, es:[17h]
and ah,00001111b
or ah, al
and ah, 0f0h ; Clear CTRL ALT SHIFT
mov es:[17h], ah
ret
; -------------------------------------------------------------------------
RestoreEnvStr:
lodsw
push si
push di
push ds
push es
mov es, cs:DosEnv
mov ds, ax
xor si, si
mov di, si
@@0: lodsb
or al, al
jnz @@1 cmp byte ptr ds:[si],0
jz @@2
@@1: stosb
jmp @@0
@@2: stosb
stosb
pop es
pop ds
pop di
pop si
ret
;----------------------------------------------------------------------------
RestoreFloppyParam: ; Mr. Lei 2/10/1992
push es
push ax
xor ax, ax
mov es, ax
mov byte ptr es:[525h],2
pop ax
pop es
ret
;---------------------------------------------------------------------------
RestoreCVTchain:
lodsw
cmp ax,'VC'
jz @@_0
call Beep
ret
@@_0:
push ax
push cx
push es
; -----------------------------------------------------------------
lodsw ; Device Driver Chain
mov di, ax
lodsw
mov es, ax
xor cx, cx
@@9: push di
mov cl,5
rep movsw
pop di
les di, es:[di]
mov ax, di
inc ax
jnz @@9
pop es
pop cx
pop ax
ret
; ----------------------------------------------------------------------------
RestoreMemoryManager:
test cs:Status, XMSbit
jz @@1
call LoadXMSstatus
@@1:
test cs:Status, EMSbit
jz @@2
call LoadEMSstatus
@@2:
ret
; -----------------------------------------------------------------------
CloseSpeaker:
in al, 61h
and al, 0fch
out 61h, al
ret
; -----------------------------------------------------------------------
RestoreClockSpeed:
mov al,00110110b
out 43h, al
xor ax, ax
out 40h, al
out 40h, al
ret
; -----------------------------------------------------------------------
ResetDisk:
xor ax, ax
xor dx, dx
int 13h ; Restore A
inc dx
int 13h ; Restore B
mov dl, 80h
int 13h ; Restore C
ret
; --------------------------------------------------------------------------
ClosePRN:
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
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
; -----------------------------------------------------------------------
; Displaystring
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 dw0
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,'$'