Topic "How is it done?"
Eliseev VA
Program gmen.com
and a system restart menu (# 91).
Today, under the heading "How is it done?"
we are acquainted with the inner workings of the program
gmen.com. This small but extremely necessary programm governs
the appointment of devices shell IS-DOS, it allows you to assign
any logical unit (A, B, C and
etc.), systemic (S), quick (Q) or
current (T). The basis of this program is the processing
procedure menu - a special box with your cursor and text
options, the selection of which causes execution respective
teams. For processing the menu at the core IS-DOS system
responds restart with the number # 91. I hope that a detailed
analysis of source code gmen.com help you easily and quickly
master this difficult process and learn how to use it in their
programs.
So, your attention is invited
source code gmen.com format IS-ASSEMBLER'a with detailed
commentary on each line of code.
;****************************************
; Example restart
; Menu # 91
; Utility System menu gmen.com
; Source code with comments
ORG # 5DC0
;****************************************
, The bulk of the program:
Setting of flowers, opening windows,
; Call menu
START XOR A; zeroing Reg. A
LD IX, WND; in the IX - the address vector
; Torus window
LD HL, (COL +5); moved from Century
LD (WND +4), HL; torus unicolor in
And the vector color window
The windows and shades
LD HL, (COL +7); moved from Century
LD (IX-10), L; torus unicolor in
LD (IX-12), H; vector color menu
; The ground and work
; Which the cursor
LD C, # 61; open
RST # 10; restart wt # 61
LD C, # 91; call menu
RST # 10; restart menu # 91
And the vector menu located directly
; To vector window, the offset for the IX
, Counted in the opposite direction
END XOR A; output in the SHELL on
LD A, # F2; finished
RET; menu # 91
; # F2 - code inside the shell command
; (Analog shell2 maintaining positions
; Cursor both panels), which
; Performed by RET, if installed
; Flag Z (team XOR A)
;****************************************
s
; Initialization procedure menu:
, Reads from the vector configuration
; Of the names of the system, fast and
; Current devices and places them in
The text menu
INIT LD C, # 10; definition addresses
RST # 10; vector
EXX; configuration system
; Themes (q cnfg # 10)
And in HL-mail
LD C, # 41 in C - the number for
; Transformation
; Device numbers
, (# 00 - # 05) in
; Character (A-F)
Form
DEC HL; in HL - address of numbers
; Pa system
; Device
LD A, (HL); assume the number
; Unit in A
ADD A, C; convert
LD (TXT +8), A; put in the text
; Menu
DEC HL; the same fast
LD A, (HL); device
ADD A, C
LD (TXT +17), A
DEC HL; the same for the current
LD A, (HL); device
ADD A, C
LD (TXT +26), A;
EXX; repair kit
; Register
RET; return to the menu
;****************************************
; Procedure for the appointment of one of the devices
; System, fast and current simultaneously
, Used a system of "hot keys"
; Restart menu # 91
, At the entrance to B - number of devices in the sim;
arbitrary (AF) as
ALL LD C, # 10; definition addresses
RST # 10; vector configuration.
LD A, # CF; in A - the number for
; Conversion of
; Symbolic form in
; Number
ADD A, B; transformation
EXX
DEC HL; in HL - address of numbers
; Pa system
; Device
LD (HL), A; record number
DEC HL; the same fast
LD (HL), A
DEC HL; the same for the current
LD (HL), A
END1 XOR A; return to the menu
INC A
RET
And if the procedure of "hot keys terminates; is called with
flag set Z, then ; Return to the running line with
; Number, a cat. stored in A
;****************************************
; Procedure for the appointment of devices
, Working out the menu options on the ENTER
SET LD C, # 10; definition addresses
RST # 10; vector configuration.
EXX
LD E, (IX-9) read from the vector
; Menu, the current position
; Tion cursor
XOR A
LD D, A; reset D
SBC HL, DE; set HL
; Address matches
; Yuschego device
; Vector system
, By subtracting
; Room menu bar
PUSH HL; save the address
LD A, (HL);
LD H, (IX-9) to determine the relative
LD L, # 08; coordinates are positive
; For the cursor editing
; Tirovaniya (H-Y,
; L-X)
SCF; set a flag C
; To call dvtrn
; # 4A after q dev
; # 8C
LD C, # 8C; call q dev # 8C
RST # 10; (name request
; Device)
; By calling dvtrn # 4A obtained
And as a result of q dev # 8C name
; Device in a symbolic form (AF)
, Is converted to the physical number of
, (# 00 - # 05)
POP HL; remember the address
; Device
; Vector configuration.
JR NZ, SET2; if the device
, So there is no name,
; Go to SET2
LD (HL), A; otherwise - to write
; Room at
SET2 LD C, # 08; waiting press
RST # 10; keys kwait # 08
JR END1; return to the menu
; To return to the menu using fragment
; The previous procedure (see END1)
;****************************************
, Procedure and exit the menu
, Practice options EXIT
EXIT OR # FF; put in A Code
; # FF to exit
; Menu and reset
; Flag
RET; return to the menu
;****************************************
; The data area of the program:
; Vector unicolor - a special table,
, Containing information about the program colors, and we and
you can edit them in ; By universal utility unicolor
COL DEFM "UnCo"; marker program
; Unicolor
DEFB # 04; the number of colors
DEFB% 01110000; color box
DEFB% 01000001; shadow color
DEFB% 00000111; color cursor
DEFB% 01000111; color desktop
; Cursor
And the vector menu - table settings for
; Of menu # 91, located before the
; Vector window, the offset for the index
; Addressing is measured in inverse
; Side from the beginning of the vector window
DEFB% 01100000; color desktop
; Cursor
DEFB% 00000000; status register
DEFB% 00000110; color of the cursor
DEFB # 01; cursor position
DEFW INIT; address of the procedure
; Initialization
DEFW # 0000 procedure address
; Caused by
; Pressing any
; Keys (0-no
; Procedure)
DEFW TABKEY; address of the procedure
; Service
; Keyboard shortcuts
DEFW TABENT; address of the procedure
; Service
; To ENTER
And the vector window
WND DEFW # 0415; window coordinates
DEFW # 0806; window size
DEFB% 01110000; color box
DEFB% 00000001; shadow color
DEFW # 091D; coordinates print
; Map cursor 00 - string does not
, Used 01 - used
DEFB # 01
DEFB # 01
DEFB # 01
DEFB # 01
The text box
TXT DEFM "System A"
DEFM "Quick A"
DEFM "Current A"
DEFM "Exit"
DEFB 03; end mark
; Text
; Table addresses the procedures invoked by
, Pressing ENTER
TABENT DEFW SET
DEFW SET
DEFW SET
DEFW EXIT
; Address table handling procedures
; Keyboard shortcuts
TABKEY DEFB # 65; e - EXIT
DEFB # 04; number of the menu bar
; For the regime holds
; Its equation of "grief
, Whose key "
DEFB # 00; marker mode
; Run line
DEFB # 20; SP - EXIT
DEFW EXIT
DEFB # 31; 1 - mgr. "A"
DEFW ALL
DEFB # 32, 2 - mgr. "B"
DEFW ALL
DEFB # 33; 3 - mgr. "C"
DEFW ALL
DEFB # 34, 4 - mgr. "D"
DEFW ALL
DEFB # 35, 5 - mgr. "E"
DEFW ALL
DEFB # 36, 6 - mgr. "F"
DEFW ALL
DEFB # FF; end mark
; List
;***************************************
Author - Leontiev
Comments - Eliseev