Section "How it's done?"
Eliseev V. A.
Program gmen.com and system restart menu (#91).
Today in the section "How it's done?" we will get acquainted with the internal structure of the program gmen.com. This small but extremely necessary program manages the assignment of devices in the IS-DOS shell, allowing any logical device (A, B, C, etc.) to be designated as system (S), quick (Q), or current (T). The core of this program is the menu processing procedure - a special window with a cursor and text options, the selection of which triggers the execution of corresponding commands. The system restart with number #91 is responsible for menu processing in the IS-DOS kernel. I hope that a detailed analysis of the source code of the program gmen.com will help you easily and quickly master this complex procedure and learn to use it in your programs. So, we present to your attention the source code of the program gmen.com in IS-ASSEMBLER format with detailed comments for each line of the program.
;****************************************
;Example of using the restart
;menu #91
;System menu utility gmen.com
;source code with comments
ORG #5DC0
;****************************************
;main part of the program:
;setting colors, opening a window,
;calling the menu
START XOR A ;clear reg. A
LD IX,WND ;load address of window vector into IX
LD HL,(COL+5);transfer from unicolor vector to
LD (WND+4),HL;window color and shadow vector
LD HL,(COL+7);transfer from unicolor vector to
LD (IX-10),L ;main and working cursor color vector
LD (IX-12),H ;
LD C,#61 ;open window
RST #10 ;restart wt #61
LD C,#91 ;call menu
RST #10 ;restart menu #91
;the menu vector is located directly
;before the window vector, the offset for IX
;is counted backwards
END XOR A ;exit to SHELL on
LD A,#F2 ;completion of work
RET ;menu #91
;#F2 - code of the internal shell command
;(analog shell2 with saving positions
;of the cursor in both panels), which
;is executed on RET if the
;Z flag is set (by the XOR A command)
;****************************************
;menu initialization procedure:
;reads from the configuration vector
;the names of the system, quick, and
;current devices and places them in
;the menu text
INIT LD C,#10 ;determine address
RST #10 ;system configuration vector (q cnfg #10)
EXX ;in HL - address
LD C,#41 ;in C - number for conversion
;of the device number (#00-#05) to
;character (A-F) form
DEC HL ;in HL - address of system device number
LD A,(HL) ;read device number
;into A
ADD A,C ;convert
LD (TXT+8),A ;place in menu text
DEC HL ;the same for quick
LD A,(HL) ;device
ADD A,C
LD (TXT+17),A
DEC HL ;the same for current
LD A,(HL) ;device
ADD A,C
LD (TXT+26),A;
EXX ;restore register set
RET ;return to menu
;****************************************
;procedure for assigning one of the devices
;as system, quick, and current simultaneously
;the "hot key" system is used
;restart menu #91
;on input in B - device number in character (A-F) form
ALL LD C,#10 ;determine address
RST #10 ;config vector
LD A,#CF ;in A - number for
;conversion from
;character form to
;number
ADD A,B ;conversion
EXX
DEC HL ;in HL - address of system device number
LD (HL),A ;write number
DEC HL ;the same for quick
LD (HL),A
DEC HL ;the same for current
LD (HL),A
END1 XOR A ;return to menu
INC A
RET
;if the "hot key" procedure ends
;with the Z flag set, then when returning to the menu
;the line with the number stored in A is executed
;****************************************
;device assignment procedure
;processing menu options by ENTER
SET LD C,#10 ;determine address
RST #10 ;config vector
EXX
LD E,(IX-9) ;read from vector
;menu current cursor position
XOR A
LD D,A ;clear D
SBC HL,DE ;set HL to address of corresponding device in
;system vector by subtracting
;menu line number
PUSH HL ;save address
LD A,(HL) ;
LD H,(IX-9) ;determine relative coordinates
LD L,#08 ;for editing cursor (H-Y, L-X)
SCF ;set C flag
;for calling dvtrn #4A after q dev #8C
LD C,#8C ;call q dev #8C
RST #10 ;(request device name)
;thanks to the call dvtrn #4A, the name
;of the device obtained as a result of q dev #8C
;in character form (A-F)
;is converted to physical number
;(#00-#05)
POP HL ;recall address
;of device in
;config vector
JR NZ,SET2 ;if there is no device with that name,
;go to SET2
LD (HL),A ;otherwise - write number at address
SET2 LD C,#08 ;wait for key press kwait #08
RST #10 ;return to menu
;to return to menu, a fragment
;of the previous procedure is used (see END1)
;****************************************
;procedure for exiting the menu
;processing the EXIT option
EXIT OR #FF ;place in A code
;#FF to exit from menu and reset
;C flag
RET ;return to menu
;****************************************
;data area of the program:
;unicolor vector - a special table,
;containing information about the program colors and
;allowing them to be edited using
;the universal utility unicolor
COL DEFM "UnCo" ;marker of the unicolor program
DEFB #04 ;number of colors
DEFB %01110000 ;window colors
DEFB %01000001 ;shadow colors
DEFB %00000111 ;cursor colors
DEFB %01000111 ;working cursor colors
;menu vector - parameters table for working with menu #91,
;located before the window vector, the offset for
;index addressing is counted backwards
;from the beginning of the window vector
DEFB %01100000 ;working cursor colors
DEFB %00000000 ;status register
DEFB %00000110 ;cursor color
DEFB #01 ;cursor position
DEFW INIT ;address of initialization procedure
DEFW #0000 ;address of procedure called on
;any key press (0-no procedure)
DEFW TABKEY ;address of hot key handling procedure
DEFW TABENT ;address of ENTER handling procedure
;window vector
WND DEFW #0415 ;window coordinates
DEFW #0806 ;window sizes
DEFB %01110000 ;window colors
DEFB %00000001 ;shadow colors
DEFW #091D ;print coordinates
;cursor movement map 00 - line not used 01 - used
DEFB #01
DEFB #01
DEFB #01
DEFB #01
;text of the window
TXT DEFM "System A"
DEFM "Quick A"
DEFM "Current A"
DEFM "Exit"
DEFB 03 ;marker of the end of text
;table of procedure addresses called by pressing ENTER
TABENT DEFW SET
DEFW SET
DEFW SET
DEFW EXIT
;table of procedure addresses for handling "hot keys"
TABKEY DEFB #65 ;e - EXIT
DEFB #04 ;menu line number
;for executing it by "hot key"
DEFB #00 ;marker of line execution mode
DEFB #20 ;SP - EXIT
DEFW EXIT
DEFB #31 ;1 - device "A"
DEFW ALL
DEFB #32 ;2 - device "B"
DEFW ALL
DEFB #33 ;3 - device "C"
DEFW ALL
DEFB #34 ;4 - device "D"
DEFW ALL
DEFB #35 ;5 - device "E"
DEFW ALL
DEFB #36 ;6 - device "F"
DEFW ALL
DEFB #FF ;marker of the end of the list
;***************************************
Author of the program - A. Leontiev
Comments - V. Eliseev
Contents of the publication: ZX Format #01
- IS-DOS
IskraSoft introduces IS-DOS Classic 4.0 with advanced text editing features, a disk utility, a hard drive controller for ZX Spectrum, and a program debugger.
- IS-DOS - Владимир Елисеев
Overview of IS-DOS for ZX Spectrum, highlighting its advantages over TR-DOS. Discussion on installation, usage, and file management features of IS-DOS. Introduction to system utilities and interface similar to Norton Commander.
- IS-DOS - Владимир Елисеев
The article provides a concise guide to the IS-DOS system disk, listing all essential files with explanations. Files are sorted alphabetically and grouped by directories for easy navigation. The guide focuses on a basic overview of files and commands without extensive descriptions.
- IS-DOS - Владимир Елисеев
Discussion on the UniColor standard for color settings in IS-DOS programs, its implementation, and advantages for user customization.
- IS-DOS - Владимир Елисеев
Discussion of IS-DOS window interface features. Implementation of window system in IS-DOS and its advantages. Example programs for creating windows and frames.
- IS-DOS - Владимир Елисеев
Description of the internal workings of the gmen.com program for IS-DOS, focusing on device management and menu handling with detailed source code and comments.
- Hardware - Vladimir Larkov
Discussion on modifying Scorpion ZS-256 hardware for compatibility with specific software. Describes blocking port #1FFD to run incompatible programs. Provides technical details for implementation.
- Железо - Nemo
Discussing hardware braking devices for ZX Spectrum. Focus on creation and impact of brakes on overclocked processors. Warning about potential side effects.
- Железо
Discussion of the impracticality of repairing old computers and the economic sense in replacing them with modern hardware. The article highlights challenges in DIY repairs and suggests alternative solutions. Emphasizes the benefits of upgrading to newer, more reliable components.
- Железо
Discussion of new peripheral developments for Scorpion ZS 256, including an innovative universal controller and MIDI interface. Highlights enhancements in keyboard and mouse controllers and expansion of built-in software capabilities. Offers details on professional ROM extension and turbo mode for improved performance.
- Игрушки - Ruster
A detailed walkthrough of the game Crystal Kingdom Dizzy, including solutions to puzzles and tips for progressing through the story.
- Игрушки - Павел Рындин
Description of the logic game 'Bulls and Cows', its mechanics and gameplay. Explains levels of difficulty and the goal to guess a number with minimal attempts.
- Игрушки - Вячеслав Медноногов
Discussion on the nuances of 'UFO: Enemy Unknown' game, focusing on alien species, their tactics, and gameplay strategies. Details on game mechanics and future sequel 'UFO-2: Devils of the Abyss'. Includes programming insights and development history.
- Игрушки - SParker
Overview of games and software on the Saint Petersburg market in 1995.
- Интервью
Vyacheslav Mednonogov shares his journey as a programmer, from assembling his first Spectrum-48 to developing notable games like 'UFO. Enemy Unknown'. He describes challenges and insights in game development and the rise of Russian game localization. His experiences highlight the evolution of programming and software distribution in the 1990s.
- Информация
Introduction to ZX-Format, a new electronic magazine for ZX Spectrum enthusiasts, focusing on games, programming, hardware, and community interaction.
- Конкурс
Discussion on organizing a new competition for the magazine. Readers are invited to submit their theme ideas. Selected themes will be featured in future issues.
- Конкурс
ZX Format announces a competition for the best mission created using the mission editor for the game Laser Squad. Submissions are accepted by mail or in person. Winner receives a box of 3M disks and the next issue for free.
- Отдохнём - Килат Амор
A programmer's day filled with dreams, gaming, and casual conversations. Vasetchkin balances ambition with relaxation, embodying the programmer's spirit. Reflects on the demands and enjoyment of a programmer's life.
- Mailbox - Максим Романов
Discussion on hardware and software offers in St. Petersburg by LOGROS and Create Soft, including detailed insights on Kempston Mouse interface.
- Mailbox - SParker
Compilation of cheat codes for ZX Spectrum games by Sergey Pavlov. Techniques for extra lives and immortality. Not recommended for fans of fair play.
- Mailbox
Description of submission guidelines for letters and articles to the magazine, including formatting and submission preferences.
- Премьера - Алексей Щекин
Gameplay of Lines game on ZX Spectrum, similar to Color Lines. Move balls to form lines of the same color. Scoring and controls are described.
- Программистам - Дмитрий Рудовский
Introduction to advanced BASIC programming techniques for ZX Spectrum 48, highlighting its advantages over 128 BASIC. Plans for future articles include service programs and language extensions. The article serves as a guide for experienced programmers.
- Программистам - Михаил Спицын
Introduction to assembly language on ZX Spectrum. Explanation of Z80 processor structure, registers, and basic commands. Includes example programs for learning.
- Программистам - Андрей Седов
Mission editor for Laser Squad by Andrey Sedov allows fans to create new missions. Includes user-friendly interface with minimal controls. Offers features like object editing, price adjustments, and sprite assignment.
- Various
History of Amiga computer development, its creators, and key features. Evolution from arcade games to a leading home computer. Amiga's market success and technological advancements.
- Разное
Review of upcoming ZX Spectrum software products with demos. Highlights include adventure games, RPG trials, and strategic tactics. Several well-known developers contribute to these releases.