Program, which we choose - A few suggestions to improve the assembly.

ZX Review #7-8-9-10
(C) Ivan Roshchin, Moscow, 1997


      A few suggestions
to improve the assembly

1. If the assembler provides

   work with blocks of text,

   It is a command to delete you
   divided by a block of text. "But

   sometimes it is necessary about
   opposite team - UDA
   pour the entire text, but distinguished
   lennogo block.

2. The ability to turn distinguished
   lenny block of text in the commentary
   tary and vice versa.


                 Example


   LD A, 1; LD A, 1

   LD B, 2 <---->; LD B, 2

   CALL M1; CALL M1

   CALL M2; CALL M2


   Of course, the same results
   that can be achieved by using
   formation of conditional directives

   assembly, but offering
   emy way more intuitive.

3. When you write enough

   great program, we must all

   time to remember what tags you

   already used in it, otherwise

   You can re-define already

   existing label. There could

   to help such a possibility:

   you type a string with a label

   not thinking about the encountered
   chalas it in the text or not,

   and when the cursor is on

   tag, you press a certain

   key combination, and productivity
   reduces test: not whether the

   This label is already defined in

   program?

4. Structuring of the selected

   a block of text, ie after each
   Doi command transfer control
   of (JP, JR, DJNZ, RET) au
   cally inserted into an empty

   line. This increases udobochi
   taemost text.


                 Example

before conversion: after conversion

L1 LD A, (M1) L1 LD A, (M1)

   LD C, A LD C, A

   CALL SUBR1 CALL SUBR1

   DJNZ L1 DJNZ L1

   XOR A

   RET XOR A
M1 DB 4,5,6 RET


                      M1 DB 4,5,6


5. Translation numbers in a selected

   block of text from one system

   notation to another, such as

   how it was done in about
   shell "Revue."


                 Example

before conversion: after conversion


   LD HL, # 4000 LD HL, 16384

   LD DE, # 4001 LD DE, 16385

   ............. .............


6. Count of bytes occupied

   portion of the program, finding
   schemsya in the selected block tech
   hundred.


                 Example


   CALL M1

   LD A, 7

   LD (HL), A

   RET

   DB 12,34


   Result: 3 +2 +1 +1 +2 = 9 bytes.


7. Counting the number of cycles to a
   Thoroe are satisfied

   in a selected block of text to
   Manda (it may be necessary

   when programming MULTICO
   LOR'a).


                 Example


   XOR A

   LD (HL), A

   LD A, 6

   LD B, 4


   Result: 4 +7 +7 +7 = 25 cycles.


8. Everyone knows the directive ac
   Sembler DB, allowing op
   We define one or more

   bytes of data. In some

   cases may be more convenient

   be a shorthand way written
   B of this directive. To couple
   stimosti other Assemblée
   ramie is necessary to provide

   and reverse transformation

   (Entire text or selected

   block), which reduced
   quadratic form entries become

   in full.


                 Example


   was:


      DB # 12, # 34, # 56

      DB% 01110111,% 11101110


   was:


      DB # 123456

      DB% 0111011111101110


9. You can make the program more

   visual considerably facilitate
   chit her writing and debugging

   if instead of typing the CP and the following
   blowing her team of conditional
   Noah transfer control study
   to use a lot more on
   nyatnye operators:


                 Example


   was: was:

   ......... .........

   CP 13 IF A = ​​13 THEN JR M1

   JR Z, M1 LD A, (X)

   LD A, (X) IF A <(IX +5) THEN JP M2

   CP (IX +5) IF A <= E THEN JR M3

   JP C, M2 IF A <> (HL) THEN CALL M4

   CP E IF A = ​​0 THEN RET

   JR C, M3 .........

   JR Z, M3

   CP (HL)

   CALL NZ, M4

   AND A

   RET Z

   .........


   Instead IF A <(IX +5) can be null
   write and IF (IX +5)> A - Assem
   Blair himself will understand what

   teams to form the object
   dimensional code.


   Provision should be excited
   possibility of conversion "normal
   normal "program (of those
   incidentally or the selection) in

   this format, and vice versa (for

   compatibility with other ac
   Sembler).


           *