ZX Format #02
30 ноября 1995
  IS-DOS  

IS-DOS - How is it done No 2

<b>IS-DOS</b> - How is it done No 2
     Topic "How is it done?" No 2


               Eliseev

     Monitor command-line IS-DOS
and restart the line editor # 6E smbgt


    Hello, dear readers ZX
Format! I hope that those of you who have decided to try their 
hand at programming in the IS-DOS, it was interesting to read 
about the internal structure of system Utilities gmen.com, the 
work described in the first issue.


    Today we continue the study of
restarts IS-DOS, so to speak, to live
examples we consider in general terms the use of the restart 
line editor # 6E smbgt the example of the utility mon.com. 

    Utility mon.com well known to each user IS-DOS, because 
with the help of organized dialogue with the user system and 
introduces all the basic commands. It allows you to take the 
keyboard and edit the text input commands and

pressing ENTER sends his system, causing the performance of the 
command specified in text. To enter and edit text command is 
used to monitor restart # 6E smbgt, which is a functionally 
complete unit string editor, with a maximum of string

256 bytes. Consider the text of the program:

;****************************************

; Example of string
; Editor IS-DOS # 6E smbgt

; Monitor command line mon.com
; Source code with comments


       ORG # 5D64

;****************************************

, The beginning of the program, the finding by
; Restart # 45 g_com buffer address coma; ne line - a special 
area of ​​memory; Tee, which is used to send commands ; System 
and putting it on the stack 

START LD C, # 45; definition addresses

       RST # 10; buffer command

       EXX; line (HL)

       PUSH HL; address - stack

;****************************************

, Initialize the program, preparation of the working window, 
buffer, etc. 

; Routine cleaning of the buffer

CLBUF LD B, # 7F; buffer length

CLBUF1 LD (HL), # 20; initialization

       INC HL; buffer

       DJNZ CLBUF1; command line

, Opens a window to the editor
; Pre-determined according to the contents; Therefore, system 
variables, the current color , So that the window does not 
stand out and ; Put them into the vector window.



       LD IX, WIND; address vector window

                      ; Editor


       LD C, # 72; determine the address

       RST # 10; vector screen

       EXX; (in HL)


       LD A, (HL); consider color

                      ; The current screen

       LD (IX +4), A; enter the current

                      ; Color vector

                      ; Editor

, Draw a box


       LD C, # 61; initialization window

       RST # 10

; Initialize pointer

CURINI SBC HL, HL; zeroing HL

       LD C, # 6B; installation

       RST # 10; cursor coordinates


       POP HL; in HL - Address

                      ; Buffer command

                      ; Line

;****************************************

, Entering and editing commands

, Sets the parameters for the editor - width
The windows and byte of the state - and vyzy; Vai Editor


       LD A, # 2A; width of the window red.

       LD DE, # 0B00; status register

; Byte status register determines the mouth; Novki default 
editor: 

; Byte 0 = 0 - lowercase
, 1 - uppercase
, B 1 = 0 - Latin register
, 1 - Russian Register
, B 2 = 0 - text mode
; 1 - mode pseudographics
; Byte 3 must equal 1


       LD BC, # 036E; call smbgt # 6E

       RST # 10

; Restart smbgt accepts any keyboard; bye characters, as well 
as independently of; rabatyvaet control keys displacement, of 
the cursor and Delete, by pressing ENTER ; Are finished editing 
and ; Output, while in case A is contained

The length of the input string. Output is possible
, Also on the piano CS +9, CS + SS, SS + A,
; SS + SPACE, SS + ENTER, while in case
; A return code of the key that caused the
; Exit from the editor


       RET C; out by mistake

                      , I / O

And if pressed CS +9, CS + SS, SS + A,
; SS + SPACE, SS + ENTER, then


       JR NZ, EXIT; out of denial

; Test - whether the buffer is not empty?


       AND A; check flag

                      ; ZERO

       JR Z, START; go to top

                      , With an empty buffer

;***************************************

, The processing of clipboard contents


       PUSH HL; remember the address

                      ; Buffer com. line

       LD D, E; reset D

       LD E, A; in E - the length of the line

       ADD HL, DE; determine the address

                      , The first free

                      ; Cell buffer

       LD (HL), # 0D; add ENTER


       EX (SP), HL; placed in a stack

                      ; Address end of the buffer

                      ; Command line

                      , And HL - start

       PUSH HL; put the address

                      ; Start command

                      ; Line in the stack over

                      ; Address end


       LD B, (HL); save the first

       PUSH BC; symbol com. line


       PUSH IX; save the address

                      ; Vector window

; Transfer name and parameters imposed by the
; Command interpreter IS-DOS


       XOR A; set A = 0

       LD C, # 44; call exebat # 44

       RST # 10

; Restoring register contents


       POP IX; vector window

       POP BC; the first character cc

       POP HL; start address cc

       POP DE; address of the end of the sg

;***************************************

, The processing result of the command
; And restore the buffer contents to
; Editing error


       RET C; out of a serious

                      ; Error exebat


       LD A, # 20, in A - the code space

       LD (DE), A; "score" ENTER to

                      ; Buffer com. line

       LD (HL), B; recover

                      ; The first character in

                      ; Buffer com. line

       PUSH HL; remember the stack

                      ; Buffer address cc


       JR NZ, CURINI; error in cc

                      , Return to the conservation
                      ; Niemi text strings

                      ; Correction


       JR CLBUF; correct return

                      , With purification buffer

                      ; To the execution of

                      ; Line

;****************************************

; Out of denial

EXIT LD (HL), # 0D; put the ENTER

                      ; Beginning of the buffer sg

       XOR A; set flags

                      ; Output:

                      ; Z = 1, C = 0

       LD A, # F4; install code

                      ; Internal team

                      ; Shell (similar to

                      ; Shel1 # 81 with preserved
                      ; Neniem positions

                      ; Cursor on both

                      ; Panels)

       RET

;****************************************

; The data area of ​​the program

And the vector window:

WIND DEFB # 00; X-coordinate of window

       DEFB # 00; Y-coordinate of window

       DEFB # 03; window height

       DEFB # 20, window width

       DEFB% 00101000; color box

       DEFB% 11111111; shadow color # FF -

                      That the shadow does not appear

       DEFB # 00; X-print position

       DEFB # 00; Y-print position

;****************************************


    Author - Leontiev

    Comments - Eliseev
_________________________________________





Other articles:

IS-DOS - Information: The news in the world IS-DOS

IS-DOS - How is it done No 2

IS-DOS - a beginner No 2

IS-DOS - No 2 users

IS-DOS - programmers No 2

Assembler - Assembler for Dummies

Iron - Revised: Pepeklyuchatel turbo / normal for the Scorpion ZS-256-Turbo

Iron - The provinces of: presenting a sound card General Sound.

Iron - Manufacturer: Create Soft - Returning to the printed

Iron - Manufacturer: KAY - turbirovanie Spectrum - Machines

Toys - Novella: 48 irons.

Toys - on the shelves: Carrier Command.

Interview - Interview with Sergei and Andrei Zonov Larchenko

Information - The authors of the journal

Information - From the authors

Information - Help

Information - Black Box

Contest

a rest - Something: Nervous Work

Mailbox - Classified Ad

Mailbox - Letters from readers

Premiere - Digital Studio v1.12

Programmers - Basic to all.

Miscellaneous - From the history of the Amiga.

Miscellaneous - Prospects for P / O.

Systems - music editor Instrument 3.01

What's New - Overview of new products: Night Hunter, Extreme, Grell & Falla, Duck Out, Internationl Ninja Rabbits, Italian Super Car, Sly Spy Secret Agent, The Turn, Sextris.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Feedback - contact the publisher.
News - News from the FLASH on 06.15.1997 year.
System - Description of the music editor FLASH TRACKERa v2 (for SOUND DRIVER v1.0).

В этот день...   29 April