阅读800 返回首页    go 阿里云 go 技术社区[云栖]


雷军20年前编写的汇编代码

Assembly code written by Xiaomi CEO Lei Jun, 25 years ago

In case you never heard of Xiaomi, it is Apple Inc. in China. Xiaomi is so hot in Asia now. Former Google Android exec Hugo Barra joined it and enjoy working there.

The CEO of Xiaomi, Lei Jun, is considered as Steve Jobs in China. But, Lei Jun can actually write code ... 

(This page is created by sending the code file as an attachment to *****@mailp.in -- create a web page with an email).

RI.ASM:

  1. ;
  2. ; RI.ASM Revision 2.12 [ July 12, 1994 ]
  3. Revision equ 'V2.12 '
  4. ;
  5. ; **************************************************************************
  6. ; * *
  7. ; * RAMinit Release 2.0 *
  8. ; * Copyright (c) 1989-1994 by Yellow Rose Software Co. *
  9. ; * Written by Mr. Leijun *
  10. ; * *
  11. ; * Function: *
  12. ; * Press HotKey to remove all TSR program after this program *
  13. ; * *
  14. ; **************************************************************************
  15.  
  16. ; ..........................................................................
  17. ; Removed Softwares by RI:
  18. ; SPDOS v6.0F, WPS v3.0F
  19. ; Game Busters III, IV
  20. ; NETX ( Novell 3.11 )
  21. ; PC-CACHE
  22. ; Norton Cache
  23. ; Microsoft SmartDrv
  24. ; SideKick 1.56A
  25. ; MOUSE Driver
  26. ; Crazy (Monochrome simulate CGA program)
  27. ; RAMBIOS v2.0
  28. ; 386MAX Version 6.01
  29. ; ..........................................................................
  30. ; No cancel softwares:
  31. ; Windows 3.1 MSD
  32. ;
  33. ; No removed TSR softwares:
  34. ; MS-DOS fastopen
  35. ; Buffers, Files ... (QEMM 6.0)
  36. ; QCache (386MAX 6.01)
  37. ; ..........................................................................
  38. ;
  39. COMMENT *
  40.  
  41. V2.04 Use mouse driver software reset function to initiation mouse
  42. 2/17/1993 by Mr. Lei and Mr. Feng
  43. V2.05 RI cannot work in Windows DOS prompt
  44. 3/9/1993 by Mr. Lei
  45. V2.06 1. When XMS cannot allocate 1K memory, RI halts.
  46. 2. RI repeat deallocates EMS memory.
  47. V2.07 HotKey Setup Error
  48. 4/25/1993 by Mr. Lei
  49. V2.08 KB Buffer
  50. V2.10 1. Release high memory blocks (EMM386 QEMM386 S-ICE 386MAX)
  51. 2. RI copies flag
  52. V2.12 1. Exists a critical error in Init 8259 procedure
  53. 2. Save [40:F0--FF] user data area
  54.  
  55. *
  56.  
  57. dosseg
  58. .model tiny
  59. .code
  60. locals @@
  61. org 100h
  62.  
  63. Start: jmp Main
  64. org 103h
  65.  
  66. True equ 1
  67. False equ 0
  68. MaxHandles equ 100h
  69.  
  70. INT3 macro
  71. out 0ffh,al
  72. endm
  73. ;
  74. ; HotKey Status Test Var
  75. ; --------------- ---------------
  76. ;
  77. ; 7 6 5 4 3 2 1 0 417 418 496
  78. ; . . x . x . . . Left Alt is pressed 8 2
  79. ; x . . . x . . . Right Alt is pressed 8 8
  80. ; . . . x . x . . Left Ctrl is pressed 4 1
  81. ; . x . . . x . . Right Ctrl is pressed 4 4
  82. ; . . . . . . x . Left Shift is pressed 2
  83. ; . . . . . . . x Right Shift is pressed 1
  84. ;
  85. LeftAlt equ 00101000b
  86. RightAlt equ 10001000b
  87. LeftCtrl equ 00010100b
  88. RightCtrl equ 01000100b
  89. LeftShift equ 00000010b
  90. RightShift equ 00000001b
  91. HotKey db LeftCtrl or RightCtrl
  92.  
  93. DataBegin dw 0
  94. NextDataSeg dw 0ffffh
  95. oldInt2F_addr dw 0, 0
  96. XMS_control dw 0, 0
  97. Handle_begin dw 0
  98. cvtOfs dw 0 ; DOS 3.0 equ 0 and above DOS 4.0 is 1
  99. org 104h
  100. db 0dh
  101. db Revision
  102. db ??date
  103. db 26
  104. org 114h
  105. tsrLength dw 0
  106. MachineID db 0FCh ; IBM PC/AT
  107.  
  108. AuxHotKey db 0 ; 2Dh ; 'X' Scan Code
  109. AuxHotKeyName db 'X$ '
  110. Power db True
  111. Flag db '!'
  112. Kbd102 db 0
  113. NoFlag db 0
  114. StopFlag db 1
  115. DosEnv dw 0
  116. WorkSeg dw 0
  117. PrevDataSeg dw 0
  118. Copies db '1'
  119. old_8259 db 0 ; 21h port
  120. db 0 ; a1h port
  121.  
  122. Status dw 0
  123. XMSbit equ 00000001b
  124. EMSbit equ 00000010b
  125. SKbit equ 10000000b
  126.  
  127. GoINT1C: db 0eah
  128. oldInt1C_addr dw 0, 0
  129. newINT1C:
  130. test cs:Status, SKbit
  131. jnz GoINT1C
  132. cmp cs:StopFlag, 0
  133. jz @@0
  134. ;
  135. ; Mr. Lei 2/8/1993
  136. ; Problem: if WPS quit and reenter, old RI cann't control keyboard.
  137. ;
  138. push ds
  139. push ax
  140. xor ax, ax
  141. mov ds, ax
  142. mov ax, ds:[9*4]
  143. cmp ax, offset NewInt9
  144. pop ax
  145. pop ds
  146. jnz GoINT1C
  147. mov cs:StopFlag, 0
  148.  
  149. @@0: push ax
  150. push ds
  151. push es
  152. xor ax, ax
  153. mov ds, ax
  154. mov es, ds:[9*4+2]
  155. cmp word ptr es:[101h], 'IE' ; 'LEI'
  156. jz @@1
  157. cli
  158. mov cs:StopFlag, 1
  159. mov ax, ds:[9*4]
  160. mov cs:oldINT9_addr2, ax
  161. mov ax, ds:[9*4+2]
  162. mov cs:oldINT9_addr2[2], ax
  163. mov ds:[9*4], offset newINT9_2
  164. mov ds:[9*4+2], cs
  165. sti
  166. @@1: pop es
  167. pop ds
  168. pop ax
  169. jmp GoINT1C
  170.  
  171. ; ----------------------------------------------------------------------
  172. ; INT2F Func
  173. ;
  174. ; AX = C0D7h Return RI segment in AX
  175. ; AX = C0D8h Removes all TSR programs after RI
  176. ; AX = C0D9h Removes all TSR programs include RI
  177. ; AX = C0DAh Removes all RI copies
  178. ; ----------------------------------------------------------------------
  179.  
  180. newINT2F:
  181. cmp ax, 0c0d7h ; LEI Hanzi GB Code
  182. jnz @@1
  183. push cs
  184. pop ax
  185. iret
  186. @@1: cmp ax, 0c0d7h+1
  187. jnz @@2
  188. jmp KeepSelf
  189. @@2: cmp ax, 0c0d7h+2
  190. jnz @@3
  191. jmp NoKeepSelf
  192. @@3: cmp ax, 0c0d7h+3
  193. jnz @@9
  194. mov cs:NextDataSeg, -1
  195. mov cs:Copies, '1'
  196. jmp NoKeepSelf
  197. @@9: jmp dword ptr cs:oldInt2F_addr
  198.  
  199.  
  200. CallInt9:
  201. ret
  202.  
  203.  
  204. newINT9_2:
  205. mov cs:NoFlag, 1
  206. pushf
  207. db 9ah ; call far ptr oldint9_addr
  208. oldInt9_Addr2 dw 0, 0
  209. jmp newINT9_proc
  210.  
  211. newINT9:
  212. pushf
  213. db 9ah ; call far ptr oldint9_addr
  214. oldInt9_Addr dw 0, 0
  215. cmp cs:NoFlag, 0
  216. jz newINT9_proc
  217. mov cs:NoFlag, 0
  218. iret
  219. newINT9_proc:
  220. cmp cs:Flag, '!' ; busy ?
  221. jnz @@0
  222. iret
  223. @@0:
  224. mov cs:Flag, '!' ; set busy flag
  225. push ax ; cmp hot key
  226. push bx
  227. push es
  228. mov ax,40h
  229. mov es,ax
  230.  
  231. cmp cs:AuxHotKey, 0
  232. jz @@_1
  233. mov bx, es:[1ah]
  234. cmp bx, es:[1ch]
  235. jz @@10
  236. push bx
  237. mov bl, es:[bx+1]
  238. cmp bl, cs:AuxHotKey
  239. pop bx
  240. jnz @@10
  241. @@_1:
  242. mov ah,es:[17h] ; test CTRL SHIFT ALT
  243. mov al,cs:HotKey
  244. push ax
  245. and ax,0f0fh
  246. cmp al,ah
  247. pop ax
  248. jnz @@10
  249. cmp cs:Kbd102, True
  250. jnz @@1
  251. shr al, 1
  252. shr al, 1
  253. shr al, 1
  254. shr al, 1
  255. push ax
  256. mov ah, es:[18h]
  257. and ax, 303h
  258. cmp al, ah
  259. pop ax
  260. jnz @@10
  261. mov ah, es:[96h]
  262. shr ax, 1
  263. shr ax, 1
  264. and ax, 303h
  265. cmp al, ah
  266. jnz @@10
  267.  
  268. cmp cs:AuxHotKey, 0
  269. jz @@_3
  270. inc bx
  271. inc bx
  272. cmp bx, 3eh
  273. jb @@_2
  274. mov bx, 1eh
  275. @@_2:
  276. mov es:[1ah], bx
  277. @@_3:
  278. call IsWinDos
  279. or ax, ax
  280. jz @@1
  281. call Beep
  282. @@10:
  283. sti
  284. pop es
  285. pop bx
  286. pop ax
  287. mov cs:Flag, ' ' ; no busy
  288. iret
  289. @@1: ; OK
  290. pop es
  291. pop bx
  292. pop ax
  293.  
  294. KeepSelf:
  295. call RemoveTSR
  296. push es
  297. mov es,cs:WorkSeg
  298. mov dx,es:tsrLength
  299. mov di,dx
  300. mov al,0h ; Aug 24, 1993
  301. mov cx,100h
  302. rep stosb
  303. pop es
  304. int 27h
  305.  
  306. NoKeepSelf:
  307. mov ax,0e07h
  308. int 10h
  309. mov cs:clsStr, 47h ; Color (White in Red)
  310. call RemoveTSR
  311. dec cs:Copies
  312. call RestoreSelfIntVec
  313. push es
  314. cmp cs:PrevDataSeg, 0
  315. jz @@1
  316. mov es, cs:PrevDataSeg
  317. mov es:NextDataSeg, -1
  318. @@1: pop es
  319. mov ax, 4c00h
  320. int 21h
  321.  
  322. ; ---------------------------------------------------------------------------
  323.  
  324. IsWinDOS:
  325. mov ax, 1600h
  326. int 2fh
  327. cmp al, 01h
  328. jz @@9
  329. cmp al, 0ffh
  330. jz @@9 ; Windows/386 Version 2.X
  331. cmp al, 00h
  332. jz @@1
  333. cmp al, 80h
  334. jnz @@9 ; Windows 3 in enhanced mode
  335. ; Version number in AL/AH
  336. @@1:
  337. mov ax, 4680h
  338. int 2fh
  339. cmp al, 80h
  340. jnz @@9
  341. xor ax, ax
  342. jmp @@10
  343. @@9: mov ax, 1
  344. @@10: ret
  345.  
  346. ; -----------------------------------------------------------------------
  347. RestoreSelfIntVec:
  348. cmp Copies, '0'
  349. jz @@0
  350. ret
  351. @@0:
  352. cli
  353. push cs
  354. pop ds
  355. xor ax, ax
  356. mov es, ax
  357. mov si, offset oldInt9_Addr
  358. mov di, 9*4
  359. movsw
  360. movsw
  361. mov si, offset oldInt2F_Addr
  362. mov di, 2Fh*4
  363. movsw
  364. movsw
  365. mov si, offset oldInt1C_Addr
  366. mov di, 1Ch*4
  367. movsw
  368. movsw
  369. sti
  370. ret
  371.  
  372. ; ------------- KERNEL PROGRAM ----------------------------------------------
  373. RemoveTSR:
  374. pop ax
  375. cli ; Set stack
  376. mov sp, cs
  377. mov ss, sp
  378. mov sp, 100h
  379. sti
  380. push ax
  381.  
  382. cmp cs:Power, True
  383. jnz @@1
  384. call Init8259
  385. @@1:
  386. push cs
  387. pop ds
  388. @@_0:
  389. mov ax,ds:NextDataSeg
  390. cmp ax, -1
  391. jz @@_1
  392. mov cs:PrevDataSeg, ds
  393. mov ds, ax
  394. jmp @@_0
  395. @@_1: mov si,ds:DataBegin
  396. mov cs:WorkSeg, ds
  397. lodsw
  398. cmp ax, 'XX'
  399. jz @@_2
  400. call Beep
  401. ret
  402. @@_2:
  403. call RestoreEnvStr
  404. call RestoreMCB ; restore current mcb
  405. call CloseFiles
  406. call RestorePort
  407. call RestoreLEDs
  408. call RestoreVecList ; Restore vectors list
  409. call RestoreFloppyParam
  410. cmp cs:Power, True
  411. jnz @@2
  412. call RestoreCVTchain ; Restore cvt chain
  413. call RestoreMemoryManager
  414. @@2:
  415. call RestoreBiosData
  416. call Enable8259
  417. mov ah, 1
  418. int 16h
  419.  
  420. call RestoreClockSpeed
  421. call CloseSpeaker
  422. call ResetDisk
  423. call UpdateTime
  424.  
  425. call ClosePRN
  426. mov bx,cs:WorkSeg
  427. mov ah,50h
  428. int 21h ; Set PSP segment
  429. mov ax,3
  430. int 10h ; Set display mode
  431.  
  432. call InitPRN
  433. call InitMouse
  434. mov al, cs:Copies
  435. cmp al, '1'
  436. ja @@_sh1
  437. mov cs:ShowCopies, '*'
  438. jmp @@_sh2
  439. @@_sh1: mov cs:ShowCopies, al
  440. @@_sh2:
  441. mov si, offset clsStr
  442. call ColorPrintStr
  443. mov cs:Flag, ' ' ; no busy
  444. cmp Copies, '1'
  445. jnz @@_end
  446. mov cs:StopFlag, 0
  447. @@_end:
  448. call ClearKB_buffer
  449. ret
  450.  
  451. Beep:
  452. mov ax,0e07h
  453. int 10h
  454. ret
  455.  
  456. ; #########################################################################
  457.  
  458. ClearKB_Buffer:
  459. push es
  460. push bx
  461. mov bx, 0040h
  462. mov es, bx
  463. cli
  464. mov bx, es:[1ah]
  465. mov es:[1ch], bx
  466. sti
  467. pop bx
  468. pop es
  469. ret
  470.  
  471.  
  472. Init8259:
  473. ; cmp cs:Copies, '1'
  474. ; jz @@1
  475. ; ret
  476. @@1:
  477. cmp cs:MachineID, 0fch
  478. ja @@pc_xt
  479. @@AT:
  480. mov bx,870h ;
  481. mov al,0 ;
  482. out 0F1h,al ;
  483. jcxz $+2
  484. jcxz $+2
  485. mov al,11h ; ICW1
  486. out 0A0h,al
  487. jcxz $+2
  488. jcxz $+2
  489. out 20h,al
  490. jcxz $+2
  491. jcxz $+2
  492. mov al,bl ; ICW2
  493. out 0A1h,al
  494. jcxz $+2
  495. jcxz $+2
  496. mov al,bh
  497. out 21h,al
  498. jcxz $+2
  499. jcxz $+2
  500. mov al,2 ; ICW3
  501. out 0A1h,al
  502. jcxz $+2
  503. jcxz $+2
  504. mov al,4
  505. out 21h,al
  506. jcxz $+2
  507. jcxz $+2
  508. mov al,1 ; ICW4
  509. out 0A1h,al
  510. jcxz $+2
  511. jcxz $+2
  512. out 21h,al
  513. jcxz $+2
  514. jcxz $+2
  515. mov al,0FFh ; OCW1
  516. out 0A1h,al
  517. jcxz $+2
  518. jcxz $+2
  519. out 21h,al
  520. ret
  521. @@PC_XT:
  522. mov al,13h ; ICW1
  523. out 20h,al
  524. jcxz $+2
  525. jcxz $+2
  526. mov al,8 ; ICW2
  527. out 21h,al
  528. jcxz $+2
  529. jcxz $+2
  530. mov al,9 ; ICW4
  531. out 21h,al
  532. jcxz $+2
  533. jcxz $+2
  534. mov al,0FFh ; OCW1
  535. out 21h,al
  536. ret
  537.  
  538. Enable8259:
  539. mov ax, word ptr cs:old_8259
  540. out 021h,al
  541. jcxz $+2
  542. jcxz $+2
  543. mov al,ah
  544. out 0a1h,al ; DEC PC Bus Mouse
  545. ret ; July 1994 by Mr. Lei
  546.  
  547. ; -------------------------------------------------------------------------
  548.  
  549. RestoreBiosData:
  550. lodsw
  551. cmp ax, '--'
  552. jz @@1
  553. call Beep
  554. ret
  555. @@1: push es
  556. push di
  557. mov di, 40h
  558. mov es, di
  559.  
  560. mov di, 10h
  561. movsw
  562. mov di, 0a8h ; [40h:a8h]
  563. movsw
  564. movsw
  565. mov di, 49h
  566. mov cx, 1dh
  567. rep movsb
  568.  
  569. mov di, 0f0h ; User data
  570. mov cx, 8
  571. rep movsw
  572.  
  573. pop di
  574. pop es
  575. ret
  576.  
  577. ; -------------------------------------------------------------------------
  578.  
  579. RestoreMCB:
  580. push ds
  581. push es
  582. lodsw ; 'MZ'
  583. @@0: lodsw
  584. cmp ax, 'MM'
  585. jz @@1
  586. mov es,ax
  587. xor di,di
  588. movsb
  589. movsw
  590. movsw
  591. inc ax
  592. mov bx, ds
  593. cmp ax, bx
  594. jz @@10
  595. mov byte ptr es:[8], 0 ; Aug 24, 1993
  596. @@10: cmp byte ptr es:[0], 'Z'
  597. jnz @@0
  598. mov byte ptr es:[10h], 0
  599. jmp @@0
  600. @@1:
  601. pop es
  602. pop ds
  603. ret
  604.  
  605. ; -------------------------------------------------------------------------
  606. CloseFiles:
  607. mov ax, 5 ; Begin handle
  608. push ds
  609. push si
  610. mov cx, 15 ; Max handle
  611. sub cx, ax
  612. inc cx
  613. mov bx, ax
  614. @@1: push bx
  615. push cx
  616. mov ah, 3eh
  617. int 21h
  618. pop cx
  619. pop bx
  620. inc bx
  621. loop @@1
  622. pop si
  623. pop ds
  624. ret
  625.  
  626. ; -------------------------------------------------------------------------
  627. RestorePort:
  628. mov di, 40h ; restore port
  629. mov es, di
  630. xor di, di
  631. mov cx, 8
  632. rep movsw
  633. ret
  634.  
  635. ; -------------------------------------------------------------------------
  636. RestoreLEDs:
  637. lodsb
  638. and al, 11110000b ; LED status
  639. mov ah, es:[17h]
  640. and ah, 00001111b
  641. or ah, al
  642. and ah, 0f0h ; Clear CTRL ALT SHIFT
  643. mov es:[17h], ah
  644. ret
  645.  
  646. ; -------------------------------------------------------------------------
  647. RestoreEnvStr:
  648. lodsw
  649. push si
  650. push di
  651. push ds
  652. push es
  653. mov es, cs:DosEnv
  654. mov ds, ax
  655. xor si, si
  656. mov di, si
  657. @@0: lodsb
  658. or al, al
  659. jnz @@1
  660. cmp byte ptr ds:[si], 0
  661. jz @@2
  662. @@1: stosb
  663. jmp @@0
  664. @@2: stosb
  665. stosb
  666. pop es
  667. pop ds
  668. pop di
  669. pop si
  670. ret
  671.  
  672. ; -----------------------------------------------------------------------
  673. RestoreVecList:
  674. xor ax,ax
  675. mov di,ax
  676. mov es,ax
  677. mov cx,100h
  678. @@0: lodsw
  679. xchg dx, ax
  680. lodsw
  681. cmp dx, 'EL'
  682. jnz @@1
  683. cmp al, 'I'
  684. jnz @@1
  685. sub cl, ah
  686. push cx
  687. mov cl, ah
  688. mov ax, es:[di-4]
  689. mov dx, es:[di-2]
  690. @@a: stosw
  691. xchg ax, dx
  692. stosw
  693. xchg ax, dx
  694. loop @@a
  695. pop cx
  696. or cx, cx
  697. jz @@9
  698. jmp @@0
  699. @@1:
  700. xchg ax, dx
  701. stosw
  702. xchg ax, dx
  703. stosw
  704. loop @@0
  705. @@9:
  706. ret
  707.  
  708. ;----------------------------------------------------------------------------
  709. RestoreFloppyParam: ; Mr. Lei 2/10/1992
  710. push es
  711. push ax
  712. xor ax, ax
  713. mov es, ax
  714. mov byte ptr es:[525h], 2
  715. pop ax
  716. pop es
  717. ret
  718.  
  719. ;---------------------------------------------------------------------------
  720. RestoreCVTchain:
  721. lodsw
  722. cmp ax, 'VC'
  723. jz @@_0
  724. call Beep
  725. ret
  726. @@_0:
  727. push ax
  728. push cx
  729. push es
  730.  
  731. ; -----------------------------------------------------------------
  732. lodsw ; DPB
  733. mov di, ax
  734. lodsw
  735. mov es, ax
  736. @@1: lodsb
  737. inc di
  738. stosb
  739. add di, cs:cvtOfs
  740. add di, 10h
  741. movsw
  742. movsw
  743. les di, es:[di+2]
  744. cmp di, -1
  745. jnz @@1
  746.  
  747. ; -----------------------------------------------------------------
  748. lodsw ; DCB
  749. mov di, ax
  750. lodsw
  751. mov es, ax
  752. xor ax, ax
  753. dec ax
  754. stosw
  755.  
  756. ; -----------------------------------------------------------------
  757. lodsw ; Device Driver Chain
  758. mov di, ax
  759. lodsw
  760. mov es, ax
  761. xor cx, cx
  762. @@9: push di
  763. mov cl, 5
  764. rep movsw
  765. pop di
  766. les di, es:[di]
  767. mov ax, di
  768. inc ax
  769. jnz @@9
  770. pop es
  771. pop cx
  772. pop ax
  773. ret
  774.  
  775. ; ----------------------------------------------------------------------------
  776. RestoreMemoryManager:
  777. test cs:Status, XMSbit
  778. jz @@1
  779. call LoadXMSstatus
  780. @@1:
  781. test cs:Status, EMSbit
  782. jz @@2
  783. call LoadEMSstatus
  784. @@2:
  785. ret
  786.  
  787.  
  788. LoadEMSstatus:
  789. lodsw
  790. cmp ax, 'ME'
  791. jz @@_0
  792. call Beep
  793. ret
  794. @@_0:
  795. lodsw
  796. mov cx, ax
  797. xor dx, dx
  798. @@_1: push ds
  799. push si
  800. push dx
  801. push cx
  802.  
  803. @@0: cmp dx, ds:[si]
  804. jz @@1
  805. add si, 4
  806. loop @@0
  807.  
  808. push cx
  809. mov cx, 5
  810. @@__0: mov ah, 45h ; Deallocate Handle and Memory
  811. int 67h
  812. or ah, ah
  813. jz @@__1
  814. loop @@__0
  815. @@__1: pop cx
  816.  
  817. @@1:
  818. pop cx
  819. pop dx
  820. pop si
  821. pop ds
  822. inc dx
  823. cmp dx, 100h
  824. jb @@_1
  825. shl cx, 1
  826. shl cx, 1
  827. add si, cx
  828. ret
  829.  
  830.  
  831. LoadXMSstatus:
  832. lodsw
  833. cmp ax, 'MX'
  834. jz @@_0
  835. call Beep
  836. ret
  837. @@_0:
  838. lodsw
  839. mov cx, ax
  840. jcxz @@5
  841. @@1:
  842. lodsw
  843. mov dx, ax
  844. @@2: push dx
  845. mov ah, 0ah ; free
  846. call dword ptr cs:xms_control
  847. or ax, ax
  848. pop dx
  849. jnz @@4
  850. cmp bl, 0abh
  851. jnz @@4
  852. push dx
  853. mov ah, 0dh ; unlock
  854. call dword ptr cs:xms_control
  855. or ax, ax
  856. pop dx
  857. jmp @@2
  858. @@4: loop @@1
  859. @@5: ret
  860. endp
  861.  
  862. ; -----------------------------------------------------------------------
  863. CloseSpeaker:
  864. in al, 61h
  865. and al, 0fch
  866. out 61h, al
  867. ret
  868.  
  869. ; -----------------------------------------------------------------------
  870. RestoreClockSpeed:
  871. mov al, 00110110b
  872. out 43h, al
  873. xor ax, ax
  874. out 40h, al
  875. out 40h, al
  876. ret
  877.  
  878. ; -----------------------------------------------------------------------
  879. ResetDisk:
  880. xor ax, ax
  881. xor dx, dx
  882. int 13h ; Restore A
  883. inc dx
  884. int 13h ; Restore B
  885. mov dl, 80h
  886. int 13h ; Restore C
  887. ret
  888.  
  889.  
  890.  
  891. ; --------------------------------------------------------------------------
  892. ClosePRN:
  893. mov ah, 51h ; Get PSP seg
  894. int 21h
  895. mov es, bx
  896. mov ax, es:[16h] ; Prev PSP seg
  897. cmp ax, bx
  898. jnz @@9
  899. mov ax, 3e00h ; COMMAND
  900. mov bx, 4
  901. int 21h
  902. @@9:
  903. ret
  904.  
  905. InitPRN:
  906. mov ax, 3e00h
  907. mov bx, 4 ; PRN
  908. int 21h
  909. mov ax, 3d01h
  910. mov dx, offset PRNname
  911. push cs
  912. pop ds
  913. int 21h
  914. ret
  915. PRNname db 'PRN',0
  916.  
  917. InitMouse: ; 2/16/1993 by Mr. Lei
  918. push es
  919. xor ax, ax
  920. mov es, ax
  921. cmp word ptr es:[33h*4+2], 0
  922. jz @@0
  923. cmp word ptr es:[33h*4], 0
  924. jz @@0
  925. mov ax, 21h
  926. int 33h ; Hook Mouse Interrupt
  927. @@

    最后更新:2017-04-03 05:39:37

      上一篇:go 【PHP】基于ThinkPHP框架搭建OAuth2.0服务
      下一篇:go 汇编 HelloWorld