Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CODE_SEG SEGMENT
- ASSUME CS:CODE_SEG,DS:code_seg
- ORG 100H
- START:
- JMP BEGIN
- ;================================== data ====================================
- int_2Fh_vector DD ?
- old_09h DD ?
- flag DB 0
- ; window's coords
- high_Y DB 01
- left_X DB 01
- low_Y DB 15
- right_X DB 30
- ;
- page_num DB 0
- ;message's coords in window
- coord_Y DB 4
- coord_X DB 15
- buffer DB ?
- tail DW 0
- count DB 0
- ;=============================================================================
- new_09h proc far
- push AX
- push ES
- mov AX,40h
- mov ES,AX
- mov AX,ES:[1Ch]
- mov CS:tail,AX
- pop ES
- pop AX
- pushf
- call CS:old_09h
- push AX
- push BX
- push ES
- mov AX,40h
- mov ES,AX
- mov BX,CS:tail
- cmp BX,ES:[1Ch]
- je exit1
- jmp cont
- exit1:
- pop ES
- pop BX
- pop AX
- iret
- cont:
- pushf
- push AX
- in AL,60h ; enter scan-code
- cmp AL,58h ; scan-code <F12>
- je hotkey ; Yes
- inc CS:count
- pop AX ; No. Restore AX
- popf
- jmp dword ptr CS:[old_09h]
- hotkey:
- sti
- in AL,61h ; Enter B port's content
- or AL,80h ; Set elder bit
- out 61h,AL ; return to content to B port.
- and AL,7Fh ; Enable keyboard,
- out 61h,AL ; Reset older bit from B port .
- ;
- ;-------------------- Window output by BIOS ---------------------------
- ;
- ;save used registers
- push BX
- push CX
- push DX
- push DS
- ;set our register to ds
- push CS ;
- pop DS ;
- ;----------------------------------------------------------------------------
- mov AX, 0600h ; Set window
- mov BH, 70h ; attribute Black on write
- ;window's coordinates
- mov CH, high_Y
- mov CL, left_X
- mov DH, low_Y
- mov DL, right_X
- int 10h
- ; ------------------------ Set cursors's position -----------------------------
- mov AH,02h ; Set position func
- mov BH,page_num ; Video
- mov DH,coord_Y ; string
- mov DL,coord_X ; row
- int 10h
- mov ah, 2
- mov dl, count
- int 21h
- ;return cursor
- ; mov AH,02h ; Set position func
- ; mov BH,0;
- ; mov DH,24 ; string
- ; mov DL,12 ; row
- ; int 10h
- pop DS ; Reset registers
- pop DX
- pop CX
- pop BX
- ;---------------------------------------------------------------------------
- cli
- ;end of interrupt
- mov AL, 20h
- out 20h,AL
- ;
- pop AX
- popf
- ;============================
- exit:
- pop ES
- pop BX
- pop AX
- iret
- new_09h endp
- ;=============================================================================
- ;
- ;=============================================================================
- int_2Fh proc far
- cmp AH,0C7h ; Is it our num?
- jne Pass_2Fh ; go exit
- cmp AL,00h ; Already installed?
- je inst ;
- cmp AL,01h ; Unload?
- je unins ; Yes, go to unload
- jmp Pass_2Fh ; Unknown command
- inst:
- mov AL,0FFh ; Already installed
- iret
- Pass_2Fh:
- jmp dword PTR CS:[int_2Fh_vector]
- ;
- ; -------------- Is unload possible ? ------
- unins:
- push BX
- push CX
- push DX
- push ES
- ;
- mov CX,CS ; for compairing
- mov AX,3509h ; check 09h
- int 21h ; Return vector in ES:BX
- ;
- mov DX,ES
- cmp CX,DX
- jne Not_remove
- ;
- cmp BX, offset CS:new_09h
- jne Not_remove
- ;
- mov AX,352Fh ; Check vector 2Fh
- int 21h
- ;
- mov DX,ES
- cmp CX,DX
- jne Not_remove
- ;
- cmp BX, offset CS:int_2Fh
- jne Not_remove
- ; ---------------------- Unload from memory ---------------------
- ;
- push DS
- ;
- lds DX, CS:old_09h
- mov AX,2509h ; Fill vector by old content
- int 21h
- ;
- lds DX, CS:int_2Fh_vector
- mov AX,252Fh
- int 21h
- ;
- pop DS
- ;
- mov ES,CS:2Ch ; ES -> enviroment
- mov AH, 49h ; Free memory function
- int 21h
- ;
- mov AX, CS
- mov ES, AX ; ES -> PSP unload programm
- mov AH, 49h ; Free memory function
- int 21h
- ;
- mov AL,0Fh ; Successful uninstall
- jmp pop_ret
- Not_remove:
- mov AL,0F0h ; Can't unload
- pop_ret:
- pop ES
- pop DX
- pop CX
- pop BX
- ;
- iret
- int_2Fh endp
- ;=============================================================================
- begin:
- mov AX,0C700h
- int 2Fh
- cmp AL, 0
- jz not_installed
- lea DX,msg
- call print
- int 20h
- msg DB 'Already installed',13,10,'$'
- not_installed:
- mov AX,352Fh
- int 21h
- mov word ptr int_2Fh_vector,BX
- mov word ptr int_2Fh_vector+2,ES
- mov DX,offset int_2Fh
- mov AX,252Fh
- int 21h
- mov AX,3509h
- int 21h
- mov word ptr old_09h,BX
- mov word ptr old_09h+2,ES
- mov DX,offset new_09h
- mov AX,2509h
- int 21h
- ;------------------------------------------------------------------------------
- mov DX,offset begin
- int 27h
- ;=============================================================================
- PRINT PROC NEAR
- MOV AH,09H
- INT 21H
- RET
- PRINT ENDP
- ;=============================================================================
- CODE_SEG ENDS
- END START
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement