(C) Ivan Roshchin, Moscow, 1998
Refinement ZX ASM 3. 0
This is a very good assembler does not
lacks some of the capabilities required for debugging programs.
So, after starting the program being debugged and the end its
work management immediately transferred assembler, and
sometimes simply impossible see what they had brought to the
screen program. There would not prevent a delay before pressing
any key. Naturally, such delay should be switchable by the user.
It would be nice to be able to
see the screen in the program being debugged
any time work in assembly language. When you debug a program on
the PC, for example, using Turbo Debugger, you can do most
naturally: connect to a computer two monitors and one can see
the debugger, and the other - the screen debugged program.
Spectrum, of course, before this far, but something can be done
at it. For example, to switch the screen assembly and screen of
the program, simply by pressing a certain key combination.
Sometimes, immediately after the
running from the assembler program is
need to run a debugger. If
to act in the usual way (ie, cause
debugger from the assembly), by the end of the program to start
the debugger will be quite a noticeable amount of time (About
two seconds). This is due to the fact that when you return to
the assembler and debugger when you call there is an exchange
of domains memory. Therefore useful would be able to run the
debugger immediately after the program, pressing a certain key
combination.
It turns out that all these possibilities
can be realized and, moreover, quite
simple. How to do it, it will be shown
below, and now look at how to
look to work with this assembler.
Enable and disable the standby mode
pressing after work
running of the assembly program can be
by changing the color of the curb (the menu
Setup / Colors). If you set the color 0
mode is disabled, 1 - enabled. You can set the other colors,
the role played by only LSB defined by numbers.
When enabled, after
of the running of the assembler program
or routines (menu Run and
Call) border turns green (this signal
you need to press). When you press "D" immediately start the
debugger, but when you press any other key management will be
transferred to the assembler.
The same effect (pause before pressing
keys) will arise in the case when
you just run the assembler (for example,
emerged from it in BASIC, but then again
run the command RUN; or when they came out
of the ASM 'in the debugger, and then - again
assembler). In this case, just longer
hold ENTER.
Now, how at any moment with the assembler view screen
program being debugged. When a program is launched from the
assembler completes its job (or just when you start
assembler), the contents of the display file
(# 4000 - # 5AFF) being transferred to the 7 th bank
RAM, on an alternate screen. To see its contents, just click
shortcut SS + I, at any time,
when the assembler expects from you pressing. This possibility
does not depend on whether whether or not the standby key is
pressed.
And now - the action to finalize
assembler.
Start the ZX ASM, then use
Menu Run / Debugger start the debugger. Set the Bank = # 1C (in
this memory bank is an assembler).
At # C000 (entry point for
launch assembly) put the team JP
# D562. Thus, each time
assembly (including after the menu Run / Run and Run / Call ...)
management will be transferred at
# D562.
At the following addresses # D55F, # D560, # D561 put
codes # FF. It is necessary to disable the processing of the
menu Print / Format, Print / fonT, Print / Driver. They still
not needed, since the corresponding functions in
This version of the ZX ASM is not supported. A
a seat place your own routine:
# D562: LD A, (# 5C48); BORDCR -
And the variable
; BASIC
BIT 3, A; value of the third
; Bits defined.
; Need
; Expectations
; Pressing keypad.
JR Z, # D589; If 0 - Immediately
; To run ASM
; Delay before keystrokes:
LD A, # 04; Green BORDER
OUT (# FE), A
# D56D: XOR A; wait ...
IN A, (# FE)
CPL
AND # 1F
JR Z, # D56D
LD A, # FD; pressed "D"?
IN A, (# FE)
BIT 2, A
JR NZ, # D589; No - run
; ASM
; If pressed "D", run
The debugger (ie, transfers control
; Address # DB00 in the 7 th memory bank):
LD HL, # DB00; Address
PUSH HL; In a stack of his ...
LD BC, # 7FFD; Port
LD A, # 1F; issue a Return
JP # 1E7D; there team
; OUT (C), A: RET
# D589: LD HL, # D5EF; throws
LD DE, # 5B58; subroutine
LD BC, # 0019; conservation
LDIR; screen
CALL # 5B58; and carry out its
LD HL, # D5CC; throws
LD DE, # 5B58; semiconductor processing
LD BC, # 0023; keystrokes
LDIR
; Now, wherever in the assembly is
; Team LD A, (# 5C08), ie check
; Pressed or not, we place
, Call our team of semiconductor, which
, Will track the user clicks
; Shortcuts SS + I:
LD HL, # 5B58; e n / n
LD A, # CD; code CALL
LD (# E2C3), A
LD (# E2C4), HL; instead
LD (# E868), A; LD A, (# 5C08)
LD (# E869), HL; put
LD (# EAD0), A; CALL # 5B58
LD (# EAD1), HL
LD (# EF9F), A
LD (# EFA0), HL
LD (# F22A), A
LD (# F22B), HL
; Starting ASM'a: In the original version of
; At # C000 were teams CALL # C006:
; JP # 6000. But they are not here to write,
, Because at work routines # C006
, There is an exchange of buckets, and
, When returning from it turns out that
; Lieu JP # 6000 will something
A stranger. Therefore it is necessary to write
, As follows:
LD HL, # 6000
PUSH HL
JP # C006
; Sub-processing keystrokes.
; When his work is in the buffer
; Printer addresses # 5B58.
# D5CC: LD A, (# 5C08); key code
CP # AC; is SS + I?
JR NZ, # D5EE; no-> Quit
XOR A
LD (# 5C08), A
PUSH BC
LD BC, # 7FFD; set
LD A, # 1C; alternatively.
OUT (C), A; screen
# D5DF: LD A, (# 5C08); and wait
AND A; clicking
JR Z, # D5DF; keys
LD A, # 14
OUT (C), A; founded. screen
XOR A
LD (# 5C08), A
POP BC
# D5EE: RET; out of n / n
; Sub-saver.
; Called each time the assembler
, Including and after the
, Running from his program.
# D5EF: LD BC, # 7FFD
LD A, # 17, set
OUT (C), A; 7-Bank
EXX
LD HL, # 4000; store
LD DE, # C000; screen
LD BC, # 1B00
LDIR
EXX
LD A, # 14, rebuilt
OUT (C), A; Bank ASM'a
RET
Once you've typed the program, save it to file "STOPKEY"
with the following parameters: Start = # D55F, Length = # A9.
For control cite dump this memory area:
# D55F: # FF, # FF, # FF, # 3A, # 48, # 5C, # CB, # 5F
# D567: # 28, # 20, # 3E, # 04, # D3, # FE, # AF, # DB
# D56F: # FE, # 2F, # E6, # 1F, # 28, # F8, # 3E, # FD
# D577: # DB, # FE, # CB, # 57, # 20, # 0C, # 21, # 00
# D57F: # DB, # E5, # 01, # FD, # 7F, # 3E, # 1F, # C3
# D587: # 7D, # 1E, # 21, # EF, # D5, # 11, # 58, # 5B
# D58F: # 01, # 19, # 00, # ED, # B0, # CD, # 58, # 5B
# D597: # 21, # CC, # D5, # 11, # 58, # 5B, # 01, # 23
# D59F: # 00, # ED, # B0, # 21, # 58, # 5B, # 3E, # CD
# D5A7: # 32, # C3, # E2, # 22, # C4, # E2, # 32, # 68
# D5AF: # E8, # 22, # 69, # E8, # 32, # D0, # EA, # 22
# D5B7: # D1, # EA, # 32, # 9F, # EF, # 22, # A0, # EF
# D5BF: # 32, # 2A, # F2, # 22, # 2B, # F2, # 21, # 00
# D5C7: # 60, # E5, # C3, # 06, # C0, # 3A, # 08, # 5C
# D5CF: # FE, # AC, # 20, # 1B, # AF, # 32, # 08, # 5C
# D5D7: # C5, # 01, # FD, # 7F, # 3E, # 1C, # ED, # 79
# D5DF: # 3A, # 08, # 5C, # A7, # 28, # FA, # 3E, # 14
# D5E7: # ED, # 79, # AF, # 32, # 08, # 5C, # C1, # C9
# D5EF: # 01, # FD, # 7F, # 3E, # 17, # ED, # 79, # D9
# D5F7: # 21, # 00, # 40, # 11, # 00, # C0, # 01, # 00
# D5FF: # 1B, # ED, # B0, # D9, # 3E, # 14, # ED, # 79
# D607: # C9
Then exit the debugger ZX
ASM. Immediately you can try for work
shortcuts SS + I. True, nothing
you are an interesting alternative to the screen
until you see - there will be only
what was on the main screen at the moment
Released in the ZX ASM.
Set Border = 1, to include the standby mode pressing. When
This border will turn blue. Type in any program, Assemble and
run it. After completing its work border should be green. Press
any key. Now at work in assembly language, you can at any
moment to see the results of your program by clicking SS + I.
To every boot assembly
you do not have to load in the 4-th bank
RAM file "STOPKEY" and put the team
# C000: JP # D562, try it yourself to write
new loader for the ZX ASM, which would perform these steps
automatically. The easiest way - use the button MAGIC (if
possible, of course).