Adventurer #08
31 августа 1998

Exchange of experience - Art Studio and the principle of open architecture (how to write their own modules to the editor).

<b>Exchange of experience</b> - Art Studio and the principle of open architecture (how to write their own modules to the editor).
     (C) Ivan Roshchin, Moscow, 1998


               ART STUDIO

     and the principle of open architecture


     There exists a version of the graphical editor ART STUDIO 
(v2.01c, corrected by ROM / SM and FUX / SM), which can

play music while working. T.
is, the disk contains the editor, and immediately
after him - the file "artmusic", containing
compiled music format PRO
TRACKER or SOUND TRACKER PRO. When you run the editor, this 
file is loaded into free bank of RAM (1 or 6), and in the 
process calls the player 'and to interrupts. (It turned out 
that the name of the file does not matter, if only he was

written directly to the editor
ie, the file "ART ".)

     I used to use other versions of ART STUDIO, who had his 
drawbacks: the needle will disappear is not clear which then 
appear on the screen colored bands, and all hang ... So with 
the advent of the new version, I turned to her. But even here

I waited for the unpleasant features (in
general, known to all users
ART STUDIO) - inclusion of a white border 'and
modes Magnify, Font editor and
Scrapbook. You should have something to do with it, and I 
decided to slightly change the player in a file with the music. 
Editor installed white border, but caused an interrupt player, 
in addition to its main tasks, set me right color.


     Quite a long time I have worked with such
version of ART STUDIO, has not yet emerged
Another problem: it was necessary to draw
some image from the known coordinates of its points. How, for 
example, noted in the figure the point with coordinates X = 45, 
Y = 83? Now, if the screen constantly displays the current 
coordinates cursor ...


     And then I thought: what if I write
module with the same start address
(# C000), the same entry points (INIT =
# C000, PLAY = # C006), as compiled from the music, and then 
"sneak" him editor, writing the file instead

"Artmusic". And this module, in turn, each time when his appeal 
is to be displayed on the screen coordinates of the cursor.


     Module (aka art_xy)
was written and a successful conclusion coordinates (and 
besides, watching the border 'th and I installed the necessary 
initial values ​​of attributes). At the end of this article 
provides the source code of its principal part, which will come 
in handy when developing own modules.


     What do we see? It turns out that any
missing an opportunity to ART STUDIO
easy to implement yourself by writing for
This special module. And if it is written
several modules, you can download them
in turn, without leaving the editor (for
Then, of course, each module must be provided for the team - 
download another module and give him control).




       RAM DISK



    ART STUDIO Module 1


                            ...


     Module 1 Module n



     Create your own module, without a doubt,
much easier than writing a new graphical editor from scratch. 
Different modules can be written by different people, 
independently of each other. And therein lies the principle of 
open architecture. Surely James Hutchby, author ART

STUDIO, had no idea about such features of its editor.

     What functions can be contained in
additional module? For example, fast
Viewing images recorded on the disc without
download them to the editor, saving and
recovery configuration, use more memory (> 128K) as RAM - disk, 
perform various transformations on the marked the window well 
and Of course, music, and screen saver. All this

quite fit in 16 kilobytes.

     In the "ZX-FORMAT # 7" You can read about
project, "STATE OF THE ART" group
"AVALON". As written there is a new
graphics editor with extraordinary
capabilities, combining the advantages
the best editors on SPECTRUM, PC and
AMIGA. I wish that there used modular construction, with
detailed description of the interface between the module and 
the editor, so that each user himself may realize the desired 
him function. It gives almost unlimited expansion possibilities 
editor. 


     Now I'll discuss in more detail
how to write your own module
ART STUDIO. I'll start with I have known addresses, which are 
variables Editor: 


  INK - 52186 (0-7, 8-transp.)

  PAPER - 52,187 (0-7, 8-transp.)

  BORDER - 52,188 (0-7)

  BRIGHT - 52189 (0-off, one-on, two-transp.)

  FLASH - 52190 (0-off, one-on, two-transp.)


     The absolute coordinates of the cursor (X -
56035, Y - 56,036) duplicated addresses
64977 and 64978, respectively. Home
coordinates located in the upper left corner of the screen.

     Since these variables are in
0 memory bank, and the module is loaded into a
or 6 bank is accessed with
using special functions - see listing.

     During the first 50 calls to the module (ie, 1 second of 
real time After starting the editor) unpacking editor and 
initialize variables. If the module required to change a set of 
default attributes (INK, PAPER, BORDER) on the other - these

attributes needed to reinstall when
Each of the first 50 hits. Explanation
here is: Obviously, when you start the editor commands are 
executed the following: 


   LD A, 0

   LD (52186), A; INK

   LD A, 7

   LD (52187), A; PAPER

   LD A, 7

   LD (52188), A; BORDER


   ... , An interrupt occurs, causing
       , With a module that installs

       ; Necessary INK, PAPER, BORDER


   CALL CLS; clear screen

                 , Acc. attributes


     It is evident that the installation of the necessary 
attributes to occur after the editor of these settings, but 
prior to as an editor to clean up the screen. A

since it is unknown which of the account termination will match 
this moment, prihoditrya perform the installation attributes of 
50. 

     By the way, if you run the editor
need to change the default values ​​for attributes on the 
"transparent", it is better to do after the first 50 calls 
module - otherwise the screen during the cleaning attributes of 
familiarity will be established at random manner.


             Source

      the main part of the module "art_xy"



        ORG # C000


        JP INIT; # C000 - INIT

        DS 3

        JP PLAY; # C006 - PLAY

        RET; # C009 - STOP

; Values ​​INK, PAPER, BORDER:

COLORS DB 7,0,0

;--------------------------------------; Procedure INIT - 
executed before ; The beginning of the editor.


INIT DI

; Save memory for the resident:


        CALL SAVE_M

; We transfer a resident of N3, and run it.
In cells BANK obtain bank number,
, Which is loaded art_xy:


        LD HL, RES3_B

        CALL LOAD_R

        CALL # 6000

; Restore previously saved
; Chunk by a resident:


        CALL LOAD_M

; Display a message "module is loaded ..."
, And the expectation of keystrokes:


        CALL # D000
INIT1 XOR A

        IN A, (254)

        CPL

        AND 31

        JR Z, INIT1

        EI

        RET

;--------------------------------------; Procedure PLAY - 
performed every , 1 / 50 seconds.


PLAY DI

        CALL SAVE_M

        ...

        CALL LOAD_M

        EI

        RET

;--------------------------------------; Procedure LOAD_M 
stored in a buffer ; The memory under the resident

; (Start address - # 6000, the length of the -
The length of the longest resident in the
; This module is a resident of N3).

LOAD_M LD HL, RES_BUF
LOAD_R LD DE, # 6000

        LD BC, RES3_E-RES3_B

        LDIR

        RET

;--------------------------------------; SAVE_M procedure 
restores the previously ; Memorized (with LOAD_M) plot

; Memory.

SAVE_M LD HL, # 6000

        LD DE, RES_BUF

        LD BC, RES3_E-RES3_B

        LDIR

        RET

;--------------------------------------; Procedure GET_MEM - 
analog command ; LD A, (DE). Need for access to bank 0

; Memory.

GET_MEM PUSH HL

        PUSH BC

        PUSH DE

        LD HL, RES1_B

        CALL LOAD_R

        POP DE

        CALL # 6000

        POP BC

        POP HL

        RET

;--------------------------------------; Procedure TO_MEM - 
analog command ; LD (DE), A. Need for access to bank 0

; Memory.

TO_MEM PUSH HL

        PUSH BC

        PUSH DE

        LD HL, RES2_B

        CALL LOAD_R

        POP DE

        CALL # 6000

        POP BC

        POP HL

        RET

;--------------------------------------; Resident N1 - LD A, 
(DE): 

RES1_B LD BC, # 7FFD

        LD HL, (BANK)

        OUT (C), H

        LD A, (DE)

        OUT (C), L

        RET
RES1_E

;--------------------------------------; Resident N2 - LD (DE), 
A: 

RES2_B LD BC, # 7FFD

        LD HL, (BANK)

        OUT (C), H

        LD (DE), A

        OUT (C), L

        RET
RES2_E

;-------------------------------------; Resident N3 determines 
which bank , (1 or 6) module is loaded art_xy.

; Record this value in the variable
; BANK.

RES3_B LD BC, # 7FFD

        LD A, # 11

        OUT (C), A

        LD A, (PRIZN)

        CP "+"

        LD A, # 11

        JR Z, RES3_1

        LD A, # 16
RES3_1 OUT (C), A

        LD (BANK), A

        RET
RES3_E

;--------------------------------------; Dl buffer memory of 
the memory ; A resident:


RES_BUF DS RES3_E-RES3_B

PRIZN DB "+"
BANK DW # 1000







Other articles:

From the Author - help: New bugs in the new shell.

From the Author - the author: about the authors of the magazine.

Presentation - Content of the program: Installer to AUTORUN DISK v2. 0 adventyurnaya game Diamond.

Presentation - a program for protecting programs TRICK v1. 003b.

Presentation - HELP Z_80: User's Guide.

Interface - letters from readers: Black Raven, The Secret Game NEW DIZZY, On the errors of the game APOLLO, a new debugger Veros STS 6.2, How to beat the game Svyatogor.

Interface - PC vs Amiga: Is AMIGA RULEZ? First impressions neophyte.

Interface - support for producers of "iron" their "creations" after they (the creatures) get into the hands of users.

Interface - thinking out loud: "SPECCY computer for young people. If we have so many cool coders, why so little steep domestic soft'a?"

Interface - pens from CAV inc: "SPECCY it does not work, this rest is, even more than the rest, it's a lifestyle, and if by that you still manage to get the money. .. "

Interface - SPECCY pros and cons, Reflections Spy / Eternity Industry.

System - Overview of system programming: ZX-IBM Editor v1.5M, PPF v1.05, Multistudio v2.0p, Mods Player v2.0, Bitmap Viewer v2.0, Corrector v2.0, Storm v1.1, 866 v1.2, HRUM v3.5, TDU v1.0, HRUST v1.0, RLE-Compressor v1.21, Overlays Consul Commander.

Toy Review - An overview of new gaming software: Rabbit Jazzy, Quadrax, Komplex, Math of the day, Cue Boy, Zly Sen, Prva Aakcia, Outlaw, The Dark Empire, Gary Linekers.

Toy Review - Demos: Little Ghost, The Dark Empire, Worms, Smagli 3 Monster Land, Civilization, Mysteries of Captain Shelton.

Guests - Presentation of a group of Kovrova - Eternity Industry.

Guests - Filix about creating games Winnie The Pooh-2.

Guests - ekstremalschiki: new section which highlights aspects of the life and work of extreme Rybinsk musicians. Today, a visit Marat and Demon - stood at the origins of such well-known (in the narrow circles) team "Disgust".

Promotion - How to play the game Encyclopedia of WAR.

Promotion - the passing game Where time Stood Still.

Promotion - description of the game Elopement: back to the Earth.

Promotion - the passage of text adventyury Island of Darkness (Island Darkness).

Promotion - the passage of text adventyury Knightmare.

Exchange of experience - Russian glitches: The Island of Darkness Game (how NOT to write adventyurnye game).

Exchange of experience - Finalization ZX-ASM v3.0 by Ivan Roshchina.

Exchange of experience - Features video controller ZX Spectrum (for programmers).

Exchange of experience - Graphic effect IRIS (plasma).

Exchange of experience - the procedure output window frame.

Exchange of experience - on how to operate in the assembly with the long numbers of type Long.

Exchange of experience - Art Studio and the principle of open architecture (how to write their own modules to the editor).

Exchange of experience - The movement procedure of attribute labels in pixels (floating atrubuty).

Ottyag - A Tale of Pentium Pentiumovicha Pentiumova. 20 things you can do if your favorite team lost on the road. Toilet, as a measure of human values.

Ottyag - Test "Formatsevt, check for authenticity."

Ottyag - Test "You are not dumb ass."

Ottyag - The test "Do you have a sense of humor."

Ottyag - Test "Which of your student."

Ottyag - How to PROPERLY kill Windows'95.

Ottyag - Winnie the Pooh and all-all-all - 2.

Novella - Tales Corporal Djilali (the game Laser Squad).

Novella - Escape from Space (the game Elite).

Novella - Hedgehogs mutants.

News - News from the Rybinsk spektrumistov: Infosoft, Shrsoft, Surgeon, Chasm, Protecvision, Groboclone, Volume 4, Experience, Mr. Vano, Ant, Demon, Miguel, Veka, RDM, Auryn.

News - News from the Yaroslavl spektrmistov: Marchy, Kav Software, Nicolas Viper, Dr Shura, Harkonnen, MacKeymn, DJ Reason.

Advertising - advertising and announcements.



Similar articles:
Paradox - An invitation and a story about the trip.
Iron - A new project the firm Peters - "Sprinter". New Spectrum-compatible PC with a new generation of Speccy.
Overview of new products - of updates: The Hexxagon 2, Pirates, Mortal Kombat (Mafia), Monster Land demo, DOOM pre release v1.5b
idea - Optimization of the music tracks.

В этот день...   23 November