home *** CD-ROM | disk | FTP | other *** search
/ The Business Master (3rd Edition) / The Business Master (3rd Edition).iso / files / utilstem / util2 / colon.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-30  |  2.3 KB  |  85 lines

  1.  
  2.     TITLE    SEMICOLON_REVERSE
  3.  
  4. ; by  William C. Parke for George Page and CHUG Aug. 1988
  5. ; This program is a Terminate-and-Stay-Resident routine which
  6. ; converts a semicolon to a colon and visa-versa when typed
  7. ; from the keyboard.  For those not drilled into QWERTY
  8. ; typing, the often used DOS colon is easier to type, not
  9. ; requiring a shift with the semicolon key.  Install the
  10. ; program in the AUTOEXEC.BAT file after testing.
  11.  
  12. ; Use DOS 2.11 or higher.
  13.  
  14. ; The resident portion of the program takes only 256 bytes.
  15. ; (It is actually contained in the original Program Segment
  16. ; Prefix. The child environment is de-allocated.)
  17.  
  18. ; This file assembled under MASM Version 4.0.
  19.  
  20. COD    SEGMENT BYTE PUBLIC 'CODE'
  21.     ASSUME  CS:COD, DS:COD, ES:COD, SS:COD
  22.  
  23.      ORG    100H
  24.  
  25. BEGIN:    JMP    INIT        ; initialize TSR for int 16h interception
  26.  
  27. INT16:    CMP    AH,2        ; int 16h function index
  28.     JC    NEW16        ; request for next char
  29.     DB    0EAH        ; far jump code
  30. JOFS    DW    0        ; original INT 16h vector 
  31. JSEG    DW    0
  32. NEW16:    PUSH    BP
  33.     PUSH    DX
  34.     MOV    BP,SP
  35.     MOV    DX,[BP+8]    ; get user flag
  36.     PUSH    DX        ; anticipate IRET after call
  37.     DB    9AH        ; far call code
  38. COFS    DW    0
  39. CSEG    DW    0
  40.     PUSHF
  41.     POP    DX        ; recover int 16h flags
  42.     MOV    [BP+8],DX    ; set user flag
  43.     POP    DX
  44.     POP    BP
  45.     CMP    AH,27H        ; scan code for colon key
  46.     JNZ    EXIT
  47.     XOR    AL,1        ; reverse to 3A/3B
  48. EXIT:    IRET
  49.  
  50. INIT:    MOV    DX,OFFSET MSG        ; tell user what will happen
  51.     MOV    AH,9
  52.     INT    21H
  53.     XOR    AX,AX
  54.     MOV    ES,AX            ; set for bios data segment
  55.     AND    BYTE PTR ES:[0417H],0DFH ; turn off NumLock
  56.     MOV    ES,DS:[002CH]        ; environ segment
  57.     MOV    AH,49H            ; free up environment
  58.     INT    21H
  59.     MOV    AX,3516H        ; get vector for int 16h
  60.     INT    21H
  61.     MOV    JOFS,BX            ; set double word far jump
  62.     MOV    JSEG,ES
  63.     MOV    COFS,BX            ; set double word far call
  64.     MOV    CSEG,ES
  65.     MOV    AX,CS
  66.     MOV    ES,AX    
  67.     MOV    DI,80H            ; use wasted psp buffer area
  68.     MOV    SI,OFFSET BEGIN
  69.     MOV    CX,40H
  70.     REP    MOVSW            ; move handler down to org 80h
  71.     MOV    DX,OFFSET INT16 - 80H    ; handler start address
  72.     MOV    AX,2516H        ; install keyboard preprocessor
  73.     INT    21H
  74.     MOV    DX,10H            ; para size of our interrupt handler
  75.     MOV    AX,3100H        ; terminate and stay resident
  76.     INT    21H
  77.  
  78. MSG DB 13,10,'Colon-Semicolon Reversed.'
  79.     DB 13,10,10,'$ COLON Version 1.0 ',13,10
  80.     DB 'William C. Parke for CHUG, 1988',13,10,10,'$'
  81.  
  82. COD    ENDS
  83.     END    BEGIN
  84.