home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / password / pwmodul.asm < prev    next >
Assembly Source File  |  1995-07-28  |  3KB  |  135 lines

  1. .386p
  2. .MODEL TPASCAL
  3.  
  4. keyb_off macro
  5.   push ax
  6.   in  al,21h
  7.   or  al,02
  8.   out 21h,al
  9.   pop ax
  10. endm
  11.  
  12. keyb_on macro
  13.   push ax
  14.   in  al,21h
  15.   and al,0Fdh
  16.   out 21h,al
  17.   pop ax
  18. endm
  19.  
  20. .DATA
  21.  extrn remaining_passes
  22.  extrn pnew_password_select : dword
  23.  extrn pinput_box_draw : dword
  24.  extrn ppassword_query : dword
  25.  extrn psystem_stop : dword
  26.  extrn password_correct : byte
  27.  extrn unnecessary_variable1 : word
  28.  extrn unnecessary_variable2 : word
  29.  
  30. .CODE
  31. extrn main_program : far
  32.  
  33. public query_loop
  34.  
  35. query_loop proc pascal
  36.   keyb_off
  37.  
  38.  ;PIQ - Trick
  39.   int 3
  40.   mov  cs:word ptr [@int_21_funct1],4CB4h  ; function end prg.
  41. @int_21_funct1:
  42.   mov  ah,30h                              ; function get DOS vers.
  43.   int 21h
  44.  
  45. @query_loop:
  46.   keyb_off
  47.  
  48.   call dword ptr pnew_password_select
  49.   cmp  unnecessary_variable1,5
  50.   jbe  @unnecessary_destination1a
  51.  
  52.  ;PIQ - Trick
  53.   int 3
  54.   mov  cs:word ptr [@int_21_funct2],4CB4h  ; function end prg.
  55. @int_21_funct2:
  56.   mov  ah,30h                              ; function get DOS vers.
  57.   int 21h
  58.   mov  cs:word ptr [@int_21_funct2],30B4h  ; function end prg.
  59.  
  60.   call dword ptr pinput_box_draw
  61.   jmp  @unnecessary_destination1b
  62.  
  63. @unnecessary_destination1a:
  64.  ;PIQ - Trick
  65.   int 3
  66.   mov  cs:word ptr [@int_21_funct2],4CB4h  ; function end prg.
  67. @int_21_funct2a:
  68.   mov  ah,30h                              ; function get DOS vers.
  69.   int 21h
  70.   mov  cs:word ptr [@int_21_funct2a],30B4h ; function end prg.
  71.  
  72.   call dword ptr pinput_box_draw
  73. @unnecessary_destination1b:
  74.   keyb_on
  75.  
  76.  
  77.   cmp  unnecessary_variable2,10
  78.   jbe  @unnecessary_destination2a
  79.  
  80.   dec  byte ptr remaining_passes
  81.  
  82. ; Protected MODE Trick
  83.     pusha
  84.     cli                                ; disa4ble interrupts
  85.     mov eax,cr0                        ; switch to Protected mode
  86.     or eax,1
  87.     mov cr0,eax
  88.     jmp PROTECTION_ENABLED             ; clear execution pipe
  89. PROTECTION_ENABLED:
  90.     and al,0FEh                        ; switch back to Real mode
  91.     mov cr0,eax                        ; do not reset CPU
  92.     jmp PROTECTION_DISABLED            ; clear execution pipe
  93. PROTECTION_DISABLED:
  94.     sti                                ; enable interrupts again
  95.     popa
  96.  
  97.   call dword ptr ppassword_query
  98.   jmp  @unnecessary_destination2b
  99.  
  100. @unnecessary_destination2a:
  101.   dec  byte ptr remaining_passes
  102.  
  103. ; Protected MODE Trick
  104.     pusha
  105.     cli                                ; disable interrupts
  106.     mov eax,cr0                        ; switch to Protected mode
  107.     or eax,1
  108.     mov cr0,eax
  109.     jmp PROTECTION_ENABLED2a           ; clear execution pipe
  110. PROTECTION_ENABLED2a:
  111.     and al,0FEh                        ; switch back to Real mode
  112.     mov cr0,eax                        ; do not reset CPU
  113.     jmp PROTECTION_DISABLED2a          ; clear execution pipe
  114. PROTECTION_DISABLED2a:
  115.     sti                                ; enable interrupts again
  116.     popa
  117.   call dword ptr ppassword_query
  118.  
  119. @unnecessary_destination2b:
  120.  
  121.   cmp  byte ptr password_correct,1
  122.   je   @query_was_OK
  123.   jmp  @query_was_not_OK
  124. @query_was_OK:
  125.  
  126.   call main_program
  127. @query_was_not_OK:
  128.  
  129.   cmp byte ptr remaining_passes,54
  130.   ja  @query_loop
  131.   call dword ptr psystem_stop
  132.   ret
  133. query_loop endp
  134.  
  135. END