Forum - Features assembly ZX ASM 3.0.

ZX Review #5-6
(C) Ivan Roshchin, Moscow, 1997


  Study and debugging @ files

       with STS 5.1


  It is known that the monitor debugger STS can freely download 
and debug @ files, occupying all 48 kilobytes. This STS makes 
indispensable to Hacker. 

  I suggest a slight improvement STS, whose meaning is as 
follows: after downloading @ file into memory, specify a 
parameter and Pressing "SS + U"

values ​​of all processor registers will be as they
were at the time of pressing
MAGIC. After that you can, for example, to continue to study 
the program step by step mode.


   This possibility is useful
you not only for research
others' programs, but also to debug their own. Assume
you wrote a program, run it, and it seems to be stuck. In this
If you can click
"MAGIC", write the contents of memory to disk and then load
obtained @ file in the STS and find out what is wrong wrong
program.


   WARNING! All the reasons mentioned below
only applies to STS 5.1!


   To convert the STS 5.1
must do the following:

1) Make sure that the disk at
   files are present "STS5.1"

   (This file may also be called
   ваться "STS5.1AL", "STS5.1XX"

   etc.), "sts5.1a", "sts5.1b".

2) Run the file "STS5.1".
140.
3) Press the "U". Address in

   top of the screen should

   become equal to # FE2A.

4) C # FE2A addresses enter commands
   between assembler JP # FE74 (that
   you could call a
   program, establishing

   register values, and clicking
   TII "SS + U").

5) Starting from the address # FE71, enter the program:

# FE71: JP # F86A

        LD HL, # FEB1

        CALL # E354

        LD HL, (# FEE6)

        CALL # E33D

        PUSH DE

        PUSH HL

        LD HL, # DC7B

        SET 0, (HL)

        BIT 2, E

        JR NZ, # FE8D

        RES 0, (HL)

        POP HL

        LD IX, # FEBF

        CALL # E33D

        LD A, (IX + # 00)

        INC IX

        LD (# FE9F), A

        LD (# FE00), DE

        CP # E4

        JR NZ, # FE92

        LD (# FEFE), DE

        LD (# FEE6), HL

        POP AF

        LD (# FEF4), A

        RET

        LD DE, (# E33B)

        LD A, D

        OUT (C), E

        LD E, (HL)

        INC HL

        LD D, (HL)

        INC HL

        OUT (C), A

        RET

5) From the following addresses (# FEBF)
Enter code block:

# FEBF: # F4, # FC, # F6, # F8, # FA, # EA, # E8, # EC

        # EE, # F0, # F2, # E4

6) The given core dump
Check if amended
changes:

# FE71 # C3, # 6A, # F8, # 21, # B1, # FE, # CD, # 54
# FE79 # E3, # 2A, # E6, # FE, # CD, # 3D, # E3, # D5
# FE81 # E5, # 21, # 7B, # DC, # CB, # C6, # CB, # 53
# FE89 # 20, # 02, # CB, # 86, # E1, # DD, # 21, # BF
# FE91 # FE, # CD, # 3D, # E3, # DD, # 7E, # 00, # DD
# FE99 # 23, # 32, # 9F, # FE, # ED, # 53, # 00, # FE
# FEA1 # FE, # E4, # 20, # ED, # ED, # 53, # FE, # FE
# FEA9 # 22, # E6, # FE, # F1, # 32, # F4, # FE, # C9
# FEB1 # ED, # 5B, # 3B, # E3, # 7A, # ED, # 59, # 5E
# FEB9 # 23, # 56, # 23, # ED, # 79, # C9, # F4, # FC
# FEC1 # F6, # F8, # FA, # EA, # E8, # EC, # EE, # F0
# FEC9 # F2, # E4
2

    Once you've typed
this program, you must save it to disk. This can be done in two 
ways: 

1) Enter the entire STS with

   amended by

   disc. This option is

   optimal, if you frequently

   concern is debugged
   Coy @ files. For the record nuzh
   but first, with the key

   "B" set the Bank = # 18, for
   to press the "E" and the settlement
   le menu appears "Setup"

   select the "Config Save".

2) Enter into a separate file

   only the changes.

   To do this, press

   'S', enter the name of the file
   example, "@ VIEW", then the old
   The quantum e (# FE2A) and length

   (# A1 bytes). Note that if

   Each subsequent run STS

   to work with the @-file at
   exists to upload a file change
   neniyami. Before downloading it
   the first file, press

   'U', and after it installed

   Bank = # 18.


    Now I will tell you about the features of BitTorrent @ 
files. First of all, before uploading correctly set the Bank in 
order to avoid mashing STS. Typically Bank = # 18. After 
specifying the name of downloadable @ File STS issues in the 
rows Start, Len information from the directory. The Start value

to remember (as at the
it is not addressed to start the download and mail in the stack
@ File). For proper load, you must specify Start =
# 4000, Len = # C000. After the download, remember the value 
Start, written in the directory of the disk, and enter it in 
the register SP. Then press the key combination 'SS + U', and 
registers take appropriate values.

Further, can debug @ file.


    Note that the code that sets the value
Register for the @-file is
memory area in which the earlier
was the procedure of disassembling with labels (for debugging
@ Files, it is not necessary). The user function that is called 
for "SS + U", initially consist of one team JP # FE74, but 
after the register values ​​@ file installed, this function can 
be changed. 


            *