Shadow assembler ALASM 3.8с (part 1). .SYSTEMS
Shadow macro assembler-debugger ALASM v3.8с
Brief description of functionality.
Contents:
1. MEMORY ALLOCATION
2. COLD START
3. ASSEMBLY ENVIRONMENT COMMANDS
4. EDITOR COMMANDS
5. ASSEMBLY DIRECTIVES
b. COMPILER ERRORS
7. SETUP MENU OPTIONS
8. IN THE NEXT VERSIONS
9. DIFFERENCES 0T PREVIOUS VERSIONS
════════════════════════════════ ════════════════════════════════
1. MEMORY ALLOCATION
ALASM allows you to work simultaneously with several texts,
located in different user memory pages. Transition
fromediting one page to another is done by entering
commands
PAGE [page]
from the assembler working line. Number of texts that can
process ALASM depends only on the amount of computer memory.
Pages in assembler are numbered according to the maximum value mask.
value passed to the extended memory driver. At the same time, his
The lower 3 bits correspond to the bits sent to port #7FFD.
──────────────────────────────── ────────────────────────────────
──────────────────────────────── ────────────────────────────────
2. COLD START
When you run the assembler from TR-DOS, the screen is cleared and
is the author's introduction, after which a memory test is carried out
across all eight bits of the driver page number. Its results
are displayed on the screen as XXX kb mask XX. The numbers indicate
how much memory is available to the assembler on your computer and what
The page number bits control access. According to these bits, the mass
The operand of the PAGE and other instructions is specified.
Below the memory test is HELP containing a list of commands
assemblerand his editor. The hotkeys for these commands are removed
to title mode. Below it is suggested to press CS/0 to start
SETUP. Launching which will allow you to change the visual and configuration
gurative parameters of assembler operation and, if desired, write down
them to disk. All changes made to SETUP are not recorded.
directly into the body of the assembler monoblock "alasm.C". Function for
Startup SETUP is only available during a cold start.
After the corresponding message, pressing any key will result in
Det to clear the screen and exit to the working line of the assembler.
──────────────────────────────── ────────────────────────────────
──────────────────────────────── ────────────────────────────────
3. ASSEMBLY ENVIRONMENT COMMANDS
The assembler environment has its own command system, most
Most of which are compatible with TASM2.0 commands.
A list of these commands can be obtained on the screen by pressing
"H" (HELP) keys. You can enter the required command by pressing la-
the capital letter that is part of this command.
In this case, the entered command is displayed in the working line, after
which, if necessary, waits for the input of operands or, depending
bridge fromdestination, confirm by pressing ENTER.
After entering the command, it is duplicated in the working screen and executed.
no doubt. If the operands are incorrect, the corresponding
this message.
The execution of any command can be interrupted by pressing BREAK.
If the result of executing a command may be lost
text, then if it has been changed, a request is displayed to save it -
Note: File has been changed. Save(Y/N)?
The assembler environment command system includes:
Help
Format: HELP
Displaying a list of commands available in the assembler and editor
The HELP command contains no operands and does not require confirmation.
by pressing ENTER.
Quit
Format: QUIT [address][,page]
Exit from assembler. If the parameters are not specified,
the exit goes through the bottom of the stack, otherwise
unconditional transition to the specified address. Page parameter
transferred tohigh memory driver (defaults to -
Xia 0). The parameters "address" and "page" can be used
labels or arithmetic expressions containing them are used.
Debug
Format: DEBUG
Exit to STS debugger. If there is no monitor on page 7
a corresponding message is displayed. If before entering this code
mand the text was compiled, then into the debug address pointer
monitor will record the address of the last ORG. At the same time, by typing
in the SS/5 debugger, you will be able to debug your pro-
gram by observing the names of tags by their addresses on the screen.
Run
Format: RUN [address][,page]
Performs the same actions as the QUIT command, but first
carries on the stack the return address to the resident assembler module,
which allows you to return to assembler from the running program
by RET command. By default, the "address" parameter takes the value
the last ORG directive, and the "page" parameter is 0.
WorkFormat: W0RK [drive:][filename[.ext]]
Loading a file into the current working page.
The default extension is "H".
"filename" can be a mask. In this case there will be
the first file that satisfies it is loaded.
If the "filename" parameter is not entered, then the user
is given the opportunity to select a file from the current directory
or the specified disk by selecting it with the cursor from the list of files,
appearing at the top of the screen.
Catalog
Format: CATAL0GUE [drive:][mask]
The default is "*.*" (all files).
Displays the disk directory.
The mask format is defined as follows:
"?" sign determines what can be in a given position
any character. The "*" sign determines that, starting from this position
all characters can take arbitrary values. Upon reaching
delimiter ("." or end of line) is assumed to be
the rest of the line is filled with SPACE characters.nUmbers
Format: NUMBERS [parameter]
Changing the number system of the displayed numeric information. "Pair-
meter" is one of two expressions: "DEC" or "HEX"
Name
Format: NAME newfilename[.ext]
Change the file name to a new one.
The default extension is "H".
"newfilename" - new file name.
Print
Format: PRINT [bytes list]
Outputs the current text to the ZX-LPRINT port, having previously output
the specified list of bytes. Bytes are separated by commas.
Edit
Format: EDIT [drive:][file name]
Go to editing the file in the current page. In case
if the "file name" parameter is specified, a file with that name is loaded
is transferred to the current page. If the filenot found on disk, in
a new file with the entered name is created on the current page.
Merge
Format: MERGE [drive:]filename
Loading a text file in ALASM format at the end of the current file.
The "file name" parameter is required.
counT
Format: C0UNT arithmetic expression
Evaluates the specified arithmetic expression. Re-
The calculation result is displayed in decimal and hexadecimal
systems. The parameters of an arithmetic expression can be
labels and their high and low bytes are used.
sYmbol
Format: SYMB0L [mask]
Displays a list of marks that satisfy the "mask" condition.
The command is executed only if it has been executed before.
compilation has been carried out. Labels can be displayed as an attribute
the following messages:
number - The label value determined whencompilation;
NoDef - The label was not defined, but was used;
Macro - The label represents the name of the macro definition block;
Wrong - The label format is not defined due to compilation errors.
Assembly
Format: ASSEMBLE
Compiles the text in the current page, starting from the first
line. During the compilation process, the number of
compiled strings to control machine hangs.
When compilation is complete, the following messages are displayed on the screen:
Symbols: ААААА-ВВВВВ
The indicated difference represents the amount of free memory
on the page reserved for the table of labels. In case the table
labels are spread across different pages, the AAAA parameter indicates
the address of the last entry in P0ST SYMB0LS PAGE, and the parameter ВВВВВ -
in SYMB0L LIST PAGE;
Save
Format: SAVE [+][drive:]
Burning edited text to disk. When specifying a parameter
"+" to the current or specified driveall files are recorded
which the change marker is set. Otherwise to disk
the current file is written. If a file with the same name is on
already exists on the disk, it is deleted without additional requests.
Info
Format: INFO
Displays the version number, a list of system page numbers
memory and listing files located in the entire memory of the computer
computer at the time the command was issued.
paGe
Format: PAGE [page number]
Goes to the page specified as the "page" parameter.
Until the next change to the PAGE command parameter, the specified page
the page becomes current and all commands for the current pages will be
be performed on it.
driVe
Format: DRIVE drive:
The specified drive becomes the current drive and all commands for the current one
the drive will operate with it.Jumb
Format: JUMB [+]
This command replaces all one-time pointers in the current file
compilation from "-" to "+". If the parameter is specified, it will be viewed
all memory is strained.
──────────────────────────────── ────────────────────────────────
──────────────────────────────── ────────────────────────────────
4. EDITOR COMMANDS
When entering the editing window, the screen splits into two hours
editing window and information line, which displays
page number of the current file, its name, amount of free space
memory in this page and the number of bytes transferred to the pocket
(if this number is not 0). In the same line it is provided under
cha service commands for serving text.
During the editing process, the user has access to service tools.
text service mands, however, unlike the assembler environment,
the result of their execution is not displayed on the screen in the form of text
message, but is controlled by the user himself.List of ALASM assembler editor commands:
Quit
Format: Q
Exit from the editor to the assembler environment.
Begin
Format: B
Go to the beginning of the text.
End
Format: E
Go to the end of the text.
Search
Format: SEARCH [character string]
Search for a string of characters in text. The search starts from the position following
following the current cursor position and continues until the end of the current
hundred. When the search is stopped, it can be continued by entering
combinations SS/I, and if such a command is given after the end of the last
next line of text, the search will start from the beginning.If the "character string" parameter is not specified, then the
the string entered last time.
sYmbol
Format: SYMB0L [label name]
Search for a description of a label by text. When searching, it is assumed that
The first character of the label name is at position zero.
Properties - similar to SEARCH.
coDe
Format: C0DE XXX>[character code]
Installing a character with an arbitrary code at the cursor position, typed
on the keyboard. When you enter a command, the character code appears,
located at the current cursor position and is asked to replace
him to another. If parameter is ignored, no action
will not be produced.
Restore
Format: R
Copies the contents of the pocket to the cursor position. Line, on
which the cursor is located appears first after the contentpocket After this operation, the permission flag is reset to
filling your pocket.
Clear
Format: C
Cleaning the pocket.
Xreplace
Format: REPLACE line1>line2
Starting from the position next to the current cursor position,
The text "line1" is searched. Once it is discovered,
the message "REPLACE(Y/N/G)?" is displayed. If the answer is "Y", the current
"line1" is replaced with "line2" and the search continues.
If the answer is "N", the search continues without replacement. When answering "G"
all encountered expressions "line1" will be replaced with "line2"
without additional requests. At any moment of the team's work
execution can be interrupted by pressing BREAK (CS/SPACE).
Line
Format: LINE line number
Places the cursor on the line with the specified number. Stringsnumbered from zero to the end of the text in increments of 1 per
each line.
Jumb
Format: JUMB [+]
Without a parameter, scans text in the current page
in order to replace the directives "-" with "+" (this operation is automatically
occurs when each file is loaded from disk). With parameter
[+] All texts found in memory are scanned.
When editing text, the user has access to the following functions:
called by pressing two keys simultaneously. These features
speed up work in the editor and have no operands:
SS/I - search continuation;
SS/D - switching between Russian and Latin input registers
basic information. The register change is indicated
changing the cursor;
SS/Q - deletes the current line. When running this command
the removed stroma is automatically transferred to the pocket, but
only if he was not busy with other information
mation;
SS/W-inserting an empty line. The current line is shifted incrementally;
SS/E - copy current line to pocket. After this command
the cursor moves to the next line;
CS/1 - tabulation;
CS/2 - insert a space at the cursor position. Rest of the line
moves to the right;
SS/SP - a list of files is displayed on the screen, in which, using
the cursor is selected for editing;
──────────────────────────────── ────────────────────────────────
──────────────────────────────── ────────────────────────────────
5. ASSEMBLY DIRECTIVES
When writing the compiler, the Author adhered to a set of guidelines
tiv adopted in TASM3.0. Directives not present in the above
creation, selected in accordance with international practice
How to write Assembler language compilers, i.e. with the help
flashlight and English-Russian dictionary.
List of ALASM compiler directives and their descriptions:
1.
ORGaddress[,page]
Setting the compilation address. Default parameter is "page"
is set equal to 0. As information about the current address of the company
For epilation, the "$" symbol can be used, which is equivalent to
connection to a reserved variable containing the address of the first
byte of the command in which the access occurred.
Example:
ORG #7D19
LDIR
;LDIR is written to address #7D19
ORG #Sob9,#84
INDR
;INDR is written to address #Sob9 in page #84 of the upper memory
──────────────────────────────── ────────────────────────────────
2.
EQU label value
Sets the label to a value equivalent to the "value" parameter.
Example:
SCREEN EQU #4000 ;SCREEN=#4000
ATTRS EQU #5В00 ;ATTRS=#5В00
SCR_LEN EQU ATTRS-SCREEN ;SCR_LEN=#1В00──────────────────────────────── ────────────────────────────────
3. Operations for selecting the high and low bytes of a word:
NUMB1 EQU #1234
NUMB2 EQU #ABCD
STBMLB EQU .NUMB1*25b+'NUMB2 ;STBMLB=#ЗЧАВ
MLBSTB EQU 'NUMB1*25b+.NUMB2 ;MLBSTB=#12CD
;Try to avoid dividing by 25b to get the high byte
;necessary word, since division takes 280 times longer
;time than just the high byte allocation operation
DEFB 'NUMB2
;Exactly equivalent, but much faster than
DEFB NUMB2/25b
;When specifying the byte value of the label, the low byte is allocated
;automatically
DEFB.NUMB1
;equivalent
DEFB NUMB1
;therefore it is mainly used for
DEFW.NUMB1
──────────────────────────────── ────────────────────────────────
4.DISP address
Setting the address where the program should run.
ENT
Assigning the program's work address to the current compilation address.
Example:
SCREEN EQU #4000
ORG #8000
LD HL,BEGIN ;Forward to screen area
LD DE,SCREEN ;and start the standby program
LD BC,END-BEGIN ;[A] interrupts
LDIR
CALL SCREEN
D.I.
HALT
BEGIN DISP SCREEN
MARKA DEC A
HALT
JP NZ,MARKA ;JP - not by chance
RET
ENT
END──────────────────────────────── ────────────────────────────────
5.
INCLUDE "drive:filename"[,page]
Including an additional text block in the compiled file,
recorded on the disc under the name "file name". At the same time, the specified
the file is loaded into the page specified by the "page" parameter
(default - current). After compiling the included
block, compilation continues from the line following this one
directives. The peculiarity of this directive is that the file
specified in it will not boot from disk if it is already found
appears on the required page.
Example:
LDIR
INCLUDE "T0KENIZE",1
0TDR
INCLUDE "ALASM2"
HALT
;First LDIR will be compiled, then the text "T0KENIZE.Н",
;loaded to page 1, then 0TDR, then to the current page
;the text "ALASM2.Н" will be downloaded and compiled, after which
;the main file will be read from disk and compilation will continue
;sHALT commands.
──────────────────────────────── ────────────────────────────────
b.
MAIN "filename"[,page]
Specifies the main compilation file. The MAIN directive must be
the first executable directive of the slave file.
Be careful with file names containing "." or
"*". It is better to replace them with the "?" symbol.
Example:
MAIN "MAKEB?7",b
LDIR
;After issuing the ASSEMBLE command, compilation is transferred
;program MAKEB*7, located on page b,
;then the INCLUDE in it calls the slave
;a program consisting of a MAIN directive and an LDIR command.
;In included files, MAIN is ignored, so after assembly
;When LDIR is removed, you return to the main program and continue
;no compilation.
──────────────────────────────── ────────────────────────────────
7.
INCBIN "drive:filename"[,length]
Inclusion ina compiled program of a code block written
on disk under the name "file name" of size "length" bytes or
default from the catalog data.
Example:
ORG #E000
LD HL,SCRFILE
LD DE,#4000
LD VS, b144
LDIR
RET
SCRFILE INCBIN "SCRb?7",b144
;The file will be loaded to SCRFILE during the compilation process
;SCRb*7, which after launch will be transferred to the screen.
──────────────────────────────── ────────────────────────────────
8.
DUP number
Left program bracket. Indicates the beginning of a block that is not
we need to compile "number" several times in a row
EDUP
Right program bracket. Indicates the end of a repeatable block
Example:
DUP 32LDI
LD A,B
0R C
JR Z,$+3 ;$ - address of the first byte of the compiled command
LD(HL),D
EDUP
;The block of text between DUP and EDUP will be compiled 32 times
──────────────────────────────── ────────────────────────────────
9.
DEFM "character string"[,"character string"]
Reserving a character string.
Example:
DEFM "There was a string of characters","VASYA"
──────────────────────────────── ────────────────────────────────
10.
DEFB byte[,list of bytes]
Reserving a list of bytes
Example:
DEFB "U",13,10,"butt",13,10,"was",13,10,"dog",13,10
──────────────────────────────── ────────────────────────────────
11.DEFW word[,list of words]
Reserving a list of words.
Example:
DEFW ALASKA,BUFFER,12,#BD15,327b7,.NUMB1
──────────────────────────────── ────────────────────────────────
12.
DEFS number of repetitions[,list of bytes]
A list of bytes (default - 0) is copied to the current computer address.
lations. The number of cycles is equal to the "number of repetitions" parameter.
Example:
LD SP,#5B00
DEFS 8,#С5,#D5,#E5,#F5
;equivalent
; DUP 8
; PUSH Sun
; PUSH DE
; PUSH HL
; PUSH AF
; EDUP
──────────────────────────────── ────────────────────────────────
13. +
When loading text from disk, it is scanned to see if it contains
"+" pointers at the beginning of each line. During compilation
all encountered "+" pointers will be replaced with "-", which indicates
tells the compiler that there is no need to compile the string
during the next assembly.
Example:
LD HL,#DB00
+SAVEADR
+ ORG #DB00.7
+ INCBIN "stsCh.2a"
+ORG SAVEADR
JP(HL)
;the main debugger file will be loaded only on the first com-
;piling text containing these commands.
──────────────────────────────── ────────────────────────────────
14.
label=expression
Reassigning the value of an already existing label.
Example:
SHLUSS EQU 0ORG 327b8
DUP #4000
DEFW SHLUSS
SHLUSS=SHLUSS+1
EDUP
;all memory above #8000 will be filled with increasing words
;from 0 to 1b384
──────────────────────────────── ────────────────────────────────
──────────────────────────────── ────────────────────────────────
b. Errors may be generated when compiling source text
compilation time associated with programmer inattention.
List of compile time errors
assembler ALASM
0 - syntax error;
1 - reserved;
2 - reserved;
3 - short transition is incorrect;
4 - reserved;
5 -reserved;
b - repeated description of the mark;
1 - reserved;
2 - reserved;
3 - short transition is incorrect;
4 - reserved;
5 - reserved;
b - repeated description of the mark;
7 - reserved;
8 - reserved;
9 - reserved;
10 - compilation into ROM;
11 - invalid operation;
12 - incorrect MACR0 operation;
13 - not used;
14 - system stack error;
15 - disk error;
Fill time errors:
wrong short - incorrect reference to a label outside
"short" field;
sweat defined -label not specified.
──────────────────────────────────────┄
Share your thoughts about the article