[Original] Compilation Demo Code of TSR Program under DOS 1 - Automatic Button Program

xiaoxiao2021-03-06  40

I like to use QE.exe in DOS to read text files, self-comparable to key handache. So I wrote an automatic keyboard buffer to put UP

And the program of the DOWN key value.

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; File Name: AutoKey.asm

; Function: automatically populate the Right or DOWN key value to the keyboard buffer to move the cursor

; Ctrl Tab stopped filling

; Ctrl → populate the RIGHT key value

; Ctrl ↓ Fill the DOWN key value

; Ctrl ↑ Improve fill speed

; Ctrl ← Reduce fill speed

;

; Author: Huang Zhibin in February 2003 Guangxi Hechi

;

Shen Ming: You can freely reprint, and you should save your integrity. And you cannot use commercial purposes

;

, Said:

1. The first time running is always stationed, and the memory is repeated again.

2. Suitable for QE.EXE and TC.exe, not suitable for edit.com

; 3. Improvement direction:

; A display current speed on the upper right corner of the screen

; Can automatically wrap when b fill the RIGHT key value

; Development environment: IBM PC 486, MSDOS7.0 (MSWIN95), MASM generation

LOG

; ------------------------------------------------- ----------------------

; 2003.02.24 Created, But The Result is Exception!

; 2003.02.25

OK! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<

CSEG segment

; ==============================

ORG 100H

Assume ES: CSEG, SS: CSEG

Assume CS: CSEG, DS: CSEG

Up EQU 48h

Left EQU 4BH

Right EQU 4DH

Down EQU 50H

Ctrl EQU 04H

Alt Equ 08h

Endkey EQU 4fh

Tab EQU 0FH

AddKey EQU 0DH

Deckey EQU 0chrightde EQU 10

Downdlay EQU 100

; -----------------------------

START: JMP @init

; ====================

Old1caddr Label DWORD

Old1Coff DW?

Old1cseg dw?

Old09addr label dword

OLD09OFF DW?

OLD09seg dw?

MCB_EVB DW?; MCB: MEMMORY Control Block

MCB_PSP DW?

SHOW DW 1

Count dw 0

FillKey DB 0

Time DW 0

AutoKey Label Word

DB 00

Keycode DB Right

Varlen Equ $ - Old1CADDR

; ---------------

New09h Proc Far

STI

Push AX

Push BX

Push DS

MOV AX, 0040H

MOV DS, AX

MOV BH, DS: [017h]

Push CS

POP DS

TEST BH, CTRL

JZ @ old09

IN Al, 60h

CMP AL, TAB; ENDKEY

JNE @right

Mov FillKey, 0

Mov Keycode, 0

JMP @ old09

@right:

CMP Al, Right

JNZ @down

Mov Byte Ptr Keycode, Right

Mov Time, Rightdelay

JMP @autoon

@Down:

CMP Al, Down

JNZ @UP

MOV BYTE PTR Keycode, Down

MOV Time, Downdlay

JMP @autoon

@UP:

CMP AL, UP

JNZ @Left

CMP Word PTR Time, 1

JE @ old09

Dec time

JMP @clrcount; jmp @ old09

@Left:

CMP Al, Left

JNZ @ old09

CMP Word PTR Time, 0FFFFH

JE @ old09

incmime

JMP @clrcount

@Autoon:

Mov FillKey, 1

@Clrcount:

Mov count, 0

@ Old09:

POP DS

POP BX

POP AX

JMP CS: OLD09ADDR

NEW09H ENDP

New1ch Proc Far

CMP BYTE PTR CS: FillKey, 1

JNE @ old1c

Push DS

Push CS

POP DS

Inc country

Mov AX, Timecmp Ax, Count

JNE N1C

Mov count, 0

Push AX

Push BX

MOV AX, 0040H

MOV DS, AX

CLI

MOV BX, Word Ptr DS: [001CH]

MOV AX, CS: AutoKey

MOV [BX], AX

Inc BX

Inc BX

CMP BX, 003EH

JNZ @notail

MOV BX, 001EH

@Notail:

MOV AX, BX

MOV BX, 001CH

MOV [BX], AX

STI

POP BX

POP AX

N1C:

POP DS

@ Old1c:

JMP CS: Old1CADDR

NEW1CH ENDP

@Init:

MOV AX, 3509H; Get Current 1ch Interrupt Vector

Int 21h

CMP BX, OFFSET NEW09H; HAS BEEN INTALLED?

JNZ @Install; no install

MOV DX, Offset strmsgunsTall

Mov Ah, 09h

Int 21h

MOV BX, 1CH * 04H; Restore OLD 1CH Interrupt Vector

XOR AX, AX; To System Interrupt Vector Talbe

MOV DS, AX

MOV AX, ES: [OLD1COFF]

MOV DS: [BX], AX

MOV AX, ES: [OLD1CSEG]

MOV DS: [BX 2], AX

MOV BX, 09H * 04H; Restore Old 09h InterRupt Vector

MOV AX, ES: [OLD09OFF]; To System Interrupt Vector Talbe

; xor ax, AX

; MOV DS, AX; DS Must Equal 0

MOV DS: [BX], AX

MOV AX, ES: [OLD09SEG]

MOV DS: [BX 2], AX

MOV BX, 1; Release Evirenment Parameter Block

MOV AX, ES: [MCB_EVB]

MOV DS, AX

MOV Word PTR DS: [BX], 0

MOV AX, ES: [MCB_PSP]; Release TSR

MOV DS, AX

MOV Word PTR DS: [BX], 0

MOV AX, 4C00H

Int 21h

@Install:

; MOV AX, 3509H; Get Current 1ch Interrupt Vector

; INT 21h

MOV old09seg, es; store current 09h interrupt vector

MOV OLD09OFF, BX

MOV DX, OFFSET New09h; Set New 09h Interrupt Vector

MOV AX, 2509H

Int 21h

MOV AX, 351CH; Get Current 1ch Interrupt Vector

Int 21h

Mov Old1cseg, ES; Store Current 1ch Interrupt Vectormov Old1Coff, BX

Mov DX, Offset New1Ch; Set New 1ch Interrupt Vector

MOV AX, 251CH

Int 21h

MOV DX, Offset strmsginstall

Mov Ah, 09h

Int 21h

Store The Address of Evirenment Parameter Block

MOV AX, CS

Dec AX

MOV [MCB_PSP], AX; MOV CS: [MCB_PSP], AX

MOV BX, 2CH

MOV AX, [BX]; MOV AX, CS: [BX]

Dec AX

MOV CS: [MCB_EVB], AX

Mov dx, offset @init

Add dx, Varlen 2

MOV CL, 04H

SHR DX, CL

MOV AX, 3100H

Int 21h

; ====================

STRMSGINSTALL DB 07H, "AutoKey Installed! $"

STRMSGUNSTALL DB 07H, "AutoKey Uninstalled! $"

CSEG Ends

End Start

转载请注明原文地址:https://www.9cbs.com/read-75410.html

New Post(0)