home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
dpl.zip
/
SHDDO.D
< prev
next >
Wrap
Text File
|
1988-07-11
|
11KB
|
418 lines
; Doug's Programming Language -- DPL, Version 2.22
; Copyright (c) 1988 Douglas S. Cody, All rights reserved.
;-----------------------------------------
; S H D D O - SHADE manipulation routines
;
;
; S H D S U P - SCROLL THE SHADE UP
;
; Entry Conditions:
; AX points to the control block
; Exit Conditions:
; No registers modified
;
;
; S H D S D N - SCROLL THE SHADE DOWN
;
; Entry Conditions:
; AX points to the control block
; Exit Conditions:
; No registers modified
;
;
; S H D C L R - CLEAR THE SHADE
;
; Entry Conditions:
; AX points to the control block
; Exit Conditions:
; No registers modified
;
;
; S H D E X P - EXPAND THE SHADE SIZE
;
; Entry Conditions:
; AX points to the control block
; Exit Conditions:
; No registers modified
;
;
; S H D S M L - REDUCE THE SHADE SIZE
;
; Entry Conditions:
; AX points to the control block
; Exit Conditions:
; No registers modified
;
;
; Screen Control Block:
; DW Starting row
; DW Starting column
; DW Ending column
; DW Number of entries in the table
; DW Video buffer backup buffer
; DW Border display attribute
; DW Box display Attribute
; DW Last option choosen
; DW Shade is opened flag (0ffh=opened, 00h=closed)
; DW 1st string
; :
; DW Xth string
;
SUBPGM SHDDO
;
; SHADE CONTROL BLOCK OFFSETS
;
SROW EQU 0 ; STARTING ROW
SCOL EQU 2 ; STARTING COLUMN
ECOL EQU 4 ; ENDING COLUMN
NUMENT EQU 6 ; NUMBER OF ENTRIES IN STRING LIST
VBOFF EQU 8 ; VIDEO BUFFER OFFSET
BDATT EQU 10 ; VIDEO BOARDER ATTRIBUTE
BXATT EQU 12 ; VIDEO BOX ATTRIBUTE
LSTOP EQU 14 ; LAST OPTION CHOOSEN BY OPERATOR
SHDFLG EQU 16 ; SHADE IS OPENED FLAG
STROFF EQU 18 ; START OF STRING LIST
;
; WORKING STORAGE OFFSETS
;
SHDOPN EQU 16 ; 0 SHADE-IS-OPENED FLAG
SHDEX1 EQU 17 ; 1 UNUSED
SHDROW EQU 18 ; 2 CURRENT ROW
SHDCOL EQU 20 ; 4 CURRENT COLUMN
;
; BOARDER CHARACTERS
;
LTC EQU 218 ; LEFT TOP CORNER
TPL EQU 196 ; TOP LINE
RTC EQU 183 ; RIGHT TOP CORNER
LVB EQU 179 ; LEFT VERTICAL BAR
RVB EQU 186 ; RIGHT VERITCAL BAR
LBC EQU 212 ; LEFT BOTTOM CORNER
BTL EQU 205 ; BOTTOM LINE
RBC EQU 188 ; RIGHT BOTTOM CORNER
;
; KEYBOARD SCAN CODES & MAIN KEY CODES
;
KEY_U EQU 048H ; UPWARD ARROW KEY
KEY_L EQU 04BH ; LEFT ARROW KEY
KEY_R EQU 04DH ; RIGHT ARROW KEY
KEY_D EQU 050H ; DOWNWARD ARROW KEY
KEY_ESC EQU 01BH ; ESCAPE KEY
KEY_SP EQU 020H ; SPACE KEY
KEY_CR EQU 00DH ; CARRIAGE RETURN
;
;-----------------------------====< EXECUTION >====----------------------------
;
BEGIN SHDDO
EXTRN SHADE:NEAR, OPSHD:NEAR, CLSHD:NEAR
EXTRN VIDOFF:NEAR, VIDON:NEAR
RETURN
;
;
;--------------------------------
; S H D C L R -- CLEAR THE SHADE
;
PUBLIC SHDCLR
SHDCLR PROC NEAR
CALL SAVE_REG ; SAVE THE REGISTERS
;
CALL SETUP_REG ; SETUP THE REGISTERS FOR THE BIOS CALL
MOV AX,0600H ; BLANK OUT THE SHADE
INT 10H
;
CALL REST_REG ; RESTORE & RETURN
RETURN
SHDCLR ENDP
;
;
;--------------------------------
; S H D E X P -- EXPAND THE SHADE
;
PUBLIC SHDEXP
SHDEXP PROC NEAR
CALL SAVE_REG ; SAVE THE REGISTERS
;
MOV SI,AX ; SI POINTS TO THE CONTROL BLOCK
PUSH [SI+SHDFLG] ; SAVE THE OPENED FLAG
CMP BYTE PTR [SI+SHDFLG],00 ; IS THE SHADE CLOSED?
JZ SHDEXP_05 ; YES, DONT BOTHER CLOSING IT
;
CALL CLSHD ; NO, CLOSE THE SHADE FIRST...
;
SHDEXP_05:
PUSH [SI+BDATT] ; SAVE THE OLD BOARDER ATTRIBUTE
OR BYTE PTR [SI+BDATT],80H ; SET THE BLINK ATTRIBUTE
;
CALL OPSHD ; OPEN THE SHADE WITH OUR BLINK
;
SHDEXP_07:
INKEY ,WAIT ; GET THE KEY
OR AL,AL ; SCAN CODE ONLY?
JNZ SHDEXP_10 ; NO, USE AL
MOV AL,AH ; YES, SO COMPARE IT
;
SHDEXP_10:
CMP AL,KEY_U ; MOVE THE TOP BOARDER
JZ SHDEXP_30
CMP AL,KEY_D ; MOVE THE TOP BOARDER
JZ SHDEXP_35
CMP AL,KEY_L ; MOVE THE LEFT BOARDER
JZ SHDEXP_40
CMP AL,KEY_R ; MOVE THE TOP BOARDER
JZ SHDEXP_45
CMP AL,KEY_ESC ; ESCAPE?
JZ SHDEXP_15 ; YES, EXIT
CMP AL,KEY_CR ; CARRIAGE RETURN?
JNZ SHDEXP_07 ; NO, TOSS OUT THE KEY
;
SHDEXP_15:
MOV AX,SI ; RESTORE THE BLOCK POINTER
CALL CLSHD ; CLOSE OUR MESS
POP [SI+BDATT] ; RESTORE THE ATTRIBUTE
POP [SI+SHDFLG] ; RESTORE THE OPENED FLAG
CMP BYTE PTR [SI+SHDFLG],00 ; WAS IT CLOSED?
JZ SHDEXP_20 ; YES, EXIT
CALL OPSHD ; NO, RESTORE IT
;
SHDEXP_20:
CALL REST_REG ; RESTORE & RETURN
RETURN
;
; EXPAND THE SHADE IN A GIVEN DIRECTION
;
SHDEXP_30: ; MOVE TOP BOARDER
MOV AX,SI ; RESTORE THE CONTROL BLOCK ADDR
CALL CLSHD ; CLOSE THE SHADE FIRST
CMP WORD PTR [SI+SROW],00 ; ARE WE AT THE TOP?
JZ SHDEXP_RET ; YES, EXIT
DEC WORD PTR [SI+SROW] ; NO, MOVE THE BOARDER
INC WORD PTR [SI+NUMENT] ; ADD 1 TO THE # OF ENTRIES
JMP SHORT SHDEXP_RET ; RETURN THROUGH COMMON CODE
;
SHDEXP_35: ; MOVE THE BOTTOM BOARDER
MOV AX,SI ; RESTORE THE CONTROL BLOCK ADDR
CALL CLSHD ; CLOSE THE SHADE FIRST
MOV AX,[SI+SROW] ; GET THE STARTING ROW
ADD AX,[SI+NUMENT] ; ADD IN THE BOTTOM ROW
CMP AX,23 ; ARE WE AT THE BOTTOM?
JZ SHDEXP_RET ; YES, EXIT
INC WORD PTR [SI+NUMENT] ; ADD 1 TO THE # OF ENTRIES
JMP SHORT SHDEXP_RET ; RETURN THROUGH COMMON CODE
;
SHDEXP_40: ; MOVE THE BOTTOM BOARDER
MOV AX,SI ; RESTORE THE CONTROL BLOCK ADDR
CALL CLSHD ; CLOSE THE SHADE FIRST
CMP WORD PTR [SI+SCOL],00 ; ARE WE AT THE LEFT MOST COLUMN?
JZ SHDEXP_RET ; YES, EXIT
DEC WORD PTR [SI+SCOL] ; NO, MOVE THE BOARDER
JMP SHORT SHDEXP_RET ; RETURN THROUGH COMMON CODE
;
SHDEXP_45: ; MOVE THE RIGHT BOARDER
MOV AX,SI ; RESTORE THE CONTROL BLOCK ADDR
CALL CLSHD ; CLOSE THE SHADE FIRST
CMP WORD PTR [SI+ECOL],79 ; ARE WE AT THE RIGHT MOST COLUMN?
JZ SHDEXP_RET ; YES, EXIT
INC WORD PTR [SI+ECOL] ; NO, MOVE THE BOARDER
;
SHDEXP_RET:
MOV AX,SI ; RESTORE THE CONTROL BLOCK ADDR
CALL OPSHD ; THEN RE-OPEN IT
JMP SHDEXP_07 ; GO GET ANOTHER KEY
SHDEXP ENDP
;
;
;-----------------------------------------
; S H D S D N -- SCROLL THE SHADE DOWNWARD
;
PUBLIC SHDSDN
SHDSDN PROC NEAR
CALL SAVE_REG ; SAVE THE REGISTERS
;
CALL SETUP_REG ; SETUP THE REGISTERS FOR THE BIOS CALL
MOV AX,0701H ; MOVE ONE LINE DOWN
INT 10H
;
CALL REST_REG ; RESTORE & RETURN
RETURN
SHDSDN ENDP
;
;
;--------------------------------
; S H D S M L -- REDUCE THE SHADE SIZE
;
PUBLIC SHDSML
SHDSML PROC NEAR
CALL SAVE_REG ; SAVE THE REGISTERS
;
MOV SI,AX ; SI POINTS TO THE CONTROL BLOCK
PUSH [SI+SHDFLG] ; SAVE THE OPENED FLAG
CMP BYTE PTR [SI+SHDFLG],00 ; IS THE SHADE CLOSED?
JZ SHDSML_05 ; YES, DONT BOTHER CLOSING IT
;
CALL CLSHD ; NO, CLOSE THE SHADE FIRST...
;
SHDSML_05:
PUSH [SI+BDATT] ; SAVE THE OLD BOARDER ATTRIBUTE
OR BYTE PTR [SI+BDATT],80H ; SET THE BLINK ATTRIBUTE
;
CALL OPSHD ; OPEN THE SHADE WITH OUR BLINK
;
SHDSML_07:
INKEY ,WAIT ; GET THE KEY
OR AL,AL ; SCAN CODE ONLY?
JNZ SHDSML_10 ; NO, USE AL
MOV AL,AH ; YES, SO COMPARE IT
;
SHDSML_10:
CMP AL,KEY_U ; MOVE THE TOP BOARDER
JZ SHDSML_30
CMP AL,KEY_D ; MOVE THE TOP BOARDER
JZ SHDSML_35
CMP AL,KEY_L ; MOVE THE RIGHT BOARDER
JZ SHDSML_40
CMP AL,KEY_R ; MOVE THE LEFT BOARDER
JZ SHDSML_45
CMP AL,KEY_ESC ; ESCAPE?
JZ SHDSML_15 ; YES, EXIT
CMP AL,KEY_CR ; CARRIAGE RETURN?
JNZ SHDSML_07 ; NO, TOSS OUT THE KEY
;
SHDSML_15:
MOV AX,SI ; RESTORE THE BLOCK POINTER
CALL CLSHD ; CLOSE OUR MESS
POP [SI+BDATT] ; RESTORE THE ATTRIBUTE
POP [SI+SHDFLG] ; RESTORE THE OPENED FLAG
CMP BYTE PTR [SI+SHDFLG],00 ; WAS IT CLOSED?
JZ SHDSML_20 ; YES, EXIT
CALL OPSHD ; NO, RESTORE IT
;
SHDSML_20:
CALL REST_REG ; RESTORE & RETURN
RETURN
;
; SHRINK THE SHADE IN A GIVEN DIRECTION
;
SHDSML_30: ; UPWARD ARROW KEY
MOV AX,SI ; RESTORE THE CONTROL BLOCK ADDR
CALL CLSHD ; CLOSE THE SHADE FIRST
CMP WORD PTR [SI+NUMENT],00 ; ARE WE ALREADY SMALL ENOUGH?
JZ SHDSML_RET ; YES, EXIT
DEC WORD PTR [SI+NUMENT] ; ADD 1 TO THE # OF ENTRIES
JMP SHORT SHDSML_RET ; RETURN THROUGH COMMON CODE
;
SHDSML_35: ; DOWNWARD ARROW KEY
MOV AX,SI ; RESTORE THE CONTROL BLOCK ADDR
CALL CLSHD ; CLOSE THE SHADE FIRST
CMP WORD PTR [SI+NUMENT],00 ; ARE WE ALREADY SMALL ENOUGH?
JZ SHDSML_RET ; YES, EXIT
INC WORD PTR [SI+SROW] ; NO, MOVE THE ROW DOWNWARD
DEC WORD PTR [SI+NUMENT] ; ADD 1 TO THE # OF ENTRIES
JMP SHORT SHDSML_RET ; RETURN THROUGH COMMON CODE
;
SHDSML_40: ; LEFT ARROW KEY
MOV AX,SI ; RESTORE THE CONTROL BLOCK ADDR
CALL CLSHD ; CLOSE THE SHADE FIRST
MOV AX,[SI+ECOL] ; GET THE RIGHT COLUMN
DEC AX ; ADJUST FOR THE BOARDERS
CMP AX,[SI+SCOL] ; ARE WE AT THE LEFT MOST COLUMN?
JZ SHDSML_RET ; YES, EXIT
DEC WORD PTR [SI+ECOL] ; NO, MOVE THE BOARDER
JMP SHORT SHDSML_RET ; RETURN THROUGH COMMON CODE
;
SHDSML_45: ; RIGHT ARROW KEY
MOV AX,SI ; RESTORE THE CONTROL BLOCK ADDR
CALL CLSHD ; CLOSE THE SHADE FIRST
MOV AX,[SI+SCOL] ; GET THE LEFT COLUMN
INC AX ; ADD IN THE MINIMAL SIZE
CMP AX,[SI+ECOL] ; ARE WE AT THE RIGHT MOST POSITION?
JZ SHDSML_RET ; YES, EXIT
INC WORD PTR [SI+SCOL] ; NO, MOVE THE BOARDER
JMP SHORT SHDSML_RET ; RETURN THROUGH COMMON CODE
;
SHDSML_RET:
MOV AX,SI ; RESTORE THE CONTROL BLOCK ADDR
CALL OPSHD ; THEN RE-OPEN IT
JMP SHDSML_07 ; GO GET ANOTHER KEY
SHDSML ENDP
;
;
;-----------------------------------------
; S H D S U P -- SCROLL THE SHADE UPWARD
;
PUBLIC SHDSUP
SHDSUP PROC NEAR
CALL SAVE_REG ; SAVE THE REGISTERS
;
CALL SETUP_REG ; SETUP THE REGISTERS FOR THE BIOS CALL
MOV AX,0601H ; MOVE ONE LINE UP
INT 10H
;
CALL REST_REG ; RESTORE & RETURN
RETURN
SHDSUP ENDP
;
;
;=====================
; ROUTINE SECTION
; LEVEL 1
;=====================
;
;
REST_REG PROC NEAR
POP CS:[RET_ADDR]
POP ES
POP DS
POP BP
POP DI
POP SI
POP DX
POP CX
POP BX
POP AX
JMP CS:[RET_ADDR]
REST_REG ENDP
;
;
INTEGER RET_ADDR ; WORK INTEGER FOR ROUTINES
;
;
SAVE_REG PROC NEAR
POP CS:[RET_ADDR]
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH SI
PUSH DI
PUSH BP
PUSH DS
PUSH ES
JMP CS:[RET_ADDR]
SAVE_REG ENDP
;
;
SETUP_REG PROC NEAR
MOV SI,AX ; SI POINTS TO THE BLOCK
MOV CH,[SI+SROW] ; FETCH THE STARTING ROW
MOV CL,[SI+SCOL] ; FETCH THE STARTING COLUMN
MOV DH,[SI+NUMENT] ; GET THE NUMBER OF ENTRIES (# OF ROWS)
ADD DH,CH
INC CL ; MOVE PAST THE BOARDER
INC CH ; MOVE PAST THE BOARDER
MOV DL,[SI+ECOL] ; FETCH THE ENDING COLUMN
DEC DL ; MOVE PAST THE BOARDER
MOV BH,[SI+BXATT] ; GET THE BOX ATTRIBUTE
RETURN
SETUP_REG ENDP
;
ENDPGM SHDDO
;