Category : Word Processors
Archive   : CASE2.ZIP
Filename : OUT_CASE.ASM

 
Output of file : OUT_CASE.ASM contained in archive : CASE2.ZIP
comment~
*** CASE.COM *** Last Rev. 10/08/83 *** Vincent T. Bly ***

Revised to work with TASM (and MASM 5.0)
and to work with enhanced keyboard on DOS 4.01 Les 6/6/89
-------------------------------------------------------------------
| |
| PURPOSE: Provide a resident utility to aid assembly language |
| programmers who wish to write their source code in |
| ALL CAPS and their comments in lower case. |
| |
| FUNCTION: Change the cursor shape to indicate the present state |
| of the "Caps Lock" key (block cursor for caps lock and |
| underline cursor for upper/lower case). |
| NOTE: I've commented out this aspect. Remove ";" in |
| lines 58-61, 81, 161 and comment code for lines |
| 94-127. Les 6/6/89 |
| |
| |
| Shift to upper/lower case for comments whenever the ";" |
| key is pressed. |
| Shift to caps lock for source code whenever the "Enter" |
| key is pressed. |
| Toggle the ";"/"Enter" case switching off or on when- |
| ever both shift keys are pressed simultaneously. |
| |
| TO USE: From DOS, type CASE and press the "Enter" key. |
| |
| NOTES: This version works with either the color graphics or |
| monochrome card. The DOS utilities (DIR, DEBUG, etc.) |
| do not turn off the cursor during printing. If you |
| find the effect with the block cursor objectionable, |
| you can temporarily turn off the case switching by |
| pressing both shift keys simultaneously or you can |
| change the DWs defining the cursor shapes. |
| |
-------------------------------------------------------------------~

INTERRUPTS SEGMENT AT 00H ;*********** Interrupt vector table **
ORG 09H*4
KB_INT LABEL DWORD ; keyboard hardware interrupt
ORG 16H*4
KEYBRD_INT LABEL DWORD ; keyboard software interrupt
INTERRUPTS ENDS

BIOS_DATA SEGMENT AT 40H ;*********** BIOS data segment *******
ORG 10H
EQUIP_FLAG LABEL WORD ; bits 4 & 5 indicate CRT board type
ORG 17H
KYBD_FLAG LABEL BYTE ; primary keyboard status flag
ORG 63H
ADDR_6845 LABEL WORD ; port address of 6845 index register
BIOS_DATA ENDS

CSEG SEGMENT
ORG 100H ; necessary for a .COM file
ASSUME CS:CSEG
START: JMP INITIALIZE ; jump to initilization routine
; CAP_CURSOR_C DW 0006H ; caps lock cursor type (color board)
; CAP_CURSOR_M DW 000BH ; as above, for monochrome board
; LOW_CURSOR_C DW 0607H ; upper/lower case cursor type (color)
; LOW_CURSOR_M DW 0B0CH ; as above, for monochrome board
ROM_KEY_INT DD ; ROM keyb'rd hardware interrupt addr.
ROM_KYBD_IO DD ; ROM keyb'rd software interrupt addr.
CASE_FLAG DB 0FFH ; case switching flag (FF=on, 00=off)
OLD_KYF DB 040H ; old value of KYBD_FLAG

;===========================================================================;
@HARD_KYBD_INT PROC FAR ; Keyboard hardware interrupts ;
ASSUME DS:BIOS_DATA ; (09H) are re-vectored to here ;
STI ;-------------------------------;
PUSHF ; set-up to call like an interrupt
CALL ROM_KEY_INT ; call ROM BIOS, but return here
PUSH AX ; save regs
PUSH DS
MOV AX,BIOS_DATA ; point DS to BIOS data seg
MOV DS,AX
MOV AL,[KYBD_FLAG] ; get BIOS keyboard status flag
CMP AL,CS:[OLD_KYF] ; has status flag changed?
JE GO_BACK ; if not, go back
MOV CS:[OLD_KYF],AL ; refresh old status flag value
; CALL SET_CURSOR ; go set proper cursor type
AND AL,3 ; mask all but shift keys
CMP AL,3 ; check for both shift keys down
JNE GO_BACK ; if not both shifts, skip toggle
MOV AL,CS:[CASE_FLAG] ; get case switch flag
NOT AL ; toggle flag
MOV CS:[CASE_FLAG],AL ; replace flag
GO_BACK: POP DS
POP AX
IRET ; back to program
@HARD_KYBD_INT ENDP

;============================================================================;
comment ~
SET_CURSOR PROC NEAR ; Set cursor for uppr/lowr case or caps lock ;
ASSUME DS:CSEG ;-------------------------------;
PUSH AX ; save regs
PUSH BX
PUSH DX
LEA BX,LOW_CURSOR_C ; load upper/lower case cursor
TEST AL,40H ; is caps lock on?
JZ CHK_BOARD ; if not, go check board type
LEA BX,CAP_CURSOR_C ; load caps lock cursor
CHK_BOARD: ASSUME DS:BIOS_DATA
MOV AX,EQUIP_FLAG ; get equipment flag
AND AX,30H ; isolate CRT board type bits
CMP AX,30H ; is it monochrome board?
JNE CG_SET ; if not, skip ahead
ADD BX,2 ; bump BX to mono cursor type
CG_SET: MOV BX,CS:[BX] ; get proper cursor into BX
MOV DX,ADDR_6845 ; point to 6845 index reg
MOV AL,10D ; point to cursor start reg
OUT DX,AL ; select cursor start reg
INC DX ; point to 6845 data reg
MOV AL,BH ; data into AL
OUT DX,AL ; data to cursor start reg
DEC DX ; point to 6845 index reg
MOV AL,11D ; point to cursor end reg
OUT DX,AL ; select cursor end reg
INC DX ; point to 6845 data reg
MOV AL,BL ; next data into AL
OUT DX,AL ; data to cursor end reg
POP DX ; restore regs
POP BX
POP AX
RET
SET_CURSOR ENDP ~

;============================================================================;
@SOFT_KYBD_INT PROC FAR ; Keyboard software interrupts ;
ASSUME DS:BIOS_DATA ; (16H) are re-vectored to here ;
STI ;-------------------------------;
OR AH,AH ; is it wait for keyboard input?
JZ THIS_ROUTINE ; if so, do this routine
CMP AH,10H ; Needed for DOS 4.01
JZ THIS_ROUTINE ; if so, do this routine
JMP ROM_KYBD_IO ; else go to ROM & back to caller
THIS_ROUTINE: PUSHF ; set-up to CALL like an interrupt
CALL ROM_KYBD_IO ; call ROM BIOS, but return here
PUSH AX ; save caller's registers
PUSH DS ; "
TEST CS:[CASE_FLAG],1 ; is case switching flag on?
JZ BACK_TO_CALLER ; if case flag off, skip the rest
CMP AL,";" ; is the character a semicolon?
JE CAPS_OFF ; if so, go turn caps lock off
CMP AL,0DH ; is the character a carriage return?
JE CAPS_ON ; if so, go turn caps lock on
BACK_TO_CALLER: POP DS ; restore caller's registers
POP AX ; "
IRET ; return to the caller
;--- Toggle caps lock for ";" or "Enter" ----------------------------------
CAPS_ON: STC ; set carry to indicate caps on
CAPS_OFF: MOV AX,BIOS_DATA ; point to BIOS data segment
MOV DS,AX
MOV AL,[KYBD_FLAG] ; get keyboard state flag
JC SET_ON ; if caps should be set on, skip ahead
AND AL,NOT 40H ; turn off caps lock
JMP REPLACE_FLAG
SET_ON: OR AL,40H ; turn caps lock on
REPLACE_FLAG: MOV [KYBD_FLAG],AL ; replace keyboard state flag
; CALL SET_CURSOR ; go set proper cursor type
JMP BACK_TO_CALLER
@SOFT_KYBD_INT ENDP

;============================================================================;
INITIALIZE PROC NEAR ; Re-vector keyb'rd interrupts ;
ASSUME DS:INTERRUPTS
MOV AX,INTERRUPTS ; point to interrupt vector segment
MOV DS,AX
;--- Set intercept for software keyboard interrupt -------------------------
MOV AX,WORD PTR KEYBRD_INT ; save old keyboard interrupt vector
MOV WORD PTR ROM_KYBD_IO,AX
MOV AX,WORD PTR KEYBRD_INT[2]
MOV WORD PTR ROM_KYBD_IO[2],AX
MOV AX,OFFSET @SOFT_KYBD_INT ; reset keyboard interrupt
MOV WORD PTR KEYBRD_INT,AX ; vector to point to this routine
MOV WORD PTR KEYBRD_INT[2],CS
;--- Set intercept for hardware keyboard interrupt -------------------------
MOV AX,WORD PTR KB_INT ; save old keyboard interrupt vector
MOV WORD PTR ROM_KEY_INT,AX
MOV AX,WORD PTR KB_INT[2]
MOV WORD PTR ROM_KEY_INT[2],AX
MOV AX,OFFSET @HARD_KYBD_INT ; reset keyboard interrupt
MOV WORD PTR KB_INT,AX ; vector to point to this routine
MOV WORD PTR KB_INT[2],CS
MOV DX,OFFSET INITIALIZE ; point to end of resident code
INT 27H ; terminate but stay resident
INITIALIZE ENDP

CSEG ENDS
END START


  3 Responses to “Category : Word Processors
Archive   : CASE2.ZIP
Filename : OUT_CASE.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/